Skip to content

Commit

Permalink
fix:修复了测试出现的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
luolananDR committed Jan 20, 2025
1 parent 363f7cb commit 8e7ae9c
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/components/ScoreTermPicker/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { systemStore } from "@/store";
interface PropsType {
year: string;
term: "" | "" | "" | "";
term: "" | "" | "" | "" ;
period?: "期中" | "期末";
selectflag: number; // flag为0表示学年、学期 ; 为1表示学年、学期、期中期末
}
Expand All @@ -48,7 +48,7 @@ const termYear = systemStore?.generalInfo?.termYear
const selectorArr = [
[["", "", "", ""]],
[["", "", "", ""], ["期中", "期末"]]
[["", "", "", "" ], ["期中", "期末"]]
];
const selector = reactive(selectorArr[props.selectflag]);
Expand Down
2 changes: 0 additions & 2 deletions src/pages/score/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
align-items: center;
justify-content: center;
background-color: var(--wjh-color-background-container);
border-bottom: 1Px solid var(--wjh-color-border);
font-size: 2.5rem;
color: var(--wjh-color-primary);
}
Expand Down Expand Up @@ -235,7 +234,6 @@ checkbox .wx-checkbox-input {
align-items: center;
justify-content: center;
background-color: var(--wjh-color-background-container);
border-bottom: 1Px solid var(--wjh-color-border);
font-size: 2.5rem;
color: var(--wjh-color-primary);
}
Expand Down
94 changes: 92 additions & 2 deletions src/pages/score/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,22 @@
{{ relativeTermInfo }}
</view>
</view>
<view v-if="selectTerm.year=='全'" class="col">
<view v-if="selectTerm.year=='全' && selectTerm.period == '期末'" class="col">
<view class="term-info">
总计绩点
</view>
<view class="relative-term-info">
入学后所有课程均绩
</view>
</view>
<view v-if="selectTerm.year=='全' && selectTerm.period == '期中'" class="col">
<view class="term-info">
总计成绩
</view>
<view class="relative-term-info">
入学后所有期中成绩
</view>
</view>
</view>

<view class="col">
Expand Down Expand Up @@ -158,6 +166,44 @@
</w-panel>
</w-collapse>

<w-button v-if="isEdit" class="lesson-group-btn" @tap="limitedLessonChange()">
限选课
</w-button>
<w-collapse v-if="isEdit" class="score-list-collapse">
<w-panel v-for="item in limitedScoreList" :key="item.lessonID">
<template #header>
<checkbox-group v-if="isEdit" @change="handleCheckboxChange(item)">
<checkbox
class="checkbox"
:checked="item.selected"
/>
</checkbox-group>
<view
v-if="item.selected"
class="score-list-collapse-item-title-selected"
color=""
@tap="handleCheckboxChange(item)"
>
{{ item.lessonName }}
</view>
<view v-if="item.selected" class="score-list-collapse-item-extra-selected" @tap="handleCheckboxChange(item)">
{{ item.score }}
</view>
<view
v-if="!item.selected"
class="score-list-collapse-item-title-unselected"
color=""
@tap="handleCheckboxChange(item)"
>
{{ item.lessonName }}
</view>
<view v-if="!item.selected" class="score-list-collapse-item-extra-unselected" @tap="handleCheckboxChange(item)">
{{ item.score }}
</view>
</template>
</w-panel>
</w-collapse>

<w-button v-if="isEdit" class="lesson-group-btn" @tap="optionalLessonChange()">
选修课
</w-button>
Expand Down Expand Up @@ -312,12 +358,17 @@ const sportsScoreList = computed(() => {
});
const optionalScoreList = computed(() => {
return scoreList.value.filter(item => item.lessonType === "任选课" || item.lessonType === "选修课" || item.lessonType === "限选课");
return scoreList.value.filter(item => item.lessonType === "任选课" || item.lessonType === "选修课");
});
const limitedScoreList = computed(() => {
return scoreList.value.filter(item => item.lessonType === "限选课");
});
const allChosen_1 = ref(false);
const allChosen_2 = ref(false);
const allChosen_3 = ref(false);
const allChosen_4 = ref(false);
const requireLessonChange = () => {
if (!allChosen_1.value) {
Expand Down Expand Up @@ -400,6 +451,33 @@ const optionalLessonChange = () => {
allChosen_3.value = !allChosen_3.value;
};
const limitedLessonChange = () => {
if (!allChosen_4.value) {
limitedScoreList.value.forEach(item => {
if (!item.selected) {
selectedLessonsList.value.push(item);
unSelectedLessonsList.value = unSelectedLessonsList.value.filter(
selected => selected.lessonID !== item.lessonID
);
};
item.selected = true;
store.commit("delUnCalc", item);
});
} else {
limitedScoreList.value.forEach(item => {
if (item.selected) {
selectedLessonsList.value = selectedLessonsList.value.filter(
selected => selected.lessonID !== item.lessonID
);
unSelectedLessonsList.value.push(item);
store.commit("setUnCalc", item);
}
item.selected = false;
});
}
allChosen_4.value = !allChosen_4.value;
};
const selectedLessonsList = ref<Score[]>([]);
const unSelectedLessonsList = ref<Score[]>([]);
const unselectedLessons = serviceStore.score.unCalScore;
Expand Down Expand Up @@ -431,6 +509,7 @@ watch(unSelectedLessonsList, (newUnSelectedLessonsList) => {
allChosen_1.value = true;
allChosen_2.value = true;
allChosen_3.value = true;
allChosen_4.value = true;
newUnSelectedLessonsList.forEach((item) => {
const isFind_1 = requiredScoreList.value.find(
storeItem => item.className === storeItem.className && item.scorePoint === storeItem.scorePoint
Expand All @@ -441,9 +520,13 @@ watch(unSelectedLessonsList, (newUnSelectedLessonsList) => {
const isFind_3 = optionalScoreList.value.find(
storeItem => item.className === storeItem.className && item.scorePoint === storeItem.scorePoint
);
const isFind_4 = limitedScoreList.value.find(
storeItem => item.className === storeItem.className && item.scorePoint === storeItem.scorePoint
);
if (isFind_1)allChosen_1.value = false;
if (isFind_2)allChosen_2.value = false;
if (isFind_3)allChosen_3.value = false;
if (isFind_4)allChosen_4.value = false;
});
}, { immediate: true });
Expand Down Expand Up @@ -518,11 +601,18 @@ const handleSwitch = () => {
isEdit.value = !isEdit.value;
};
const checkEdit = () => {
if (isEdit.value) isEdit.value = !isEdit.value;
};
async function termChanged(e) {
checkEdit();
store.commit("changeScorePeriod", e.period);
isRefreshing.value = true;
selectTerm.value = e;
await ZFService.updateScoreInfo(e);
isRefreshing.value = false;
}
</script>

0 comments on commit 8e7ae9c

Please sign in to comment.