You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
109 lines
2.4 KiB
109 lines
2.4 KiB
<template>
|
|
<view>
|
|
<view class="card" v-for="(item, index) in list" :key="index" @click="goDetails(item.id)">
|
|
<view class="lf-row-between lf-m-b-20">
|
|
<view class="lf-color-black lf-flex">
|
|
<text class="hot" v-if="item.is_read == 0"></text>
|
|
<!-- <text class="gray" v-else></text> -->
|
|
<text class="lf-font-28">收到一条新消息</text>
|
|
</view>
|
|
<view class="lf-color-gray lf-font-22">{{item.created_at}} </view>
|
|
</view>
|
|
<view class="lf-font-24 lf-color-555">{{item.title}}</view>
|
|
</view>
|
|
<!-- 加载 -->
|
|
<view class="loading-more">
|
|
<text v-if="list.length" :class="{'loading-more-text': loadingClass}">{{ loadingText }}</text>
|
|
<lf-nocontent v-else></lf-nocontent>
|
|
</view>
|
|
<!-- 回到顶部 -->
|
|
<u-back-top :scroll-top="pageScrollTop" :custom-style="{background: 'rgba(51, 51 51, 0.3)'}"></u-back-top>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data(){
|
|
return {
|
|
list: [],
|
|
loadingClass: true,
|
|
loadingText: '正在加载中',
|
|
page: 1,
|
|
isPage: false
|
|
}
|
|
},
|
|
onShow(){
|
|
this.getMessageList()
|
|
},
|
|
methods: {
|
|
goDetails(id) {
|
|
this.$url('/pages/message/detail?news_id='+id)
|
|
},
|
|
getMessageList() {
|
|
this.$http(this.API.API_MESSAGELIST,{page: this.page}).then(res => {
|
|
let isPage = res.data.next_page_url == null?false:true;
|
|
this.isPage = isPage;
|
|
if(!isPage){
|
|
this.loadingClass = false;
|
|
this.loadingText = '没有更多数据啦~';
|
|
}
|
|
if(this.page == 1){
|
|
this.list = res.data.data;
|
|
}else{
|
|
this.list.push(...res.data.data);
|
|
}
|
|
uni.stopPullDownRefresh();
|
|
console.log(this.list)
|
|
}).catch(err => {
|
|
|
|
})
|
|
}
|
|
},
|
|
onReachBottom(){
|
|
if(this.isPage){
|
|
this.page = this.page + 1;
|
|
this.getMessageList();
|
|
}
|
|
},
|
|
onPullDownRefresh(){
|
|
this.getMessageList()
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
page{
|
|
background-color: #F6F6F6;
|
|
}
|
|
</style>
|
|
<style lang="scss" scoped="scoped">
|
|
.card{
|
|
margin: 0 auto;
|
|
margin-top: 30rpx;
|
|
width: 686rpx;
|
|
height: max-content;
|
|
background-color: #FFFFFF;
|
|
padding: 20rpx;
|
|
border-radius: 20rpx;
|
|
box-sizing: border-box;
|
|
.hot{
|
|
display: inline-block;
|
|
margin-right: 10rpx;
|
|
width: 15rpx;
|
|
height: 15rpx;
|
|
border-radius: 50rpx;
|
|
background-color: #FF0000;
|
|
}
|
|
.gray {
|
|
display: inline-block;
|
|
margin-right: 10rpx;
|
|
width: 15rpx;
|
|
height: 15rpx;
|
|
border-radius: 50rpx;
|
|
background-color: #999;
|
|
}
|
|
}
|
|
.lf-font-22{
|
|
font-size: 22rpx;
|
|
}
|
|
</style>
|