mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 16:03:25 +08:00
【新增】微信小程序端文章新增分类列表模式,放弃统一跳转到tabs切换模式,方便首页导航宫格可以直接到单个栏目列表。
This commit is contained in:
@@ -297,7 +297,8 @@ module.exports = {
|
||||
this.$u.route('/pages/article/details/details', { idType: 1, id: val });
|
||||
} else if (type == navLinkType.articleCategory) {
|
||||
// 文章列表
|
||||
this.$u.route('/pages/article/list/list')
|
||||
//this.$u.route('/pages/article/list/list')
|
||||
this.$u.route('/pages/article/category/category', { id: val });
|
||||
} else if (type == navLinkType.intelligentForms) {
|
||||
//自定义表单
|
||||
this.$u.route('/pages/form/details/details', { id: val });
|
||||
|
||||
@@ -87,6 +87,13 @@
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationBarTitleText": "文章列表"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "category/category",
|
||||
"style": {
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationBarTitleText": "文章栏目列表"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
110
CoreCms.Net.Uni-App/CoreShop/pages/article/category/category.vue
Normal file
110
CoreCms.Net.Uni-App/CoreShop/pages/article/category/category.vue
Normal file
@@ -0,0 +1,110 @@
|
||||
<template>
|
||||
<view>
|
||||
<u-toast ref="uToast" /><u-no-network></u-no-network>
|
||||
<u-navbar :title="typeName" 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>
|
||||
<u-icon name="home" size="22" @click="goHome"></u-icon>
|
||||
</view>
|
||||
<view slot="right">
|
||||
</view>
|
||||
</u-navbar>
|
||||
|
||||
<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" 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>
|
||||
</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>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
|
||||
data() {
|
||||
return {
|
||||
id: 0, // 文章分类id
|
||||
page: 1,
|
||||
limit: 10,
|
||||
list: [],
|
||||
status: 'loadmore',
|
||||
iconType: 'flower',
|
||||
loadText: {
|
||||
loadmore: '轻轻上拉',
|
||||
loading: '努力加载中',
|
||||
nomore: '实在没有了'
|
||||
},
|
||||
articleType: [],
|
||||
typeName: '',
|
||||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
if (options.id) {
|
||||
this.id = Number(options.id);
|
||||
this.articleList();
|
||||
}
|
||||
},
|
||||
onReachBottom() {
|
||||
if (this.status === 'loadmore') {
|
||||
this.articleList();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
articleList() {
|
||||
let data = {
|
||||
page: this.page,
|
||||
limit: this.limit,
|
||||
id: this.id
|
||||
};
|
||||
this.status = 'loading';
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
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';
|
||||
}
|
||||
} else {
|
||||
// 接口请求出错了
|
||||
this.$u.toast(res.msg);
|
||||
}
|
||||
});
|
||||
},
|
||||
change(item) {
|
||||
this.id = item.id;
|
||||
this.list = [];
|
||||
this.page = 1;
|
||||
this.limit = 10;
|
||||
this.loadStatus = 'more';
|
||||
this.articleList();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
</style>
|
||||
Reference in New Issue
Block a user