2025-04-22 10:22:33 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<view class="message-page">
|
|
|
|
|
|
<BasicListLayout @register="register">
|
|
|
|
|
|
<template #top>
|
|
|
|
|
|
<view class="tabs-container">
|
|
|
|
|
|
<view
|
2025-06-08 19:07:15 +08:00
|
|
|
|
class="tab-item"
|
|
|
|
|
|
:class="{ active: currentTab === 1 }"
|
|
|
|
|
|
@click="changeTab(1)"
|
2025-04-22 10:22:33 +08:00
|
|
|
|
>
|
|
|
|
|
|
待办
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view
|
2025-06-08 19:07:15 +08:00
|
|
|
|
class="tab-item"
|
|
|
|
|
|
:class="{ active: currentTab === 0 }"
|
|
|
|
|
|
@click="changeTab(0)"
|
2025-04-22 10:22:33 +08:00
|
|
|
|
>
|
|
|
|
|
|
已办
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template #default="{ data }">
|
|
|
|
|
|
<view class="white-bg-color r-md p-15 mb-15 flex-row" @click="goToDetail(data)">
|
|
|
|
|
|
<view class="card-left">
|
2025-06-08 19:07:15 +08:00
|
|
|
|
<view class="card-title">{{ data.rwmc }}</view>
|
|
|
|
|
|
<view class="card-desc" v-html="data.rwms"></view>
|
2025-04-22 10:22:33 +08:00
|
|
|
|
<view class="card-meta">
|
2025-06-08 19:07:15 +08:00
|
|
|
|
<text>{{ data.fbsj }}</text>
|
2025-04-22 10:22:33 +08:00
|
|
|
|
<text>{{ data.timeAgo }}</text>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view class="card-right">
|
|
|
|
|
|
<view class="tag" :class="data.tagType">{{ data.tagText }}</view>
|
|
|
|
|
|
<view class="stats">
|
|
|
|
|
|
<!-- TODO: 替换为实际图标 -->
|
|
|
|
|
|
<text class="icon">❤️ {{ data.likes }}</text>
|
|
|
|
|
|
<text class="icon">💬 {{ data.comments }}</text>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</BasicListLayout>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
2025-06-08 19:07:15 +08:00
|
|
|
|
import {ref, reactive, watch, onMounted} from "vue";
|
2025-04-22 10:22:33 +08:00
|
|
|
|
|
2025-06-08 19:07:15 +08:00
|
|
|
|
import {useLayout} from "@/components/BasicListLayout/hooks/useLayout";
|
|
|
|
|
|
import {jsdFindPageTaskApi} from "@/api/base/server";
|
2025-04-22 10:22:33 +08:00
|
|
|
|
|
|
|
|
|
|
// 模拟待办列表数据
|
|
|
|
|
|
const mockTodoList = [
|
|
|
|
|
|
{
|
|
|
|
|
|
title: "教务通知 (待办)",
|
|
|
|
|
|
desc: "学校召开期初教学准备会议暨首次教学工作例会",
|
|
|
|
|
|
date: "2025-02-17",
|
|
|
|
|
|
timeAgo: "8 mins 前",
|
|
|
|
|
|
tagText: "通知",
|
|
|
|
|
|
tagType: "notice",
|
|
|
|
|
|
likes: 6,
|
|
|
|
|
|
comments: 12,
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: "教学日志 (待办)",
|
|
|
|
|
|
desc: "请于2025年3月15日前上传教学日志",
|
|
|
|
|
|
date: "2025-02-17",
|
|
|
|
|
|
timeAgo: "8 mins 前",
|
|
|
|
|
|
tagText: "任务",
|
|
|
|
|
|
tagType: "task",
|
|
|
|
|
|
likes: 6,
|
|
|
|
|
|
comments: 12,
|
|
|
|
|
|
},
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
const testList = async (param: any): Promise<Requests<any>> => {
|
|
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
|
|
setTimeout(() => {
|
2025-06-08 19:07:15 +08:00
|
|
|
|
resolve({message: "测试", resultCode: 1, rows: mockTodoList});
|
2025-04-22 10:22:33 +08:00
|
|
|
|
}, 1000);
|
|
|
|
|
|
});
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-06-08 19:07:15 +08:00
|
|
|
|
const [register, {reload, setParam}] = useLayout({
|
|
|
|
|
|
api: jsdFindPageTaskApi,
|
|
|
|
|
|
componentProps: {
|
|
|
|
|
|
auto: false
|
|
|
|
|
|
},
|
2025-04-22 10:22:33 +08:00
|
|
|
|
});
|
|
|
|
|
|
|
2025-06-08 19:07:15 +08:00
|
|
|
|
const currentTab = ref(1); // 0: 待办, 1: 已办
|
2025-04-22 10:22:33 +08:00
|
|
|
|
|
|
|
|
|
|
const fetchListData = async (tabIndex: number) => {
|
|
|
|
|
|
setParam({
|
|
|
|
|
|
type: tabIndex,
|
2025-06-08 19:07:15 +08:00
|
|
|
|
mobile: getUser.mobile
|
2025-04-22 10:22:33 +08:00
|
|
|
|
});
|
|
|
|
|
|
reload();
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const changeTab = (tabIndex: number) => {
|
|
|
|
|
|
if (currentTab.value !== tabIndex) {
|
|
|
|
|
|
currentTab.value = tabIndex;
|
|
|
|
|
|
fetchListData(tabIndex);
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
2025-06-08 19:07:15 +08:00
|
|
|
|
import {useUserStore} from "@/store/modules/user";
|
2025-04-22 10:22:33 +08:00
|
|
|
|
|
2025-06-08 19:07:15 +08:00
|
|
|
|
const {getUser} = useUserStore()
|
2025-04-22 10:22:33 +08:00
|
|
|
|
// 组件加载完成后,获取初始数据 (待办)
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
|
fetchListData(currentTab.value);
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const goToDetail = (data: any) => {
|
|
|
|
|
|
// Ensure data and data.id exist before navigating
|
|
|
|
|
|
if (data && data.id) {
|
|
|
|
|
|
// Encode the ID in case it contains special characters
|
|
|
|
|
|
const encodedId = encodeURIComponent(data.id);
|
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
|
url: `/pages/base/message/detail?id=${encodedId}`
|
|
|
|
|
|
});
|
2025-06-08 19:07:15 +08:00
|
|
|
|
} else if (data && data.rwmc) {
|
2025-04-22 10:22:33 +08:00
|
|
|
|
// Fallback: use title if id is missing (less reliable)
|
2025-06-08 19:07:15 +08:00
|
|
|
|
console.warn("Navigating using title as ID fallback for:", data);
|
|
|
|
|
|
const encodedTitle = encodeURIComponent(data.title);
|
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
|
url: `/pages/base/message/detail?id=${encodedTitle}`
|
|
|
|
|
|
});
|
2025-04-22 10:22:33 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
console.error("Cannot navigate to detail: Missing identifier (id or title) in data:", data);
|
2025-06-08 19:07:15 +08:00
|
|
|
|
uni.showToast({title: "无法打开详情", icon: "none"});
|
2025-04-22 10:22:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
|
.message-page {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
height: 100vh; /* 或 calc(100vh - var(--window-top)) 如果需要精确计算 */
|
|
|
|
|
|
background-color: #f4f5f7;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 自定义导航栏
|
|
|
|
|
|
.custom-navbar {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center; // 标题居中
|
|
|
|
|
|
height: 44px; // 标准导航栏高度
|
|
|
|
|
|
padding: 0 15px;
|
|
|
|
|
|
padding-top: var(--status-bar-height); // 适配状态栏
|
|
|
|
|
|
background-color: #ffffff;
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
border-bottom: 1px solid #eee;
|
|
|
|
|
|
|
|
|
|
|
|
.navbar-title {
|
|
|
|
|
|
font-size: 17px;
|
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
color: #333;
|
|
|
|
|
|
}
|
2025-06-08 19:07:15 +08:00
|
|
|
|
|
2025-04-22 10:22:33 +08:00
|
|
|
|
.navbar-actions {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
right: 15px;
|
|
|
|
|
|
top: var(--status-bar-height);
|
|
|
|
|
|
height: 44px;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
font-size: 18px; // ... 图标大小
|
|
|
|
|
|
color: #666;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Tab 切换
|
|
|
|
|
|
.tabs-container {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
background-color: #ffffff;
|
|
|
|
|
|
height: 45px;
|
|
|
|
|
|
border-bottom: 1px solid #eee;
|
|
|
|
|
|
flex-shrink: 0; // 防止被压缩
|
|
|
|
|
|
|
|
|
|
|
|
.tab-item {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
font-size: 15px;
|
|
|
|
|
|
color: #666;
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
|
|
|
|
|
|
&.active {
|
|
|
|
|
|
color: #447ade;
|
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
|
|
|
|
|
|
&::after {
|
|
|
|
|
|
content: "";
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
bottom: 0;
|
|
|
|
|
|
left: 50%;
|
|
|
|
|
|
transform: translateX(-50%);
|
|
|
|
|
|
width: 30px;
|
|
|
|
|
|
height: 3px;
|
|
|
|
|
|
background-color: #447ade;
|
|
|
|
|
|
border-radius: 2px;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 内容滚动区域
|
|
|
|
|
|
.content-scroll {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
overflow-y: auto;
|
|
|
|
|
|
padding: 15px;
|
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.loading-placeholder,
|
|
|
|
|
|
.empty-placeholder {
|
|
|
|
|
|
padding: 40px 0;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
color: #999;
|
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 消息卡片
|
|
|
|
|
|
.card-left {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
margin-right: 15px;
|
|
|
|
|
|
// 防止内容溢出,特别是标题和描述
|
|
|
|
|
|
min-width: 0;
|
|
|
|
|
|
|
|
|
|
|
|
.card-title {
|
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
color: #333;
|
|
|
|
|
|
margin-bottom: 5px;
|
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
|
}
|
2025-06-08 19:07:15 +08:00
|
|
|
|
|
2025-04-22 10:22:33 +08:00
|
|
|
|
.card-desc {
|
|
|
|
|
|
font-size: 13px;
|
|
|
|
|
|
color: #666;
|
|
|
|
|
|
margin-bottom: 10px;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
|
display: -webkit-box;
|
|
|
|
|
|
-webkit-line-clamp: 2;
|
|
|
|
|
|
-webkit-box-orient: vertical;
|
|
|
|
|
|
}
|
2025-06-08 19:07:15 +08:00
|
|
|
|
|
2025-04-22 10:22:33 +08:00
|
|
|
|
.card-meta {
|
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
color: #999;
|
2025-06-08 19:07:15 +08:00
|
|
|
|
|
2025-04-22 10:22:33 +08:00
|
|
|
|
text {
|
|
|
|
|
|
margin-right: 10px;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.card-right {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
flex-shrink: 0; // 防止被压缩
|
|
|
|
|
|
|
|
|
|
|
|
.tag {
|
|
|
|
|
|
padding: 5px 10px;
|
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
|
font-size: 13px;
|
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
color: #ffffff;
|
|
|
|
|
|
margin-bottom: 10px;
|
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
|
|
|
|
|
|
|
&.notice {
|
|
|
|
|
|
background-color: #447ade;
|
|
|
|
|
|
}
|
2025-06-08 19:07:15 +08:00
|
|
|
|
|
2025-04-22 10:22:33 +08:00
|
|
|
|
&.task {
|
|
|
|
|
|
background-color: #19be6b;
|
|
|
|
|
|
}
|
2025-06-08 19:07:15 +08:00
|
|
|
|
|
2025-04-22 10:22:33 +08:00
|
|
|
|
// 添加新的标签样式示例
|
|
|
|
|
|
&.approval {
|
|
|
|
|
|
background-color: #ff9f0a; // 橙色
|
|
|
|
|
|
}
|
2025-06-08 19:07:15 +08:00
|
|
|
|
|
2025-04-22 10:22:33 +08:00
|
|
|
|
&.submit {
|
|
|
|
|
|
background-color: #8e8e93; // 灰色
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-06-08 19:07:15 +08:00
|
|
|
|
|
2025-04-22 10:22:33 +08:00
|
|
|
|
.stats {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
color: #999;
|
2025-06-08 19:07:15 +08:00
|
|
|
|
|
2025-04-22 10:22:33 +08:00
|
|
|
|
.icon {
|
|
|
|
|
|
margin-left: 8px;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|