<template>
|
<view>
|
<u-toast ref="uToast" /><u-no-network></u-no-network>
|
<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>
|
<u-icon name="home" size="22" @click="goHome"></u-icon>
|
</view>
|
<view slot="right">
|
</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" 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 {
|
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();
|
}
|
},
|
methods: {
|
articleList() {
|
let data = {
|
page: this.page,
|
limit: this.limit,
|
id: this.cid
|
};
|
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.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';
|
}
|
} 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>
|
</style>
|