165 lines
3.6 KiB
Vue
165 lines
3.6 KiB
Vue
<template>
|
|
<view class="messageList">
|
|
<mescroll-body ref="mescrollRef" top="16rpx" bottom="0" class='cotent-scroll' :up="upOption" :down="downOption" @up="upCallback" @down="downCallback" @init="mescrollInit" @emptyclick="emptyClick">
|
|
<view class="acea-row row-column">
|
|
<view
|
|
@click="toDetail(msg.id)"
|
|
class="acea-row message-box"
|
|
v-for="(msg, index) in list"
|
|
:key="index"
|
|
>
|
|
<view class="acea-row row-between row-middle">
|
|
<view class="title line1">{{msg.noticeTitle}}</view>
|
|
<!-- <div class="date">{{dataFormat(msg.createdTime,true)}}</div> -->
|
|
<view class="date">{{dataFormat(msg.noticeTime/1000,true)}}</view>
|
|
</view>
|
|
<view class="acea-row row-middle row-between">
|
|
<view class="content line1" v-html="msg.noticeContent"></view>
|
|
<view v-if="msg.readFlag=='RF0'" class="unread-dot"></view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</mescroll-body>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import { noticeList } from "@/api/user";
|
|
import { isWeixin, dataFormat } from "@/utils";
|
|
import MescrollMixins from "@/mixins/mescroll-mixins.js";
|
|
import MescrollBody from "@/components/mescroll-uni/mescroll-body.vue";
|
|
export default {
|
|
components:{
|
|
MescrollBody
|
|
},
|
|
data() {
|
|
return {
|
|
list:[
|
|
// {
|
|
// noticeTitle:'ddjifjiejfiejife',
|
|
// noticeTime:'2020-09-09',
|
|
// noticeContent:'djdifjeijfiejifef'
|
|
// }
|
|
],
|
|
upOption:{
|
|
noMoreSize: 10, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
|
|
auto:true,
|
|
empty:{
|
|
tip: '暂无消息' // 提示
|
|
// btnText:'点击刷新'
|
|
}
|
|
},
|
|
downOption:{
|
|
auto:false
|
|
}
|
|
}
|
|
},
|
|
mixins:[
|
|
MescrollMixins({
|
|
getPageData(mescroll){
|
|
var _this = this;
|
|
// 此时mescroll会携带page的参数:
|
|
let pageNum = mescroll.num; // 页码, 默认从1开始
|
|
let pageSize = mescroll.size; // 页长, 默认每页10条
|
|
var params = {
|
|
limit:pageSize,
|
|
page:pageNum
|
|
}
|
|
// mescroll.endByPage(0, 0);
|
|
// return;
|
|
|
|
noticeList(params)
|
|
.then(res => {
|
|
|
|
|
|
if(mescroll.num == 1) {
|
|
_this.list = []; //如果是第一页需手动制空列表
|
|
}
|
|
_this.list = _this.list.concat(res.data);//追加新数据
|
|
|
|
mescroll.endSuccess(res.data.length);
|
|
})
|
|
.catch(err => {
|
|
mescroll.endErr();
|
|
uni.showToast({
|
|
title: err + '',
|
|
icon: 'none',
|
|
mask: false,
|
|
duration: 1500
|
|
});
|
|
})
|
|
}
|
|
})
|
|
],
|
|
methods: {
|
|
dataFormat,
|
|
toDetail(mid){
|
|
this.$yrouter.push('/pages/user/MessageDetail/MessageDetail?id='+mid);
|
|
// this.$yrouter.push({
|
|
// path: "/pages/user/MessageDetail/MessageDetail",
|
|
// query: {
|
|
// id:mid
|
|
// }
|
|
// });
|
|
}
|
|
},
|
|
onLoad:function(e){
|
|
|
|
},
|
|
onShow:function(){
|
|
//静默刷新
|
|
this.mescroll && this.mescroll.resetUpScroll(false);
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="less">
|
|
page{
|
|
background-color: #fff;
|
|
}
|
|
.messageList{
|
|
padding: 0.32*100rpx;
|
|
background-color: #FFFFFF;
|
|
}
|
|
|
|
.message-box{
|
|
background:rgba(246,247,250,1);
|
|
border-radius:0.12*100rpx;
|
|
padding: 0.24*100rpx;
|
|
margin-bottom: 0.4*100rpx;
|
|
display: block;
|
|
// width: 100%;
|
|
}
|
|
|
|
.unread-dot{
|
|
position: absolute;
|
|
right: 0.2*100rpx;
|
|
top: auto;
|
|
flex-shrink: 0;
|
|
width:0.16*100rpx;
|
|
height:0.16*100rpx;
|
|
background:rgba(255,26,26,1);
|
|
border-radius:50%;
|
|
}
|
|
|
|
.content{
|
|
flex: 1;
|
|
color: #8B8F99;
|
|
font-size: 0.24*100rpx;
|
|
margin-top: 0.08*100rpx;
|
|
}
|
|
|
|
.date{
|
|
font-size:0.24*100rpx;
|
|
font-weight: bold;
|
|
color:rgba(139,143,153,1);
|
|
flex-shrink: 0;
|
|
color: #8B8F99;
|
|
}
|
|
|
|
.title{
|
|
flex: 1;
|
|
|
|
}
|
|
</style>
|