123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- <template>
- <view class="page">
- <view class="message dis f-c" v-for="(item,index) in dataList" :key="index">
- <view class="time dis j-c a-c">{{item.createTime}}</view>
- <view class="content dis f-c">
- <view class="dis f-c j-s" style="border-bottom: 1px solid #f2f2f2;padding-bottom: 6px;">
- <text>消息编号:{{item.id}}</text>
- </view>
- <view class="dis f-c j-s" style="border-bottom: 1px solid #f2f2f2;padding: 10px 0;">
- <text> <text style="color: rgba(35,40,50,0.6);">消息内容:</text>
- {{item.content}}</text>
- </view>
- <view class="details">
- <u-section title="查看详情" sub-title="" :show-line="false"></u-section>
- </view>
- </view>
- </view>
- <u-loadmore v-if="dataList.length>0" :status="status" />
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- msgType: "",
- dataList: [],
- pageRequest: {
- pageNum: 1,
- pageSize: 20,
- },
- status: 'loadmore',
- pages: 0, //订单总页数
- }
- },
- onShow() {
- },
- onReachBottom() {
- if (this.pageRequest.pageNum >= this.pages) return;
- this.status = 'loading';
- this.pageRequest.pageNum = ++this.pageRequest.pageNum;
- setTimeout(async () => {
- let res = await this.$http.post('/api/message/getUserMessageList', {
- msgType: this.msgType,
- ...this.pageRequest
- });
- if (res.code == '200') {
- this.pageResult = [...this.pageResult, ...res.data.records];
- }
- if (this.pageRequest.pageNum >= this.pages) this.status = 'nomore';
- else this.status = 'loading';
- }, 1000)
- },
- onPullDownRefresh() {
- // 执行刷新逻辑
- this.list(1, 20);
- },
- onLoad(params) {
- if (params.msgType) {
- this.msgType = params.msgType;
- this.list(1, 20);
- }
- },
- methods: {
- async list(page, size) {
- this.pageRequest.pageNum = page;
- this.pageRequest.pageSize = size;
- let res = await this.$http.post('/api/message/getUserMessageList', {
- msgType: this.msgType,
- ...this.pageRequest
- });
- if (res.code == '200') {
- this.dataList = res.data.records;
- this.pages = res.data.pages;
- uni.stopPullDownRefresh();
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .page {
- padding: 16px;
- background: #F8FAFE;
- }
- .message {
- width: 100%;
- cursor: pointer;
- .time {
- width: 100%;
- font-size: 14px;
- color: rgba(35, 40, 50, 0.6);
- }
- .content {
- width: 100%;
- background: #FFFFFF;
- box-shadow: 0px 4px 10px 0px #DAE3F4;
- border-radius: 6px;
- margin: 15px 0;
- padding: 6px 16px 16px 16px;
- >view:nth-child(1) {
- color: #232832;
- font-size: 14px;
- font-weight: bold;
- }
- >view:nth-child(2) {
- color: #232832;
- font-size: 14px;
- }
- }
- .details {
- padding-top: 16px;
- }
- }
- </style>
|