调整课表

This commit is contained in:
ywyonui 2025-09-29 22:42:00 +08:00
parent de714aeb69
commit d26a8fb38f

View File

@ -5,15 +5,18 @@
<uni-icons type="right" size="16" color="#fff"></uni-icons> <uni-icons type="right" size="16" color="#fff"></uni-icons>
</view> </view>
<view class="date-tabs"> <view class="date-tabs" v-if="rqList.length > 0">
<view v-for="(day, index) in rqList" :key="index" :class="['date-tab-item', { active: curRqIndex === index }]" <view v-for="(day, index) in rqList" :key="index" :class="['date-tab-item', { active: curRqIndex === index }]"
@click="selectDay(index)"> @click="selectDay(index)">
<text class="weekday">{{ day.zjmc }}</text> <text class="weekday">{{ day.zjmc }}</text>
<text class="date">{{ day.rqmc }}</text> <text class="date">{{ day.rqmc }}</text>
</view> </view>
</view> </view>
<view class="no-course-notice" v-else>
<text class="notice-text">本周处于节假日中无课程信息</text>
</view>
<view class="schedule-body"> <view class="schedule-body" v-if="rqList.length > 0 && sjList.length > 0">
<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"> <view class="time-slot">
<text class="slot-name">{{ sj.mc }}</text> <text class="slot-name">{{ sj.mc }}</text>
@ -88,7 +91,14 @@ const curRqIndex = ref(0)
// //
const zcList = ref<any>([]) const zcList = ref<any>([])
// //
const rqList = ref<any>([]) const rqList = computed(() => {
if (!curZc.value || !curZc.value.drList || !curZc.value.drList.length) {
return [];
}
return curZc.value.drList.filter((dr: any) => {
return (!dr.holiday && dr.zj <= 5) || (dr.holiday && dr.holiday.type != 2);
});
});
// //
const sjList = ref<any>([]) const sjList = ref<any>([])
@ -98,10 +108,8 @@ const isLoading = ref(false);
const showWeekPicker = ref(false); const showWeekPicker = ref(false);
const weekPopup = ref<any>(null); const weekPopup = ref<any>(null);
const selectedWeekNumber = ref(0);
const targetScrollTop = ref(0); // scroll-top const targetScrollTop = ref(0); // scroll-top
// //
const openWeekPicker = async () => { const openWeekPicker = async () => {
showWeekPicker.value = true; showWeekPicker.value = true;
@ -137,7 +145,6 @@ const selectWeek = (zc: any) => {
} }
// //
Object.assign(curZc.value, zc); Object.assign(curZc.value, zc);
Object.assign(rqList.value, curZc.value.drList);
// //
closeWeekPicker(); closeWeekPicker();
@ -152,13 +159,21 @@ const selectDay = (index: number) => {
if (!rqList.value.length) { if (!rqList.value.length) {
return; return;
} }
drpkkbApi({ const params = {
jsId: "", jsId: "",
bjId: getCurXs.bjId, bjId: getCurXs.bjId,
xqId: xqId, xqId: xqId,
rq: rqList.value[index].rq, // rq: rqList.value[index].rq, //
zj: rqList.value[index].zj zj: rqList.value[index].zj,
}).then(res => { txDate: null
};
if (params.zj > 5) {
const holiday = rqList.value[index].holiday || {};
if (holiday && holiday.type === 3 && holiday.txDate) {
params.txDate = holiday.txDate;
}
}
drpkkbApi(params).then(res => {
// result // result
if (res && res.resultCode === 1) { if (res && res.resultCode === 1) {
sjList.value = res.result; sjList.value = res.result;
@ -185,10 +200,10 @@ const getCourseColorClass = (subject: string | undefined): string => {
onMounted(async () => { onMounted(async () => {
const res = await dqpkApi(); const res = await dqpkApi();
const result = res.result; const result = res.result;
dqZc = res.result.dqZc; dqZc = res.result.zc;
xqId = res.result.dqXq.id; xqId = res.result.xq.id;
zcList.value = result.zcList; zcList.value = result.zcList;
sjList.value = result.sjList; sjList.value = [];
// //
const today = dayjs(); const today = dayjs();
@ -235,6 +250,7 @@ onMounted(async () => {
display: flex; display: flex;
background-color: #4477ee; background-color: #4477ee;
padding: 10px 15px 15px 15px; padding: 10px 15px 15px 15px;
overflow-x: auto;
gap: 10px; gap: 10px;
.date-tab-item { .date-tab-item {
@ -242,12 +258,13 @@ onMounted(async () => {
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
padding: 8px 5px; padding: 16rpx 10rpx;
border-radius: 6px; border-radius: 12rpx;
background-color: rgba(255, 255, 255, 0.1); background-color: rgba(255, 255, 255, 0.1);
color: #ffffff; color: #ffffff;
flex: 1; flex: 1;
min-width: 50px; min-width: 100rpx;
max-width: 118rpx;
cursor: pointer; cursor: pointer;
transition: background-color 0.2s ease; transition: background-color 0.2s ease;
@ -476,4 +493,14 @@ onMounted(async () => {
} }
} }
} }
.no-course-notice {
margin: 15px;
background-color: #fff;
border-radius: 8px;
padding: 50px 15px;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
text-align: center;
}
</style> </style>