diff --git a/src/views/index/allSections/AllSections.vue b/src/views/index/allSections/AllSections.vue
index 254281b..055a683 100755
--- a/src/views/index/allSections/AllSections.vue
+++ b/src/views/index/allSections/AllSections.vue
@@ -10,12 +10,12 @@
-
@@ -29,24 +29,46 @@ export default {
data() {
return {
allActive: 0,
- list: [{
+ list: [{}],
+ postCollectionState: false, // 收藏的请求的状态
+
- }],
}
},
methods: {
allClick(index) {
this.allActive = index
},
+
+ // 点击收藏
starClick(k, fid) {
- // if (this.starList[k].checked) this.starList[k].checked = false
- // else this.starList[k].checked = true
+ if (this.postCollectionState) return
+ this.postCollectionState = true
this.$http.post("/api/operation/forumFav", {
fid
}).then(res => {
- console.log(res);
+ if (res.code != 200) return
+ this.list[this.allActive].data[k]['iscollection'] = 1
+ this.$forceUpdate()
+ }).finally(() => {
+ this.postCollectionState = false
+ })
+ },
+
+ // 点击取消收藏
+ cancelCollection(k, fid) {
+ if (this.postCollectionState) return
+ this.postCollectionState = true
+
+ this.$http.post("/api/operation/unforumFav", {
+ fid
+ }).then(res => {
+ if (res.code != 200) return
+ this.list[this.allActive].data[k]['iscollection'] = 0
+ this.$forceUpdate()
+ }).finally(() => {
+ this.postCollectionState = false
})
- this.$forceUpdate()
},
// 获取全部板块
diff --git a/src/views/index/recommend/Recommend.vue b/src/views/index/recommend/Recommend.vue
index 0edde0b..7b24493 100755
--- a/src/views/index/recommend/Recommend.vue
+++ b/src/views/index/recommend/Recommend.vue
@@ -7,12 +7,6 @@