416 lines
8.9 KiB
Vue
416 lines
8.9 KiB
Vue
<template>
|
||
<view class="main_div max_page">
|
||
<view class="body-title">
|
||
<view class="back_div">
|
||
<view class="back-icon"></view>
|
||
</view>
|
||
<view>消息</view>
|
||
<view class="delete_div">
|
||
<image class="img" src="@/static/images/messageNotification/delete_icon.png" mode="aspectFit"></image>
|
||
</view>
|
||
</view>
|
||
<view class="input-view">
|
||
<uv-input
|
||
shape="circle"
|
||
placeholderStyle="color:#999999;font-size:28rpx"
|
||
placeholder="请输入关键词"
|
||
suffixIcon="search"
|
||
:customStyle="customStyle"
|
||
:suffixIconStyle="suffixIconStyle"
|
||
></uv-input>
|
||
</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"
|
||
>
|
||
<view class="item" v-for="(item, index) in data_list" @click="readMessageOpen(item)">
|
||
<view class="icon">
|
||
<image
|
||
v-if="item.noticeTyp == '01'"
|
||
class="img_100"
|
||
src="@/static/images/messageNotification/type_01.png"
|
||
mode="widthFix"
|
||
></image>
|
||
<image
|
||
v-if="item.noticeTyp == '02'"
|
||
class="img_100"
|
||
src="@/static/images/messageNotification/type_02.png"
|
||
mode="widthFix"
|
||
></image>
|
||
<image
|
||
v-if="item.noticeTyp == '03'"
|
||
class="img_100"
|
||
src="@/static/images/messageNotification/type_03.png"
|
||
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="num_div"></view> -->
|
||
<view class="read_div" v-if="item.isRead"></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>
|
||
<uni-popup ref="popup" type="bottom">
|
||
<view class="popup">
|
||
<view class="message_popup_div">
|
||
<view class="title">
|
||
{{ popup_info.title }}
|
||
</view>
|
||
<view class="text">消正息内容正文,消息内容正文</view>
|
||
<view class="button_div" @click.stop="readMessage">
|
||
<uv-button class="button">我知道了</uv-button>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</uni-popup>
|
||
</view>
|
||
</template>
|
||
|
||
<script setup>
|
||
import { ref, reactive, nextTick, onMounted } from 'vue';
|
||
import { onLoad } from '@dcloudio/uni-app';
|
||
import { queryTraPersonalMessageNoticePaging, readNotice } from '@/api/messageNotification.js';
|
||
|
||
const customStyle = {
|
||
backgroundColor: '#ffffff',
|
||
paddingLeft: '40rpx',
|
||
height: '78rpx',
|
||
paddingTop: '5px',
|
||
paddingBottom: '5px',
|
||
border: 'none'
|
||
};
|
||
const suffixIconStyle = {
|
||
color: '#2c8ef2',
|
||
fontSize: '50rpx'
|
||
};
|
||
|
||
const status = ref('loadmore'); // loadmore - 加载前,loading - 加载中,nomore - 没有数据
|
||
const limit = 15;
|
||
const total = ref(-1);
|
||
const page = ref(0);
|
||
const data_list = reactive([]);
|
||
const triggered = ref(false);
|
||
const _freshing = ref(false);
|
||
const offset = ref(0);
|
||
const scrollRef = ref(null);
|
||
const popup_info = reactive({
|
||
id: '',
|
||
title: '',
|
||
text: ''
|
||
});
|
||
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++;
|
||
}
|
||
console.log(status.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 = () => {
|
||
readNotice({ noticeId: popup_info.id }).then(() => {
|
||
// todo
|
||
popup.value.close();
|
||
});
|
||
};
|
||
// 读取消息
|
||
const readMessageOpen = (item) => {
|
||
popup_info.id = item.noticeId;
|
||
popup_info.title = item.noticeTitle;
|
||
popup_info.text = item.noticeContent;
|
||
popup.value.open();
|
||
};
|
||
const scrolltolower = (item) => {
|
||
getData();
|
||
};
|
||
onMounted(() => {
|
||
getData();
|
||
});
|
||
</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: calc(100vh - 70rpx - var(--status-bar-height) - 78rpx - 40rpx);
|
||
position: relative;
|
||
overflow: hidden;
|
||
border-radius: 20rpx 20rpx 0 0;
|
||
position: relative;
|
||
background-color: #fff;
|
||
box-shadow: 0 0 6rpx #b3d6ff;
|
||
|
||
.item {
|
||
height: 154rpx;
|
||
padding: 38rpx 0 38rpx 0;
|
||
margin: 0 38rpx;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
border-top: 2rpx solid #efefef;
|
||
.icon {
|
||
width: 78rpx;
|
||
height: 78rpx;
|
||
}
|
||
|
||
.right {
|
||
margin-left: 16rpx;
|
||
flex: 1;
|
||
|
||
.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;
|
||
}
|
||
|
||
.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;
|
||
}
|
||
|
||
.body-title {
|
||
width: 100%;
|
||
height: 70rpx;
|
||
font-size: 33rpx;
|
||
padding-top: 10rpx;
|
||
font-weight: 500;
|
||
color: #000;
|
||
position: relative;
|
||
text-align: center;
|
||
|
||
.delete_div {
|
||
position: absolute;
|
||
right: 20rpx;
|
||
top: 17rpx;
|
||
width: 50rpx;
|
||
height: 50rpx;
|
||
|
||
.img {
|
||
width: 34rpx;
|
||
height: 34rpx;
|
||
}
|
||
}
|
||
|
||
.back_div {
|
||
position: absolute;
|
||
left: 26rpx;
|
||
height: 34rpx;
|
||
top: 17rpx;
|
||
|
||
.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>
|