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.
172 lines
3.7 KiB
172 lines
3.7 KiB
<style lang="less" scoped>
|
|
.container{
|
|
height:100%;
|
|
background:#f6f6f6;
|
|
|
|
&>.btns{
|
|
flex-shrink: 0;
|
|
margin:30rpx;
|
|
display:flex;
|
|
border-radius: 30rpx;
|
|
button{
|
|
width:50%;
|
|
color:#999;
|
|
&:first-child{
|
|
border-radius: 30rpx 0 0 30rpx;
|
|
}
|
|
&:nth-child(2){
|
|
border-radius:0 30rpx 30rpx 0;
|
|
}
|
|
&.active{
|
|
background:#10C176;
|
|
color:#fff;
|
|
}
|
|
}
|
|
}
|
|
|
|
scroll-view{
|
|
flex-grow: 1;
|
|
height:1rpx;
|
|
.card{
|
|
margin-top:0;
|
|
&>view{
|
|
display: flex;
|
|
align-items: center;
|
|
&+view{
|
|
border-top:2rpx solid rgba(216, 216, 216, 0.2);
|
|
margin-top:20rpx;
|
|
padding-top:20rpx;
|
|
}
|
|
.PA-news{
|
|
flex-shrink: 0;
|
|
width:76rpx;
|
|
height:76rpx;
|
|
background:#10C176;
|
|
border-radius: 50%;
|
|
color:#fff;
|
|
font-size:40rpx;
|
|
text-align: center;
|
|
line-height: 76rpx;
|
|
box-shadow: 0 4rpx 6rpx rgba(0, 0, 0, 0.1);
|
|
margin-right:20rpx;
|
|
position:relative;
|
|
&.unread:after{
|
|
content:"";
|
|
position:absolute;
|
|
width:16rpx;
|
|
height:16rpx;
|
|
border-radius: 50%;
|
|
top:1rpx;
|
|
right:1rpx;
|
|
background:#EE4949;
|
|
}
|
|
}
|
|
.content{
|
|
flex-grow: 1;
|
|
width:1rpx;
|
|
.head{
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
.name{
|
|
font-size:28rpx;
|
|
}
|
|
.date{
|
|
font-size:24rpx;
|
|
color:#bbb;
|
|
}
|
|
}
|
|
.dec{
|
|
font-size:24rpx;
|
|
color:#999;
|
|
margin-top:10rpx;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style>
|
|
<template>
|
|
<view class="container flex">
|
|
|
|
<view class="btns shadow bg-white">
|
|
<button class="cu-btn bg-white" :class="{active:searchVal.msgType==0}" @click="searchVal.msgType=0">未读</button>
|
|
<button class="cu-btn bg-white" :class="{active:searchVal.msgType==1}" @click="searchVal.msgType=1">已读</button>
|
|
</view>
|
|
|
|
<scroll-view scroll-y @scrolltolower="search">
|
|
<view class="card" v-if="list.length>0">
|
|
<view v-for="(v,k) in list" :key="k" @click="toDetail(v)">
|
|
<text class="PA-news" :class="{unread:searchVal.msgType==0}"/>
|
|
<view class="content">
|
|
<view class="head">
|
|
<text class="name over">{{v.msgType}}</text> <text class="date">{{v.sendTime}}</text>
|
|
</view>
|
|
<view class="dec over">{{v.msgContent}}</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<u-empty :show="list.length<=0" text="未查询到相关信息" width="50%" icon="/static/noData.png"/>
|
|
<view style="border:0.5rpx solid transparent"/>
|
|
</scroll-view>
|
|
</view>
|
|
</template>
|
|
<script>
|
|
import request from '@/common/request'
|
|
export default {
|
|
data(){
|
|
return{
|
|
tabIndex:0,
|
|
searchVal:{
|
|
companyId:this.$store.getters.userInfo.companyId,
|
|
msgType:0,
|
|
pageNo:1,
|
|
pageSize:11,
|
|
},
|
|
list:[],
|
|
total:0,
|
|
}
|
|
},
|
|
watch:{
|
|
'searchVal.msgType'(n){
|
|
this.search('pageOne')
|
|
}
|
|
},
|
|
onLoad(){
|
|
this.search()
|
|
},
|
|
methods:{
|
|
async search(type){
|
|
if(type=='pageOne'){
|
|
this.searchVal.pageNo=1
|
|
this.list=[]
|
|
this.total=0
|
|
}
|
|
if(this.total==0 ||this.list.length<this.total){
|
|
var res=await request("/suyuan/messageApi/queryMessageList",{
|
|
method:"post",
|
|
body: this.searchVal
|
|
})
|
|
if(res.statu){
|
|
this.list=this.list.concat(res.data.list)
|
|
this.total=res.data.total
|
|
if(this.list.length==this.total)uni.showToast({title:"加载完成!",icon:"none"})
|
|
}else{
|
|
uni.showModal({
|
|
title:"提示",
|
|
content:res.msg||"获取消息失败!",
|
|
showCancel:false,
|
|
})
|
|
}
|
|
}
|
|
},
|
|
toDetail(e){
|
|
uni.navigateTo({
|
|
url:`/pages/home/newsDetail?type=${e.msgType}&msgType=${this.searchVal.msgType}`,
|
|
events:{update:()=>this.search('pageOne')}
|
|
})
|
|
},
|
|
},
|
|
}
|
|
</script>
|
|
|