选课调整
This commit is contained in:
parent
8d74c22698
commit
f50635b6e1
@ -189,11 +189,27 @@ onMounted(async () => {
|
||||
xqId = res.result.dqXq.id;
|
||||
zcList.value = result.zcList;
|
||||
sjList.value = result.sjList;
|
||||
|
||||
// 按当前日期定位到对应的周次和星期几
|
||||
const today = dayjs();
|
||||
const currentWeekday = today.day(); // 0-6,0是周日
|
||||
const currentWeekdayIndex = currentWeekday === 0 ? 6 : currentWeekday - 1; // 转换为1-7,1是周一
|
||||
|
||||
// 查找当前周次
|
||||
let zc = zcList.value.find((item:any) => item.djz === dqZc);
|
||||
if (!zc) {
|
||||
zc = zcList.value[0];
|
||||
}
|
||||
|
||||
// 选择当前周次
|
||||
selectWeek(zc);
|
||||
|
||||
// 自动选择当前星期几
|
||||
if (rqList.value && rqList.value.length > 0) {
|
||||
// 确保索引在有效范围内
|
||||
const targetIndex = Math.min(currentWeekdayIndex, rqList.value.length - 1);
|
||||
selectDay(targetIndex);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
<view class="course-time"
|
||||
>上课时间:{{ courseDetail.studyTime }}</view
|
||||
>
|
||||
<view class="course-price">
|
||||
<view class="course-price" v-if="courseDetail.price > 0">
|
||||
金额:<text class="price-value">¥{{ courseDetail.price }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user