wx.request({
url: 'https://huyahaha.com/xxxx/xxx',
data: {
pid: _this.data.info.id,
nickname: _this.data.user_nickname,
avatar: _this.data.user_avatar,
saytext: _this.data.inputValue,
openid: _this.data.user_openid
},
/** 注意header要修改, 否则无效 */
header: {
'content-type': 'application/x-www-form-urlencoded'
},
method: 'POST',
success: function(res) {
if (res.data.errcode == 0) {
wx.showToast({
title: res.data.errmsg,
icon: 'success',
duration: 2000
}) _this.setData({
inputValue: ''
});
/**重新加载评论列表*/
_this.loadComment(_this.data.info.id);
} else {
wx.showModal({
title: '提示',
content: res.data.errmsg,
showCancel: false,
confirmText: '确定'
}) return;
}
}
})
来源: https://www.huyahaha.com/index/info?id=23