From be2b43c6409a6ab37dfa3e7390cb2b2738a093aa Mon Sep 17 00:00:00 2001 From: pufferandrr <49437243+pufferandrr@users.noreply.github.com> Date: Wed, 16 Jun 2021 13:12:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=B0=8F=E8=B4=B4=E5=A3=AB?= =?UTF-8?q?=E8=AF=84=E8=AE=BA=E5=AE=A1=E6=A0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../miniprogram/pages/tippage/tippage.js" | 53 +++++++++++++------ 1 file changed, 37 insertions(+), 16 deletions(-) diff --git "a/\347\202\271\346\273\264\347\224\237\346\264\273/miniprogram/pages/tippage/tippage.js" "b/\347\202\271\346\273\264\347\224\237\346\264\273/miniprogram/pages/tippage/tippage.js" index b80dc21..ed4ccc7 100644 --- "a/\347\202\271\346\273\264\347\224\237\346\264\273/miniprogram/pages/tippage/tippage.js" +++ "b/\347\202\271\346\273\264\347\224\237\346\264\273/miniprogram/pages/tippage/tippage.js" @@ -122,24 +122,42 @@ Page({ createTime=createTime.toString();//转化时间戳 console.log(createTime) wx.cloud.callFunction({ - name:'addComment', - data : { - tipId:_this.data.tipId, //post_id由小贴士列表传送 - content:_this.data.commentInputText, - createTime:createTime + name: 'msgesc', + data: { + text: _this.data.commentInputText, + } + }).then(res => {console.log(res.result) + if(res.result.errCode==0){ + wx.cloud.callFunction({ + name:'addComment', + data : { + tipId:_this.data.tipId, //post_id由小贴士列表传送 + content:_this.data.commentInputText, + createTime:createTime + } + }).then(res=>{ + console.log(res.result); + _this.getTipsDetail(_this.data.tipId) + wx.showToast({ + title: '评论发布成功', + icon: 'none',//icon + duration: 1500 //停留时间 + }) + _this.setData({ + commentInputText:"" + }) + }) + }else{ + wx.showToast({ + title: '你的标题含有违规内容,请重新编辑', + icon:'none', + }) + _this.setData({ + commentInputText:"" + }) } - }).then(res=>{ - console.log(res.result); - this.getTipsDetail(this.data.tipId) - wx.showToast({ - title: '评论发布成功', - icon: 'none',//icon - duration: 1500 //停留时间 - }) - _this.setData({ - commentInputText:"" - }) }) + } else{ wx.showToast({ @@ -237,6 +255,9 @@ onLoad(option){ } }) } + }, + fail:function (res) { + console.log(res) } }) const post_id = option.id;