Merge branch 'master' of http://119.29.194.155:8894/zwq/zhxy-jzd
This commit is contained in:
commit
88e398655d
17
src/api/base/notice.ts
Normal file
17
src/api/base/notice.ts
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import { get } from "@/utils/request";
|
||||||
|
|
||||||
|
// 通知公告分页查询参数接口
|
||||||
|
export interface NoticePageParams {
|
||||||
|
page: number;
|
||||||
|
rows: number;
|
||||||
|
appCode: string;
|
||||||
|
fbfw?: string;
|
||||||
|
xqId?: string;
|
||||||
|
fbNjmcId?: string;
|
||||||
|
releaseFlag?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取通知公告列表
|
||||||
|
export function getNoticeListApi(params: NoticePageParams) {
|
||||||
|
return get("/api/cms/article/list", params);
|
||||||
|
}
|
||||||
@ -63,6 +63,14 @@ export const checkOpenId = async (param: {
|
|||||||
export const updateUserApi = async (param: any) => {
|
export const updateUserApi = async (param: any) => {
|
||||||
return await post("/open/login/js/updateUser", param);
|
return await post("/open/login/js/updateUser", param);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const updateSignFileApi = async (param: { userId: number; signFile: string }) => {
|
||||||
|
return await post("/api/user/updateSignFile", {
|
||||||
|
id: param.userId,
|
||||||
|
signFile: param.signFile
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
export const findJsByPhoneApi = async (param: any) => {
|
export const findJsByPhoneApi = async (param: any) => {
|
||||||
return await get("/api/js/findJsByPhone", param);
|
return await get("/api/js/findJsByPhone", param);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -57,6 +57,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/system/subscribe/index",
|
||||||
|
"style": {
|
||||||
|
"navigationStyle": "custom",
|
||||||
|
"navigationBarTitleText": "关注服务号",
|
||||||
|
"enablePullDownRefresh": false,
|
||||||
|
"backgroundColor": "#f4f5f7"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/system/webView/webView",
|
"path": "pages/system/webView/webView",
|
||||||
"style": {
|
"style": {
|
||||||
@ -242,6 +251,13 @@
|
|||||||
"enablePullDownRefresh": false
|
"enablePullDownRefresh": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/base/course-selection/noticeclub",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "告知书",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/base/course-selection/enrolled",
|
"path": "pages/base/course-selection/enrolled",
|
||||||
"style": {
|
"style": {
|
||||||
@ -254,6 +270,14 @@
|
|||||||
"navigationBarTitleText": "未开放",
|
"navigationBarTitleText": "未开放",
|
||||||
"enablePullDownRefresh": false
|
"enablePullDownRefresh": false
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/base/course-selection/enrollment-ended",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "选课已结束",
|
||||||
|
"enablePullDownRefresh": false,
|
||||||
|
"navigationStyle": "custom"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"globalStyle": {
|
"globalStyle": {
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="countdown-section">
|
<view class="countdown-section">
|
||||||
<template v-if="!isEnrollmentEnded">
|
<template v-if="!isEnrollmentEnded">
|
||||||
<view class="countdown-title">{{ countdownTitle }}</view>
|
|
||||||
<view class="countdown-timer">
|
<view class="countdown-timer">
|
||||||
<view class="time-block">
|
<view class="time-block">
|
||||||
<text class="time-value">{{ countdownTime.hours }}</text>
|
<text class="time-value">{{ countdownTime.hours }}</text>
|
||||||
@ -20,10 +19,21 @@
|
|||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<view class="enrollment-ended">
|
<view class="enrollment-ended" v-if="isEnrollmentEnded && isCourseEnded">
|
||||||
<u-icon name="info-circle" color="#FF9900" size="20"></u-icon>
|
<u-icon name="info-circle" color="#FF9900" size="20"></u-icon>
|
||||||
<text>选课已经结束</text>
|
<text>选课已经结束</text>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="enrollment-started" v-else-if="isEnrollmentEnded && !isCourseEnded">
|
||||||
|
<view class="enrollment-content">
|
||||||
|
<view class="enrollment-title">
|
||||||
|
<u-icon name="clock" color="#4CAF50" size="16"></u-icon>
|
||||||
|
<text>报名结束时间</text>
|
||||||
|
</view>
|
||||||
|
<view class="enrollment-date">
|
||||||
|
<text>{{ formatEndTime }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</template>
|
</template>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@ -48,17 +58,20 @@ const countdownTime = reactive({
|
|||||||
|
|
||||||
const kcStatus = ref(false);
|
const kcStatus = ref(false);
|
||||||
|
|
||||||
// 倒计时标题文本
|
|
||||||
const countdownTitle = computed(() => {
|
|
||||||
return kcStatus.value ? "距离选课结束还剩" : "距离选课开始还剩";
|
|
||||||
});
|
|
||||||
|
|
||||||
// 当前选中的学生
|
// 当前选中的学生
|
||||||
let countdownTimer: number | null = null;
|
let countdownTimer: number | null = null;
|
||||||
const remainTime = ref("00:00:00");
|
const remainTime = ref("00:00:00");
|
||||||
|
|
||||||
// 添加选课是否已结束的标记
|
// 添加选课是否已结束的标记
|
||||||
const isEnrollmentEnded = ref(false);
|
const isEnrollmentEnded = ref(false);
|
||||||
|
// 添加选课是否已结束的标记(区分选课开始和选课结束)
|
||||||
|
const isCourseEnded = ref(false);
|
||||||
|
|
||||||
|
// 格式化结束时间
|
||||||
|
const formatEndTime = computed(() => {
|
||||||
|
if (!props.xk || !props.xk.xkjstime) return '';
|
||||||
|
return dayjs(props.xk.xkjstime).format('YYYY-MM-DD');
|
||||||
|
});
|
||||||
|
|
||||||
// 启动倒计时
|
// 启动倒计时
|
||||||
const startCountdown = (endTimeStamp: number) => {
|
const startCountdown = (endTimeStamp: number) => {
|
||||||
@ -82,26 +95,10 @@ const startCountdown = (endTimeStamp: number) => {
|
|||||||
countdownTimer = null;
|
countdownTimer = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 判断当前倒计时是选课开始还是选课结束
|
// 选课开始倒计时结束
|
||||||
if (!kcStatus.value) {
|
isEnrollmentEnded.value = true; // 标记选课已开始,隐藏倒计时
|
||||||
// 如果是选课开始倒计时结束,则切换到选课结束倒计时
|
isCourseEnded.value = false; // 标记选课未结束
|
||||||
kcStatus.value = true; // 更新状态为选课已开始
|
emit("over");
|
||||||
uni.showToast({
|
|
||||||
title: "选课已开始",
|
|
||||||
icon: "none",
|
|
||||||
});
|
|
||||||
// 开始选课结束倒计时
|
|
||||||
const xkjstime = dayjs(props.xk.xkjstime).valueOf();
|
|
||||||
startCountdown(xkjstime);
|
|
||||||
} else {
|
|
||||||
// 如果是选课结束倒计时结束
|
|
||||||
isEnrollmentEnded.value = true; // 标记选课已结束
|
|
||||||
emit("over");
|
|
||||||
uni.showToast({
|
|
||||||
title: "选课已结束",
|
|
||||||
icon: "none",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,22 +131,29 @@ const changeXk = (xk: any) => {
|
|||||||
//获取选课结束时间
|
//获取选课结束时间
|
||||||
const xkjstime = dayjs(xk.xkjstime).valueOf();
|
const xkjstime = dayjs(xk.xkjstime).valueOf();
|
||||||
|
|
||||||
// 检查是否已经超过选课结束时间
|
// 如果当前时间 >= 选课结束时间,则显示选课已结束
|
||||||
if (now > xkjstime) {
|
if (now >= xkjstime) {
|
||||||
kcStatus.value = true;
|
|
||||||
isEnrollmentEnded.value = true;
|
isEnrollmentEnded.value = true;
|
||||||
|
isCourseEnded.value = true;
|
||||||
countdownTime.hours = "00";
|
countdownTime.hours = "00";
|
||||||
countdownTime.minutes = "00";
|
countdownTime.minutes = "00";
|
||||||
countdownTime.seconds = "00";
|
countdownTime.seconds = "00";
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
//判断选课是否开始
|
|
||||||
else if (now < xkkstime) {
|
// 如果当前时间 >= 选课开始时间 且 < 选课结束时间,显示报名提示
|
||||||
kcStatus.value = false;
|
if (now >= xkkstime && now < xkjstime) {
|
||||||
startCountdown(xkkstime);
|
isEnrollmentEnded.value = true;
|
||||||
} else {
|
isCourseEnded.value = false;
|
||||||
kcStatus.value = true;
|
countdownTime.hours = "00";
|
||||||
startCountdown(xkjstime);
|
countdownTime.minutes = "00";
|
||||||
|
countdownTime.seconds = "00";
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 只有当前时间 < 选课开始时间时才显示倒计时
|
||||||
|
kcStatus.value = false;
|
||||||
|
startCountdown(xkkstime);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 页面卸载前清除定时器
|
// 页面卸载前清除定时器
|
||||||
@ -174,38 +178,37 @@ if (props.xk && props.xk.id) {
|
|||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.countdown-section {
|
.countdown-section {
|
||||||
.countdown-title {
|
|
||||||
font-size: 14px;
|
|
||||||
margin-bottom: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.countdown-timer {
|
.countdown-timer {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
gap: 4px;
|
||||||
|
|
||||||
.time-block {
|
.time-block {
|
||||||
background-color: rgba(255, 255, 255, 0.2);
|
background-color: rgba(255, 255, 255, 0.2);
|
||||||
border-radius: 6px;
|
border-radius: 4px;
|
||||||
min-width: 40px;
|
min-width: 30px;
|
||||||
padding: 5px 8px;
|
padding: 3px 5px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
||||||
.time-value {
|
.time-value {
|
||||||
font-size: 20px;
|
font-size: 14px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
line-height: 1;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
.time-unit {
|
.time-unit {
|
||||||
font-size: 12px;
|
font-size: 9px;
|
||||||
opacity: 0.9;
|
opacity: 0.9;
|
||||||
|
line-height: 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.time-separator {
|
.time-separator {
|
||||||
font-size: 20px;
|
font-size: 14px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
margin: 0 5px;
|
margin: 0 1px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,12 +219,49 @@ if (props.xk && props.xk.id) {
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
background-color: rgba(255, 255, 255, 0.2);
|
background-color: rgba(255, 255, 255, 0.2);
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
padding: 12px 15px;
|
padding: 8px 12px;
|
||||||
font-size: 16px;
|
font-size: 14px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
gap: 8px;
|
gap: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 选课已开始样式 */
|
||||||
|
.enrollment-started {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background-color: rgba(76, 175, 80, 0.2);
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 8px 12px;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #fff;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 1.3;
|
||||||
|
|
||||||
|
.enrollment-content {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
gap: 4px;
|
||||||
|
|
||||||
|
.enrollment-title {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 4px;
|
||||||
|
font-size: 11px;
|
||||||
|
opacity: 0.9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.enrollment-date {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
@ -117,13 +117,6 @@ const loadXkList = async () => {
|
|||||||
const switchXk = (xk: any) => {
|
const switchXk = (xk: any) => {
|
||||||
curXk.value = xk;
|
curXk.value = xk;
|
||||||
showFlag.value = false;
|
showFlag.value = false;
|
||||||
if (xk && xk.id) {
|
|
||||||
// 显示切换成功提示
|
|
||||||
uni.showToast({
|
|
||||||
title: `已切换到${xk.xkmc}`,
|
|
||||||
icon: "none",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
emit("change", xk);
|
emit("change", xk);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -9,15 +9,17 @@
|
|||||||
:class="{ selected: xkkc.isSelected }"
|
:class="{ selected: xkkc.isSelected }"
|
||||||
@click="toggleSelection(xkkc)"
|
@click="toggleSelection(xkkc)"
|
||||||
>
|
>
|
||||||
<view class="course-name">{{ xkkc.kcmc }}</view>
|
<view class="course-header">
|
||||||
|
<view class="course-name">{{ xkkc.kcmc }}</view>
|
||||||
|
<view class="detail-btn" @click.stop="goToDetail(xkkc)">
|
||||||
|
<image src="/static/base/home/details.svg" class="detail-icon" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
<view class="register-info">
|
<view class="register-info">
|
||||||
<text>报名情况:</text>
|
<text>报名情况:</text>
|
||||||
<text class="register-count">{{ xkkc.hasNum || 0 }}</text>
|
<text class="register-count">{{ xkkc.hasNum || 0 }}</text>
|
||||||
<text> | {{ xkkc.maxNum || 0 }}</text>
|
<text> | {{ xkkc.maxNum || 0 }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="detail-btn" @click.stop="goToDetail(xkkc)"
|
|
||||||
>详情</view
|
|
||||||
>
|
|
||||||
<view v-if="xkkc.isSelected" class="selected-mark">
|
<view v-if="xkkc.isSelected" class="selected-mark">
|
||||||
<uni-icons
|
<uni-icons
|
||||||
type="checkbox-filled"
|
type="checkbox-filled"
|
||||||
@ -179,29 +181,40 @@ if (props.xk && props.xk.xkkcs) {
|
|||||||
box-shadow: 0 2px 8px rgba(63, 191, 114, 0.15);
|
box-shadow: 0 2px 8px rgba(63, 191, 114, 0.15);
|
||||||
}
|
}
|
||||||
|
|
||||||
.course-name {
|
.course-header {
|
||||||
font-size: 16px;
|
display: flex;
|
||||||
font-weight: 500;
|
justify-content: space-between;
|
||||||
color: #333;
|
align-items: flex-start;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
|
|
||||||
|
.course-name {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #333;
|
||||||
|
flex: 1;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-btn {
|
||||||
|
flex-shrink: 0;
|
||||||
|
padding: 4px;
|
||||||
|
|
||||||
|
.detail-icon {
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.register-info {
|
.register-info {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: #666;
|
color: #666;
|
||||||
margin-bottom: 12px;
|
|
||||||
|
|
||||||
.register-count {
|
.register-count {
|
||||||
color: #2879ff;
|
color: #2879ff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.detail-btn {
|
|
||||||
display: inline-block;
|
|
||||||
color: #2879ff;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.selected-mark {
|
.selected-mark {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: -6px;
|
top: -6px;
|
||||||
|
|||||||
@ -86,21 +86,21 @@ const switchXs = (xs: any) => {
|
|||||||
setCurXs(xs);
|
setCurXs(xs);
|
||||||
showFlag.value = false;
|
showFlag.value = false;
|
||||||
emit('change', xs);
|
emit('change', xs);
|
||||||
// 这里可以添加切换学生后的其他操作,如刷新页面数据等
|
}
|
||||||
uni.showToast({
|
|
||||||
title: `已切换到${xs.xm}`,
|
// 设置当前学生(无提示)
|
||||||
icon: "none",
|
const setCurrentStudent = (xs: any) => {
|
||||||
});
|
setCurXs(xs);
|
||||||
|
emit('change', xs);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果是bar形式,则默认打开选择器
|
// 如果是bar形式,则默认打开选择器
|
||||||
if (props.isBar
|
if (props.isBar) {
|
||||||
//&& (getCurXs === null || !getCurXs.id)
|
|
||||||
) {
|
|
||||||
if (getUser.xsList.length > 1 ) {
|
if (getUser.xsList.length > 1 ) {
|
||||||
showPicker();
|
showPicker();
|
||||||
} else {
|
} else {
|
||||||
switchXs(getUser.xsList[0]);
|
// 只有一个学生时,直接设置但不显示提示
|
||||||
|
setCurrentStudent(getUser.xsList[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -3,12 +3,15 @@
|
|||||||
<!-- 选课信息头部 - 固定部分 -->
|
<!-- 选课信息头部 - 固定部分 -->
|
||||||
<view class="selection-header">
|
<view class="selection-header">
|
||||||
<view class="header-content">
|
<view class="header-content">
|
||||||
<!-- 选课类型选择部分 -->
|
<!-- 第一行:选课类型选择 -->
|
||||||
<XkPicker title="俱乐部信息" :is-qk="true" xklx-id="816059832" :xs-id="curXs.id" @change="switchXk" v-if="!xsFlag" />
|
<view class="top-row" v-if="!xsFlag">
|
||||||
<!-- 学生选择部分 -->
|
<XkPicker title="俱乐部信息" :is-qk="true" xklx-id="816059832" :xs-id="curXs.id" @change="switchXk" />
|
||||||
<XsPicker :is-bar="true" @change="switchXs" />
|
</view>
|
||||||
<!-- 倒计时-->
|
<!-- 第二行:学生选择和倒计时 -->
|
||||||
<XkCountdown :xk="curXk" @over="xkTimeOver" v-if="curXk && curXk.id" />
|
<view class="bottom-row">
|
||||||
|
<XsPicker :is-bar="true" @change="switchXs" />
|
||||||
|
<XkCountdown :xk="curXk" @over="xkTimeOver" v-if="curXk && curXk.id" />
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@ -35,6 +38,7 @@ import XkkcList from "@/pages/base/components/XkkcList/index.vue"
|
|||||||
import { jzXkQkjApi } from "@/api/base/server";
|
import { jzXkQkjApi } from "@/api/base/server";
|
||||||
import { useUserStore } from "@/store/modules/user";
|
import { useUserStore } from "@/store/modules/user";
|
||||||
import { useDataStore } from "@/store/modules/data";
|
import { useDataStore } from "@/store/modules/data";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
|
||||||
const { getCurXs, getUser } = useUserStore();
|
const { getCurXs, getUser } = useUserStore();
|
||||||
const { setData, getData } = useDataStore();
|
const { setData, getData } = useDataStore();
|
||||||
@ -46,9 +50,31 @@ const selectedXkkcIds = ref<any>([]);
|
|||||||
|
|
||||||
const xsFlag = ref(true);
|
const xsFlag = ref(true);
|
||||||
|
|
||||||
|
// 检查选课是否已结束
|
||||||
|
const checkEnrollmentStatus = (xk: any) => {
|
||||||
|
if (!xk || !xk.xkjstime) return;
|
||||||
|
|
||||||
|
const now = new Date().getTime();
|
||||||
|
const endTime = new Date(xk.xkjstime).getTime();
|
||||||
|
|
||||||
|
if (now > endTime) {
|
||||||
|
// 选课已结束,跳转到结束页面
|
||||||
|
const courseInfo = encodeURIComponent(JSON.stringify(xk));
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/base/course-selection/enrollment-ended?courseInfo=${courseInfo}`
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
// 切换选课
|
// 切换选课
|
||||||
const switchXk = (xk: any) => {
|
const switchXk = (xk: any) => {
|
||||||
curXk.value = xk;
|
curXk.value = xk;
|
||||||
|
// 检查选课状态
|
||||||
|
if (checkEnrollmentStatus(xk)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const switchXs = (xs: any) => {
|
const switchXs = (xs: any) => {
|
||||||
@ -57,7 +83,9 @@ const switchXs = (xs: any) => {
|
|||||||
|
|
||||||
// 选课时间结束
|
// 选课时间结束
|
||||||
const xkTimeOver = (val: any) => {
|
const xkTimeOver = (val: any) => {
|
||||||
console.log(val);
|
console.log('选课时间结束:', val);
|
||||||
|
// 选课开始时不再跳转,让用户继续选课
|
||||||
|
// 只有在选课结束时才跳转到选课结束页面
|
||||||
}
|
}
|
||||||
|
|
||||||
// 选中课程
|
// 选中课程
|
||||||
@ -75,6 +103,21 @@ const submit = async () => {
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 检查选课时间
|
||||||
|
if (curXk.value && curXk.value.xkkstime) {
|
||||||
|
const now = dayjs().valueOf();
|
||||||
|
const startTime = dayjs(curXk.value.xkkstime).valueOf();
|
||||||
|
|
||||||
|
if (now < startTime) {
|
||||||
|
uni.showToast({
|
||||||
|
title: "选课还未开始,请耐心等待!",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: "抢课中...",
|
title: "抢课中...",
|
||||||
});
|
});
|
||||||
@ -173,6 +216,36 @@ const submit = async () => {
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 15px;
|
gap: 15px;
|
||||||
|
|
||||||
|
.top-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
:deep(.title-section) {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottom-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 15px;
|
||||||
|
|
||||||
|
// 学生选择器样式
|
||||||
|
:deep(.xs-bar) {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 倒计时组件样式
|
||||||
|
:deep(.countdown-section) {
|
||||||
|
flex-shrink: 0;
|
||||||
|
background: rgba(255, 255, 255, 0.1);
|
||||||
|
border-radius: 6px;
|
||||||
|
padding: 6px 10px;
|
||||||
|
backdrop-filter: blur(10px);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -161,7 +161,7 @@ const courseDetail = computed(() => {
|
|||||||
location: data.kcdd || "暂无地点信息",
|
location: data.kcdd || "暂无地点信息",
|
||||||
price: data.kcje || 0,
|
price: data.kcje || 0,
|
||||||
studyTime: data.studyTime || "暂无上课时间",
|
studyTime: data.studyTime || "暂无上课时间",
|
||||||
xkkcImg: data.xkkcImg || "/static/images/robot-course.jpg", // 默认图片
|
xkkcImg: imagUrl(data.xkkcImg), // 使用imagUrl处理图片路径
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
291
src/pages/base/course-selection/enrollment-ended.vue
Normal file
291
src/pages/base/course-selection/enrollment-ended.vue
Normal file
@ -0,0 +1,291 @@
|
|||||||
|
<template>
|
||||||
|
<view class="enrollment-ended-page">
|
||||||
|
<view class="ended-container">
|
||||||
|
<!-- 页面头部 -->
|
||||||
|
<view class="page-header">
|
||||||
|
<text class="page-title">选课已结束</text>
|
||||||
|
<text class="page-subtitle">本次选课活动已经结束,感谢您的参与</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 主要信息显示区域 -->
|
||||||
|
<view class="main-content">
|
||||||
|
<view class="content-card">
|
||||||
|
<view class="icon-section">
|
||||||
|
<u-icon name="clock" size="80" color="#FF6B6B" />
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="info-section">
|
||||||
|
<view class="info-item">
|
||||||
|
<text class="info-label">选课名称:</text>
|
||||||
|
<text class="info-value">{{ courseInfo?.xkmc || '兴趣课选课' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="info-item">
|
||||||
|
<text class="info-label">选课时间:</text>
|
||||||
|
<text class="info-value">{{ formatTime(courseInfo?.xkkstime) }} - {{ formatTime(courseInfo?.xkjstime) }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="info-item">
|
||||||
|
<text class="info-label">结束时间:</text>
|
||||||
|
<text class="info-value">{{ formatTime(courseInfo?.xkjstime) }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="info-item" v-if="courseInfo?.qdmc">
|
||||||
|
<text class="info-label">选课地点:</text>
|
||||||
|
<text class="info-value">{{ courseInfo.qdmc }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="status-section">
|
||||||
|
<view class="status-badge">
|
||||||
|
<u-icon name="close-circle" size="16" color="#FF6B6B" />
|
||||||
|
<text class="status-text">选课已结束</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 提示信息 -->
|
||||||
|
<view class="tips-section">
|
||||||
|
<view class="tips-header">
|
||||||
|
<u-icon name="info-circle" size="16" color="#409EFF" />
|
||||||
|
<text class="tips-title">温馨提示</text>
|
||||||
|
</view>
|
||||||
|
<view class="tips-content">
|
||||||
|
<text class="tip-item">• 本次选课活动已经结束,无法继续选课</text>
|
||||||
|
<text class="tip-item">• 如需了解选课结果,请联系相关老师</text>
|
||||||
|
<text class="tip-item">• 下次选课时间请关注学校通知</text>
|
||||||
|
<text class="tip-item">• 如有疑问,请联系学校教务处</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 操作按钮 -->
|
||||||
|
<view class="action-buttons">
|
||||||
|
<button @click="goBack" class="back-btn">
|
||||||
|
<u-icon name="arrow-left" size="16" color="#666" />
|
||||||
|
<text class="btn-text">返回首页</text>
|
||||||
|
</button>
|
||||||
|
<button @click="refreshPage" class="refresh-btn">
|
||||||
|
<u-icon name="reload" size="16" color="#409EFF" />
|
||||||
|
<text class="btn-text">刷新页面</text>
|
||||||
|
</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, onMounted } from 'vue';
|
||||||
|
import { onLoad } from '@dcloudio/uni-app';
|
||||||
|
|
||||||
|
// 页面参数
|
||||||
|
const courseInfo = ref<any>(null);
|
||||||
|
|
||||||
|
onLoad((options) => {
|
||||||
|
// 接收传递过来的选课信息
|
||||||
|
if (options?.courseInfo) {
|
||||||
|
try {
|
||||||
|
courseInfo.value = JSON.parse(decodeURIComponent(options.courseInfo));
|
||||||
|
} catch (error) {
|
||||||
|
console.error('解析选课信息失败:', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 格式化时间
|
||||||
|
const formatTime = (time: string) => {
|
||||||
|
if (!time) return '未设置';
|
||||||
|
const date = new Date(time);
|
||||||
|
return date.toLocaleString('zh-CN', {
|
||||||
|
year: 'numeric',
|
||||||
|
month: '2-digit',
|
||||||
|
day: '2-digit',
|
||||||
|
hour: '2-digit',
|
||||||
|
minute: '2-digit'
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 返回首页
|
||||||
|
const goBack = () => {
|
||||||
|
uni.reLaunch({
|
||||||
|
url: '/pages/base/home/index'
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 刷新页面
|
||||||
|
const refreshPage = () => {
|
||||||
|
uni.reLaunch({
|
||||||
|
url: '/pages/base/course-selection/index'
|
||||||
|
});
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.enrollment-ended-page {
|
||||||
|
min-height: 100vh;
|
||||||
|
background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
|
||||||
|
padding: 20px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ended-container {
|
||||||
|
max-width: 400px;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 页面头部
|
||||||
|
.page-header {
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
|
||||||
|
.page-title {
|
||||||
|
display: block;
|
||||||
|
font-size: 28px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: white;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-subtitle {
|
||||||
|
font-size: 16px;
|
||||||
|
color: rgba(255, 255, 255, 0.8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 主要内容区域
|
||||||
|
.main-content {
|
||||||
|
margin-bottom: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-card {
|
||||||
|
background: white;
|
||||||
|
border-radius: 16px;
|
||||||
|
padding: 24px;
|
||||||
|
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-section {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info-section {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
|
||||||
|
.info-item {
|
||||||
|
display: flex;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
|
||||||
|
.info-label {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #666;
|
||||||
|
min-width: 80px;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info-value {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #333;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-section {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
.status-badge {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
background: #fff5f5;
|
||||||
|
border: 1px solid #ff6b6b;
|
||||||
|
border-radius: 20px;
|
||||||
|
padding: 8px 16px;
|
||||||
|
|
||||||
|
.status-text {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #ff6b6b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 提示信息
|
||||||
|
.tips-section {
|
||||||
|
background: rgba(255, 255, 255, 0.1);
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 20px;
|
||||||
|
backdrop-filter: blur(10px);
|
||||||
|
margin-bottom: 30px;
|
||||||
|
|
||||||
|
.tips-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
|
||||||
|
.tips-title {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tips-content {
|
||||||
|
.tip-item {
|
||||||
|
display: block;
|
||||||
|
font-size: 14px;
|
||||||
|
color: rgba(255, 255, 255, 0.9);
|
||||||
|
margin-bottom: 8px;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 操作按钮
|
||||||
|
.action-buttons {
|
||||||
|
display: flex;
|
||||||
|
gap: 12px;
|
||||||
|
|
||||||
|
.back-btn, .refresh-btn {
|
||||||
|
flex: 1;
|
||||||
|
height: 44px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 8px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 8px;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.back-btn {
|
||||||
|
background: #f5f5f5;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.refresh-btn {
|
||||||
|
background: #409EFF;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-text {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 响应式优化
|
||||||
|
@media (max-width: 375px) {
|
||||||
|
.enrollment-ended-page {
|
||||||
|
padding: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-card {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-header .page-title {
|
||||||
|
font-size: 24px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -5,10 +5,11 @@
|
|||||||
<view class="header-content">
|
<view class="header-content">
|
||||||
<!-- 选课类型选择部分 -->
|
<!-- 选课类型选择部分 -->
|
||||||
<XkPicker title="俱乐部信息" :is-qk="true" xklx-id="962488654" :xs-id="curXs.id" @change="switchXk" v-if="!xsFlag" />
|
<XkPicker title="俱乐部信息" :is-qk="true" xklx-id="962488654" :xs-id="curXs.id" @change="switchXk" v-if="!xsFlag" />
|
||||||
<!-- 学生选择部分 -->
|
<!-- 学生选择和倒计时 -->
|
||||||
<XsPicker :is-bar="true" @change="switchXs" />
|
<view class="bottom-row">
|
||||||
<!-- 倒计时-->
|
<XsPicker :is-bar="true" @change="switchXs" />
|
||||||
<XkCountdown :xk="curXk" @over="xkTimeOver" v-if="curXk && curXk.id" />
|
<XkCountdown :xk="curXk" @over="xkTimeOver" v-if="curXk && curXk.id" />
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@ -35,6 +36,7 @@ import XkkcList from "@/pages/base/components/XkkcList/index.vue"
|
|||||||
import { jzXkQkjApi } from "@/api/base/server";
|
import { jzXkQkjApi } from "@/api/base/server";
|
||||||
import { useUserStore } from "@/store/modules/user";
|
import { useUserStore } from "@/store/modules/user";
|
||||||
import { useDataStore } from "@/store/modules/data";
|
import { useDataStore } from "@/store/modules/data";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
|
||||||
const { getCurXs, getUser } = useUserStore();
|
const { getCurXs, getUser } = useUserStore();
|
||||||
const { setData, getData } = useDataStore();
|
const { setData, getData } = useDataStore();
|
||||||
@ -47,9 +49,31 @@ const selectedXkkcIds = ref<any>([]);
|
|||||||
|
|
||||||
const xsFlag = ref(true);
|
const xsFlag = ref(true);
|
||||||
|
|
||||||
|
// 检查选课是否已结束
|
||||||
|
const checkEnrollmentStatus = (xk: any) => {
|
||||||
|
if (!xk || !xk.xkjstime) return;
|
||||||
|
|
||||||
|
const now = new Date().getTime();
|
||||||
|
const endTime = new Date(xk.xkjstime).getTime();
|
||||||
|
|
||||||
|
if (now > endTime) {
|
||||||
|
// 选课已结束,跳转到结束页面
|
||||||
|
const courseInfo = encodeURIComponent(JSON.stringify(xk));
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/base/course-selection/enrollment-ended?courseInfo=${courseInfo}`
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
// 切换选课
|
// 切换选课
|
||||||
const switchXk = (xk: any) => {
|
const switchXk = (xk: any) => {
|
||||||
curXk.value = xk;
|
curXk.value = xk;
|
||||||
|
// 检查选课状态
|
||||||
|
if (checkEnrollmentStatus(xk)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 切换学生
|
// 切换学生
|
||||||
@ -59,7 +83,12 @@ const switchXs = (xs: any) => {
|
|||||||
|
|
||||||
// 选课时间结束
|
// 选课时间结束
|
||||||
const xkTimeOver = (val: any) => {
|
const xkTimeOver = (val: any) => {
|
||||||
console.log(val);
|
console.log('选课时间结束:', val);
|
||||||
|
// 跳转到选课结束页面
|
||||||
|
const courseInfo = encodeURIComponent(JSON.stringify(curXk.value));
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/base/course-selection/enrollment-ended?courseInfo=${courseInfo}`
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 选中课程
|
// 选中课程
|
||||||
@ -77,6 +106,21 @@ const submit = async () => {
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 检查选课时间
|
||||||
|
if (curXk.value && curXk.value.xkkstime) {
|
||||||
|
const now = dayjs().valueOf();
|
||||||
|
const startTime = dayjs(curXk.value.xkkstime).valueOf();
|
||||||
|
|
||||||
|
if (now < startTime) {
|
||||||
|
uni.showToast({
|
||||||
|
title: "选课还未开始,请耐心等待!",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: "抢课中...",
|
title: "抢课中...",
|
||||||
});
|
});
|
||||||
@ -174,6 +218,27 @@ const submit = async () => {
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 15px;
|
gap: 15px;
|
||||||
|
|
||||||
|
.bottom-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 15px;
|
||||||
|
|
||||||
|
// 学生选择器样式
|
||||||
|
:deep(.xs-bar) {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 倒计时组件样式
|
||||||
|
:deep(.countdown-section) {
|
||||||
|
flex-shrink: 0;
|
||||||
|
background: rgba(255, 255, 255, 0.1);
|
||||||
|
border-radius: 6px;
|
||||||
|
padding: 6px 10px;
|
||||||
|
backdrop-filter: blur(10px);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -25,14 +25,19 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import { ref } from "vue";
|
||||||
import { xkgzsApi } from "@/api/base/server";
|
import { xkgzsApi } from "@/api/base/server";
|
||||||
|
import { updateSignFileApi } from "@/api/system/login";
|
||||||
import { useDataStore } from "@/store/modules/data";
|
import { useDataStore } from "@/store/modules/data";
|
||||||
|
import { useUserStore } from "@/store/modules/user";
|
||||||
import { showLoading } from "@/utils/uniapp";
|
import { showLoading } from "@/utils/uniapp";
|
||||||
import { onLoad } from "@dcloudio/uni-app";
|
import { onLoad } from "@dcloudio/uni-app";
|
||||||
|
import BasicSign from "@/components/BasicSign/Sign.vue";
|
||||||
|
|
||||||
const signCompRef = ref<any>(null);
|
const signCompRef = ref<any>(null);
|
||||||
const sign_file = ref<any>(null);
|
const sign_file = ref<any>(null);
|
||||||
const { setData, getGlobal } = useDataStore();
|
const { setData, getGlobal } = useDataStore();
|
||||||
|
const userStore = useUserStore();
|
||||||
|
|
||||||
const notice = ref("");
|
const notice = ref("");
|
||||||
onLoad(async () => {
|
onLoad(async () => {
|
||||||
@ -43,20 +48,46 @@ onLoad(async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
async function submit() {
|
async function submit() {
|
||||||
// 显示加载中
|
try {
|
||||||
|
// 获取签名数据
|
||||||
const data = await signCompRef.value.getSyncSignature();
|
const data = await signCompRef.value.getSyncSignature();
|
||||||
sign_file.value = data.base64;
|
sign_file.value = data.base64;
|
||||||
|
|
||||||
|
// 获取当前用户信息
|
||||||
|
const userInfo = userStore.getUser;
|
||||||
|
|
||||||
|
// 检查localStorage userdata中是否已有signFile
|
||||||
|
const hasExistingSignFile = userInfo && userInfo.signFile;
|
||||||
|
|
||||||
|
// 更新localStorage userdata中的signFile
|
||||||
setData({
|
setData({
|
||||||
sign_file: sign_file.value,
|
sign_file: sign_file.value,
|
||||||
});
|
});
|
||||||
if (getGlobal.type == 1) {
|
|
||||||
|
// 如果localStorage userdata中没有signFile,则调用后端API更新u_user表
|
||||||
|
if (!hasExistingSignFile && userInfo && userInfo.userId) {
|
||||||
|
try {
|
||||||
|
await updateSignFileApi({
|
||||||
|
userId: userInfo.userId,
|
||||||
|
signFile: sign_file.value
|
||||||
|
});
|
||||||
|
console.log('签名数据已更新到后端数据库');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('更新后端签名数据失败:', error);
|
||||||
|
// 即使后端更新失败,也不影响前端流程继续
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 跳转到下一页
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
url: "/pages/base/course-selection/index",
|
url: "/pages/base/course-selection/index",
|
||||||
});
|
});
|
||||||
}
|
|
||||||
if (getGlobal.type == 2) {
|
} catch (error) {
|
||||||
uni.reLaunch({
|
console.error('提交签名失败:', error);
|
||||||
url: "/pages/base/course-selection/club-selection",
|
uni.showToast({
|
||||||
|
title: '签名提交失败',
|
||||||
|
icon: 'none'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
73
src/pages/base/course-selection/noticeclub.vue
Normal file
73
src/pages/base/course-selection/noticeclub.vue
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
<template>
|
||||||
|
<BasicLayout>
|
||||||
|
<view class="p-15">
|
||||||
|
<view class="white-bg-color p-15 r-md" v-if="notice">
|
||||||
|
<view> 各位家长:</view>
|
||||||
|
<view class="notice-text">
|
||||||
|
{{ notice }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<BasicSign ref="signCompRef" title="签名"></BasicSign>
|
||||||
|
</view>
|
||||||
|
<template #bottom>
|
||||||
|
<view class="white-bg-color py-5">
|
||||||
|
<view class="flex-row items-center pb-10 pt-5">
|
||||||
|
<u-button
|
||||||
|
text="下一步"
|
||||||
|
class="mx-15"
|
||||||
|
type="primary"
|
||||||
|
@click="submit"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
</BasicLayout>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { xkgzsApi } from "@/api/base/server";
|
||||||
|
import { useDataStore } from "@/store/modules/data";
|
||||||
|
import { showLoading } from "@/utils/uniapp";
|
||||||
|
import { onLoad } from "@dcloudio/uni-app";
|
||||||
|
|
||||||
|
const signCompRef = ref<any>(null);
|
||||||
|
const sign_file = ref<any>(null);
|
||||||
|
const { setData, getGlobal } = useDataStore();
|
||||||
|
|
||||||
|
const notice = ref("");
|
||||||
|
onLoad(async () => {
|
||||||
|
showLoading({ title: "加载中..." });
|
||||||
|
const res = await xkgzsApi({ kcLx: "俱乐部" });
|
||||||
|
notice.value = res.rows?.[0]?.content || "";
|
||||||
|
uni.hideLoading();
|
||||||
|
});
|
||||||
|
|
||||||
|
async function submit() {
|
||||||
|
// 显示加载中
|
||||||
|
const data = await signCompRef.value.getSyncSignature();
|
||||||
|
sign_file.value = data.base64;
|
||||||
|
setData({
|
||||||
|
sign_file: sign_file.value,
|
||||||
|
});
|
||||||
|
uni.reLaunch({
|
||||||
|
url: "/pages/base/course-selection/club-selection",
|
||||||
|
});
|
||||||
|
/*if (getGlobal.type == 1) {
|
||||||
|
uni.reLaunch({
|
||||||
|
url: "/pages/base/course-selection/index",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (getGlobal.type == 2) {
|
||||||
|
uni.reLaunch({
|
||||||
|
url: "/pages/base/course-selection/club-selection",
|
||||||
|
});
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.notice-text {
|
||||||
|
margin-top: 10px;
|
||||||
|
text-indent: 2em; /* 添加两个中文字符的缩进 */
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -27,6 +27,7 @@
|
|||||||
<view
|
<view
|
||||||
v-for="(item, index) in menuItems"
|
v-for="(item, index) in menuItems"
|
||||||
:key="index"
|
:key="index"
|
||||||
|
v-show="hasPermissionDirect(item.permissionKey)"
|
||||||
class="grid-item"
|
class="grid-item"
|
||||||
@click="handleMenuClick(item)"
|
@click="handleMenuClick(item)"
|
||||||
>
|
>
|
||||||
@ -79,14 +80,48 @@ import { ref, computed, onMounted, watch } from "vue";
|
|||||||
import { onShow } from "@dcloudio/uni-app";
|
import { onShow } from "@dcloudio/uni-app";
|
||||||
import XsPicker from "@/pages/base/components/XsPicker/index.vue"
|
import XsPicker from "@/pages/base/components/XsPicker/index.vue"
|
||||||
import { cmsArticlePageApi, getUserLatestInfoApi } from "@/api/base/server";
|
import { cmsArticlePageApi, getUserLatestInfoApi } from "@/api/base/server";
|
||||||
|
import { getNoticeListApi } from "@/api/base/notice";
|
||||||
import { useUserStore } from "@/store/modules/user";
|
import { useUserStore } from "@/store/modules/user";
|
||||||
import { useDataStore } from "@/store/modules/data";
|
import { useDataStore } from "@/store/modules/data";
|
||||||
|
import { hasPermission } from "@/utils/permission";
|
||||||
|
|
||||||
const { getCurXs } = useUserStore();
|
const { getCurXs } = useUserStore();
|
||||||
const { setData, getAppCode } = useDataStore();
|
const { setData, getAppCode } = useDataStore();
|
||||||
|
|
||||||
// 刷新相关变量
|
// 刷新相关变量
|
||||||
const { getLastRefreshTime, getRefreshInterval, setLastRefreshTime, updateStudentInfo, updateStudentList } = useUserStore();
|
const { getLastRefreshTime, getRefreshInterval, setLastRefreshTime, updateStudentInfo, updateStudentList } = useUserStore();
|
||||||
const REFRESH_INTERVAL = 10 * 60 * 1000; // 10分钟刷新一次(测试用)
|
const REFRESH_INTERVAL = 7 * 24 * 60 * 60 * 1000; // 1周刷新一次(7天)
|
||||||
|
|
||||||
|
// 获取当前changeTime
|
||||||
|
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) {
|
||||||
|
console.error('获取changeTime失败:', error);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 检查权限(带changeTime)
|
||||||
|
const checkPermission = (permissionKey: string) => {
|
||||||
|
const changeTime = getCurrentChangeTime();
|
||||||
|
return hasPermission(permissionKey, changeTime);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 直接权限检查函数,避免缓存问题
|
||||||
|
const hasPermissionDirect = (permissionKey: string) => {
|
||||||
|
if (!permissionKey) return true;
|
||||||
|
const userStore = useUserStore();
|
||||||
|
const permissions = userStore.getAuth;
|
||||||
|
if (!permissions || permissions.length === 0) return false;
|
||||||
|
|
||||||
|
const uniquePermissions = [...new Set(permissions)];
|
||||||
|
return uniquePermissions.includes(permissionKey);
|
||||||
|
};
|
||||||
|
|
||||||
// 检查是否需要刷新学生信息
|
// 检查是否需要刷新学生信息
|
||||||
const checkAndRefreshStudentInfo = async () => {
|
const checkAndRefreshStudentInfo = async () => {
|
||||||
@ -135,37 +170,56 @@ const menuItems = ref([
|
|||||||
title: "班级课表",
|
title: "班级课表",
|
||||||
icon: "/static/base/home/book-read-line.png",
|
icon: "/static/base/home/book-read-line.png",
|
||||||
path: "/pages/base/class-schedule/index",
|
path: "/pages/base/class-schedule/index",
|
||||||
|
permissionKey: "school-bjkb", // 班级课表权限编码
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "成绩查询",
|
title: "成绩查询",
|
||||||
icon: "/static/base/home/file-search-line.png",
|
icon: "/static/base/home/file-search-line.png",
|
||||||
path: "/pages/base/grades/list",
|
path: "/pages/base/grades/list",
|
||||||
|
permissionKey: "school-cjcx", // 成绩查询权限编码
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "在线请假",
|
title: "在线请假",
|
||||||
icon: "/static/base/home/draft-line.png",
|
icon: "/static/base/home/draft-line.png",
|
||||||
path: "/pages/base/leave-request/index",
|
path: "/pages/base/leave-request/index",
|
||||||
|
permissionKey: "school-zxqj", // 在线请假权限编码
|
||||||
},
|
},
|
||||||
// TODO:需求待协商硬件对接
|
// TODO:需求待协商硬件对接
|
||||||
// {
|
// {
|
||||||
// title: "进出校园",
|
// title: "进出校园",
|
||||||
// icon: "/static/base/home/file-transfer-line.png",
|
// icon: "/static/base/home/file-transfer-line.png",
|
||||||
// path: "/pages/base/campus-access/index",
|
// path: "/pages/base/campus-access/index",
|
||||||
|
// permissionKey: "school-jcxy", // 进出校园权限编码
|
||||||
// },
|
// },
|
||||||
{
|
{
|
||||||
title: "家校沟通",
|
title: "家校沟通",
|
||||||
icon: "/static/base/home/file-transfer-line.png",
|
icon: "/static/base/home/file-transfer-line.png",
|
||||||
path: "/pages/base/jl/index",
|
path: "/pages/base/jl/index",
|
||||||
|
permissionKey: "school-jxgt", // 家校沟通权限编码
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "兴趣课",
|
title: "兴趣课",
|
||||||
icon: "/static/base/home/file-text-line.png",
|
icon: "/static/base/home/file-text-line.png",
|
||||||
path: "/pages/base/interest-class/index",
|
path: "/pages/base/interest-class/index",
|
||||||
|
permissionKey: "school-xqk", // 兴趣课权限编码
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "俱乐部",
|
title: "俱乐部",
|
||||||
icon: "/static/base/home/contacts-book-3-line.png",
|
icon: "/static/base/home/contacts-book-3-line.png",
|
||||||
path: "/pages/base/club/index",
|
path: "/pages/base/club/index",
|
||||||
|
permissionKey: "school-jlb", // 俱乐部权限编码
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "兴趣课选课",
|
||||||
|
icon: "/static/base/home/file-text-line.png",
|
||||||
|
path: "/pages/base/course-selection/notice",
|
||||||
|
permissionKey: "school-xqkxk", // 兴趣课选课权限编码
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "俱乐部选课",
|
||||||
|
icon: "/static/base/home/contacts-book-3-line.png",
|
||||||
|
path: "/pages/base/course-selection/noticeclub",
|
||||||
|
permissionKey: "school-jlbxk", // 俱乐部选课权限编码
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@ -229,13 +283,21 @@ function goToDetail(notice: any) {
|
|||||||
|
|
||||||
const getArticleList = async () => {
|
const getArticleList = async () => {
|
||||||
if (curXs.value && curXs.value.njmcId) {
|
if (curXs.value && curXs.value.njmcId) {
|
||||||
const params = Object.assign({}, pageParams.value, { njmcId: curXs.value.njmcId });
|
const params = {
|
||||||
|
page: pageParams.value.page,
|
||||||
|
rows: pageParams.value.rows,
|
||||||
|
appCode: getAppCode,
|
||||||
|
fbfw: 'JZ', // 发布范围:家长端
|
||||||
|
xqId: curXs.value.xqId || curXs.value.xq_id, // 学生所在学期
|
||||||
|
fbNjmcId: curXs.value.njmcId, // 学生所在年级
|
||||||
|
releaseFlag: 'A' // 发布状态:有效
|
||||||
|
};
|
||||||
|
|
||||||
cmsArticlePageApi(params).then(res => {
|
getNoticeListApi(params).then(res => {
|
||||||
announcements.value = res.rows;
|
announcements.value = res.rows;
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
// 接口调用失败
|
// 接口调用失败
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -255,8 +317,66 @@ onMounted(async () => {
|
|||||||
|
|
||||||
// 初始化时检查是否需要刷新学生信息
|
// 初始化时检查是否需要刷新学生信息
|
||||||
await checkAndRefreshStudentInfo();
|
await checkAndRefreshStudentInfo();
|
||||||
|
|
||||||
|
// 检查权限缓存,确保权限数据是最新的
|
||||||
|
const userStore = useUserStore();
|
||||||
|
const changeTime = userStore.getChangeTime;
|
||||||
|
if (changeTime) {
|
||||||
|
// 如果有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');
|
||||||
|
const currentPermissions = userStore.getAuth;
|
||||||
|
if (currentPermissions && currentPermissions.length > 0) {
|
||||||
|
refreshPermissionCache(currentPermissions, changeTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查用户是否已关注服务号
|
||||||
|
await checkSubscribeStatus();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 检查关注状态
|
||||||
|
const checkSubscribeStatus = async () => {
|
||||||
|
const userStore = useUserStore();
|
||||||
|
const userInfo = userStore.getUser;
|
||||||
|
|
||||||
|
if (userInfo && !userInfo.subscribed) {
|
||||||
|
// 延迟显示关注提醒,避免与启动页面冲突
|
||||||
|
setTimeout(() => {
|
||||||
|
showSubscribeReminder();
|
||||||
|
}, 2000);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 显示关注提醒
|
||||||
|
const showSubscribeReminder = () => {
|
||||||
|
uni.showModal({
|
||||||
|
title: '关注服务号',
|
||||||
|
content: '请先关注我们的服务号,以便接收重要通知',
|
||||||
|
showCancel: true,
|
||||||
|
cancelText: '稍后关注',
|
||||||
|
confirmText: '立即关注',
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
// 跳转到关注页面
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/system/subscribe/index'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
// 页面显示时检查是否需要刷新
|
// 页面显示时检查是否需要刷新
|
||||||
onShow(async () => {
|
onShow(async () => {
|
||||||
await checkAndRefreshStudentInfo();
|
await checkAndRefreshStudentInfo();
|
||||||
|
|||||||
@ -16,6 +16,7 @@ import {onLoad} from "@dcloudio/uni-app";
|
|||||||
import {useDataStore} from "@/store/modules/data";
|
import {useDataStore} from "@/store/modules/data";
|
||||||
import {useUserStore} from "@/store/modules/user";
|
import {useUserStore} from "@/store/modules/user";
|
||||||
import {checkOpenId} from "@/api/system/login";
|
import {checkOpenId} from "@/api/system/login";
|
||||||
|
import {refreshPermissionCache} from "@/utils/permission";
|
||||||
|
|
||||||
const { setGlobal } = useDataStore();
|
const { setGlobal } = useDataStore();
|
||||||
const { afterLoginAction } = useUserStore();
|
const { afterLoginAction } = useUserStore();
|
||||||
@ -36,24 +37,35 @@ function toHome(data: any) {
|
|||||||
onLoad(async (data: any) => {
|
onLoad(async (data: any) => {
|
||||||
setGlobal(data);
|
setGlobal(data);
|
||||||
if (data && data.openId) {
|
if (data && data.openId) {
|
||||||
checkOpenId({ openId: data.openId, appCode: "JZ" })
|
try {
|
||||||
.then(async (res) => {
|
const res = await checkOpenId({ openId: data.openId, appCode: "JZ" });
|
||||||
if (res.resultCode == 1) {
|
|
||||||
if (res.result) {
|
if (res.resultCode == 1 && res.result) {
|
||||||
afterLoginAction(res.result);
|
// 执行登录操作
|
||||||
toHome(data);
|
afterLoginAction(res.result);
|
||||||
return;
|
|
||||||
|
// 如果有changeTime参数,更新权限缓存
|
||||||
|
if (data.changeTime) {
|
||||||
|
const userStore = useUserStore();
|
||||||
|
const currentPermissions = userStore.getAuth;
|
||||||
|
|
||||||
|
if (currentPermissions && currentPermissions.length > 0) {
|
||||||
|
refreshPermissionCache(currentPermissions, data.changeTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
uni.reLaunch({
|
|
||||||
url: "/pages/system/login/login",
|
// 直接跳转到首页,关注检查在首页进行
|
||||||
});
|
toHome(data);
|
||||||
})
|
} else {
|
||||||
.catch((err) => {
|
uni.reLaunch({
|
||||||
uni.reLaunch({
|
url: "/pages/system/login/login",
|
||||||
url: "/pages/system/login/login",
|
});
|
||||||
});
|
}
|
||||||
});
|
} catch (err) {
|
||||||
|
uni.reLaunch({
|
||||||
|
url: "/pages/system/login/login",
|
||||||
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
url: "/pages/system/login/login",
|
url: "/pages/system/login/login",
|
||||||
|
|||||||
@ -124,6 +124,7 @@ import { loginRegisterJzApi } from "@/api/base/server";
|
|||||||
import { useUserStore } from "@/store/modules/user";
|
import { useUserStore } from "@/store/modules/user";
|
||||||
import { useDataStore } from "@/store/modules/data";
|
import { useDataStore } from "@/store/modules/data";
|
||||||
import {imagUrl} from "@/utils";
|
import {imagUrl} from "@/utils";
|
||||||
|
import {refreshPermissionCache} from "@/utils/permission";
|
||||||
|
|
||||||
const dicOptions = ref<any>([[[]]]);
|
const dicOptions = ref<any>([[[]]]);
|
||||||
const dicPickerRef = ref();
|
const dicPickerRef = ref();
|
||||||
@ -264,7 +265,7 @@ function toHome() {
|
|||||||
});
|
});
|
||||||
} else if (getGlobal.type == 2) {
|
} else if (getGlobal.type == 2) {
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
url: "/pages/base/course-selection/club-selection",
|
url: "/pages/base/course-selection/noticeclub",
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
@ -305,6 +306,17 @@ async function submit() {
|
|||||||
hideLoading();
|
hideLoading();
|
||||||
if (res.resultCode == 1) {
|
if (res.resultCode == 1) {
|
||||||
afterLoginAction(res.result);
|
afterLoginAction(res.result);
|
||||||
|
|
||||||
|
// 如果有changeTime参数,更新权限缓存
|
||||||
|
if (res.result && res.result.changeTime) {
|
||||||
|
const userStore = useUserStore();
|
||||||
|
const currentPermissions = userStore.getAuth;
|
||||||
|
|
||||||
|
if (currentPermissions && currentPermissions.length > 0) {
|
||||||
|
refreshPermissionCache(currentPermissions, res.result.changeTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
toHome();
|
toHome();
|
||||||
} else {
|
} else {
|
||||||
showToast({ title: res.message || "提交失败", icon: "none" });
|
showToast({ title: res.message || "提交失败", icon: "none" });
|
||||||
|
|||||||
194
src/pages/system/subscribe/index.vue
Normal file
194
src/pages/system/subscribe/index.vue
Normal file
@ -0,0 +1,194 @@
|
|||||||
|
<template>
|
||||||
|
<view class="subscribe-page">
|
||||||
|
<!-- 内容区域 -->
|
||||||
|
<view class="content-container">
|
||||||
|
<!-- 二维码区域 -->
|
||||||
|
<view class="qr-section">
|
||||||
|
<view class="qr-container">
|
||||||
|
<image src="/static/base/home/rdcode.jpg" class="qr-code" mode="aspectFit"></image>
|
||||||
|
</view>
|
||||||
|
<text class="qr-tip">请长按二维码识别并关注我们的服务号</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 关注好处 -->
|
||||||
|
<view class="benefits-section">
|
||||||
|
<view class="section-title">
|
||||||
|
<text class="title-text">关注后可享受</text>
|
||||||
|
</view>
|
||||||
|
<view class="benefits-list">
|
||||||
|
<view class="benefit-item">
|
||||||
|
<view class="benefit-icon">
|
||||||
|
<uni-icons type="notification" size="20" color="#4A90E2"></uni-icons>
|
||||||
|
</view>
|
||||||
|
<view class="benefit-content">
|
||||||
|
<text class="benefit-title">重要通知</text>
|
||||||
|
<text class="benefit-desc">及时接收学校重要通知和公告</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="benefit-item">
|
||||||
|
<view class="benefit-icon">
|
||||||
|
<uni-icons type="calendar" size="20" color="#4A90E2"></uni-icons>
|
||||||
|
</view>
|
||||||
|
<view class="benefit-content">
|
||||||
|
<text class="benefit-title">课程安排</text>
|
||||||
|
<text class="benefit-desc">课程变更和安排调整实时推送</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="benefit-item">
|
||||||
|
<view class="benefit-icon">
|
||||||
|
<uni-icons type="star" size="20" color="#4A90E2"></uni-icons>
|
||||||
|
</view>
|
||||||
|
<view class="benefit-content">
|
||||||
|
<text class="benefit-title">成绩查询</text>
|
||||||
|
<text class="benefit-desc">考试成绩发布第一时间通知</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="benefit-item">
|
||||||
|
<view class="benefit-icon">
|
||||||
|
<uni-icons type="checkmarkempty" size="20" color="#4A90E2"></uni-icons>
|
||||||
|
</view>
|
||||||
|
<view class="benefit-content">
|
||||||
|
<text class="benefit-title">请假审批</text>
|
||||||
|
<text class="benefit-desc">请假申请审批结果及时反馈</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { useDataStore } from '@/store/modules/data';
|
||||||
|
|
||||||
|
const { getGlobal } = useDataStore();
|
||||||
|
|
||||||
|
// 页面逻辑保持不变,但移除按钮相关的方法
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.subscribe-page {
|
||||||
|
min-height: 100vh;
|
||||||
|
background: linear-gradient(135deg, #f4f5f7 0%, #e8f0ff 100%);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding: 40rpx 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-container {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
gap: 40rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.qr-section {
|
||||||
|
background: white;
|
||||||
|
border-radius: 24rpx;
|
||||||
|
padding: 60rpx 40rpx;
|
||||||
|
text-align: center;
|
||||||
|
box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.1);
|
||||||
|
width: 100%;
|
||||||
|
max-width: 600rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.qr-container {
|
||||||
|
margin-bottom: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.qr-code {
|
||||||
|
width: 400rpx;
|
||||||
|
height: 400rpx;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
box-shadow: 0 12rpx 36rpx rgba(0, 0, 0, 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
.qr-tip {
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #333;
|
||||||
|
line-height: 1.5;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.benefits-section {
|
||||||
|
background: white;
|
||||||
|
border-radius: 24rpx;
|
||||||
|
padding: 40rpx 30rpx;
|
||||||
|
box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.1);
|
||||||
|
width: 100%;
|
||||||
|
max-width: 600rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-title {
|
||||||
|
margin-bottom: 40rpx;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title-text {
|
||||||
|
font-size: 36rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #333;
|
||||||
|
position: relative;
|
||||||
|
padding-left: 24rpx;
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
width: 8rpx;
|
||||||
|
height: 32rpx;
|
||||||
|
background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
|
||||||
|
border-radius: 4rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.benefits-list {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.benefit-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.benefit-icon {
|
||||||
|
width: 80rpx;
|
||||||
|
height: 80rpx;
|
||||||
|
background: linear-gradient(135deg, #f0f4ff 0%, #e6f0ff 100%);
|
||||||
|
border-radius: 16rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
flex-shrink: 0;
|
||||||
|
box-shadow: 0 6rpx 16rpx rgba(74, 144, 226, 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
.benefit-content {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 12rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.benefit-title {
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.benefit-desc {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #666;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
1
src/static/base/home/details.svg
Normal file
1
src/static/base/home/details.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1754283033015" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="10483" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M511.812 929.397c-230.391 0-417.826-187.434-417.826-417.821 0-230.391 187.434-417.826 417.826-417.826 230.386 0 417.821 187.434 417.821 417.826 0 230.386-187.436 417.821-417.821 417.821zM511.812 137.482c-206.277 0-374.092 167.815-374.092 374.093 0 206.273 167.815 374.089 374.092 374.089 206.273 0 374.089-167.815 374.089-374.089 0-206.277-167.815-374.093-374.089-374.093z" p-id="10484" fill="#1296db"></path><path d="M589.938 510.195l-164.817 164.817 30.521 30.521 195.339-195.339-195.339-195.339-30.521 30.521z" p-id="10485" fill="#1296db"></path></svg>
|
||||||
|
After Width: | Height: | Size: 889 B |
BIN
src/static/base/home/rdcode.jpg
Normal file
BIN
src/static/base/home/rdcode.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.4 KiB |
@ -15,6 +15,7 @@ interface UserState {
|
|||||||
auth: string[];
|
auth: string[];
|
||||||
lastRefreshTime: number; // 上次刷新时间
|
lastRefreshTime: number; // 上次刷新时间
|
||||||
refreshInterval: number; // 刷新间隔(毫秒)
|
refreshInterval: number; // 刷新间隔(毫秒)
|
||||||
|
changeTime: string; // 权限变更时间
|
||||||
ws: any;
|
ws: any;
|
||||||
wsCallback: any;
|
wsCallback: any;
|
||||||
}
|
}
|
||||||
@ -32,6 +33,7 @@ export const useUserStore = defineStore({
|
|||||||
auth: [],
|
auth: [],
|
||||||
lastRefreshTime: 0, // 上次刷新时间
|
lastRefreshTime: 0, // 上次刷新时间
|
||||||
refreshInterval: 7 * 24 * 60 * 60 * 1000, // 刷新间隔(毫秒)
|
refreshInterval: 7 * 24 * 60 * 60 * 1000, // 刷新间隔(毫秒)
|
||||||
|
changeTime: '', // 权限变更时间
|
||||||
ws: null,
|
ws: null,
|
||||||
wsCallback: defWsCallback
|
wsCallback: defWsCallback
|
||||||
}),
|
}),
|
||||||
@ -53,6 +55,9 @@ export const useUserStore = defineStore({
|
|||||||
},
|
},
|
||||||
getRefreshInterval(): number {
|
getRefreshInterval(): number {
|
||||||
return this.refreshInterval;
|
return this.refreshInterval;
|
||||||
|
},
|
||||||
|
getChangeTime(): string {
|
||||||
|
return this.changeTime;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
@ -74,6 +79,9 @@ export const useUserStore = defineStore({
|
|||||||
setRefreshInterval(interval: number) {
|
setRefreshInterval(interval: number) {
|
||||||
this.refreshInterval = interval;
|
this.refreshInterval = interval;
|
||||||
},
|
},
|
||||||
|
setChangeTime(changeTime: string) {
|
||||||
|
this.changeTime = changeTime;
|
||||||
|
},
|
||||||
// 更新学生信息
|
// 更新学生信息
|
||||||
updateStudentInfo(studentInfo: any) {
|
updateStudentInfo(studentInfo: any) {
|
||||||
this.setCurXs(studentInfo);
|
this.setCurXs(studentInfo);
|
||||||
|
|||||||
@ -2,11 +2,258 @@ import {ISROUTERINTERCEPT} from "@/config";
|
|||||||
import {getRouter} from "@/utils/uniapp";
|
import {getRouter} from "@/utils/uniapp";
|
||||||
import {useUserStore} from "@/store/modules/user";
|
import {useUserStore} from "@/store/modules/user";
|
||||||
|
|
||||||
export function _auth(autd: string) {
|
// 权限缓存接口
|
||||||
const {getAuth} = useUserStore()
|
interface PermissionCache {
|
||||||
return getAuth.includes(autd);
|
permissions: string[];
|
||||||
|
timestamp: number;
|
||||||
|
userId: string;
|
||||||
|
changeTime: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 存储键名
|
||||||
|
const PERMISSION_CACHE_KEY = 'permission_cache';
|
||||||
|
const CHANGE_TIME_KEY = 'change_time';
|
||||||
|
|
||||||
|
// 存储操作
|
||||||
|
function setStorage(key: string, value: any): void {
|
||||||
|
try {
|
||||||
|
const jsonValue = JSON.stringify(value);
|
||||||
|
uni.setStorageSync(key, jsonValue);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('存储权限缓存失败:', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getStorage(key: string): any {
|
||||||
|
try {
|
||||||
|
const value = uni.getStorageSync(key);
|
||||||
|
|
||||||
|
if (value) {
|
||||||
|
const parsedValue = JSON.parse(value);
|
||||||
|
return parsedValue;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取权限缓存失败:', error);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 从app-user获取changeTime
|
||||||
|
export function getChangeTimeFromAppUser(): string | null {
|
||||||
|
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) {
|
||||||
|
console.error('获取changeTime失败:', error);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置changeTime到app-user
|
||||||
|
function setChangeTimeToAppUser(changeTime: string): void {
|
||||||
|
try {
|
||||||
|
const userDataStr = uni.getStorageSync('app-user');
|
||||||
|
if (!userDataStr) return;
|
||||||
|
|
||||||
|
const userData = typeof userDataStr === 'string' ? JSON.parse(userDataStr) : userDataStr;
|
||||||
|
userData.changeTime = changeTime;
|
||||||
|
uni.setStorageSync('app-user', JSON.stringify(userData));
|
||||||
|
} catch (error) {
|
||||||
|
console.error('设置changeTime失败:', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取权限缓存
|
||||||
|
function getPermissionCache(): PermissionCache | null {
|
||||||
|
return getStorage(PERMISSION_CACHE_KEY);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置权限缓存
|
||||||
|
function setPermissionCache(permissions: string[], userId: string, changeTime?: string): void {
|
||||||
|
const cache: PermissionCache = {
|
||||||
|
permissions,
|
||||||
|
timestamp: Date.now(),
|
||||||
|
userId,
|
||||||
|
changeTime: changeTime || ''
|
||||||
|
};
|
||||||
|
|
||||||
|
setStorage(PERMISSION_CACHE_KEY, cache);
|
||||||
|
|
||||||
|
if (changeTime) {
|
||||||
|
setChangeTimeToAppUser(changeTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 清除权限缓存
|
||||||
|
function clearPermissionCache(): void {
|
||||||
|
try {
|
||||||
|
uni.removeStorageSync(PERMISSION_CACHE_KEY);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('清除权限缓存失败:', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查缓存是否有效
|
||||||
|
function isCacheValid(cache: PermissionCache, currentUserId: string): boolean {
|
||||||
|
if (!cache || !cache.permissions || cache.userId !== currentUserId) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查缓存是否过期(7天)
|
||||||
|
const now = Date.now();
|
||||||
|
const cacheAge = now - cache.timestamp;
|
||||||
|
const maxAge = 7 * 24 * 60 * 60 * 1000; // 7天
|
||||||
|
|
||||||
|
return cacheAge < maxAge;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取用户权限(带缓存)
|
||||||
|
function getUserPermissionsWithCache(currentChangeTime?: string): string[] {
|
||||||
|
const userStore = useUserStore();
|
||||||
|
const currentUser = userStore.getUser;
|
||||||
|
const currentUserId = currentUser?.userId || currentUser?.id;
|
||||||
|
|
||||||
|
if (!currentUserId) {
|
||||||
|
return userStore.getAuth;
|
||||||
|
}
|
||||||
|
|
||||||
|
const cache = getPermissionCache();
|
||||||
|
|
||||||
|
if (cache && isCacheValid(cache, currentUserId)) {
|
||||||
|
if (currentChangeTime) {
|
||||||
|
const serverTime = new Date(currentChangeTime).getTime();
|
||||||
|
const cacheTime = new Date(cache.changeTime).getTime();
|
||||||
|
|
||||||
|
if (serverTime > cacheTime) {
|
||||||
|
const permissions = userStore.getAuth;
|
||||||
|
if (permissions && permissions.length > 0) {
|
||||||
|
setPermissionCache(permissions, currentUserId, currentChangeTime);
|
||||||
|
}
|
||||||
|
return permissions;
|
||||||
|
} else {
|
||||||
|
return cache.permissions;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return cache.permissions;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const permissions = userStore.getAuth;
|
||||||
|
if (permissions && permissions.length > 0) {
|
||||||
|
setPermissionCache(permissions, currentUserId, currentChangeTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
return permissions;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 刷新权限缓存
|
||||||
|
export function refreshPermissionCache(permissions?: string[], changeTime?: string): void {
|
||||||
|
const userStore = useUserStore();
|
||||||
|
const currentUser = userStore.getUser;
|
||||||
|
const currentUserId = currentUser?.userId || currentUser?.id;
|
||||||
|
|
||||||
|
if (!currentUserId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const permissionList = permissions || userStore.getAuth;
|
||||||
|
|
||||||
|
const currentCache = getPermissionCache();
|
||||||
|
if (currentCache && currentCache.permissions && permissionList) {
|
||||||
|
const isSame = JSON.stringify(currentCache.permissions.sort()) === JSON.stringify(permissionList.sort());
|
||||||
|
if (isSame && currentCache.changeTime === changeTime) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setPermissionCache(permissionList, currentUserId, changeTime);
|
||||||
|
|
||||||
|
if (changeTime) {
|
||||||
|
userStore.setChangeTime(changeTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 清除权限缓存(供外部调用)
|
||||||
|
export function clearPermissionCachePublic(): void {
|
||||||
|
clearPermissionCache();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 权限检查函数
|
||||||
|
export function _auth(autd: string, changeTime?: string) {
|
||||||
|
const permissions = getUserPermissionsWithCache(changeTime);
|
||||||
|
return permissions.includes(autd);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function hasPermission(permissionKey: string, changeTime?: string): boolean {
|
||||||
|
if (!permissionKey) return true;
|
||||||
|
const permissions = getUserPermissionsWithCache(changeTime);
|
||||||
|
// 去重处理,避免重复权限影响判断
|
||||||
|
const uniquePermissions = [...new Set(permissions)];
|
||||||
|
return uniquePermissions.includes(permissionKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function hasAnyPermission(permissionKeys: string[], changeTime?: string): boolean {
|
||||||
|
if (!permissionKeys || permissionKeys.length === 0) return true;
|
||||||
|
const permissions = getUserPermissionsWithCache(changeTime);
|
||||||
|
// 去重处理,避免重复权限影响判断
|
||||||
|
const uniquePermissions = [...new Set(permissions)];
|
||||||
|
return permissionKeys.some(key => uniquePermissions.includes(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
export function hasAllPermissions(permissionKeys: string[], changeTime?: string): boolean {
|
||||||
|
if (!permissionKeys || permissionKeys.length === 0) return true;
|
||||||
|
const permissions = getUserPermissionsWithCache(changeTime);
|
||||||
|
// 去重处理,避免重复权限影响判断
|
||||||
|
const uniquePermissions = [...new Set(permissions)];
|
||||||
|
return permissionKeys.every(key => uniquePermissions.includes(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取用户权限
|
||||||
|
export function getUserPermissions(changeTime?: string): string[] {
|
||||||
|
return getUserPermissionsWithCache(changeTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 权限缓存管理器
|
||||||
|
export const PermissionCacheManager = {
|
||||||
|
getCacheInfo() {
|
||||||
|
const cache = getPermissionCache();
|
||||||
|
const changeTime = getChangeTimeFromAppUser();
|
||||||
|
return {
|
||||||
|
cache,
|
||||||
|
changeTime,
|
||||||
|
hasCache: !!cache,
|
||||||
|
cacheAge: cache ? Date.now() - cache.timestamp : 0
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
debugCache() {
|
||||||
|
const info = this.getCacheInfo();
|
||||||
|
console.log('权限缓存信息:', info);
|
||||||
|
},
|
||||||
|
|
||||||
|
forceRefresh() {
|
||||||
|
clearPermissionCache();
|
||||||
|
const userStore = useUserStore();
|
||||||
|
const permissions = userStore.getAuth;
|
||||||
|
if (permissions && permissions.length > 0) {
|
||||||
|
const currentUser = userStore.getUser;
|
||||||
|
const currentUserId = currentUser?.userId || currentUser?.id;
|
||||||
|
if (currentUserId) {
|
||||||
|
setPermissionCache(permissions, currentUserId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
clear() {
|
||||||
|
clearPermissionCache();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
function loginPage(url: string) {
|
function loginPage(url: string) {
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: "/pages/system/login/login?redirect=" + url,
|
url: "/pages/system/login/login?redirect=" + url,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user