xytSk-App/pages/messageList/index.vue

226 lines
4.8 KiB
Vue
Raw Normal View History

2024-09-14 09:22:12 +08:00
<template>
<view :style="{height:'100vh',overflow:'hidden',backgroundColor: '#f0f0f0'}">
<u-status-bar></u-status-bar>
2024-11-06 15:56:11 +08:00
<u-navbar title="消息中心" :autoBack="true" :titleStyle="{
2024-09-14 09:22:12 +08:00
fontSize:'18px'
2024-11-06 15:56:11 +08:00
}" rightText="一键已读" @rightClick='rightClick' :height='44' :safeAreaInsetTop=true leftIconSize='20'
leftIconColor='rgb(153, 153, 153)'>
2024-09-14 09:22:12 +08:00
</u-navbar>
<view class="" style="margin-top: 44px;;background-color: #f0f0f0;border-top: 1px solid #f0f0f0;">
2024-11-06 15:56:11 +08:00
<view style="padding:0 10px,backgroundColor:#fff">
<view class="time-ranger">
<view class="start-time">
<text>开始时间</text>
<text @click="showTime=true" style="margin-left:15%;color:#3399ef">{{startTime}}</text>
</view>
<view class="end-time">
<text>结束时间</text>
<text @click="showTime1=true" style="margin:0 15%;color:#3399ef">{{endTime}}</text>
<view class="search-btn" @click="searchTm">
搜索
</view>
</view>
</view>
2024-09-14 09:22:12 +08:00
</view>
<view class="" v-for="item in list" style="margin: 10px;background-color: #fff;padding: 10px;">
<view class="item">
<view class="align-center">
<view class="blueTiao">
2024-11-06 15:56:11 +08:00
2024-09-14 09:22:12 +08:00
</view>
<view class="title">
{{item.title}}
</view>
</view>
2024-11-06 15:56:11 +08:00
2024-09-14 09:22:12 +08:00
<view class="titleRight" @click="toDetail(item)">
2024-11-06 15:56:11 +08:00
{{item.publishTime}}
2024-09-14 09:22:12 +08:00
</view>
</view>
<view class="contentItem">
<view class="itemC">
2024-11-06 15:56:11 +08:00
{{item.content}}
2024-09-14 09:22:12 +08:00
</view>
2024-11-06 15:56:11 +08:00
2024-09-14 09:22:12 +08:00
</view>
</view>
</view>
2024-11-06 15:56:11 +08:00
<u-datetime-picker :show="showTime" v-model="stm" mode="datetime" @confirm="showTime=false"
@cancel="showTime=false"></u-datetime-picker>
<u-datetime-picker :show="showTime1" v-model="etm" mode="datetime" @confirm="showTime1=false"
@cancel="showTime1=false"></u-datetime-picker>
2024-09-14 09:22:12 +08:00
</view>
</template>
<script>
import moment from 'moment'
export default {
data() {
return {
show: false,
2024-11-06 15:56:11 +08:00
showTime:false,
showTime1:false,
start: '请选择开始时间',
end: '请选择结束时间',
stm:'',
etm:'',
userList: uni.getStorageSync('value').data,
2024-09-14 09:22:12 +08:00
customStyle: {
background: '#000'
},
2024-11-06 15:56:11 +08:00
list: []
2024-09-14 09:22:12 +08:00
};
},
2024-11-06 15:56:11 +08:00
onLoad(options) {
this.getList()
},
computed:{
startTime:function (){
return this.stm?moment(this.stm).format('YYYY-MM-DD HH:mm:ss'):this.start
},
endTime:function (){
return this.etm?moment(this.etm).format('YYYY-MM-DD HH:mm:ss'):this.end
}
2024-09-14 09:22:12 +08:00
},
methods: {
2024-11-06 15:56:11 +08:00
rightClick() {
uni.$http.get('/gunshiApp/xyt/messageCenter/all/read', {
receiveUserId: uni.getStorageSync('value').userId
}).then(res => {
if (res.data.code == 200) {
this.getList()
}
})
},
searchTm() {
this.getList()
},
getList() {
console.log(111);
uni.$http.post('/gunshiApp/xyt/messageCenter/list', {
start:this.stm?moment(this.stm).format('YYYY-MM-DD HH:mm:ss'):'',
end:this.etm?moment(this.etm).format('YYYY-MM-DD HH:mm:ss'):''
}).then(res => {
if (res.data.code == 200) {
this.list = res.data.data
}
})
},
2024-09-14 09:22:12 +08:00
confirm(e) {
console.log(e);
this.model.start = e[0]
this.model.end = e[1]
this.show = false
},
cancel() {
this.show = false
},
2024-11-06 15:56:11 +08:00
toDetail(item) {
console.log(item);
2024-09-14 09:22:12 +08:00
uni.navigateTo({
2024-11-06 15:56:11 +08:00
url: '/pages/messageList/detail/index?item=' + JSON.stringify(item),
2024-09-14 09:22:12 +08:00
})
}
}
}
</script>
<style lang="scss" scoped>
2024-11-06 15:56:11 +08:00
.time-ranger {
margin-bottom: 10px;
.start-time,
.end-time {
display: flex;
align-items: center;
padding: 10px 0;
border-bottom: 1px solid #dfdfdf;
}
.search-btn {
margin: 3px 0 0 5px;
// color: #3399ef;
}
}
.uni-input-placeholder {
2024-09-14 09:22:12 +08:00
text-align: center;
}
2024-11-06 15:56:11 +08:00
2024-09-14 09:22:12 +08:00
.myTitleStyle {
font-size: 30px;
background-color: red;
height: 200px;
}
.tabsClass {
margin-top: 44px;
height: 44px;
padding: 0 40px;
border-top: 1px solid #eee;
border-bottom: 1px solid #eee;
}
.item {
// border-bottom: 1px solid #f0f0f0;
padding-bottom: 10px;
display: flex;
justify-content: space-between;
align-items: center;
2024-11-06 15:56:11 +08:00
.blueTiao {
2024-09-14 09:22:12 +08:00
background-color: #2a7efa;
width: 8px;
height: 8px;
border-radius: 50%;
margin-right: 10px;
}
2024-11-06 15:56:11 +08:00
2024-09-14 09:22:12 +08:00
.title {
border-width: 0px;
font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑', sans-serif;
font-weight: 700;
font-style: normal;
font-size: 15px;
color: #666666
}
.titleRight {
display: flex;
2024-11-06 15:56:11 +08:00
2024-09-14 09:22:12 +08:00
.border {
border-width: 0px;
background-color: rgba(236, 245, 255, 1);
box-sizing: border-box;
border-width: 1px;
border-style: solid;
border-color: rgba(187, 220, 255, 1);
border-radius: 5px;
box-shadow: none;
width: 58px;
height: 25px;
color: #689FFF;
text-align: center;
}
}
}
2024-11-06 15:56:11 +08:00
.contentItem {
.itemC {
2024-09-14 09:22:12 +08:00
display: flex;
justify-content: space-between;
display: flex;
color: #666666;
padding: 10px;
}
}
</style>