This commit is contained in:
2025-10-24 09:34:42 +08:00
commit c0e46d1ae7
282 changed files with 33820 additions and 0 deletions

169
pages/msglog/msglog.vue Normal file
View File

@@ -0,0 +1,169 @@
<template>
<view class="app-custom-root">
<view class="app-container">
<!-- 顶部头部区域 -->
<view class="container-header">
<view class="header-btnLf button-click" @click="changeType(0)" :class="{ active: state.current === 0 }">
全部消息
<!-- <view class="btns-wd"></view> -->
</view>
<view class="header-btnLf button-click" @click="changeType(1)" :class="{ active: state.current === 1 }">
未读消息
<view class="btns-wd" v-if="unreadCount"></view>
</view>
</view>
<!-- 主体内容区域 -->
<view class="container-main">
<swiper class="swiper" :current="state.current" @change="changeSwiperType">
<swiper-item class="swiper-item" v-for="(_, index) in 2" :key="index">
<!-- #ifndef MP-WEIXIN -->
<component :is="components[index]" :ref="(el) => handelComponentsRef(el, index)" />
<!-- #endif -->
<!-- #ifdef MP-WEIXIN -->
<ReadComponent v-show="currentIndex === 0" :ref="(el) => handelComponentsRef(el, index)" />
<UnreadComponent v-show="currentIndex === 1" :ref="(el) => handelComponentsRef(el, index)" />
<!-- #endif -->
</swiper-item>
</swiper>
</view>
<Tabbar :currentpage="3"></Tabbar>
</view>
</view>
</template>
<script setup>
import { reactive, inject, watch, ref, onMounted } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
import Tabbar from '@/components/tabbar/midell-box.vue';
import ReadComponent from './read.vue';
import UnreadComponent from './unread.vue';
const loadedMap = reactive([false, false]);
const swiperRefs = [ref(null), ref(null)];
const components = [ReadComponent, UnreadComponent];
import { storeToRefs } from 'pinia';
import { useReadMsg } from '@/stores/useReadMsg';
const { unreadCount } = storeToRefs(useReadMsg());
onShow(() => {
// 获取消息列表
useReadMsg().fetchMessages();
});
const state = reactive({
current: 0,
all: [{}],
});
onMounted(() => {
handleTabChange(state.current);
});
const handelComponentsRef = (el, index) => {
if (el) {
swiperRefs[index].value = el;
}
};
// 查看消息类型
function changeSwiperType(e) {
const index = e.detail.current;
state.current = index;
handleTabChange(index);
}
function changeType(index) {
state.current = index;
handleTabChange(index);
}
function handleTabChange(index) {
if (!loadedMap[index]) {
swiperRefs[index].value?.loadData();
loadedMap[index] = true;
}
}
// 查看消息类型
function changeSwiperMsgType(e) {
const currented = e.detail.current;
state.current = currented;
}
</script>
<style lang="stylus" scoped>
.app-custom-root {
position: fixed;
z-index: 10;
width: 100vw;
height: calc(100% - var(--window-bottom));
overflow: hidden;
}
.app-container {
display: flex;
flex-direction: column;
height: 100%;
width: 100%;
.container-header {
height: calc(88rpx - 14rpx);
text-align: center;
line-height: calc(88rpx - 14rpx);
font-size: 32rpx;
display: flex;
flex-direction: row;
align-items: center;
padding: 16rpx 44rpx 36rpx 44rpx;
background: url('@/static/icon/msgTopbg.png') 0 0 no-repeat;
background-size: 100% 100%;
.header-title {
color: #000000;
font-weight: bold;
}
.header-btnLf {
font-family: 'PingFangSC-Medium', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', sans-serif;
display: flex;
justify-content: flex-start;
align-items: center;
width: calc(60rpx * 3);
font-weight: 500;
font-size: 40rpx;
color: #696969;
margin-right: 44rpx;
position: relative;
.btns-wd{
position: absolute
top: 2rpx;
right: 2rpx
width: 16rpx;
height: 16rpx;
background: #F73636;
border-radius: 50%;
border: 4rpx solid #EEEEFF;
}
}
.active {
font-weight: 600;
font-size: 40rpx;
color: #000000;
}
}
}
.container-main {
flex: 1;
overflow: hidden;
background-color: #f4f4f4;
}
.main-scroll {
width: 100%
height: 100%;
}
.scrollmain{
padding: 28rpx
}
.swiper
height: 100%;
width: 100%
.list
width: 100%
display: flex;
flex-direction: column;
</style>

149
pages/msglog/read.vue Normal file
View File

@@ -0,0 +1,149 @@
<template>
<scroll-view scroll-y class="main-scroll">
<view class="scrollmain">
<view
class="list-card press-button"
v-for="(item, index) in msgList"
:key="index"
@click="seeDetail(item, index)"
>
<view class="card-img">
<image
class="card-img-flame"
v-if="item.title === '招聘会预约提醒'"
src="/static/icon/msgtype.png"
></image>
<image
class="card-img-flame"
v-if="item.title === '职位上新'"
src="/static/icon/msgtype2.png"
></image>
<image
class="card-img-flame"
v-if="item.title === '系统通知'"
src="/static/icon/msgtype3.png"
></image>
<view class="subscript" v-if="item.notReadCount || !item.isRead">
{{ item.notReadCount || '' }}
</view>
</view>
<view class="card-info">
<view class="info-title">
<text>{{ item.title }}</text>
<view class="card-time">{{ item.date }}</view>
</view>
<view class="info-text line_2">{{ item.subTitle || '消息' }}</view>
</view>
</view>
</view>
</scroll-view>
</template>
<script setup>
import { reactive, inject, ref } from 'vue';
const { $api, navTo, debounce } = inject('globalFunction');
import { storeToRefs } from 'pinia';
import { useReadMsg } from '@/stores/useReadMsg';
const { msgList } = storeToRefs(useReadMsg());
const isLoaded = ref(false);
async function loadData() {
try {
if (isLoaded.value) return;
isLoaded.value = true;
} catch (err) {
isLoaded.value = false; // 重置状态允许重试
throw err;
}
}
function seeDetail(item, index) {
switch (item.title) {
case '职位上新':
useReadMsg().markAsRead(item, index);
navTo('/packageA/pages/newJobPosition/newJobPosition');
break;
case '招聘会预约提醒':
useReadMsg().markAsRead(item, index);
navTo('/packageA/pages/reservation/reservation');
break;
case '系统通知':
navTo('/packageA/pages/systemNotification/systemNotification');
break;
}
}
defineExpose({ loadData });
</script>
<style lang="stylus" scoped>
.main-scroll {
width: 100%
height: 100%;
}
.scrollmain{
padding: 28rpx
}
.read{
}
.list-card
background: #FFFFFF;
border-radius: 17rpx;
display: flex;
justify-content: flex-start;
align-items: center;
padding: 26rpx 36rpx;
margin: 0 0 28rpx 0
.card-img
width: 96rpx;
height: 96rpx;
border-radius: 50%
display: grid;
place-items: center;
margin-right: 30rpx;
position: relative;
.card-img-flame
width: 100%;
height: 100%
.subscript
position: absolute;
right: 0;
top: 0;
min-width: 26rpx;
height: 26rpx;
padding: 0 8rpx; /* 横向内边距控制宽度自适应 */
border-radius: 1000rpx; /* 实现椭圆形/圆角 */
text-align: center;
line-height: 26rpx;
background: #F73636;
font-weight: 600;
font-size: 20rpx;
color: #FFFFFF;
box-sizing: border-box;
.card-info
flex: 1;
display: flex;
align-items: flex-start;
flex-direction: column;
.info-title
font-weight: 500;
font-size: 32rpx;
color: #333333;
display: flex;
justify-content: space-between;
width: 100%
text
font-family: 'PingFangSC-Medium', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', sans-serif;
.card-time
font-weight: 400;
font-size: 28rpx;
color: #AAAAAA;
height: 100%
margin: 4rpx;
.info-text
font-weight: 400;
font-size: 28rpx;
color: #6C7282;
margin-top: 4rpx;
</style>

135
pages/msglog/unread.vue Normal file
View File

@@ -0,0 +1,135 @@
<template>
<scroll-view scroll-y class="main-scroll">
<view class="scrollmain">
<view
class="list-card press-button"
v-for="(item, index) in unreadMsgList"
:key="index"
@click="seeDetail(item)"
>
<view class="card-img">
<image
class="card-img-flame"
v-if="item.title === '招聘会预约提醒'"
src="/static/icon/msgtype.png"
></image>
<image
class="card-img-flame"
v-if="item.title === '职位上新'"
src="/static/icon/msgtype2.png"
></image>
<image
class="card-img-flame"
v-if="item.title === '系统通知'"
src="/static/icon/msgtype3.png"
></image>
<view class="subscript" v-if="item.notReadCount">{{ item.notReadCount }}</view>
</view>
<view class="card-info">
<view class="info-title">
<text>{{ item.title }}</text>
<view class="card-time">{{ item.date }}</view>
</view>
<view class="info-text line_2">{{ item.subTitle || '消息' }}</view>
</view>
</view>
</view>
</scroll-view>
</template>
<script setup>
import { reactive, inject, ref } from 'vue';
const { $api, navTo, debounce } = inject('globalFunction');
import { storeToRefs } from 'pinia';
import { useReadMsg } from '@/stores/useReadMsg';
const { unreadMsgList } = storeToRefs(useReadMsg());
const isLoaded = ref(false);
async function loadData() {
try {
if (isLoaded.value) return;
isLoaded.value = true;
} catch (err) {
isLoaded.value = false; // 重置状态允许重试
throw err;
}
}
function seeDetail(item) {
console.log(item);
}
defineExpose({ loadData });
</script>
<style lang="stylus" scoped>
.main-scroll {
width: 100%
height: 100%;
}
.scrollmain{
padding: 28rpx
}
.read{
}
.list-card
background: #FFFFFF;
border-radius: 17rpx;
display: flex;
justify-content: flex-start;
align-items: center;
padding: 26rpx 36rpx;
margin: 0 0 28rpx 0
.card-img
width: 96rpx;
height: 96rpx;
border-radius: 50%
display: grid;
place-items: center;
margin-right: 30rpx;
position: relative;
.card-img-flame
width: 100%;
height: 100%
.subscript
position: absolute;
right: 0;
top: 0;
min-width: 26rpx;
height: 26rpx;
padding: 0 8rpx; /* 横向内边距控制宽度自适应 */
border-radius: 1000rpx; /* 实现椭圆形/圆角 */
text-align: center;
line-height: 26rpx;
background: #F73636;
font-weight: 600;
font-size: 20rpx;
color: #FFFFFF;
box-sizing: border-box;
.card-info
flex: 1;
display: flex;
align-items: flex-start;
flex-direction: column;
.info-title
font-weight: 500;
font-size: 32rpx;
color: #333333;
display: flex;
justify-content: space-between;
width: 100%
text
font-family: 'PingFangSC-Medium', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', sans-serif;
.card-time
font-weight: 400;
font-size: 28rpx;
color: #AAAAAA;
height: 100%
margin: 4rpx;
.info-text
font-weight: 400;
font-size: 28rpx;
color: #6C7282;
margin-top: 4rpx;
</style>