const util = require('../../utils/util.js') var app = getApp() Page({ data: { id: 0, content: '', loading: false, title:'点评', ty:'', oid:'' }, onLoad: function(options) { let id = options.id; let oid = options.oid; this.setData({ id: id, oid: oid }) }, inputComment: function(e) { this.setData({ content: e.detail.value }) }, submit: function() { wx.hideLoading() let that = this if (that.data.loading) return if (that.data.content.length < 5 || that.data.content.length > 256) { wx.showToast({ title: '点评内容需要 5 ~ 256 个字符', icon: 'none', duration: 3000 }) return } that.setData({ loading: true }) let id = that.data.id; let comments = that.data.content; let openid = app.globalData.openid; let oid = that.data.oid; console.log("oid==" + oid); wx.request({ url: app.data.resturl + '/comment.action', method: 'post', header: { 'content-type': 'application/x-www-form-urlencoded' }, data: { openid: openid, id:id, contents: comments, oid:oid }, success: function (res) { wx.showToast({ title: '发表点评成功', }) wx.navigateBack({ }) that.setData({ loading: false }) } }) } })