Browse Source

接口拆分

integral
zhaoyongnian 5 years ago
parent
commit
0f3c11387e
  1. 60
      epdc-resident-mp-yushan/subpages/association/pages/topicDetail/topicDetail.js

60
epdc-resident-mp-yushan/subpages/association/pages/topicDetail/topicDetail.js

@ -1,4 +1,4 @@
import { getTopicDetail, getRemarkList, closeTopic, publishStatement, getCloseReason } from '../../utils/api'
import { getTopicDetail, getRemarkList, closeTopic, publishStatement, getCloseReason, topicComLike, topicComUnlike } from '../../utils/api'
import { getTimestamp } from '../../utils/common'
const app = getApp()
@ -292,9 +292,9 @@ Page({
} catch (err) {
return false
}
publishStatement(para).then(res => {
topicComLike(para).then(res => {
this.getTopicAltitudeNum()
console.log('支持', res)
console.log("支持", res)
this.data.remarkList.forEach((item, index) => {
if (item.commentId === e.detail.commentId) {
this.setData({
@ -304,8 +304,8 @@ Page({
[`remarkList[${index}].opposeNum`]: parseInt(this.data.remarkList[index].opposeNum) > 0 ? parseInt(this.data.remarkList[index].opposeNum) - 1 : 0
})
wx.showToast({
title: '表态成功',
icon: 'none',
title: "表态成功",
icon: "none",
duration: 2000
})
}
@ -313,6 +313,27 @@ Page({
}).catch(err => {
console.log(err)
})
// publishStatement(para).then(res => {
// this.getTopicAltitudeNum()
// console.log('支持', res)
// this.data.remarkList.forEach((item,index) => {
// if (item.commentId === e.detail.commentId) {
// this.setData({
// [`remarkList[${index}].userLike`]: true,
// [`remarkList[${index}].userDislike`]: false,
// [`remarkList[${index}].approveNum`]: parseInt(this.data.remarkList[index].approveNum) + 1,
// [`remarkList[${index}].opposeNum`]: parseInt(this.data.remarkList[index].opposeNum) > 0 ? parseInt(this.data.remarkList[index].opposeNum) - 1 : 0
// })
// wx.showToast({
// title: '表态成功',
// icon: 'none',
// duration: 2000
// })
// }
// })
// }).catch(err => {
// console.log(err)
// })
},
// 反对某条评论 debounce 防抖
debiunceDispportReply (e) {
@ -362,9 +383,9 @@ Page({
} catch (err) {
return false
}
publishStatement(para).then(res => {
topicComUnlike(para).then(res => {
this.getTopicAltitudeNum()
console.log('反对', res)
console.log("反对", res)
this.data.remarkList.forEach((item, index) => {
if (item.commentId === e.detail.commentId) {
this.setData({
@ -374,8 +395,8 @@ Page({
[`remarkList[${index}].opposeNum`]: parseInt(this.data.remarkList[index].opposeNum) + 1
})
wx.showToast({
title: '表态成功',
icon: 'none',
title: "表态成功",
icon: "none",
duration: 2000
})
}
@ -383,6 +404,27 @@ Page({
}).catch(err => {
console.log(err)
})
// publishStatement(para).then(res => {
// this.getTopicAltitudeNum()
// console.log('反对', res)
// this.data.remarkList.forEach((item, index) => {
// if (item.commentId === e.detail.commentId) {
// this.setData({
// [`remarkList[${index}].userLike`]: false,
// [`remarkList[${index}].userDislike`]: true,
// [`remarkList[${index}].approveNum`]: parseInt(this.data.remarkList[index].approveNum) > 0 ? parseInt(this.data.remarkList[index].approveNum) - 1: 0,
// [`remarkList[${index}].opposeNum`]: parseInt(this.data.remarkList[index].opposeNum) + 1
// })
// wx.showToast({
// title: '表态成功',
// icon: 'none',
// duration: 2000
// })
// }
// })
// }).catch(err => {
// console.log(err)
// })
},
// 对评论进行回复
replyRemark (e) {

Loading…
Cancel
Save