修改课程记录bug

This commit is contained in:
田岩
2025-09-16 14:33:42 +08:00
parent 5d1ba8a22e
commit 7f3b3829a2
10 changed files with 81 additions and 128 deletions
+41 -112
View File
@@ -1,35 +1,26 @@
<template>
<view class="main_div max_page">
<view class="body-title">
<view class="back_div" @click="common.navigateBack()">
<view class="back-icon"></view>
<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>
<view>消息</view>
<view class="delete_div" @click="oneClickReadMessage">
<image class="img" src="@/static/images/messageNotification/delete_icon.png" mode="aspectFit"></image>
</view>
</view>
<scroll-view
ref="scrollRef"
:scroll-y="true"
class="scroll-Y"
:refresher-enabled="false"
:show-scrollbar="false"
@scrolltolower="scrolltolower"
@refresherrefresh="onRefresh"
@refresherrestore="triggered = 'restore'"
:refresher-triggered="triggered"
refresher-default-style="none"
>
</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>
<!-- <image
v-if="item.noticeTyp == '02'"
class="img_100"
src="@/static/images/messageNotification/type_02.png"
mode="widthFix"
></image> -->
</view>
<view class="right">
<view class="top">
@@ -44,16 +35,20 @@
<view class="note ellipsis-text">
{{ item.noticeContent }}
</view>
<!-- <view class="num_div"></view> -->
<view class="read_div" v-if="item?.isRead === '01'"></view>
</view>
</view>
</view>
<list-no-data v-if="total === 0 && status == 'nomore'">暂无数据</list-no-data>
<uv-load-more v-if="total !== 0" :status="status" loadmore-text="轻轻上拉加载" :height="30"></uv-load-more>
</scroll-view>
</view>
<uni-popup ref="popup" type="bottom">
<view class="popup">
<view
class="popup"
@touchmove.stop.prevent="
() => {
return false;
}
"
>
<view class="message_popup_div">
<view class="title">
{{ popup_info.title }}
@@ -65,11 +60,11 @@
</view>
</view>
</uni-popup>
</view>
</z-paging>
</template>
<script setup>
import { ref, reactive, nextTick, onMounted } from 'vue';
import { ref, reactive } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import { queryTraPersonalMessageNoticePaging, readNotice, oneTimeRead } from '@/api/messageNotification.js';
import common from '../../common/common';
@@ -78,24 +73,18 @@
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 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
};
const status = ref('loadmore'); // loadmore - 加载前,loading - 加载中,nomore - 没有数据
const limit = 20;
const total = ref(-1);
const page = ref(0);
const data_list = reactive([]);
const triggered = ref(false);
const _freshing = ref(false);
const readLoading = ref(false);
const offset = ref(0);
const scrollRef = ref(null);
const popup_info = reactive({
id: '',
title: '',
@@ -104,55 +93,6 @@
});
const popup = ref(null);
// 下拉过程中触发
const onPulling = (e) => {
page.value = 1;
total.value = -1;
page.data_list.length = 0;
getData();
};
// 刷新处理函数
const onRefresh = () => {
if (_freshing.value) return;
_freshing.value = true;
setTimeout(() => {
triggered.value = false;
_freshing.value = false;
}, 1000);
};
const getData = (from = '') => {
if (from === 'first') {
if (total.value !== -1) {
return;
}
status.value = 'loading';
total.value = -1;
page.value = 1;
data_list.length = 0;
} else {
if (status.value !== 'loadmore' && status.value !== '') return;
status.value = 'loading';
page.value++;
}
queryTraPersonalMessageNoticePaging({
page: page.value,
limit: limit
})
.then((res) => {
total.value = res.total;
data_list.push(...res.body);
})
.finally(() => {
if (data_list.length >= total.value) {
status.value = 'nomore';
} else {
status.value = 'loadmore';
}
});
};
const readMessage = () => {
if (popup_info.isRead === '02') {
popup.value.close();
@@ -163,7 +103,7 @@
.then((res) => {
popup.value.close();
readLoading.value = false;
data_list.forEach((item) => {
data_list.value.forEach((item) => {
if (item.noticeId === popup_info.id) {
item.isRead = res.body.isRead;
return;
@@ -174,8 +114,9 @@
readLoading.value = false;
});
};
const oneClickReadMessage = () => {
const state = data_list.every((res) => res.isRead === '02');
const state = data_list.value.every((res) => res.isRead === '02');
if (state) {
common.msg('暂无未读消息');
return;
@@ -183,7 +124,7 @@
common.loading();
oneTimeRead()
.then((res) => {
data_list.forEach((item) => {
data_list.value.forEach((item) => {
item.isRead = '02';
});
common.hideLoading();
@@ -205,12 +146,6 @@
popup_info.isRead = item.isRead;
popup.value.open();
};
const scrolltolower = (item) => {
getData();
};
onMounted(() => {
getData();
});
</script>
<style scoped lang="scss">
@@ -266,17 +201,11 @@
}
}
}
.scroll-Y {
// 70rpx 改成100 78没了
height: calc(100vh - 100rpx - var(--status-bar-height) - 40rpx);
height: 100%;
position: relative;
overflow: hidden;
border-radius: 20rpx 20rpx 0 0;
position: relative;
background-color: #fff;
box-shadow: 0 -12rpx 12rpx #c3dbff;
.item {
height: 154rpx;
padding: 38rpx 0 38rpx 0;
@@ -284,7 +213,7 @@
display: flex;
justify-content: space-between;
align-items: center;
border-top: 2rpx solid #efefef;
border-bottom: 2rpx solid #efefef;
.icon {
width: 78rpx;
height: 78rpx;
@@ -370,12 +299,12 @@
background-repeat: no-repeat; /* 防止渐变重复平铺 */
padding-top: var(--status-bar-height);
overflow: hidden;
margin-bottom: -20rpx;
}
.body-title {
width: 100%;
height: 100rpx;
// 80改成100
height: 120rpx;
font-size: 33rpx;
padding-top: 10rpx;
font-weight: 500;