调整头像显示
This commit is contained in:
parent
9e68d93eaa
commit
ee2e2fc16c
@ -75,3 +75,31 @@ export const xsKsccApi = async (params: any) => {
|
||||
export const xsKscjApi = async (params: any) => {
|
||||
return await get("/mobile/jz/kscj", params);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* 家长抢课
|
||||
*/
|
||||
export const jzXkQkjApi = async (params: any) => {
|
||||
return await post("/mobile/jz/xk/qk", params);
|
||||
};
|
||||
/**
|
||||
* 家长发起缴费
|
||||
*/
|
||||
export const jzXkFqJfjApi = async (params: any) => {
|
||||
return await post("/mobile/jz/xk/fqjf", params);
|
||||
};
|
||||
|
||||
/**
|
||||
* 家长退课
|
||||
*/
|
||||
export const jzXkTkjApi = async (params: any) => {
|
||||
return await post("/mobile/jz/xk/tk", params);
|
||||
};
|
||||
|
||||
/**
|
||||
* 家长缴费查询
|
||||
*/
|
||||
export const jzXkJfCxjApi = async (params: any) => {
|
||||
return await post("/mobile/jz/xk/jfcx", params);
|
||||
};
|
||||
|
||||
@ -6,23 +6,15 @@
|
||||
</view>
|
||||
|
||||
<view class="date-tabs">
|
||||
<view
|
||||
v-for="(day, index) in rqList"
|
||||
:key="index"
|
||||
:class="['date-tab-item', { active: curRqIndex === index }]"
|
||||
@click="selectDay(index)"
|
||||
>
|
||||
<view v-for="(day, index) in rqList" :key="index" :class="['date-tab-item', { active: curRqIndex === index }]"
|
||||
@click="selectDay(index)">
|
||||
<text class="weekday">{{ day.zjmc }}</text>
|
||||
<text class="date">{{ day.rqmc }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="schedule-body">
|
||||
<view
|
||||
v-for="(sj, index) in sjList"
|
||||
:key="index"
|
||||
class="schedule-row"
|
||||
>
|
||||
<view v-for="(sj, index) in sjList" :key="index" class="schedule-row">
|
||||
<view class="time-slot">
|
||||
<text class="slot-name">{{ sj.mc }}</text>
|
||||
<text class="slot-time">{{ sj.kssj }}-{{ sj.jssj }}</text>
|
||||
@ -30,11 +22,8 @@
|
||||
|
||||
<view class="course-container">
|
||||
<template v-if="sj.pkkbList && sj.pkkbList.length > 0">
|
||||
<view
|
||||
v-for="(pkkb, pkkbIndex) in sj.pkkbList"
|
||||
:key="pkkbIndex"
|
||||
:class="['course-card', getCourseColorClass(pkkb.pkName)]"
|
||||
>
|
||||
<view v-for="(pkkb, pkkbIndex) in sj.pkkbList" :key="pkkbIndex"
|
||||
:class="['course-card', getCourseColorClass(pkkb.pkName)]">
|
||||
<text class="course-subject">{{ pkkb.pkName }}</text>
|
||||
<text class="course-class">{{ pkkb.jsName }}</text>
|
||||
</view>
|
||||
@ -57,20 +46,11 @@
|
||||
<text class="title">选择周</text>
|
||||
</view>
|
||||
<view class="week-list">
|
||||
<scroll-view
|
||||
scroll-y
|
||||
style="max-height: 60vh"
|
||||
:scroll-top="targetScrollTop"
|
||||
>
|
||||
<view
|
||||
v-for="(zc, index) in zcList"
|
||||
:key="index"
|
||||
:class="[
|
||||
<scroll-view scroll-y style="max-height: 60vh" :scroll-top="targetScrollTop">
|
||||
<view v-for="(zc, index) in zcList" :key="index" :class="[
|
||||
'week-item',
|
||||
{ active: zc.djz === curZc.djz },
|
||||
]"
|
||||
@click="selectWeek(zc)"
|
||||
>
|
||||
]" @click="selectWeek(zc)">
|
||||
<text>{{ zc.mc }}</text>
|
||||
<text v-if="zc.djz === curZc.djz" class="current-tag">当前周</text>
|
||||
</view>
|
||||
@ -88,7 +68,6 @@ import "dayjs/locale/zh-cn";
|
||||
import weekOfYear from "dayjs/plugin/weekOfYear";
|
||||
import isoWeek from "dayjs/plugin/isoWeek";
|
||||
import { dqpkApi, drpkkbApi } from "@/api/base/server";
|
||||
import * as DataConfig from "data.config";
|
||||
import { useUserStore } from "@/store/modules/user";
|
||||
const { getCurXs } = useUserStore();
|
||||
|
||||
@ -363,14 +342,17 @@ onMounted(async () => {
|
||||
background-color: #ffebee;
|
||||
border-left: 3px solid #f44336;
|
||||
}
|
||||
|
||||
&.color-phys {
|
||||
background-color: #e3f2fd;
|
||||
border-left: 3px solid #2196f3;
|
||||
}
|
||||
|
||||
&.color-math {
|
||||
background-color: #e8f5e9;
|
||||
border-left: 3px solid #4caf50;
|
||||
}
|
||||
|
||||
&.color-other {
|
||||
background-color: #f5f5f5;
|
||||
border-left: 3px solid #9e9e9e;
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
<view class="student-selector-bar" @click="clickShowXsSelector">
|
||||
<view class="user-avatar">
|
||||
<image
|
||||
:src="curXs.avatar || '/static/base/home/11222.png'"
|
||||
:src="curXs.xstxUrl || '/static/base/home/11222.png'"
|
||||
class="w-full h-full"
|
||||
></image>
|
||||
</view>
|
||||
@ -95,7 +95,7 @@
|
||||
>
|
||||
<view class="student-avatar">
|
||||
<image
|
||||
:src="xs.avatar || '/static/base/home/11222.png'"
|
||||
:src="xs.xstxUrl || '/static/base/home/11222.png'"
|
||||
class="w-full h-full"
|
||||
></image>
|
||||
</view>
|
||||
|
||||
@ -14,17 +14,17 @@
|
||||
<view class="student-selector-bar" @click="showStudentSelector">
|
||||
<view class="user-avatar">
|
||||
<image
|
||||
:src="currentStudent.avatar || '/static/base/home/11222.png'"
|
||||
:src="curXs.xstxUrl || '/static/base/home/11222.png'"
|
||||
class="w-full h-full"
|
||||
></image>
|
||||
</view>
|
||||
<view class="student-info">
|
||||
<text class="student-name">{{ currentStudent.xm }}</text>
|
||||
<text class="student-name">{{ curXs.xm }}</text>
|
||||
<text class="student-class"
|
||||
>{{ currentStudent.njmc }} {{ currentStudent.bjmc }}</text
|
||||
>{{ curXs.njmc }} {{ curXs.bjmc }}</text
|
||||
>
|
||||
</view>
|
||||
<view class="switch-btn" v-if="studentList.length > 1">切换</view>
|
||||
<view class="switch-btn" v-if="xsList.length > 1">切换</view>
|
||||
</view>
|
||||
<view class="countdown-section">
|
||||
<template v-if="!isEnrollmentEnded">
|
||||
@ -59,9 +59,9 @@
|
||||
<!-- 可滚动的内容区域 -->
|
||||
<view class="scrollable-content">
|
||||
<!-- 课程网格列表 -->
|
||||
<view class="course-grid" v-if="courseListData.length > 0">
|
||||
<view class="course-grid" v-if="xkkcList.length > 0">
|
||||
<view
|
||||
v-for="(course, index) in courseListData"
|
||||
v-for="(course, index) in xkkcList"
|
||||
:key="course.id || index"
|
||||
class="course-item"
|
||||
:class="{ selected: course.isSelected }"
|
||||
@ -124,28 +124,28 @@
|
||||
</view>
|
||||
<view class="student-list">
|
||||
<view
|
||||
v-for="(student, index) in studentList"
|
||||
v-for="(xs, index) in xsList"
|
||||
:key="index"
|
||||
class="student-item"
|
||||
:class="{
|
||||
'student-item-active': currentStudent.id === student.id,
|
||||
'student-item-active': curXs.id === xs.id,
|
||||
}"
|
||||
@click="switchStudent(student)"
|
||||
@click="switchXs(xs)"
|
||||
>
|
||||
<view class="student-avatar">
|
||||
<image
|
||||
:src="student.avatar || '/static/base/home/11222.png'"
|
||||
:src="xs.xstxUrl || '/static/base/home/11222.png'"
|
||||
class="w-full h-full"
|
||||
></image>
|
||||
</view>
|
||||
<view class="student-info">
|
||||
<text class="student-name">{{ student.xm }}</text>
|
||||
<text class="student-name">{{ xs.xm }}</text>
|
||||
<text class="student-class"
|
||||
>{{ student.njmc }} {{ student.bjmc }}</text
|
||||
>{{ xs.njmc }} {{ xs.bjmc }}</text
|
||||
>
|
||||
</view>
|
||||
<u-icon
|
||||
v-if="currentStudent.id === student.id"
|
||||
v-if="curXs.id === xs.id"
|
||||
name="checkmark"
|
||||
color="#409EFF"
|
||||
size="20"
|
||||
@ -198,19 +198,15 @@ let countdownTimer: number | null = null;
|
||||
const remainTime = ref("00:00:00");
|
||||
|
||||
// 学生列表数据
|
||||
const studentList = computed(() => {
|
||||
const xsList = computed(() => {
|
||||
return getUser.xsList;
|
||||
});
|
||||
|
||||
const currentStudent = ref();
|
||||
const curXs = ref<any>({});
|
||||
|
||||
// 控制选择器显示状态
|
||||
const showSelector = ref(false);
|
||||
|
||||
if (studentList.value.length > 1) {
|
||||
showSelector.value = true;
|
||||
}
|
||||
|
||||
const kcData = ref();
|
||||
const kcStatus = ref(false);
|
||||
|
||||
@ -220,13 +216,13 @@ const isEnrollmentEnded = ref(false);
|
||||
// 添加轮询定时器变量
|
||||
let pollTimer: number | null = null;
|
||||
|
||||
const courseInfo = ref({});
|
||||
const curXkkc = ref({});
|
||||
|
||||
// 封装检查学生报名状态的通用方法
|
||||
function checkStudentEnrollmentApi(student: any): Promise<boolean> {
|
||||
function checkStudentEnrollmentApi(xs: any): Promise<boolean> {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!student || !student.id || !student.njId) {
|
||||
console.error("学生信息不完整:", student);
|
||||
if (!xs || !xs.id || !xs.njId) {
|
||||
console.error("学生信息不完整:", xs);
|
||||
resolve(false);
|
||||
return;
|
||||
}
|
||||
@ -240,8 +236,8 @@ function checkStudentEnrollmentApi(student: any): Promise<boolean> {
|
||||
|
||||
// 调用选课签到接口检查学生是否已报名
|
||||
xkXkqdApi({
|
||||
njId: student.njId,
|
||||
xsId: student.id,
|
||||
njId: xs.njId,
|
||||
xsId: xs.id,
|
||||
xklxId: "816059832", // 课程类型ID
|
||||
xkId: kcData.value.id,
|
||||
})
|
||||
@ -253,7 +249,7 @@ function checkStudentEnrollmentApi(student: any): Promise<boolean> {
|
||||
setData({
|
||||
...getData,
|
||||
kcData,
|
||||
studentInfo: student,
|
||||
studentInfo: xs,
|
||||
enrolledCourse: res.result,
|
||||
});
|
||||
resolve(res.result.length > 0); // 转换为布尔值返回
|
||||
@ -288,12 +284,12 @@ const pollEnrollmentCount = () => {
|
||||
const updateEnrollmentCount = (
|
||||
data: Array<{ xkkcId: string; bmrs: number }>
|
||||
) => {
|
||||
if (!Array.isArray(courseListData.value) || courseListData.value.length === 0)
|
||||
if (!Array.isArray(xkkcList.value) || xkkcList.value.length === 0)
|
||||
return;
|
||||
|
||||
let hasUpdates = false;
|
||||
|
||||
courseListData.value.forEach((course) => {
|
||||
xkkcList.value.forEach((course) => {
|
||||
const newCount = data.find((item) => item.xkkcId === course.id);
|
||||
if (newCount && course.ybmr !== newCount.bmrs) {
|
||||
course.ybmr = newCount.bmrs;
|
||||
@ -303,7 +299,7 @@ const updateEnrollmentCount = (
|
||||
|
||||
// 如果有更新,强制重新渲染列表
|
||||
if (hasUpdates) {
|
||||
courseListData.value = [...courseListData.value];
|
||||
xkkcList.value = [...xkkcList.value];
|
||||
}
|
||||
};
|
||||
|
||||
@ -329,8 +325,11 @@ const stopPolling = () => {
|
||||
|
||||
// 在组件挂载时开始轮询
|
||||
onMounted(() => {
|
||||
if (xsList.value.length > 0 && xsList.value.length === 1) {
|
||||
showSelector.value = true;
|
||||
}
|
||||
// 当课程列表加载完成后启动轮询
|
||||
watch(courseListData, (newVal) => {
|
||||
watch(xkkcList, (newVal) => {
|
||||
if (newVal.length > 0 && !pollTimer) {
|
||||
startPolling();
|
||||
}
|
||||
@ -338,11 +337,11 @@ onMounted(() => {
|
||||
});
|
||||
|
||||
// 页面初始化时检查当前学生是否已报名
|
||||
const checkInitialEnrollment = (currentStudent: any) => {
|
||||
if (!currentStudent) return;
|
||||
const checkInitialEnrollment = (curXs: any) => {
|
||||
if (!curXs) return;
|
||||
|
||||
// 使用封装的API函数检查学生报名状态
|
||||
checkStudentEnrollmentApi(currentStudent)
|
||||
checkStudentEnrollmentApi(curXs)
|
||||
.then((isEnrolled) => {
|
||||
if (isEnrolled) {
|
||||
uni.hideLoading();
|
||||
@ -358,14 +357,14 @@ const checkInitialEnrollment = (currentStudent: any) => {
|
||||
};
|
||||
|
||||
// 加载课程列表
|
||||
const loadCourseList = (currentStudent: any) => {
|
||||
if (!currentStudent) {
|
||||
const loadXkList = (curXs: any) => {
|
||||
if (!curXs) {
|
||||
uni.hideLoading();
|
||||
return;
|
||||
}
|
||||
|
||||
xkListApi({
|
||||
njId: currentStudent.njId,
|
||||
njId: curXs.njId,
|
||||
xklxId: "816059832",
|
||||
})
|
||||
.then((res) => {
|
||||
@ -397,7 +396,7 @@ const loadCourseList = (currentStudent: any) => {
|
||||
}
|
||||
|
||||
// 课程数据加载完成后,检查学生报名状态
|
||||
checkInitialEnrollment(currentStudent);
|
||||
checkInitialEnrollment(curXs);
|
||||
} else {
|
||||
uni.reLaunch({
|
||||
url: "/pages/base/course-selection/notopen",
|
||||
@ -411,25 +410,16 @@ const loadCourseList = (currentStudent: any) => {
|
||||
});
|
||||
};
|
||||
|
||||
if (studentList.value.length > 0 && studentList.value.length === 1) {
|
||||
currentStudent.value = studentList.value[0];
|
||||
// 先加载课程列表,不立即检查报名状态
|
||||
uni.showLoading({
|
||||
title: "加载中...",
|
||||
});
|
||||
loadCourseList(currentStudent.value);
|
||||
}
|
||||
|
||||
// 显示学生选择器
|
||||
function showStudentSelector() {
|
||||
if (studentList.value.length > 1) {
|
||||
const showStudentSelector = () => {
|
||||
if (xsList.value.length > 1) {
|
||||
showSelector.value = true;
|
||||
}
|
||||
}
|
||||
|
||||
// 切换学生
|
||||
function switchStudent(student: any) {
|
||||
currentStudent.value = student;
|
||||
const switchXs = (xs: any) => {
|
||||
curXs.value = xs;
|
||||
showSelector.value = false;
|
||||
|
||||
// 显示加载中
|
||||
@ -439,12 +429,12 @@ function switchStudent(student: any) {
|
||||
|
||||
// 显示切换成功提示
|
||||
uni.showToast({
|
||||
title: `已切换到${student.xm}`,
|
||||
title: `已切换到${xs.xm}`,
|
||||
icon: "none",
|
||||
});
|
||||
|
||||
// 先加载当前学生的课程列表,课程数据加载完成后会自动检查报名状态
|
||||
loadCourseList(student);
|
||||
loadXkList(xs);
|
||||
}
|
||||
|
||||
// 启动倒计时
|
||||
@ -535,26 +525,26 @@ const displayCourseList = computed(() => {
|
||||
});
|
||||
|
||||
// 可修改的课程列表数据
|
||||
const courseListData = ref<any[]>([]);
|
||||
const xkkcList = ref<any[]>([]);
|
||||
|
||||
// 计算已选择的课程数量
|
||||
const selectedCoursesCount = computed(() => {
|
||||
return courseListData.value.filter((course: any) => course.isSelected).length;
|
||||
return xkkcList.value.filter((course: any) => course.isSelected).length;
|
||||
});
|
||||
|
||||
// 监听计算属性变化,更新可修改的数据
|
||||
watch(
|
||||
displayCourseList,
|
||||
(newVal) => {
|
||||
courseListData.value = JSON.parse(JSON.stringify(newVal));
|
||||
xkkcList.value = JSON.parse(JSON.stringify(newVal));
|
||||
|
||||
// 初始化时,将已选课程的全部信息存入courseInfo
|
||||
// 初始化时,将已选课程的全部信息存入curXkkc
|
||||
const selectedCourseIds = uni.getStorageSync("selectedCourseIds") || [];
|
||||
if (selectedCourseIds.length > 0) {
|
||||
const selectedCourses = newVal.filter((course: any) =>
|
||||
selectedCourseIds.includes(course.id)
|
||||
);
|
||||
courseInfo.value = selectedCourses;
|
||||
curXkkc.value = selectedCourses;
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
@ -571,30 +561,30 @@ const toggleSelection = (course: any) => {
|
||||
return;
|
||||
}
|
||||
|
||||
const courseIndex = courseListData.value.findIndex(
|
||||
const courseIndex = xkkcList.value.findIndex(
|
||||
(item) => item.id === course.id
|
||||
);
|
||||
if (courseIndex === -1) return;
|
||||
|
||||
// 切换当前课程的选中状态
|
||||
courseListData.value[courseIndex].isSelected =
|
||||
!courseListData.value[courseIndex].isSelected;
|
||||
xkkcList.value[courseIndex].isSelected =
|
||||
!xkkcList.value[courseIndex].isSelected;
|
||||
|
||||
// 获取所有选中的课程ID
|
||||
const selectedCourseIds = courseListData.value
|
||||
const selectedCourseIds = xkkcList.value
|
||||
.filter((item: any) => item.isSelected)
|
||||
.map((item: any) => item.id);
|
||||
|
||||
// 存储选中的课程ID数组
|
||||
uni.setStorageSync("selectedCourseIds", selectedCourseIds);
|
||||
|
||||
// 更新courseInfo为所有选中的课程
|
||||
courseInfo.value = courseListData.value.filter(
|
||||
// 更新curXkkc为所有选中的课程
|
||||
curXkkc.value = xkkcList.value.filter(
|
||||
(item: any) => item.isSelected
|
||||
);
|
||||
|
||||
// 显示提示
|
||||
if (courseListData.value[courseIndex].isSelected) {
|
||||
if (xkkcList.value[courseIndex].isSelected) {
|
||||
uni.showToast({
|
||||
title: `已选择 ${course.kcmc}`,
|
||||
icon: "none",
|
||||
@ -649,7 +639,7 @@ const submitRegistration = () => {
|
||||
return;
|
||||
}
|
||||
|
||||
const selectedCourses = courseListData.value.filter(
|
||||
const selectedCourses = xkkcList.value.filter(
|
||||
(course: any) => course.isSelected
|
||||
);
|
||||
|
||||
@ -678,7 +668,7 @@ const submitRegistration = () => {
|
||||
|
||||
uni.showModal({
|
||||
title: "确认报名",
|
||||
content: `您确定要为${currentStudent.value.xm}报名以下课程吗?\n\n${courseNames}`,
|
||||
content: `您确定要为${curXs.value.xm}报名以下课程吗?\n\n${courseNames}`,
|
||||
success: async (res) => {
|
||||
if (res.confirm) {
|
||||
uni.showLoading({
|
||||
@ -691,7 +681,7 @@ const submitRegistration = () => {
|
||||
.join(",");
|
||||
|
||||
const res = await xkAddXkqdApi({
|
||||
xsId: currentStudent.value.id,
|
||||
xsId: curXs.value.id,
|
||||
xkkcId: selectedCourseIds,
|
||||
qmFile: sign_file,
|
||||
xklxId: "816059832",
|
||||
@ -701,7 +691,7 @@ const submitRegistration = () => {
|
||||
setData({
|
||||
...getData,
|
||||
kcData,
|
||||
studentInfo: currentStudent.value,
|
||||
studentInfo: curXs.value,
|
||||
enrolledCourse: res.result,
|
||||
});
|
||||
uni.showToast({
|
||||
|
||||
@ -133,10 +133,8 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import { cmsArticlePageApi } from "@/api/base/server";
|
||||
import { imagUrl } from "@/utils";
|
||||
import { useUserStore } from "@/store/modules/user";
|
||||
import { useDataStore } from "@/store/modules/data";
|
||||
import { get } from "lodash";
|
||||
const { getUser, setCurXs, getCurXs } = useUserStore();
|
||||
const { setData, getAppCode } = useDataStore();
|
||||
|
||||
@ -282,12 +280,7 @@ const getArticleList = async () => {
|
||||
|
||||
onMounted(async () => {
|
||||
xsList.value = getUser.xsList;
|
||||
for (let i = 0; i < xsList.value.length; i++) {
|
||||
const xs = xsList.value[i];
|
||||
xs.xstxUrl = imagUrl(xs.xstx) || "";
|
||||
}
|
||||
curXs.value = getCurXs;
|
||||
curXs.value.xstxUrl = imagUrl(getCurXs.xstx) || "";
|
||||
getArticleList();
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import { defineStore } from "pinia";
|
||||
import { authenticationApi, loginCode, loginPass, weChatLogin } from "@/api/system/login";
|
||||
import { AUTH_KEY } from "@/config";
|
||||
import { imagUrl } from "@/utils";
|
||||
|
||||
interface UserState {
|
||||
userdata: any;
|
||||
@ -53,7 +54,7 @@ export const useUserStore = defineStore({
|
||||
*/
|
||||
async codeLogin(params: { phone: number | string, code: number | string }) {
|
||||
try {
|
||||
const {result} = await loginCode({phone: params.phone, code: params.code});
|
||||
const { result } = await loginCode({ phone: params.phone, code: params.code, openId: '' });
|
||||
this.afterLoginAction(result)
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
@ -64,7 +65,7 @@ export const useUserStore = defineStore({
|
||||
*/
|
||||
async passwordLogin(params: { name: string, password: string }) {
|
||||
try {
|
||||
const {result} = await loginPass({username: params.name, password: params.password});
|
||||
const { result } = await loginPass({ username: params.name, password: params.password, openId: '' });
|
||||
this.afterLoginAction(result)
|
||||
} catch (e) {
|
||||
|
||||
@ -87,6 +88,10 @@ export const useUserStore = defineStore({
|
||||
afterLoginAction(value: any) {
|
||||
this.setUser(value)
|
||||
if (value.xsList && value.xsList.length > 0) {
|
||||
for (let i = 0; i < value.xsList.length; i++) {
|
||||
const xs = value.xsList[i];
|
||||
xs.xstxUrl = imagUrl(xs.xstx) || "";
|
||||
}
|
||||
this.setCurXs(value.xsList[0])
|
||||
} else {
|
||||
this.setCurXs({})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user