|
|
@@ -29,6 +29,39 @@ Page({
|
|
|
})
|
|
|
},
|
|
|
|
|
|
+ deleteActivity: function () {
|
|
|
+ wx.showModal({
|
|
|
+ content: "确认删除信息?",
|
|
|
+ confirmColor: "#009195",
|
|
|
+ success: function (res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ wx.showLoading({
|
|
|
+ title: '删除中'
|
|
|
+ })
|
|
|
+ wx.cloud.callFunction({
|
|
|
+ name: 'deleteMessage',
|
|
|
+ data: {
|
|
|
+ msg_id: this.data.messageId
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ wx.hideLoading()
|
|
|
+ if (res.result.status !== 'OK') {
|
|
|
+ wx.showToast({
|
|
|
+ title: res.result.errMsg,
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ wx.showToast({
|
|
|
+ title: "删除成功",
|
|
|
+ })
|
|
|
+ wx.navigateBack()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }.bind(this)
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
toggleLike: function () {
|
|
|
wx.showLoading({
|
|
|
title: this.data.like ? '取消收藏' : '收藏中'
|
|
|
@@ -55,56 +88,6 @@ Page({
|
|
|
like: !this.data.like
|
|
|
})
|
|
|
})
|
|
|
-
|
|
|
- // if (!this.data.likeEnable) return
|
|
|
- // this.setData({
|
|
|
- // likeEnable: false
|
|
|
- // })
|
|
|
- // const db = wx.cloud.database()
|
|
|
- // if (this.data.like == 0) {
|
|
|
- // db.collection('likeData').add({
|
|
|
- // data: {
|
|
|
- // type: 'message',
|
|
|
- // id: this.data.activityInfo._id
|
|
|
- // },
|
|
|
- // success: function () {
|
|
|
- // this.setData({
|
|
|
- // like: 1,
|
|
|
- // likeEnable: true
|
|
|
- // })
|
|
|
- // wx.showToast({
|
|
|
- // title: '已收藏',
|
|
|
- // })
|
|
|
- // }.bind(this),
|
|
|
- // fail: function () {
|
|
|
- // wx.showToast({
|
|
|
- // title: '网络错误',
|
|
|
- // icon: 'none'
|
|
|
- // })
|
|
|
- // }
|
|
|
- // })
|
|
|
- // } else {
|
|
|
- // db.collection('likeData').where({
|
|
|
- // type: 'message',
|
|
|
- // id: this.data.activityInfo._id
|
|
|
- // }).remove({
|
|
|
- // success: function () {
|
|
|
- // this.setData({
|
|
|
- // like: 0,
|
|
|
- // likeEnable: true
|
|
|
- // })
|
|
|
- // wx.showToast({
|
|
|
- // title: '已取消收藏',
|
|
|
- // })
|
|
|
- // }.bind(this),
|
|
|
- // fail: function () {
|
|
|
- // wx.showToast({
|
|
|
- // title: '网络错误',
|
|
|
- // icon: 'none'
|
|
|
- // })
|
|
|
- // }
|
|
|
- // })
|
|
|
- // }
|
|
|
},
|
|
|
|
|
|
loadQuestionData: function () {
|