hookehuyr

refactor(teacher/checkinPage): 重构下拉菜单变量名并添加筛选逻辑

重构年级、班级和课程下拉菜单的变量名,使其更具语义化。同时为每个下拉菜单的变更事件添加数据重置和重新加载逻辑,以支持筛选功能。
<!--
* @Date: 2025-05-29 15:34:17
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-06-24 16:40:27
* @LastEditTime: 2025-06-24 16:56:33
* @FilePath: /mlaj/src/views/teacher/checkinPage.vue
* @Description: 文件描述
-->
......@@ -10,9 +10,9 @@
<van-config-provider :theme-vars="themeVars">
<van-sticky>
<van-dropdown-menu active-color="#4caf50">
<van-dropdown-item v-model="value1" :options="option1" @change="handleChange1" />
<van-dropdown-item v-model="value2" :options="option2" @change="handleChange2" />
<van-dropdown-item v-model="value3" :options="option3" @change="handleChange3" />
<van-dropdown-item v-model="selectGradeValue" :options="gradeOption" @change="handleGradeChange" />
<van-dropdown-item v-model="selectClassValue" :options="classOption" @change="handleClassChange" />
<van-dropdown-item v-model="selectCourseValue" :options="courseOption" @change="handleCourseChange" />
</van-dropdown-menu>
</van-sticky>
......@@ -251,35 +251,56 @@ const currentCommentPost = ref(null)
const showAuditDialog = ref(false)
const currentAuditPost = ref(null)
const value1 = ref(0);
const value2 = ref('a');
const value3 = ref('v');
const option1 = [
const selectGradeValue = ref(0);
const selectClassValue = ref('a');
const selectCourseValue = ref('v');
const gradeOption = [
{ text: '全部年级', value: 0 },
{ text: '一年级', value: 1 },
{ text: '二年级', value: 2 },
];
const option2 = [
const classOption = [
{ text: '全部班级', value: 'a' },
{ text: '一班级', value: 'b' },
{ text: '二班级', value: 'c' },
];
const option3 = [
const courseOption = [
{ text: '全部课程', value: 'v' },
{ text: '一课程', value: 'b' },
{ text: '二课程', value: 'c' },
];
const handleChange1 = (val) => {
const handleGradeChange = (val) => {
console.log('val', val);
selectGradeValue.value = val;
// 重置分页参数
page.value = 0
checkinDataList.value = []
finished.value = false
// 重新加载数据
onLoad()
}
const handleChange2 = (val) => {
const handleClassChange = (val) => {
console.log('val', val);
selectClassValue.value = val;
// 重置分页参数
page.value = 0
checkinDataList.value = []
finished.value = false
// 重新加载数据
onLoad()
}
const handleChange3 = (val) => {
const handleCourseChange = (val) => {
console.log('val', val);
selectCourseValue.value = val;
// 重置分页参数
page.value = 0
checkinDataList.value = []
finished.value = false
// 重新加载数据
onLoad()
}
const active = ref(0);
......@@ -802,7 +823,10 @@ const onLoad = async (date) => {
limit: limit.value,
page: nextPage,
task_id: route.query.id,
date: current_date
date: current_date,
grade: selectGradeValue.value,
class_id: selectClassValue.value,
course_id: selectCourseValue.value,
});
if (res.code) {
// 整理数据结构
......