1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- 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
- })
- }
- })
-
- }
- })
|