优化:文章列表支持指定分类
This commit is contained in:
parent
eb852c8d17
commit
6c4ae85f86
38
api/api.js
38
api/api.js
|
|
@ -2,11 +2,11 @@
|
|||
import request from "@/utils/request.js";
|
||||
/**
|
||||
* 公共接口 ,优惠券接口 , 行业此讯 , 手机号码注册
|
||||
*
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 获取主页数据 无需授权
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function getIndexData()
|
||||
{
|
||||
|
|
@ -20,7 +20,7 @@ export function getAppVersion() {
|
|||
}
|
||||
/**
|
||||
* 获取登录授权login
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function getLogo()
|
||||
{
|
||||
|
|
@ -28,7 +28,7 @@ export function getLogo()
|
|||
}
|
||||
/**
|
||||
* 保存form_id
|
||||
* @param string formId
|
||||
* @param string formId
|
||||
*/
|
||||
export function setFormId(formId) {
|
||||
return request.post("wechat/set_form_id", { formId: formId});
|
||||
|
|
@ -36,7 +36,7 @@ export function setFormId(formId) {
|
|||
/**
|
||||
* 领取优惠卷
|
||||
* @param int couponId
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function setCouponReceive(couponId){
|
||||
return request.post('coupon/receive/'+couponId);
|
||||
|
|
@ -64,37 +64,41 @@ 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})
|
||||
}
|
||||
/**
|
||||
* 文章列表
|
||||
* @param int cid
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function getArticleList(cid,data){
|
||||
return request.get('article/lst/' + cid, data,{noAuth:true})
|
||||
}
|
||||
/**
|
||||
* 文章 热门列表
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function getArticleHotList(){
|
||||
return request.get('article/hot/list',{},{noAuth:true});
|
||||
}
|
||||
/**
|
||||
* 文章 轮播列表
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function getArticleBannerList(){
|
||||
return request.get('article/banner/list',{},{noAuth:true})
|
||||
}
|
||||
/**
|
||||
* 文章详情
|
||||
* @param int id
|
||||
*
|
||||
* @param int id
|
||||
*
|
||||
*/
|
||||
export function getArticleDetails(id){
|
||||
return request.get('article/detail/'+id,{},{noAuth:true});
|
||||
|
|
@ -123,7 +127,7 @@ export function registerVerify(phone, reset, key, code){
|
|||
/**
|
||||
* 手机号注册
|
||||
* @param object data
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function phoneRegister(data){
|
||||
return request.post('register',data,{noAuth:true});
|
||||
|
|
@ -131,7 +135,7 @@ export function phoneRegister(data){
|
|||
/**
|
||||
* 手机号修改密码
|
||||
* @param object data
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function phoneRegisterReset(data){
|
||||
return request.post('register/reset',data,{noAuth:true})
|
||||
|
|
@ -139,7 +143,7 @@ export function phoneRegisterReset(data){
|
|||
/**
|
||||
* 手机号+密码登录
|
||||
* @param object data
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function phoneLogin(data){
|
||||
return request.post('login',data,{noAuth:true})
|
||||
|
|
@ -337,4 +341,4 @@ export function getCateData(data) {
|
|||
return request.get("diy/category", data, {
|
||||
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