提交 6a9ec7dd authored 作者: 劳广强's avatar 劳广强

feat(文章): 文章筛选层级增加一层

上级 269f457a
......@@ -7,7 +7,7 @@
<view :class="[articleIdx === index ? 'task_line' : 'task_line_none']"></view>
</view>
</view>
<view class="article_list">
<view v-if="articleDeepTypeList.length > 0" class="article_list">
<view class="article_item" v-for="(item, index) in articleDeepTypeList" @click="changeDeepArticle(item, index)" :key="item.name">
<view :class="[articleDeepIdx === index ? 'article_active' : 'article_item_name']">{{ item.name }}</view>
<view :class="[articleDeepIdx === index ? 'task_line' : 'task_line_none']"></view>
......@@ -98,12 +98,12 @@ export default {
const url = `/api/backend/articletype/list?parent_id=${id}`
const { list } = await uni.$u.http.get(url)
this.articleDeepTypeList = list
if (list.length <= 0) return
if (list.length <= 0) return this.fetchArticleData(id)
this.articleDeepTypeId = list[0]?.id
this.fetchArticleData()
this.fetchArticleData(this.articleDeepTypeId)
},
async fetchArticleData() {
async fetchArticleData(id) {
this.articleLoading = true
const articleTypeId = this.articleTypeId
const articleDeepTypeId = this.articleDeepTypeId
......@@ -114,7 +114,7 @@ export default {
[
'/api/article/list',
{
article_type_id: this.articleDeepTypeId,
article_type_id: id,
},
],
{
......@@ -138,7 +138,7 @@ export default {
this.articleDeepIdx = index
this.articleDeepTypeId = item.id
this.articleList = createList()
this.fetchArticleData()
this.fetchArticleData(item.id)
},
onArticleClick(item, index) {
......
......@@ -44,7 +44,7 @@
<view :class="[articleTypeAction === index ? 'article-task-line--action' : 'article-task-line--none']" />
</view>
</view>
<view class="article-list">
<view v-if="articleDeepTypeList.length > 0" class="article-list">
<view class="article-item" v-for="(item, index) in articleDeepTypeList" :key="item.id" @click="onArticleDeepTypeClick(item, index)">
<view :class="[articleDeepTypeAction === index ? 'article-item-name--action' : 'article-item-name--none']">{{ item.name }}</view>
<view :class="[articleDeepTypeAction === index ? 'article-task-line--action' : 'article-task-line--none']" />
......@@ -134,15 +134,15 @@ export default {
const url = `/api/backend/articletype/list?parent_id=${id}`
const { list } = await uni.$u.http.get(url)
this.articleDeepTypeList = list
if (list.length <= 0) return
if (list.length <= 0) return this.fetchArticleData(id)
this.articleDeepTypeId = list[0]?.id
this.fetchArticleData()
this.fetchArticleData(this.articleDeepTypeId)
},
async fetchArticleData() {
async fetchArticleData(id) {
const { list } = await uni.$u.http.get('/api/article/list', {
params: {
article_type_id: this.articleDeepTypeId,
article_type_id: id,
},
})
this.articleList = list
......@@ -157,7 +157,6 @@ export default {
this.articleTypeAction = index
this.articleTypeId = item.id
this.articleDeepTypeAction = 0
// this.fetchArticleData()
this.fetchArticleDeepTypeData(item.id)
},
......@@ -165,7 +164,7 @@ export default {
if (this.articleDeepTypeAction === index) return
this.articleDeepTypeAction = index
this.articleDeepTypeId = item.id
this.fetchArticleData()
this.fetchArticleData(item.id)
},
articleMore() {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论