| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203 |
- <template>
- <view class="container">
- <uni-nav-bar dark :fixed="true" backgroundColor="#3F9EFF" statusBar="false" left-icon="left" left-text="返回"
- @clickLeft="toBack">
- <view style="width: 100%;display: flex;flex-direction: row;justify-content: center;align-items: center;">
- <text style="color: white;font-size: 1rem;">{{title}}</text>
- </view>
- </uni-nav-bar>
- <uni-list>
- <uni-list-item ellipsis="1" v-for="item in noticeList" :key="item.id" :title="item.title"
- :note="item.releaseTime" showArrow clickable @click="onNoticeItemClick(item.id)"></uni-list-item>
- </uni-list>
- <uni-load-more :status="status" @clickLoadMore="clickLoadMore" />
- </view>
- </template>
- <script>
- import http from '@/http/api.js';
- export default {
- components: {
- },
- data() {
- return {
- title: '通知公告消息',
- status: 'more',
- pageCurrent: 1,
- pageSize: 10,
- noticeList: [],
- totalCount: 0,
- };
- },
- onLoad() {
- this.getNotice();
- },
- onReady() {
- },
- onPullDownRefresh() {
- },
- onReachBottom() {
- if (this.totalCount > this.noticeList.length) {
- this.status = 'loading';
- setTimeout(() => {
- this.pageCurrent++
- this.getNotice(); //执行的方法
- }, 1000)
- } else { //停止加载
- this.status = 'noMore';
- }
- },
- methods: {
- toBack() {
- uni.navigateBack({
- delta: 1
- })
- },
- clickLoadMore(e) {
- if (this.totalCount > this.noticeList.length) {
- this.status = 'loading';
- setTimeout(() => {
- this.pageCurrent++
- this.getNotice(); //执行的方法
- }, 1000)
- } else { //停止加载
- this.status = 'noMore';
- }
- },
- getNotice() {
- let that = this;
- let current = this.pageCurrent;
- let size = this.pageSize;
- http.request({
- url: '/galaxy-business/notice/page',
- method: 'GET',
- params: {
- current,
- size,
- },
- }).then(res => {
- if (res.data.records != null) {
- for (let i = 0; i < res.data.records.length; i++) {
- that.noticeList.push(res.data.records[i]);
- }
- }
- that.totalCount = res.data.total;
- if (that.totalCount > that.noticeList.length) {
- this.status = 'more';
- }
- that.viewNotice();
- }).catch(err => {
- console.log(err)
- })
- },
- viewNotice() {
- http.request({
- url: '/galaxy-business/notice/view',
- method: 'POST',
- }).then(res => {}).catch(err => {
- console.log(err)
- })
- },
- onNoticeItemClick(id) {
- console.log('执行click事件', id)
- uni.navigateTo({
- url: '/pages/news/detail?id=' + id
- })
- },
- }
- };
- </script>
- <style lang="scss">
- .message-icon {
- width: 32rpx;
- height: auto;
- margin-right: 27rpx;
- }
- .tab {
- margin: 0 0 10rpx;
- border-bottom: 1px solid #e4e7ed;
- }
- .content {
- padding: 0 0 150rpx;
- .news {
- &:not(:last-of-type) {
- border-bottom: 2rpx solid #e4e7ed;
- }
- }
- }
- .nomore {
- padding: 30rpx 20rpx;
- }
- .news {
- margin: 30rpx 30rpx 0;
- padding: 0 0 30rpx;
- .head {
- display: flex;
- .avatar {
- flex-shrink: 0;
- width: 69rpx;
- height: 69rpx;
- background: #ffffff;
- border: 1px solid #14b9c8;
- border-radius: 50%;
- }
- .info {
- flex: 1;
- margin-left: 14rpx;
- .name {
- display: flex;
- align-items: center;
- font-size: 28rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #000000;
- line-height: 36rpx;
- .tag {
- margin-left: 15rpx;
- display: inline-block;
- padding: 8rpx 10rpx;
- font-size: 14rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #4cbeca;
- line-height: 21rpx;
- border: 1px solid #0bb9c8;
- border-radius: 6px;
- }
- }
- .date {
- font-size: 24rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #a3a3a3;
- line-height: 36rpx;
- }
- }
- }
- .des {
- margin-top: 40rpx;
- font-size: 30rpx;
- font-family: PingFang SC;
- color: #000000;
- line-height: 47rpx;
- }
- }
- .swiper-box {
- height: 100vh;
- }
- </style>
|