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

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<{
ywId: string,
ywType: string,
showSqr: boolean,
showSpr: boolean,
showCsr: boolean,
showSqr?: boolean,
showSpr?: boolean,
showCsr?: boolean,
}>(), {
ywId: '',
ywType: '',

View File

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