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,30 +1,39 @@
<template>
<div class="allSections">
<!-- 左选项 -->
<div class="allSections-left">
<span v-for="(item, index) in list" :class="{ 'active': index == allActive }" :key="index"
@click="allClick(index)">{{ item.name }}</span>
</div>
<!-- 右选项 -->
<div class="allSections-right">
<div class="allSections-right-item" v-for="(i, k) in list[allActive].data" :key="k">
<div class="item-content">
<div class="item-title">{{ i.name }}</div>
<div v-if="i.description" class="item-text" v-html="i.description.replace(/<[^>]+>/g, '')"></div>
</div>
<div class="item-star">
<img v-if="!i.iscollection" src="~assets/img/allSections/nullStar.png" alt="空星"
@click="starClick(k, i.fid)">
<img v-else src="~assets/img/allSections/star.png" alt="实星" @click="cancelCollection(k, i.fid)">
<div>
<div class="allSections" v-if="!fid">
<div class="allSections-left">
<span v-for="(item, index) in list" :class="{ 'active': index == allActive }" :key="index"
@click="allClick(index)">{{ item.name }}</span>
</div>
<div class="allSections-right">
<div class="allSections-right-item" v-for="(i, k) in list[allActive].data" :key="k">
<div class="item-content">
<div class="item-title">{{ i.name }}</div>
<div v-if="i.description" class="item-text" v-html="i.description.replace(/<[^>]+>/g, '')"></div>
</div>
<div class="item-star">
<img v-if="!i.iscollection" src="~assets/img/allSections/nullStar.png" alt="空星"
@click.stop="starClick(k, i.fid)">
<img v-else src="~assets/img/allSections/star.png" alt="实星"
@click.stop="cancelCollection(k, i.fid)">
</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>
</template>
<script>
import plateNavigation from '@/components/PlateNavigation'
import indexList from '@/components/IndexList'
export default {
name: "AllSections",
data() {
@ -32,6 +41,8 @@ export default {
allActive: 0,
list: [{}],
postCollectionState: false, //
fid: 0, // id
}
},
@ -49,6 +60,7 @@ export default {
}).then(res => {
if (res.code != 200) return
this.list[this.allActive].data[k]['iscollection'] = 1
this.$Message.success(res.message)
this.$forceUpdate()
}).finally(() => {
this.postCollectionState = false
@ -65,9 +77,7 @@ export default {
}).then(res => {
if (res.code != 200) return
this.list[this.allActive].data[k]['iscollection'] = 0
this.$Message({
})
this.$Message.success(res.message)
this.$forceUpdate()
}).finally(() => {
this.postCollectionState = false
@ -84,13 +94,20 @@ export default {
}).catch(err => {
this.$message.error(err.message)
});
}
},
},
mounted() {
this.getAllForum()
},
components: {
plateNavigation,
indexList
},
}
</script>
@ -101,7 +118,7 @@ export default {
border-radius: 0.32rem;
margin-top: 0.666667rem;
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 {

View File

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

View File

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