340 lines
7.2 KiB
Vue
340 lines
7.2 KiB
Vue
<template>
|
|
<z-paging
|
|
ref="pagingRef"
|
|
v-model="data_list"
|
|
@query="queryList"
|
|
class="scroll_div"
|
|
empty-view-text="暂无数据"
|
|
:refresher-enabled="true"
|
|
:loading-more-enabled="false"
|
|
>
|
|
<template #top>
|
|
<view class="main_div">
|
|
<view class="body-title">
|
|
<view class="back_div" @click="common.navigateBack()">
|
|
<view class="back-icon"></view>
|
|
</view>
|
|
<view>消息</view>
|
|
<view class="delete_div" @click="oneClickReadMessage">
|
|
<image
|
|
class="img"
|
|
src="@/static/images/messageNotification/delete_icon.png"
|
|
mode="aspectFit"
|
|
></image>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
<view class="scroll-Y">
|
|
<view class="item" v-for="(item, index) in data_list" @click="gotoMessageList(item)">
|
|
<view class="icon">
|
|
<image class="img_100" :src="imageMap[item.noticeTyp]" mode="widthFix"></image>
|
|
</view>
|
|
<view class="right">
|
|
<view class="top">
|
|
<view class="title">
|
|
{{ item.noticeName }}
|
|
</view>
|
|
</view>
|
|
<view class="bottom">
|
|
<view class="time">
|
|
{{ item.msgTm?.substr(0, 16) }}
|
|
</view>
|
|
<view class="read_div" v-if="item?.isMsg === 'Y'"></view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</z-paging>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { ref, reactive } from 'vue';
|
|
import { onLoad } from '@dcloudio/uni-app';
|
|
import {
|
|
queryTraPersonalMessageNoticePaging,
|
|
readNotice,
|
|
oneTimeRead,
|
|
queryMessageNoticeClass
|
|
} from '@/api/messageNotification.js';
|
|
import common from '../../common/common';
|
|
import type_01 from '@/static/images/messageNotification/type_01.png';
|
|
import type_02 from '@/static/images/messageNotification/type_02.png';
|
|
import type_03 from '@/static/images/messageNotification/type_03.png';
|
|
import type_04 from '@/static/images/messageNotification/type_04.png';
|
|
import type_05 from '@/static/images/messageNotification/type_05.png';
|
|
import type_06 from '@/static/images/messageNotification/type_06.png';
|
|
import type_07 from '@/static/images/messageNotification/type_07.png';
|
|
|
|
const pagingRef = ref(null);
|
|
const data_list = ref([]);
|
|
const queryList = () => {
|
|
queryMessageNoticeClass().then(({ body }) => {
|
|
data_list.value = body;
|
|
pagingRef.value.completeByTotal(body, body.length);
|
|
});
|
|
};
|
|
|
|
const imageMap = {
|
|
'01': type_01,
|
|
'02': type_02,
|
|
'03': type_03,
|
|
'04': type_04,
|
|
'05': type_05,
|
|
'06': type_06,
|
|
'07': type_07
|
|
};
|
|
|
|
const gotoMessageList = (item) => {
|
|
common.navigateTo('/pages/messageNotification/list?type=' + item.noticeTyp);
|
|
};
|
|
|
|
const oneClickReadMessage = () => {
|
|
const state = data_list.value.every((res) => res.isRead === '02');
|
|
if (state) {
|
|
common.msg('暂无未读消息');
|
|
return;
|
|
}
|
|
common.loading();
|
|
oneTimeRead()
|
|
.then((res) => {
|
|
data_list.value.forEach((item) => {
|
|
item.isMsg = 'N';
|
|
});
|
|
common.hideLoading();
|
|
setTimeout(() => {
|
|
common.msg('一键读取成功');
|
|
}, 10);
|
|
})
|
|
.catch(() => {
|
|
common.hideLoading();
|
|
});
|
|
};
|
|
const refreshType = (type) => {
|
|
const index = data_list.value.findIndex((res) => res.noticeTyp === type);
|
|
if (index === -1) {
|
|
return false;
|
|
}
|
|
data_list.value[index].isMsg = 'N';
|
|
};
|
|
|
|
defineExpose({ refreshType });
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.popup {
|
|
width: 100vw;
|
|
height: 100vh;
|
|
position: relative;
|
|
}
|
|
.message_popup_div {
|
|
width: 580rpx;
|
|
border-radius: 38rpx;
|
|
background: #ffffff url('@/static/images/messageNotification/popup_bg.png') no-repeat center -4rpx;
|
|
background-size: auto 50%;
|
|
background-color: #ffffff;
|
|
margin: 0 auto;
|
|
overflow: hidden;
|
|
top: 30%;
|
|
position: absolute;
|
|
left: calc(50% - 290rpx);
|
|
.title {
|
|
padding: 0 40rpx;
|
|
width: 100%;
|
|
height: 90rpx;
|
|
line-height: 110rpx;
|
|
font-weight: 700;
|
|
text-align: center;
|
|
}
|
|
|
|
.text {
|
|
padding: 16rpx 40rpx;
|
|
font-family: PingFangSC;
|
|
font-size: 30rpx;
|
|
color: #333333;
|
|
line-height: 48rpx;
|
|
text-align: left;
|
|
font-style: normal;
|
|
min-height: 300rpx;
|
|
max-height: 650rpx;
|
|
overflow: auto;
|
|
}
|
|
.button_div {
|
|
overflow: hidden;
|
|
.button {
|
|
width: 100%;
|
|
height: 100%;
|
|
:deep(.uv-button) {
|
|
height: 100rpx;
|
|
font-family: PingFangSC;
|
|
font-weight: 500;
|
|
font-size: 36rpx;
|
|
color: #0066ff;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.scroll-Y {
|
|
height: 100%;
|
|
position: relative;
|
|
border-radius: 20rpx 20rpx 0 0;
|
|
background-color: #fff;
|
|
.item {
|
|
height: 154rpx;
|
|
padding: 38rpx 0 38rpx 0;
|
|
margin: 0 38rpx;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
border-bottom: 2rpx solid #efefef;
|
|
.icon {
|
|
width: 78rpx;
|
|
height: 78rpx;
|
|
}
|
|
.time {
|
|
font-size: 23rpx;
|
|
color: #999999;
|
|
line-height: 30rpx;
|
|
text-align: right;
|
|
font-style: normal;
|
|
}
|
|
.right {
|
|
margin-left: 16rpx;
|
|
flex: 1;
|
|
overflow: hidden;
|
|
.top {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
|
|
.title {
|
|
font-family: PingFangSC;
|
|
font-weight: 600;
|
|
font-size: 30rpx;
|
|
color: #000000;
|
|
line-height: 46rpx;
|
|
text-align: left;
|
|
font-style: normal;
|
|
}
|
|
}
|
|
|
|
.bottom {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
overflow: hidden;
|
|
width: 100%;
|
|
.note {
|
|
font-family: PingFangSC;
|
|
font-weight: 400;
|
|
font-size: 26rpx;
|
|
color: #666666;
|
|
line-height: 35rpx;
|
|
text-align: left;
|
|
font-style: normal;
|
|
flex: 1;
|
|
width: 100%;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.num_div {
|
|
padding: 0 8rpx;
|
|
height: 31rpx;
|
|
background: #ff6c75;
|
|
border-radius: 15rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
font-family: ArialMT;
|
|
font-size: 22rpx;
|
|
color: #ffffff;
|
|
line-height: 26px;
|
|
min-width: 40rpx;
|
|
}
|
|
.read_div {
|
|
width: 16rpx;
|
|
height: 16rpx;
|
|
background-color: #d70c18;
|
|
border-radius: 100%;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
.main_div {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
background: linear-gradient(0deg, rgba(195, 219, 255, 0) 0%, #c3dbff 100%);
|
|
background-size: 100% 300px;
|
|
background-repeat: no-repeat; /* 防止渐变重复平铺 */
|
|
padding-top: var(--status-bar-height);
|
|
overflow: hidden;
|
|
margin-bottom: -20rpx;
|
|
}
|
|
|
|
.body-title {
|
|
width: 100%;
|
|
height: 120rpx;
|
|
font-size: 33rpx;
|
|
padding-top: 10rpx;
|
|
font-weight: 500;
|
|
color: #000;
|
|
font-weight: 600;
|
|
position: relative;
|
|
text-align: center;
|
|
|
|
.delete_div {
|
|
position: absolute;
|
|
right: 20rpx;
|
|
top: 7rpx;
|
|
width: 70rpx;
|
|
height: 70rpx;
|
|
.img {
|
|
margin-top: 10rpx;
|
|
width: 34rpx;
|
|
height: 34rpx;
|
|
}
|
|
}
|
|
|
|
.back_div {
|
|
position: absolute;
|
|
left: 26rpx;
|
|
top: 17rpx;
|
|
padding: 0 14rpx 14rpx 0;
|
|
|
|
.back-icon {
|
|
position: relative;
|
|
width: 50rpx;
|
|
height: 50rpx;
|
|
cursor: pointer;
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
|
|
.back-icon::before,
|
|
.back-icon::after {
|
|
content: '';
|
|
position: absolute;
|
|
transition: all 0.3s ease;
|
|
}
|
|
|
|
.back-icon::after {
|
|
top: 25%;
|
|
left: 25%;
|
|
width: 40%;
|
|
height: 40%;
|
|
border-top: 4rpx solid #2b2c2e;
|
|
border-left: 4rpx solid #2b2c2e;
|
|
transform: rotate(-45deg);
|
|
}
|
|
}
|
|
}
|
|
|
|
.input-view {
|
|
width: 90%;
|
|
margin: 20rpx auto;
|
|
height: 78rpx;
|
|
}
|
|
</style>
|