评论区修复
修复了在评论界面注册返回时信息未更新的问题,修复回复逻辑。
This commit is contained in:
parent
4a6b788146
commit
b5d2213ca0
@ -27,7 +27,7 @@ var comment = async (event) => {
|
||||
comment: db.command.push({
|
||||
name:event.userInfos.userName,
|
||||
avatar:event.userInfos.avatarUrl,
|
||||
userid:event.userInfos._id,
|
||||
userId:event.userInfos._id,
|
||||
time: (new Date(new Date().getTime() + 1000 * 60 * 60 * 8)).Format("yyyy-MM-dd hh:mm:ss"),
|
||||
msg: event.msg,
|
||||
})
|
||||
|
@ -124,6 +124,7 @@ Page({
|
||||
},
|
||||
//点击提交事件(没加任何过滤条件,只有未输入的时候直接退出)
|
||||
submit(e) {
|
||||
this.data.userInfo = wx.getStorageSync('userInfoDetail')
|
||||
var hasSign = this.judgeHasSign()
|
||||
if(!hasSign) return
|
||||
if(!this.data.inputValue) { this.hideModal(); return;}
|
||||
@ -131,7 +132,9 @@ Page({
|
||||
title: '提交中',
|
||||
mask: true
|
||||
})
|
||||
|
||||
if(this.data.modalType === 1) {
|
||||
//评论
|
||||
var iscomment = true;
|
||||
var commentData = {
|
||||
iscomment:iscomment,
|
||||
@ -139,16 +142,20 @@ Page({
|
||||
productId:this.data.productId,
|
||||
msg:this.data.inputValue,
|
||||
productName:this.data.list.title,
|
||||
replyId:this.data.list.userId
|
||||
}
|
||||
} else if (this.data.modalType === 2) {
|
||||
//回复
|
||||
var iscomment = false;
|
||||
if(this.data.replyNum !== -1) {
|
||||
//不是第一个回复
|
||||
var msg = '@' + this.data.list.comment[this.data.commentNum].reply[this.data.replyNum].name+":"+ this.data.inputValue;
|
||||
var replyId = this.data.list.comment[this.data.commentNum].reply[this.data.replyNum].userId;
|
||||
}
|
||||
else {
|
||||
var msg = '@' + this.data.list.userName+":"+ this.data.inputValue;
|
||||
var replyId = this.data.list.userId
|
||||
//第一个回复
|
||||
var msg = '@' + this.data.list.comment[this.data.commentNum].name+":"+this.data.inputValue;
|
||||
var replyId = this.data.list.comment[this.data.commentNum].userId;
|
||||
}
|
||||
var commentData = {
|
||||
iscomment:iscomment,
|
||||
@ -160,11 +167,13 @@ Page({
|
||||
productName:this.data.list.title,
|
||||
}
|
||||
}
|
||||
console.log(this.data)
|
||||
console.log(commentData)
|
||||
wx.cloud.callFunction({
|
||||
name: 'sM_comment',
|
||||
data: commentData
|
||||
}).then(res => {
|
||||
// console.log(res.result)
|
||||
console.log(res.result)
|
||||
if(res.result.errCode!==200) { //报错
|
||||
wx.hideLoading();
|
||||
wx.showToast({
|
||||
|
Loading…
x
Reference in New Issue
Block a user