فهرست منبع

修复不同主题点赞问题

shaogen1995 4 سال پیش
والد
کامیت
28e0760699
2فایلهای تغییر یافته به همراه8 افزوده شده و 8 حذف شده
  1. 2 2
      houtai/src/utils/request.js
  2. 6 6
      houtai/src/views/forum/look.vue

+ 2 - 2
houtai/src/utils/request.js

@@ -1,7 +1,7 @@
 import axios from 'axios'
 import axios from 'axios'
 const service = axios.create({
 const service = axios.create({
-  baseURL: 'http://192.168.0.135:8005/', // 本地调试
-  // baseURL: 'http://192.168.0.245:8005/', // 线上调试
+  // baseURL: 'http://192.168.0.135:8005/', // 本地调试
+  baseURL: 'http://192.168.0.245:8005/', // 线上调试
   // baseURL: '', // build
   // baseURL: '', // build
   timeout: 5000
   timeout: 5000
 })
 })

+ 6 - 6
houtai/src/views/forum/look.vue

@@ -128,8 +128,8 @@ export default {
     // 这里存放数据
     // 这里存放数据
     return {
     return {
       // 点赞-帖子的开关
       // 点赞-帖子的开关
-      likeFlagOne: true,
-      unLikeFlagOne: true,
+      likeFlagOne: [],
+      unLikeFlagOne: [],
       // 点赞-评论的开关
       // 点赞-评论的开关
       likeFlag: [],
       likeFlag: [],
       unLikeFlag: [],
       unLikeFlag: [],
@@ -158,22 +158,22 @@ export default {
   methods: {
   methods: {
     // 点赞-帖子
     // 点赞-帖子
     async clickLikeOne (type, id) {
     async clickLikeOne (type, id) {
-      if (this.likeFlagOne) {
+      if (!this.likeFlagOne.includes(id)) {
         const res = await webBbsLike(type, id)
         const res = await webBbsLike(type, id)
         if (res.code === 0) {
         if (res.code === 0) {
           this.$message.success('点赞成功.')
           this.$message.success('点赞成功.')
-          this.likeFlagOne = false
+          this.likeFlagOne.push(id)
           this.lookInfo.upVote++
           this.lookInfo.upVote++
         } else this.$message.warning(res.msg)
         } else this.$message.warning(res.msg)
       } else this.$message.warning('您已经赞过了.')
       } else this.$message.warning('您已经赞过了.')
     },
     },
     // 点踩-帖子
     // 点踩-帖子
     async clickUnlikeOne (type, id) {
     async clickUnlikeOne (type, id) {
-      if (this.unLikeFlagOne) {
+      if (!this.unLikeFlagOne.includes(id)) {
         const res = await webBbsLike(type, id)
         const res = await webBbsLike(type, id)
         if (res.code === 0) {
         if (res.code === 0) {
           this.$message.success('点踩成功.')
           this.$message.success('点踩成功.')
-          this.unLikeFlagOne = false
+          this.unLikeFlagOne.push(id)
           this.lookInfo.unVote++
           this.lookInfo.unVote++
         } else this.$message.warning(res.msg)
         } else this.$message.warning(res.msg)
       } else this.$message.warning('您已经踩过了.')
       } else this.$message.warning('您已经踩过了.')