优化:文章列表支持指定分类

This commit is contained in:
wuhui_zzw 2024-05-23 17:06:16 +08:00
parent eb852c8d17
commit 6c4ae85f86
2 changed files with 48 additions and 21 deletions

View File

@ -69,6 +69,10 @@ export function getUserCoupons(data){
export function getArticleCategoryList(){
return request.get('article/category/lst',{},{noAuth:true})
}
// 文章分类详情
export function getArticleCategoryInfo(id){
return request.get('article/category/info/'+id,{},{noAuth:true})
}
/**
* 文章列表
* @param int cid

View File

@ -48,16 +48,17 @@
</template>
<script>
import {
getArticleCategoryList,
getArticleList,
getArticleHotList,
getArticleBannerList
getArticleBannerList,
getArticleCategoryInfo
} from '@/api/api.js';
import home from '@/components/home';
import spread from "../../libs/spread";
import { mapGetters } from "vuex";
export default {
components: {
home
@ -88,7 +89,17 @@
* 生命周期函数--监听页面显示
*/
onLoad: function(options) {
//
this.active = options.cate_id || 0;
if(this.active > 0) {
//
this.getCidArticle();
this.getArticleInfo();
} else {
//
this.getArticleCate();
}
//
this.status = false;
this.page = 1;
this.articleList = [];
@ -151,7 +162,19 @@
this.status = false;
this.getCidArticle();
}
},
getArticleInfo() {
let _this = this;
getArticleCategoryInfo(_this.active).then(res => {
let data = res.data || {};
let title = data.title || '';
if(title){
uni.setNavigationBarTitle({
title: title
})
}
});
},
},
// #ifdef MP
//