Browse Source

回滚代码,只更改左邻右舍

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

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

@ -1,4 +1,4 @@
import { getTopicDetail, getRemarkList, closeTopic, publishStatement, topicComLike, topicComUnlike } from '../../utils/api' import { getTopicDetail, getRemarkList, closeTopic, publishStatement } from '../../utils/api'
import { getTimestamp } from '../../utils/common' import { getTimestamp } from '../../utils/common'
const app = getApp() const app = getApp()
@ -291,9 +291,9 @@ Page({
} catch (err) { } catch (err) {
return false return false
} }
topicComLike(para).then(res => { publishStatement(para).then(res => {
this.getTopicAltitudeNum() this.getTopicAltitudeNum()
console.log("支持", res) console.log('支持', res)
this.data.remarkList.forEach((item,index) => { this.data.remarkList.forEach((item,index) => {
if (item.commentId === e.detail.commentId) { if (item.commentId === e.detail.commentId) {
this.setData({ this.setData({
@ -303,8 +303,8 @@ Page({
[`remarkList[${index}].opposeNum`]: parseInt(this.data.remarkList[index].opposeNum) > 0 ? parseInt(this.data.remarkList[index].opposeNum) - 1 : 0 [`remarkList[${index}].opposeNum`]: parseInt(this.data.remarkList[index].opposeNum) > 0 ? parseInt(this.data.remarkList[index].opposeNum) - 1 : 0
}) })
wx.showToast({ wx.showToast({
title: "表态成功", title: '表态成功',
icon: "none", icon: 'none',
duration: 2000 duration: 2000
}) })
} }
@ -312,27 +312,6 @@ Page({
}).catch(err => { }).catch(err => {
console.log(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 防抖 // 反对某条评论 debounce 防抖
debiunceDispportReply (e) { debiunceDispportReply (e) {
@ -382,9 +361,9 @@ Page({
} catch (err) { } catch (err) {
return false return false
} }
topicComUnlike(para).then(res => { publishStatement(para).then(res => {
this.getTopicAltitudeNum() this.getTopicAltitudeNum()
console.log("反对", res) console.log('反对', res)
this.data.remarkList.forEach((item, index) => { this.data.remarkList.forEach((item, index) => {
if (item.commentId === e.detail.commentId) { if (item.commentId === e.detail.commentId) {
this.setData({ this.setData({
@ -394,8 +373,8 @@ Page({
[`remarkList[${index}].opposeNum`]: parseInt(this.data.remarkList[index].opposeNum) + 1 [`remarkList[${index}].opposeNum`]: parseInt(this.data.remarkList[index].opposeNum) + 1
}) })
wx.showToast({ wx.showToast({
title: "表态成功", title: '表态成功',
icon: "none", icon: 'none',
duration: 2000 duration: 2000
}) })
} }
@ -403,27 +382,6 @@ Page({
}).catch(err => { }).catch(err => {
console.log(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) { replyRemark (e) {

Loading…
Cancel
Save