hookehuyr

refactor(teacher/formPage): 优化表单页面布局和章节数据管理

- 调整目标次数输入框宽度为相对单位
- 移除章节与课程的关联逻辑,改为独立章节列表
- 优化目标次数容器布局为两端对齐
- 设置目标次数默认值为1
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
2 * @Author: hookehuyr hookehuyr@gmail.com 2 * @Author: hookehuyr hookehuyr@gmail.com
3 * @Date: 2025-01-20 10:00:00 3 * @Date: 2025-01-20 10:00:00
4 * @LastEditors: hookehuyr hookehuyr@gmail.com 4 * @LastEditors: hookehuyr hookehuyr@gmail.com
5 - * @LastEditTime: 2025-06-20 16:01:50 5 + * @LastEditTime: 2025-06-23 09:49:16
6 * @FilePath: /mlaj/src/views/teacher/formPage.vue 6 * @FilePath: /mlaj/src/views/teacher/formPage.vue
7 * @Description: 教师作业新增表单页面 7 * @Description: 教师作业新增表单页面
8 --> 8 -->
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
41 <!-- 作业设置 --> 41 <!-- 作业设置 -->
42 <div class="mb-6"> 42 <div class="mb-6">
43 <h3 class="section-title">作业设置</h3> 43 <h3 class="section-title">作业设置</h3>
44 - <van-row> 44 + <van-row gutter="10">
45 <van-col span="12"> 45 <van-col span="12">
46 <label class="setting-label">作业频次</label> 46 <label class="setting-label">作业频次</label>
47 <van-field 47 <van-field
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
64 max="100" 64 max="100"
65 integer 65 integer
66 button-size="24px" 66 button-size="24px"
67 - input-width="60px" 67 + input-width="5rem"
68 /> 68 />
69 <span class="target-unit">次</span> 69 <span class="target-unit">次</span>
70 </div> 70 </div>
...@@ -122,7 +122,7 @@ ...@@ -122,7 +122,7 @@
122 <van-icon name="arrow" class="arrow-icon" @click="showCoursePicker = true" /> 122 <van-icon name="arrow" class="arrow-icon" @click="showCoursePicker = true" />
123 </div> 123 </div>
124 </div> 124 </div>
125 - <div class="select-row" v-if="formData.course"> 125 + <div class="select-row">
126 <div class="select-item"> 126 <div class="select-item">
127 <van-icon name="bookmark-o" class="select-icon" /> 127 <van-icon name="bookmark-o" class="select-icon" />
128 <span class="select-label">课程章节:</span> 128 <span class="select-label">课程章节:</span>
...@@ -278,7 +278,7 @@ const formData = ref({ ...@@ -278,7 +278,7 @@ const formData = ref({
278 description: '', 278 description: '',
279 type: $route.query.type === 'homework' ? '上传附件' : '签到', 279 type: $route.query.type === 'homework' ? '上传附件' : '签到',
280 frequency: '', 280 frequency: '',
281 - target_count: 10, 281 + target_count: 1,
282 start_time: new Date(), 282 start_time: new Date(),
283 end_time: new Date(), 283 end_time: new Date(),
284 course: '', 284 course: '',
...@@ -341,36 +341,25 @@ const courses = ref([ ...@@ -341,36 +341,25 @@ const courses = ref([
341 { id: 4, name: '物理课程' } 341 { id: 4, name: '物理课程' }
342 ]); 342 ]);
343 343
344 -// 章节数据 - 根据课程动态变化 344 +// 章节数据 - 独立的章节列表,不与课程关联
345 -const chapters = ref([]); 345 +const chapters = ref([
346 - 346 + { id: 1, name: '第一章 数与代数' },
347 -// 各课程对应的章节数据 347 + { id: 2, name: '第二章 几何图形' },
348 -const courseChapters = { 348 + { id: 3, name: '第三章 统计与概率' },
349 - '数学课程': [ 349 + { id: 4, name: '第四章 函数与方程' },
350 - { id: 1, name: '第一章 数与代数' }, 350 + { id: 5, name: '第一单元 现代文阅读' },
351 - { id: 2, name: '第二章 几何图形' }, 351 + { id: 6, name: '第二单元 古诗文阅读' },
352 - { id: 3, name: '第三章 统计与概率' }, 352 + { id: 7, name: '第三单元 写作训练' },
353 - { id: 4, name: '第四章 函数与方程' } 353 + { id: 8, name: '第四单元 口语交际' },
354 - ], 354 + { id: 9, name: 'Unit 1 Hello World' },
355 - '语文课程': [ 355 + { id: 10, name: 'Unit 2 My Family' },
356 - { id: 1, name: '第一单元 现代文阅读' }, 356 + { id: 11, name: 'Unit 3 School Life' },
357 - { id: 2, name: '第二单元 古诗文阅读' }, 357 + { id: 12, name: 'Unit 4 Hobbies' },
358 - { id: 3, name: '第三单元 写作训练' }, 358 + { id: 13, name: '第一章 力学基础' },
359 - { id: 4, name: '第四单元 口语交际' } 359 + { id: 14, name: '第二章 热学原理' },
360 - ], 360 + { id: 15, name: '第三章 电磁学' },
361 - '英语课程': [ 361 + { id: 16, name: '第四章 光学现象' }
362 - { id: 1, name: 'Unit 1 Hello World' }, 362 +]);
363 - { id: 2, name: 'Unit 2 My Family' },
364 - { id: 3, name: 'Unit 3 School Life' },
365 - { id: 4, name: 'Unit 4 Hobbies' }
366 - ],
367 - '物理课程': [
368 - { id: 1, name: '第一章 力学基础' },
369 - { id: 2, name: '第二章 热学原理' },
370 - { id: 3, name: '第三章 电磁学' },
371 - { id: 4, name: '第四章 光学现象' }
372 - ]
373 -};
374 363
375 const activities = ref([ 364 const activities = ref([
376 { id: 1, name: '春游活动' }, 365 { id: 1, name: '春游活动' },
...@@ -510,10 +499,6 @@ const onEndTimeConfirm = () => { ...@@ -510,10 +499,6 @@ const onEndTimeConfirm = () => {
510 */ 499 */
511 const onCourseSelect = (course) => { 500 const onCourseSelect = (course) => {
512 formData.value.course = course.name; 501 formData.value.course = course.name;
513 - // 清空之前选择的章节
514 - formData.value.chapter = '';
515 - // 根据选择的课程更新章节数据
516 - chapters.value = courseChapters[course.name] || [];
517 showCoursePicker.value = false; 502 showCoursePicker.value = false;
518 courseSearchValue.value = ''; 503 courseSearchValue.value = '';
519 }; 504 };
...@@ -728,7 +713,7 @@ onMounted(() => { ...@@ -728,7 +713,7 @@ onMounted(() => {
728 .target-count-container { 713 .target-count-container {
729 display: flex; 714 display: flex;
730 align-items: center; 715 align-items: center;
731 - justify-content: center; 716 + justify-content: space-around;
732 gap: 8px; 717 gap: 8px;
733 } 718 }
734 719
......