a1300399510@qq.com 提交于 2023/04/03 -17:40:01

This commit is contained in:
XiaoMo 2023-04-03 17:40:10 +08:00
parent b7f562c7eb
commit 6562df5677
4 changed files with 42 additions and 26 deletions

View File

@ -1,11 +1,10 @@
<template> <template>
<div class="allSections"> <div>
<!-- 左选项 --> <div class="allSections" v-if="!fid">
<div class="allSections-left"> <div class="allSections-left">
<span v-for="(item, index) in list" :class="{ 'active': index == allActive }" :key="index" <span v-for="(item, index) in list" :class="{ 'active': index == allActive }" :key="index"
@click="allClick(index)">{{ item.name }}</span> @click="allClick(index)">{{ item.name }}</span>
</div> </div>
<!-- 右选项 -->
<div class="allSections-right"> <div class="allSections-right">
<div class="allSections-right-item" v-for="(i, k) in list[allActive].data" :key="k"> <div class="allSections-right-item" v-for="(i, k) in list[allActive].data" :key="k">
<div class="item-content"> <div class="item-content">
@ -14,17 +13,27 @@
</div> </div>
<div class="item-star"> <div class="item-star">
<img v-if="!i.iscollection" src="~assets/img/allSections/nullStar.png" alt="空星" <img v-if="!i.iscollection" src="~assets/img/allSections/nullStar.png" alt="空星"
@click="starClick(k, i.fid)"> @click.stop="starClick(k, i.fid)">
<img v-else src="~assets/img/allSections/star.png" alt="实星" @click="cancelCollection(k, i.fid)"> <img v-else src="~assets/img/allSections/star.png" alt="实星"
@click.stop="cancelCollection(k, i.fid)">
</div>
</div> </div>
</div> </div>
</div> </div>
<div v-else style="margin-top:.64rem;">
<plate-navigation stairname="寄托学术类备" subsectionsname="SAT、AP考试、海外本科申…"></plate-navigation>
<div style="margin:.4rem 0.35rem">
<index-list></index-list>
</div>
</div>
</div> </div>
</template> </template>
<script> <script>
import plateNavigation from '@/components/PlateNavigation'
import indexList from '@/components/IndexList'
export default { export default {
name: "AllSections", name: "AllSections",
data() { data() {
@ -32,6 +41,8 @@ export default {
allActive: 0, allActive: 0,
list: [{}], list: [{}],
postCollectionState: false, // postCollectionState: false, //
fid: 0, // id
} }
}, },
@ -49,6 +60,7 @@ export default {
}).then(res => { }).then(res => {
if (res.code != 200) return if (res.code != 200) return
this.list[this.allActive].data[k]['iscollection'] = 1 this.list[this.allActive].data[k]['iscollection'] = 1
this.$Message.success(res.message)
this.$forceUpdate() this.$forceUpdate()
}).finally(() => { }).finally(() => {
this.postCollectionState = false this.postCollectionState = false
@ -65,9 +77,7 @@ export default {
}).then(res => { }).then(res => {
if (res.code != 200) return if (res.code != 200) return
this.list[this.allActive].data[k]['iscollection'] = 0 this.list[this.allActive].data[k]['iscollection'] = 0
this.$Message({ this.$Message.success(res.message)
})
this.$forceUpdate() this.$forceUpdate()
}).finally(() => { }).finally(() => {
this.postCollectionState = false this.postCollectionState = false
@ -84,13 +94,20 @@ export default {
}).catch(err => { }).catch(err => {
this.$message.error(err.message) this.$message.error(err.message)
}); });
} },
}, },
mounted() { mounted() {
this.getAllForum() this.getAllForum()
}, },
components: {
plateNavigation,
indexList
},
} }
</script> </script>
@ -101,7 +118,7 @@ export default {
border-radius: 0.32rem; border-radius: 0.32rem;
margin-top: 0.666667rem; margin-top: 0.666667rem;
filter: drop-shadow(0.05rem 0 0.09rem rgba(0, 0, 0, 0.1)); filter: drop-shadow(0.05rem 0 0.09rem rgba(0, 0, 0, 0.1));
margin: .64rem 0.35rem 0; margin: .64rem 0.35rem;
} }
.allSections-left { .allSections-left {

View File

@ -62,7 +62,7 @@
<script> <script>
import plateNavigation from '@/components/PlateNavigation' import plateNavigation from '@/components/PlateNavigation'
import indexList from '@/components/indexList' import indexList from '@/components/IndexList'
export default { export default {
name: "Collect", name: "Collect",
@ -108,7 +108,6 @@ export default {
// //
cancelFavoritesSection(index) { cancelFavoritesSection(index) {
console.log(index);
this.list.splice(index, 1) this.list.splice(index, 1)
} }

View File

@ -15,7 +15,7 @@
<script> <script>
import plateNavigation from '@/components/PlateNavigation.vue' import plateNavigation from '@/components/PlateNavigation.vue'
import indexList from '@/components/indexList.vue' import indexList from '@/components/IndexList'
export default { export default {
name: "Recommend",// name: "Recommend",//
data() { data() {