12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <template>
- <view class="container">
- <uni-card :title="istitle" class="cardBox">
- <uni-list border class="list">
- <uni-list-item v-for="(item, index) in dataList" :key="index" :ellipsis="1" :title="item.noticeTitle" link clickable @click="listItemBtn(item)" ></uni-list-item>
- </uni-list>
- <uni-load-more :status="more" />
- </uni-card>
- </view>
- </template>
- <script>
- import request from '../../api/system.js';
- export default {
- onLoad: function (option) {
-
- },
- data() {
- return {
- dataList: [],
- more: 'more',
- page: 0,
- size: 20
- }
- },
- async mounted() {
- await this.getServiceList();
- },
- methods: {
- listItemBtn(e) {
- uni.navigateTo({ url: `/pages/details/index?noticeId=${e.noticeId}` });
- },
- // 查询列表函数
- async getServiceList() {
- this.page += 1;
- this.more = 'loading';
- const res = await request.getSystemNoticeList({ pageNum: this.page, pageSize: this.size });
- this.dataList.push(...res.rows)
- // 根据总数 算页数 如果当前页 = 总页数就是没有数据 否则就是上拉加载
- this.more = this.page >= Math.ceil(res.total / this.size) ? 'noMore' : 'more';
- },
- },
- // 页面生命周期中onReachBottom(页面滚动到底部的事件)
- onReachBottom() {
- if(this.more != 'noMore') {
- this.more = 'more';
- const filter = {};
- if(this.searchVal !== '') filter.title = this.searchVal;
- if (this.policyItem !== null && this.policyItem !== '') filter.tagName = this.policyItem;
- this.getPolicyList({ ...filter });
-
- }
- }
- }
- </script>
- <style>
- </style>
|