格式化首页,调整流程参数非必传

This commit is contained in:
ywyonui 2025-09-15 23:28:07 +08:00
parent 8ecd234353
commit b46e29c5e6
2 changed files with 74 additions and 84 deletions

View File

@ -48,9 +48,9 @@ import { getByYwIdAndYwTypeApi } from "@/api/base/lcglSpApi";
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{
ywId: string, ywId: string,
ywType: string, ywType: string,
showSqr: boolean, showSqr?: boolean,
showSpr: boolean, showSpr?: boolean,
showCsr: boolean, showCsr?: boolean,
}>(), { }>(), {
ywId: '', ywId: '',
ywType: '', ywType: '',

View File

@ -3,14 +3,14 @@
<view class="content-container"> <view class="content-container">
<!-- 用户信息卡片 --> <!-- 用户信息卡片 -->
<view class="user-info-card" v-if="curXs"> <view class="user-info-card" v-if="curXs">
<view class="banner-content"> <view class="banner-content">
<image src="/static/base/home/2211.png" class="banner-img"></image> <image src="/static/base/home/2211.png" class="banner-img"></image>
<view class="banner-overlay"> <view class="banner-overlay">
</view> </view>
</view> </view>
<!-- 学生信息 --> <!-- 学生信息 -->
<XsPicker :is-bar="false" @change="switchXs" /> <XsPicker :is-bar="false" @change="switchXs" />
<view class="glxs-btn" @click="goToGlxs"> <view class="glxs-btn" @click="goToGlxs">
<u-icon name="plus" size="12" color="#fff"></u-icon> <u-icon name="plus" size="12" color="#fff"></u-icon>
<text>新增学生</text> <text>新增学生</text>
@ -24,13 +24,8 @@
<view class="title-line"></view> <view class="title-line"></view>
</view> </view>
<view class="grid-menu"> <view class="grid-menu">
<view <view v-for="(item, index) in menuItems" :key="index" v-show="hasPermissionDirect(item.permissionKey)"
v-for="(item, index) in menuItems" class="grid-item" @click="handleMenuClick(item)">
:key="index"
v-show="hasPermissionDirect(item.permissionKey)"
class="grid-item"
@click="handleMenuClick(item)"
>
<view class="grid-icon-container"> <view class="grid-icon-container">
<view class="icon-background"></view> <view class="icon-background"></view>
<image :src="item.icon" class="grid-icon"></image> <image :src="item.icon" class="grid-icon"></image>
@ -48,12 +43,7 @@
</view> </view>
<view class="notice-list"> <view class="notice-list">
<view <view v-for="(notice, index) in announcements" :key="index" class="notice-item" @click="goToDetail(notice)">
v-for="(notice, index) in announcements"
:key="index"
class="notice-item"
@click="goToDetail(notice)"
>
<view class="notice-icon"> <view class="notice-icon">
<u-icon name="bell" size="20" color="#4A90E2"></u-icon> <u-icon name="bell" size="20" color="#4A90E2"></u-icon>
</view> </view>
@ -100,7 +90,7 @@ const getCurrentChangeTime = () => {
try { try {
const userDataStr = uni.getStorageSync('app-user'); const userDataStr = uni.getStorageSync('app-user');
if (!userDataStr) return null; if (!userDataStr) return null;
const userData = typeof userDataStr === 'string' ? JSON.parse(userDataStr) : userDataStr; const userData = typeof userDataStr === 'string' ? JSON.parse(userDataStr) : userDataStr;
return userData?.changeTime || null; return userData?.changeTime || null;
} catch (error) { } catch (error) {
@ -121,7 +111,7 @@ const hasPermissionDirect = (permissionKey: string) => {
const userStore = useUserStore(); const userStore = useUserStore();
const permissions = userStore.getAuth; const permissions = userStore.getAuth;
if (!permissions || permissions.length === 0) return false; if (!permissions || permissions.length === 0) return false;
const uniquePermissions = [...new Set(permissions)]; const uniquePermissions = [...new Set(permissions)];
return uniquePermissions.includes(permissionKey); return uniquePermissions.includes(permissionKey);
}; };
@ -130,7 +120,7 @@ const hasPermissionDirect = (permissionKey: string) => {
const checkAndRefreshStudentInfo = async () => { const checkAndRefreshStudentInfo = async () => {
const lastRefreshTime = getLastRefreshTime; const lastRefreshTime = getLastRefreshTime;
const currentTime = Date.now(); const currentTime = Date.now();
if (!lastRefreshTime || (currentTime - lastRefreshTime) > REFRESH_INTERVAL) { if (!lastRefreshTime || (currentTime - lastRefreshTime) > REFRESH_INTERVAL) {
await refreshStudentInfo(); await refreshStudentInfo();
setLastRefreshTime(currentTime); setLastRefreshTime(currentTime);
@ -145,7 +135,7 @@ const refreshStudentInfo = async () => {
// //
if (response.result.xsList && response.result.xsList.length > 0) { if (response.result.xsList && response.result.xsList.length > 0) {
updateStudentList(response.result.xsList); updateStudentList(response.result.xsList);
// //
const currentXsId = curXs.value?.id; const currentXsId = curXs.value?.id;
if (currentXsId) { if (currentXsId) {
@ -182,10 +172,10 @@ const menuItems = ref([
permissionKey: "school-cjcx", // permissionKey: "school-cjcx", //
}, },
{ {
title: "在线请假", title: "在线请假",
icon: "/static/base/home/draft-line.png", icon: "/static/base/home/draft-line.png",
path: "/pages/base/qj/index", path: "/pages/base/qj/index",
permissionKey: "school-zxqj", // 线 permissionKey: "school-zxqj", // 线
}, },
// TODO: // TODO:
// { // {
@ -238,7 +228,7 @@ const menuItems = ref([
title: "就餐报名", title: "就餐报名",
icon: "/static/base/home/contacts-book-3-line.png", icon: "/static/base/home/contacts-book-3-line.png",
path: "/pages/base/gzs/index", path: "/pages/base/gzs/index",
permissionKey: "school-jcjf", permissionKey: "school-jcjf",
action: 'jf', action: 'jf',
lxId: 'JC', lxId: 'JC',
}, },
@ -267,15 +257,15 @@ const announcements = ref<any>([])
let curXs = computed(() => getCurXs) let curXs = computed(() => getCurXs)
let pageParams = ref({ let pageParams = ref({
page: 1, page: 1,
rows: 10, rows: 10,
appCode: getAppCode appCode: getAppCode
}) })
const goToGlxs = () => { const goToGlxs = () => {
uni.navigateTo({ uni.navigateTo({
url: "/pages/base/home/glxs", url: "/pages/base/home/glxs",
}); });
} }
// //
@ -299,13 +289,13 @@ function switchXs(xs: any) {
// //
function goToDetail(notice: any) { function goToDetail(notice: any) {
setData(notice) setData(notice)
uni.navigateTo({ uni.navigateTo({
url: '/pages/base/home/detail' url: '/pages/base/home/detail'
}) })
} }
const getArticleList = async () => { const getArticleList = async () => {
if (curXs.value && curXs.value.njmcId) { if (curXs.value && curXs.value.njmcId) {
const params = { const params = {
page: pageParams.value.page, page: pageParams.value.page,
@ -316,13 +306,13 @@ const getArticleList = async () => {
fbNjmcId: curXs.value.njmcId, // fbNjmcId: curXs.value.njmcId, //
releaseFlag: 'A' // releaseFlag: 'A' //
}; };
getNoticeListApi(params).then(res => { getNoticeListApi(params).then(res => {
announcements.value = res.rows; announcements.value = res.rows;
}) })
.catch((error) => { .catch((error) => {
// //
}); });
} }
}; };
@ -339,10 +329,10 @@ onMounted(async () => {
} }
}, 100); }, 100);
} }
// //
await checkAndRefreshStudentInfo(); await checkAndRefreshStudentInfo();
// //
const userStore = useUserStore(); const userStore = useUserStore();
const changeTime = userStore.getChangeTime; const changeTime = userStore.getChangeTime;
@ -350,11 +340,11 @@ onMounted(async () => {
// changeTime // changeTime
const { PermissionCacheManager } = await import('@/utils/permission'); const { PermissionCacheManager } = await import('@/utils/permission');
const cacheInfo = PermissionCacheManager.getCacheInfo(); const cacheInfo = PermissionCacheManager.getCacheInfo();
if (cacheInfo.hasCache && cacheInfo.changeTime) { if (cacheInfo.hasCache && cacheInfo.changeTime) {
const serverTime = new Date(changeTime).getTime(); const serverTime = new Date(changeTime).getTime();
const cacheTime = new Date(cacheInfo.changeTime).getTime(); const cacheTime = new Date(cacheInfo.changeTime).getTime();
if (serverTime > cacheTime) { if (serverTime > cacheTime) {
// //
const { refreshPermissionCache } = await import('@/utils/permission'); const { refreshPermissionCache } = await import('@/utils/permission');
@ -365,7 +355,7 @@ onMounted(async () => {
} }
} }
} }
// //
await checkSubscribeStatus(); await checkSubscribeStatus();
}); });
@ -374,7 +364,7 @@ onMounted(async () => {
const checkSubscribeStatus = async () => { const checkSubscribeStatus = async () => {
const userStore = useUserStore(); const userStore = useUserStore();
const userInfo = userStore.getUser; const userInfo = userStore.getUser;
if (userInfo && !userInfo.subscribed) { if (userInfo && !userInfo.subscribed) {
// //
setTimeout(() => { setTimeout(() => {
@ -441,18 +431,18 @@ watch(curXs, (newXs, oldXs) => {
overflow: hidden; overflow: hidden;
.banner-content { .banner-content {
position: absolute; position: absolute;
top: 0; top: 0;
bottom: 0; bottom: 0;
left: 0; left: 0;
right: 0; right: 0;
.banner-img { .banner-img {
width: 100%; width: 100%;
height: 100%; height: 100%;
object-fit: cover; object-fit: cover;
} }
.banner-overlay { .banner-overlay {
position: absolute; position: absolute;
top: 0; top: 0;
@ -463,7 +453,7 @@ watch(curXs, (newXs, oldXs) => {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
} }
@ -473,7 +463,7 @@ watch(curXs, (newXs, oldXs) => {
bottom: 0; bottom: 0;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
gap: 4px; gap: 4px;
padding: 8px 16px; padding: 8px 16px;
background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%); background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
@ -487,7 +477,7 @@ watch(curXs, (newXs, oldXs) => {
flex-shrink: 0; flex-shrink: 0;
min-width: 60px; min-width: 60px;
height: 16px; height: 16px;
text { text {
line-height: 1; line-height: 1;
} }
@ -497,20 +487,20 @@ watch(curXs, (newXs, oldXs) => {
/* 功能菜单 */ /* 功能菜单 */
.menu-section { .menu-section {
margin-bottom: 25px; margin-bottom: 25px;
.section-title { .section-title {
display: flex; display: flex;
align-items: center; align-items: center;
margin-bottom: 20px; margin-bottom: 20px;
padding: 0 5px; padding: 0 5px;
.title-text { .title-text {
font-size: 18px; font-size: 18px;
font-weight: 600; font-weight: 600;
color: #303133; color: #303133;
position: relative; position: relative;
padding-left: 12px; padding-left: 12px;
&::before { &::before {
content: ''; content: '';
position: absolute; position: absolute;
@ -523,7 +513,7 @@ watch(curXs, (newXs, oldXs) => {
border-radius: 2px; border-radius: 2px;
} }
} }
.title-line { .title-line {
flex: 1; flex: 1;
height: 1px; height: 1px;
@ -531,7 +521,7 @@ watch(curXs, (newXs, oldXs) => {
margin-left: 20px; margin-left: 20px;
} }
} }
.grid-menu { .grid-menu {
display: grid; display: grid;
grid-template-columns: repeat(3, 1fr); grid-template-columns: repeat(3, 1fr);
@ -540,7 +530,7 @@ watch(curXs, (newXs, oldXs) => {
border-radius: 16px; border-radius: 16px;
box-shadow: 0 8px 32px rgba(74, 144, 226, 0.2); box-shadow: 0 8px 32px rgba(74, 144, 226, 0.2);
border: 1px solid rgba(255, 255, 255, 0.8); border: 1px solid rgba(255, 255, 255, 0.8);
.grid-item { .grid-item {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@ -550,12 +540,12 @@ watch(curXs, (newXs, oldXs) => {
transition: all 0.3s ease; transition: all 0.3s ease;
border-radius: 12px; border-radius: 12px;
position: relative; position: relative;
&:active { &:active {
transform: scale(0.95); transform: scale(0.95);
background-color: rgba(74, 144, 226, 0.05); background-color: rgba(74, 144, 226, 0.05);
} }
.grid-icon-container { .grid-icon-container {
position: relative; position: relative;
width: 48px; width: 48px;
@ -564,7 +554,7 @@ watch(curXs, (newXs, oldXs) => {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
.icon-background { .icon-background {
position: absolute; position: absolute;
top: 0; top: 0;
@ -575,7 +565,7 @@ watch(curXs, (newXs, oldXs) => {
background: linear-gradient(135deg, #f0f4ff 0%, #e6f0ff 100%); background: linear-gradient(135deg, #f0f4ff 0%, #e6f0ff 100%);
box-shadow: 0 2px 8px rgba(74, 144, 226, 0.15); box-shadow: 0 2px 8px rgba(74, 144, 226, 0.15);
} }
.grid-icon { .grid-icon {
position: relative; position: relative;
z-index: 1; z-index: 1;
@ -584,7 +574,7 @@ watch(curXs, (newXs, oldXs) => {
object-fit: contain; object-fit: contain;
} }
} }
.grid-text { .grid-text {
font-size: 13px; font-size: 13px;
font-weight: 500; font-weight: 500;
@ -603,14 +593,14 @@ watch(curXs, (newXs, oldXs) => {
align-items: center; align-items: center;
margin-bottom: 20px; margin-bottom: 20px;
padding: 0 5px; padding: 0 5px;
.title-text { .title-text {
font-size: 18px; font-size: 18px;
font-weight: 600; font-weight: 600;
color: #303133; color: #303133;
position: relative; position: relative;
padding-left: 12px; padding-left: 12px;
&::before { &::before {
content: ''; content: '';
position: absolute; position: absolute;
@ -623,7 +613,7 @@ watch(curXs, (newXs, oldXs) => {
border-radius: 2px; border-radius: 2px;
} }
} }
.title-line { .title-line {
flex: 1; flex: 1;
height: 1px; height: 1px;
@ -631,7 +621,7 @@ watch(curXs, (newXs, oldXs) => {
margin-left: 20px; margin-left: 20px;
} }
} }
.notice-list { .notice-list {
.notice-item { .notice-item {
display: flex; display: flex;
@ -643,12 +633,12 @@ watch(curXs, (newXs, oldXs) => {
box-shadow: 0 8px 24px rgba(74, 144, 226, 0.18); box-shadow: 0 8px 24px rgba(74, 144, 226, 0.18);
border: 1px solid rgba(255, 255, 255, 0.8); border: 1px solid rgba(255, 255, 255, 0.8);
transition: all 0.3s ease; transition: all 0.3s ease;
&:active { &:active {
transform: translateY(-2px); transform: translateY(-2px);
box-shadow: 0 12px 36px rgba(74, 144, 226, 0.25); box-shadow: 0 12px 36px rgba(74, 144, 226, 0.25);
} }
.notice-icon { .notice-icon {
width: 50px; width: 50px;
height: 50px; height: 50px;
@ -661,13 +651,13 @@ watch(curXs, (newXs, oldXs) => {
box-shadow: 0 2px 8px rgba(74, 144, 226, 0.15); box-shadow: 0 2px 8px rgba(74, 144, 226, 0.15);
flex-shrink: 0; flex-shrink: 0;
} }
.notice-content { .notice-content {
flex: 1; flex: 1;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
min-width: 0; min-width: 0;
.notice-title { .notice-title {
font-size: 15px; font-size: 15px;
font-weight: 600; font-weight: 600;
@ -680,7 +670,7 @@ watch(curXs, (newXs, oldXs) => {
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
line-height: 1.3; line-height: 1.3;
} }
.notice-desc { .notice-desc {
font-size: 13px; font-size: 13px;
color: #606266; color: #606266;
@ -693,19 +683,19 @@ watch(curXs, (newXs, oldXs) => {
flex: 1; flex: 1;
line-height: 1.4; line-height: 1.4;
} }
.notice-footer { .notice-footer {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
.notice-date { .notice-date {
font-size: 12px; font-size: 12px;
color: #909399; color: #909399;
font-weight: 400; font-weight: 400;
line-height: 1; line-height: 1;
} }
.notice-arrow { .notice-arrow {
width: 20px; width: 20px;
height: 20px; height: 20px;