2022-03-24 08:34:50 +00:00
|
|
|
|
<template>
|
|
|
|
|
<view>
|
|
|
|
|
<status-nav navBarTitle="消息中心" returnColor="#c2c2c2"></status-nav>
|
2022-04-07 10:16:05 +00:00
|
|
|
|
<view v-show="ifDel" class="bacf pad-sx20 pad-zy40 fon24 disjbac animated" :class="ifDel ? 'fadeInDown' :'fadeOutUp'" style="position: sticky;" :style="{top: newTop+'px'}">
|
|
|
|
|
<view @tap="delEv(0)">删除所有</view>
|
|
|
|
|
<view @tap="delEv(1)">删除({{delNum}})</view>
|
|
|
|
|
</view>
|
2022-03-24 08:34:50 +00:00
|
|
|
|
<container-subgroup>
|
2022-04-07 10:16:05 +00:00
|
|
|
|
<view slot="content">
|
2022-04-12 00:50:56 +00:00
|
|
|
|
<!-- <view @longtap.stop="longTap(index)" @tap="chooseDel(index,item.id)" class="mar-x10 bacf" :style="{backgroundColor: (ifDel && item.status) ? '#dddddd' :''}" v-for="(item,index) in dataList" :key="index"> -->
|
|
|
|
|
<view class="mar-x10 bacf" :style="{backgroundColor: (ifDel && item.status) ? '#dddddd' :''}" v-for="(item,index) in dataList" :key="index">
|
2022-03-24 08:34:50 +00:00
|
|
|
|
<view class="pad-sx30 pad-zy20 disjbac">
|
2022-04-12 00:50:56 +00:00
|
|
|
|
<view class="fon30 message-circle disac" :class="['','system-notification','activity-message','server-message','audit-failed'][item.message_type]"><view class="clips1 mar-y20">{{item.title}}</view></view>
|
|
|
|
|
<view class="fon26 col9 flexs">{{item.time}}</view>
|
2022-03-24 08:34:50 +00:00
|
|
|
|
</view>
|
|
|
|
|
<view class="bbot"></view>
|
2022-04-07 10:16:05 +00:00
|
|
|
|
<view class="fon27 line-h46 pad-zy20 pad-sx30" style="color: #737373;">{{item.content}}</view>
|
2022-03-24 08:34:50 +00:00
|
|
|
|
</view>
|
2022-04-07 10:16:05 +00:00
|
|
|
|
<pitera v-if="total==dataList.length" textStr="暂无更多"></pitera>
|
2022-03-24 08:34:50 +00:00
|
|
|
|
</view>
|
|
|
|
|
</container-subgroup>
|
2022-04-07 10:16:05 +00:00
|
|
|
|
<nothing-page v-if="dataList.length==0"></nothing-page>
|
2022-03-24 08:34:50 +00:00
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2022-04-07 10:16:05 +00:00
|
|
|
|
import pitera from '@/components/nothing/pitera.vue';
|
2022-03-24 08:34:50 +00:00
|
|
|
|
export default {
|
2022-04-07 10:16:05 +00:00
|
|
|
|
components:{
|
|
|
|
|
pitera
|
|
|
|
|
},
|
2022-03-24 08:34:50 +00:00
|
|
|
|
data() {
|
|
|
|
|
return {
|
2022-04-07 10:16:05 +00:00
|
|
|
|
delNum:0,
|
|
|
|
|
newTop: uni.getSystemInfoSync().statusBarHeight + 40,
|
|
|
|
|
ifDel:false,
|
|
|
|
|
total:12,
|
2022-04-12 00:50:56 +00:00
|
|
|
|
dataList:[],
|
2022-04-07 10:16:05 +00:00
|
|
|
|
delArrId:[]
|
2022-03-24 08:34:50 +00:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onLoad() {
|
|
|
|
|
this.getMessageList();
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
// 查询消息列表
|
|
|
|
|
getMessageList(){
|
2022-04-06 03:24:55 +00:00
|
|
|
|
this.$requst.get('/universal/api.message/message_list',{page: 1,list_rows: 200}).then(res=>{
|
2022-04-12 00:50:56 +00:00
|
|
|
|
if(res.code) {
|
|
|
|
|
if(res.data.data.length) {
|
|
|
|
|
res.data.data.forEach(item=>{
|
|
|
|
|
let obj = {
|
|
|
|
|
id:item.message_id,
|
|
|
|
|
title:item.title,
|
|
|
|
|
content:item.content,
|
|
|
|
|
time:item.create_time,
|
|
|
|
|
is_read:item.is_read,
|
|
|
|
|
message_type:item.message_type,
|
|
|
|
|
status:false
|
|
|
|
|
}
|
|
|
|
|
this.dataList.push(obj);
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-03-24 08:34:50 +00:00
|
|
|
|
})
|
2022-04-07 10:16:05 +00:00
|
|
|
|
},
|
|
|
|
|
// 长按事件
|
|
|
|
|
longTap(index) {
|
|
|
|
|
console.log(index);
|
|
|
|
|
this.ifDel = true;
|
|
|
|
|
this.dataList[index].status = true;
|
|
|
|
|
this.delNum++;
|
|
|
|
|
this.delArrId.push(this.dataList[index].id);
|
|
|
|
|
},
|
|
|
|
|
// 删除事件
|
|
|
|
|
delEv(index) {
|
|
|
|
|
if(index) {
|
|
|
|
|
console.log('删除选中项');
|
|
|
|
|
this.delArrId.forEach(item=>{
|
|
|
|
|
this.dataList.forEach((item1,index1)=>{
|
|
|
|
|
if(item == item1.id) {
|
|
|
|
|
console.log(item);
|
|
|
|
|
this.dataList.splice(index1,1);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
console.log('清空所有');
|
|
|
|
|
this.dataList = [];
|
|
|
|
|
}
|
|
|
|
|
this.ifDel = false;
|
|
|
|
|
this.delNum = 0;
|
|
|
|
|
this.delArrId = [];
|
|
|
|
|
},
|
|
|
|
|
// 选中删除
|
|
|
|
|
chooseDel(index,id){
|
|
|
|
|
if(this.ifDel) {
|
|
|
|
|
this.dataList[index].status = !this.dataList[index].status;
|
|
|
|
|
this.delNum = 0;
|
|
|
|
|
this.delArrId = [];
|
|
|
|
|
this.dataList.forEach(item=>{
|
|
|
|
|
if(item.status) {
|
|
|
|
|
this.delNum++;
|
|
|
|
|
this.delArrId.push(item.id);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
2022-03-24 08:34:50 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
|
|
|
|
|
</style>
|