<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>
|
<block v-if="list.length > 0">
|
<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="goNoticeDetail(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>
|
</block>
|
<!-- 无数据时默认显示 -->
|
<view class="coreshop-emptybox" v-else>
|
<u-empty :icon="$globalConstVars.apiFilesUrl+'/static/images/empty/data.png'" icon-size="150" text="暂无数据" mode="list"></u-empty>
|
</view>
|
<!-- 登录提示 -->
|
<coreshop-login-modal></coreshop-login-modal>
|
</view>
|
</template>
|
|
<script>
|
|
export default {
|
|
data() {
|
return {
|
page: 1,
|
limit: 20,
|
list: [],
|
status: 'loadmore',
|
iconType: 'flower',
|
loadText: {
|
loadmore: '轻轻上拉',
|
loading: '努力加载中',
|
nomore: '实在没有了'
|
},
|
};
|
},
|
onLoad(options) {
|
this.noticeList();
|
},
|
onReachBottom() {
|
if (this.status === 'loadmore') {
|
this.noticeList();
|
}
|
},
|
methods: {
|
noticeList() {
|
let data = {
|
page: this.page,
|
limit: this.limit,
|
};
|
this.status = 'loading';
|
this.$u.api.notice(data).then(res => {
|
if (res.status) {
|
if (res.data.length > 0) {
|
const _list = res.data;
|
this.list = [...this.list, ..._list];
|
if (res.data.count > this.list.length) {
|
this.status = 'loadmore';
|
this.page++;
|
} else {
|
// 数据已加载完毕
|
this.status = 'nomore';
|
}
|
} else {
|
// 数据已加载完毕
|
this.status = 'nomore';
|
}
|
|
} else {
|
// 接口请求出错了
|
this.$u.toast(res.msg);
|
}
|
});
|
}
|
}
|
};
|
</script>
|
|
<style lang="scss" scoped>
|
</style>
|