mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 15:43:27 +08:00
【调整】帮助中心改为文档中心,业务模式调整为先大类列表,再小类文档列表,最后文章详情。
This commit is contained in:
@@ -195,7 +195,7 @@ module.exports = {
|
||||
|
||||
// 查看文章分类
|
||||
goArticleClassify(id) {
|
||||
this.$u.route('/pages/article/list/list', { id: id });
|
||||
this.$u.route('/pages/article/category/category', { id: id });
|
||||
},
|
||||
goArticleList() {
|
||||
this.$u.route('/pages/article/list/list')
|
||||
|
||||
@@ -32,6 +32,8 @@ const install = (Vue, vm) => {
|
||||
let articleInfo = (params, config = {}) => http.post('/Api/Article/GetArticleDetail', params, { custom: { methodName: 'articles.getArticleDetail', needToken: false } });
|
||||
// 获取文章列表
|
||||
let articleList = (params, config = {}) => http.post('/Api/Article/GetArticleList', params, { custom: { methodName: 'articles.getArticleList', needToken: false } });
|
||||
// 获取文章分类
|
||||
let articleClassify = (params, config = {}) => http.post('/Api/Article/GetArticleClassify', params, { custom: { methodName: 'articles.GetArticleClassify', needToken: false } });
|
||||
|
||||
|
||||
// 获取商品分类
|
||||
@@ -449,6 +451,7 @@ const install = (Vue, vm) => {
|
||||
noticeInfo,
|
||||
articleInfo,
|
||||
articleList,
|
||||
articleClassify,
|
||||
|
||||
categories,
|
||||
goodsList,
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
loading: '努力加载中',
|
||||
nomore: '实在没有了'
|
||||
},
|
||||
articleType: [],
|
||||
articleType: {},
|
||||
typeName: '',
|
||||
};
|
||||
},
|
||||
@@ -73,11 +73,7 @@
|
||||
this.$u.api.articleList(data).then(res => {
|
||||
if (res.status) {
|
||||
this.articleType = res.data.articleType;
|
||||
for (var i = 0; i < this.articleType.length; i++) {
|
||||
if (this.id === this.articleType[i].id) {
|
||||
this.typeName = this.articleType[i].name;
|
||||
}
|
||||
}
|
||||
this.typeName = res.data.articleType.name
|
||||
|
||||
const _list = res.data.list;
|
||||
this.list = [...this.list, ..._list];
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<view>
|
||||
<u-toast ref="uToast" /><u-no-network></u-no-network>
|
||||
<u-navbar title="帮助中心" safeAreaInsetTop fixed placeholder>
|
||||
<u-navbar title="文档分类" safeAreaInsetTop fixed placeholder>
|
||||
<view class="coreshop-navbar-left-slot" slot="left">
|
||||
<u-icon name="arrow-left" size="19" @click="goNavigateBack"></u-icon>
|
||||
<u-line direction="column" :hairline="false" length="16" margin="0 8px"></u-line>
|
||||
@@ -11,24 +11,15 @@
|
||||
</view>
|
||||
</u-navbar>
|
||||
|
||||
<u-sticky customNavHeight="88" bgColor="#f1f1f1">
|
||||
<u-tabs :list="articleType" sticky :current="current" @change="change" lineWidth="30"></u-tabs>
|
||||
</u-sticky>
|
||||
|
||||
<view class="coreshop-bg-white coreshop-margin-10">
|
||||
<view class="coreshop-flex coreshop-solid-bottom coreshop-justify-between coreshop-flex-nowrap coreshop-padding-top-10 coreshop-padding-bottom-10 coreshop-padding-left-10 coreshop-padding-right-10" v-for="item in list" :key="item.id" @click="goArticleDetail(item.id)">
|
||||
<view class="coreshop-flex coreshop-flex-nowrap">
|
||||
<u--image width="25px" height="25px" :src="item.coverImage? item.coverImage : '/static/images/common/empty.png'" mode="aspectFill" :showLoading="true"></u--image>
|
||||
<view class="u-line-2 coreshop-padding-left-5 coreshop-font-14">{{item.title}}</view>
|
||||
</view>
|
||||
<view class="coreshop-text-gray coreshop-text-right coreshop-justify-end">
|
||||
<u-icon name="arrow-right-double"></u-icon>
|
||||
<view class="coreshop-padding-top-10 coreshop-padding-bottom-10 coreshop-padding-left-10 coreshop-padding-right-10">
|
||||
|
||||
<view class="list-grid" v-for="item in articleType" :key="item.id" @click="goArticleClassify(item.id)">
|
||||
<u-button type="primary" :text="item.name"></u-button>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<u-loadmore :status="status" :icon-type="iconType" :load-text="loadText" margin-top="0" margin-bottom="20" class="coreshop-padding-top-10" />
|
||||
</view>
|
||||
<!-- 登录提示 -->
|
||||
<coreshop-login-modal></coreshop-login-modal>
|
||||
</view>
|
||||
@@ -40,81 +31,27 @@
|
||||
|
||||
data() {
|
||||
return {
|
||||
cid: 0, // 文章分类id
|
||||
page: 1,
|
||||
limit: 20,
|
||||
list: [],
|
||||
status: 'loadmore',
|
||||
iconType: 'flower',
|
||||
loadText: {
|
||||
loadmore: '轻轻上拉',
|
||||
loading: '努力加载中',
|
||||
nomore: '实在没有了'
|
||||
},
|
||||
articleType: [],
|
||||
typeName: '',
|
||||
current: 0
|
||||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
if (options.cid) {
|
||||
this.cid = Number(options.cid);
|
||||
}
|
||||
this.articleList();
|
||||
if (options.current) {
|
||||
this.current = options.current;
|
||||
}
|
||||
},
|
||||
onReachBottom() {
|
||||
console.log("到达底部");
|
||||
if (this.status === 'loadmore') {
|
||||
this.articleList();
|
||||
}
|
||||
onLoad() {
|
||||
this.articleClassify();
|
||||
},
|
||||
methods: {
|
||||
articleList() {
|
||||
let data = {
|
||||
page: this.page,
|
||||
limit: this.limit,
|
||||
id: this.cid
|
||||
};
|
||||
this.status = 'loading';
|
||||
this.$u.api.articleList(data).then(res => {
|
||||
articleClassify() {
|
||||
this.$u.api.articleClassify().then(res => {
|
||||
if (res.status) {
|
||||
this.articleType = res.data.articleType;
|
||||
for (var i = 0; i < this.articleType.length; i++) {
|
||||
if (this.cid === this.articleType[i].id) {
|
||||
this.current = i;
|
||||
}
|
||||
}
|
||||
this.typeName = res.data.typeName;
|
||||
const _list = res.data.list;
|
||||
this.list = [...this.list, ..._list];
|
||||
if (res.data.count > this.list.length) {
|
||||
this.status = 'loadmore';
|
||||
this.page++;
|
||||
} else {
|
||||
// 数据已加载完毕
|
||||
this.status = 'nomore';
|
||||
}
|
||||
this.articleType = res.data;
|
||||
} else {
|
||||
// 接口请求出错了
|
||||
this.$u.toast(res.msg);
|
||||
}
|
||||
});
|
||||
},
|
||||
change(item) {
|
||||
this.current = item.index;
|
||||
this.cid = item.id;
|
||||
this.list = [];
|
||||
this.page = 1;
|
||||
this.limit = 20;
|
||||
this.loadStatus = 'more';
|
||||
this.articleList();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.list-grid { padding: 10px; }
|
||||
</style>
|
||||
|
||||
@@ -197,7 +197,7 @@
|
||||
</u-grid-item>
|
||||
|
||||
<u-grid-item @click="goArticleList()">
|
||||
<u-icon name="question-circle" :size="25" color="#666" label="帮助中心" labelPos="bottom" labelSize="13" space="25" top="15"></u-icon>
|
||||
<u-icon name="question-circle" :size="25" color="#666" label="文档中心" labelPos="bottom" labelSize="13" space="25" top="15"></u-icon>
|
||||
</u-grid-item>
|
||||
|
||||
<u-grid-item v-for="(item,i) in other" :key="i" v-if="item.showItem" @click="navigateToHandle(item.router)">
|
||||
|
||||
@@ -108,20 +108,10 @@ namespace CoreCms.Net.Web.WebApi.Controllers
|
||||
{
|
||||
var jm = new WebApiCallBack();
|
||||
|
||||
var articleType = await _articleTypeServices.QueryListByClauseAsync(p => p.id > 0, p => p.sort, OrderByType.Asc, true, true);
|
||||
if (articleType.Any())
|
||||
var articleType = await _articleTypeServices.QueryByClauseAsync(p => p.id == entity.id);
|
||||
if (articleType != null)
|
||||
{
|
||||
var where = PredicateBuilder.True<CoreCmsArticle>();
|
||||
if (entity.id > 0)
|
||||
{
|
||||
where = where.And(p => p.isDel == false && p.typeId == entity.id && p.isPub == true);
|
||||
}
|
||||
else
|
||||
{
|
||||
var typeId = articleType.FirstOrDefault()!.id;
|
||||
where = where.And(p => p.isDel == false && p.typeId == typeId && p.isPub == true);
|
||||
}
|
||||
var list = await _articleServices.QueryPageAsync(where, p => p.createTime, OrderByType.Desc, entity.page, entity.limit);
|
||||
var list = await _articleServices.QueryPageAsync(p => p.isDel == false && p.typeId == articleType.id && p.isPub == true, p => p.createTime, OrderByType.Desc, entity.page, entity.limit);
|
||||
jm.data = new
|
||||
{
|
||||
list,
|
||||
|
||||
Reference in New Issue
Block a user