diff --git a/src/apps/AppVillageDiscuss/Detail.vue b/src/apps/AppVillageDiscuss/Detail.vue
index d2b5a48a..e6baae50 100644
--- a/src/apps/AppVillageDiscuss/Detail.vue
+++ b/src/apps/AppVillageDiscuss/Detail.vue
@@ -32,7 +32,7 @@
@@ -108,9 +108,14 @@ export default {
this.data = {
...res.data,
avatar: res.data.createUserName?.substr(0, 2) || '游客',
- messages: res.data.messages || [],
+ messages: res.data.messages.map(v => {
+ return {
+ ...v,
+ isSuport: v.suportUser ? v.suportUser.indexOf(this.user.id) > -1 : false
+ }
+ })
}
- this.data.images = JSON.parse(res.data.images) || []
+ this.data.images = JSON.parse(res.data.images)
this.isAnnouncer = this.user.id === res.data.createUserId
var discussTime = (new Date(res.data.discussDeadline).getTime() * 1) / 1000
@@ -122,6 +127,26 @@ export default {
})
},
+ like (id) {
+ this.$loading()
+ this.$http.post(`/app/appvillagediscussmessage/suport?id=${id}&userId=${this.user.id}`).then(res => {
+ this.$hideLoading()
+ if (res.code === 0) {
+ this.$u.toast('点赞成功')
+
+ this.$nextTick(() => {
+ this.getDetail()
+ })
+ } else {
+ this.$u.toast(res.msg)
+ }
+
+ }).catch((e) => {
+ this.$hideLoading()
+ this.$u.toast(e)
+ })
+ },
+
publish() {
if (this.flag) return
if (!this.content) {