|
|
<template> <view class="content flex_col flex_start"> <!-- item --> <view class="item flex_col flex_start_y bg-white padding " v-for="(i,k) in pageList" @click="jumpDetail(i)"> <view class="title flex_row flex_start"> <view class="text-m text-left">{{i.msg_title}}</view> <view class="bandage" v-if="!i.is_read"></view> </view> <view class="time">{{i.updated_at}}</view> </view> </view> </template> <script> import {msgList} from "../../nxTemp/apis/userAPI.js" export default { data() { return { address:"", login:true, postData:{ page:1, page_size:10 }, listLoadFinished:false, listTotal:0, pageList:[], no_data_txt:"还没有任何赛事~" }; }, onLoad(parms) { }, onShow() { this.updateList() }, onUnload() { this.resetPostData() }, onReachBottom(){ console.log("onReachBottom"); this.updateList() }, methods: { updateList(){ if(this.listLoadFinished)return this.$tools.showNone("已加载完毕") msgList(this.postData).then(res => { // this.$tools.showNone("已更新");
this.pageList.push(...res.list) checkListLoadFinished(res,this); }).catch(e=>{ this.$tools.showNone(e.errMsg) }) function checkListLoadFinished(res,that){ if(that.pageList.length == res.total)that.listLoadFinished = true else that.postData.page++ } }, //重置请求参数
resetPostData(){ this.postData = { page:1, page_size:10 } this.pageList = [] this.listLoadFinished = false }, jumpPage(name){ this.$Router.push({name:name}) }, jumpDetail(i){ let {id,msg_optid} = i this.resetPostData() this.$Router.push({ name:"messageDetail", params:{ id,msg_optid } }) }, } } </script>
<style lang="less" scoped> .content{ .item{ color: #333333; position: relative; margin-top: 24rpx; border-radius: 10rpx; width: 702rpx; height: 124rpx; .title{ font-size: 32rpx; color: #1A1A1A; margin-bottom: 10rpx; font-weight: 700; } .time{ font-size: 24rpx; color: #B2B2B2; } .bandage{ width: 16rpx; height: 16rpx; // position: absolute;
// right: 60rpx;
background: #EA5061; border-radius: 50%; font-size: 24rpx; color: white; text-align: center; line-height: 34rpx; margin-top: -16rpx; margin-left: 10rpx; } } } </style>
|