优化:文章列表支持指定分类
This commit is contained in:
parent
eb852c8d17
commit
6c4ae85f86
|
|
@ -65,9 +65,13 @@ export function getUserCoupons(data){
|
|||
/**
|
||||
* 文章分类列表
|
||||
*
|
||||
*/
|
||||
*/
|
||||
export function getArticleCategoryList(){
|
||||
return request.get('article/category/lst',{},{noAuth:true})
|
||||
return request.get('article/category/lst',{},{noAuth:true})
|
||||
}
|
||||
// 文章分类详情
|
||||
export function getArticleCategoryInfo(id){
|
||||
return request.get('article/category/info/'+id,{},{noAuth:true})
|
||||
}
|
||||
/**
|
||||
* 文章列表
|
||||
|
|
|
|||
|
|
@ -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.getArticleCate();
|
||||
// 是否存在指定分类 不存在获取分类列表
|
||||
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
|
||||
// 分享给好友
|
||||
|
|
|
|||
Loading…
Reference in New Issue