hookehuyr

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

重构年级、班级和课程下拉菜单的变量名,使其更具语义化。同时为每个下拉菜单的变更事件添加数据重置和重新加载逻辑,以支持筛选功能。
1 <!-- 1 <!--
2 * @Date: 2025-05-29 15:34:17 2 * @Date: 2025-05-29 15:34:17
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-06-24 16:40:27 4 + * @LastEditTime: 2025-06-24 16:56:33
5 * @FilePath: /mlaj/src/views/teacher/checkinPage.vue 5 * @FilePath: /mlaj/src/views/teacher/checkinPage.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -10,9 +10,9 @@ ...@@ -10,9 +10,9 @@
10 <van-config-provider :theme-vars="themeVars"> 10 <van-config-provider :theme-vars="themeVars">
11 <van-sticky> 11 <van-sticky>
12 <van-dropdown-menu active-color="#4caf50"> 12 <van-dropdown-menu active-color="#4caf50">
13 - <van-dropdown-item v-model="value1" :options="option1" @change="handleChange1" /> 13 + <van-dropdown-item v-model="selectGradeValue" :options="gradeOption" @change="handleGradeChange" />
14 - <van-dropdown-item v-model="value2" :options="option2" @change="handleChange2" /> 14 + <van-dropdown-item v-model="selectClassValue" :options="classOption" @change="handleClassChange" />
15 - <van-dropdown-item v-model="value3" :options="option3" @change="handleChange3" /> 15 + <van-dropdown-item v-model="selectCourseValue" :options="courseOption" @change="handleCourseChange" />
16 </van-dropdown-menu> 16 </van-dropdown-menu>
17 </van-sticky> 17 </van-sticky>
18 18
...@@ -251,35 +251,56 @@ const currentCommentPost = ref(null) ...@@ -251,35 +251,56 @@ const currentCommentPost = ref(null)
251 const showAuditDialog = ref(false) 251 const showAuditDialog = ref(false)
252 const currentAuditPost = ref(null) 252 const currentAuditPost = ref(null)
253 253
254 -const value1 = ref(0); 254 +const selectGradeValue = ref(0);
255 -const value2 = ref('a'); 255 +const selectClassValue = ref('a');
256 -const value3 = ref('v'); 256 +const selectCourseValue = ref('v');
257 -const option1 = [ 257 +const gradeOption = [
258 { text: '全部年级', value: 0 }, 258 { text: '全部年级', value: 0 },
259 { text: '一年级', value: 1 }, 259 { text: '一年级', value: 1 },
260 { text: '二年级', value: 2 }, 260 { text: '二年级', value: 2 },
261 ]; 261 ];
262 -const option2 = [ 262 +const classOption = [
263 { text: '全部班级', value: 'a' }, 263 { text: '全部班级', value: 'a' },
264 { text: '一班级', value: 'b' }, 264 { text: '一班级', value: 'b' },
265 { text: '二班级', value: 'c' }, 265 { text: '二班级', value: 'c' },
266 ]; 266 ];
267 -const option3 = [ 267 +const courseOption = [
268 { text: '全部课程', value: 'v' }, 268 { text: '全部课程', value: 'v' },
269 { text: '一课程', value: 'b' }, 269 { text: '一课程', value: 'b' },
270 { text: '二课程', value: 'c' }, 270 { text: '二课程', value: 'c' },
271 ]; 271 ];
272 272
273 -const handleChange1 = (val) => { 273 +const handleGradeChange = (val) => {
274 console.log('val', val); 274 console.log('val', val);
275 + selectGradeValue.value = val;
276 + // 重置分页参数
277 + page.value = 0
278 + checkinDataList.value = []
279 + finished.value = false
280 + // 重新加载数据
281 + onLoad()
275 } 282 }
276 283
277 -const handleChange2 = (val) => { 284 +const handleClassChange = (val) => {
278 console.log('val', val); 285 console.log('val', val);
286 + selectClassValue.value = val;
287 + // 重置分页参数
288 + page.value = 0
289 + checkinDataList.value = []
290 + finished.value = false
291 + // 重新加载数据
292 + onLoad()
279 } 293 }
280 294
281 -const handleChange3 = (val) => { 295 +const handleCourseChange = (val) => {
282 console.log('val', val); 296 console.log('val', val);
297 + selectCourseValue.value = val;
298 + // 重置分页参数
299 + page.value = 0
300 + checkinDataList.value = []
301 + finished.value = false
302 + // 重新加载数据
303 + onLoad()
283 } 304 }
284 305
285 const active = ref(0); 306 const active = ref(0);
...@@ -802,7 +823,10 @@ const onLoad = async (date) => { ...@@ -802,7 +823,10 @@ const onLoad = async (date) => {
802 limit: limit.value, 823 limit: limit.value,
803 page: nextPage, 824 page: nextPage,
804 task_id: route.query.id, 825 task_id: route.query.id,
805 - date: current_date 826 + date: current_date,
827 + grade: selectGradeValue.value,
828 + class_id: selectClassValue.value,
829 + course_id: selectCourseValue.value,
806 }); 830 });
807 if (res.code) { 831 if (res.code) {
808 // 整理数据结构 832 // 整理数据结构
......