修复签到展示bug,修改图片比例为16:9

This commit is contained in:
田岩
2025-11-24 15:36:50 +08:00
parent 1aee63f2d6
commit e32c6289ae
20 changed files with 171 additions and 523 deletions
+19 -9
View File
@@ -1,5 +1,13 @@
<template>
<z-paging ref="pagingRef" v-model="data_list" @query="queryList" class="scroll_div" empty-view-text="暂无数据">
<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">
@@ -32,9 +40,6 @@
<view class="time">
{{ item.msgTm?.substr(0, 16) }}
</view>
<!-- <view class="note ellipsis-text">
{{ item.noticeContent }}
</view> -->
<view class="read_div" v-if="item?.isMsg === 'Y'"></view>
</view>
</view>
@@ -44,7 +49,7 @@
</template>
<script setup>
import { ref, reactive } from 'vue';
import { ref, reactive, defineExpose } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import {
queryTraPersonalMessageNoticePaging,
@@ -60,13 +65,9 @@
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';
import useZpaging from '@/composables/useZpaging.js';
const pagingRef = ref(null);
const data_list = ref([]);
// const { pagingRef, queryList, data_list, reload } = useZpaging({
// fetchFunction: noticeMessageCount
// });
const queryList = () => {
queryMessageNoticeClass().then(({ body }) => {
data_list.value = body;
@@ -109,6 +110,15 @@
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">
+19 -2
View File
@@ -42,7 +42,7 @@
<script setup>
import { ref, reactive, computed } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import { queryTraPersonalMessageNoticePaging } from '@/api/messageNotification.js';
import { queryTraPersonalMessageNoticePaging, oneTimeReadByNoticeTyp } 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';
@@ -52,7 +52,24 @@
import type_06 from '@/static/images/messageNotification/type_06.png';
import type_07 from '@/static/images/messageNotification/type_07.png';
import useZpaging from '@/composables/useZpaging.js';
const fetchFunction = (params) => queryTraPersonalMessageNoticePaging({ noticeTyp: typeValue.value, ...params });
const fetchFunction = (params) => {
const page = params?.page || 1;
if (page === 1) {
oneTimeReadByNoticeTyp({ noticeTyp: typeValue.value }).then((res) => {
const pages = getCurrentPages();
if (pages.length >= 1) {
const prevPage = pages[pages.length - 2];
if (prevPage.route === 'pages/messageNotification/index') {
if (prevPage.$vm && typeof prevPage.$vm.$?.exposed?.refreshType === 'function') {
prevPage.$vm.$?.exposed?.refreshType(typeValue.value);
}
}
}
});
}
return queryTraPersonalMessageNoticePaging({ noticeTyp: typeValue.value, ...params });
};
const { pagingRef, queryList, data_list } = useZpaging({
fetchFunction: fetchFunction
});
-370
View File
@@ -1,370 +0,0 @@
<template>
<z-paging ref="pagingRef" v-model="data_list" @query="queryList" class="scroll_div" empty-view-text="暂无数据">
<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="readMessageOpen(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.noticeTitle }}
</view>
<view class="time">
{{ item.ctTime?.substr(0, 16) }}
</view>
</view>
<view class="bottom">
<view class="note ellipsis-text">
{{ item.noticeContent }}
</view>
<view class="read_div" v-if="item?.isRead === '01'"></view>
</view>
</view>
</view>
</view>
<uni-popup ref="popup" type="bottom">
<view
class="popup"
@touchmove.stop.prevent="
() => {
return false;
}
"
>
<view class="message_popup_div">
<view class="title">
{{ popup_info.title }}
</view>
<view class="text">{{ popup_info.text }}</view>
<view class="button_div" @click.stop="readMessage">
<uv-button :loading="readLoading" class="button">我知道了</uv-button>
</view>
</view>
</view>
</uni-popup>
</z-paging>
</template>
<script setup>
import { ref, reactive } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import { queryTraPersonalMessageNoticePaging, readNotice, oneTimeRead } 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 useZpaging from '@/composables/useZpaging.js';
const { pagingRef, queryList, data_list, reload } = useZpaging({
fetchFunction: queryTraPersonalMessageNoticePaging
});
const imageMap = {
'01': type_01,
'02': type_02,
'03': type_03,
'04': type_04,
'05': type_05
};
const readLoading = ref(false);
const offset = ref(0);
const popup_info = reactive({
id: '',
title: '',
text: '',
isRead: ''
});
const popup = ref(null);
const readMessage = () => {
if (popup_info.isRead === '02') {
popup.value.close();
return;
}
readLoading.value = true;
readNotice({ noticeId: popup_info.id })
.then((res) => {
popup.value.close();
readLoading.value = false;
data_list.value.forEach((item) => {
if (item.noticeId === popup_info.id) {
item.isRead = res.body.isRead;
return;
}
});
})
.finally(() => {
readLoading.value = false;
});
};
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.isRead = '02';
});
common.hideLoading();
setTimeout(() => {
common.msg('一键读取成功');
}, 10);
})
.catch(() => {
common.hideLoading();
});
};
// 读取消息
const readMessageOpen = (item) => {
console.log('item', item);
popup_info.id = item.noticeId;
popup_info.title = item.noticeTitle;
popup_info.text = item.noticeContent;
popup_info.isRead = item.isRead;
popup.value.open();
};
</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;
}
.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;
}
.time {
font-size: 23rpx;
color: #999999;
line-height: 30rpx;
text-align: right;
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>