From 860a5cc8c0e172f6802e59162b5677b4e2c245a3 Mon Sep 17 00:00:00 2001 From: liutong <836164388@qq.com> Date: Thu, 10 Apr 2025 17:43:15 +0800 Subject: [PATCH] =?UTF-8?q?feat(coach/job/add):=E5=A2=9E=E5=8A=A0=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E7=B1=BB=E5=9E=8B=E9=80=89=E6=8B=A9=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在页面中添加作业类型选择的 radio 组 - 更新 formData 中 content_type 的默认值为 '1' (图片作业) - 修正课程选择器中 class_id 和 classes_id 的命名 - 优化页面布局,将发布类型和作业类型分开显示 --- pages/coach/job/add.vue | 44 ++++++++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 9 deletions(-) diff --git a/pages/coach/job/add.vue b/pages/coach/job/add.vue index a3cafa3..fdd25a5 100644 --- a/pages/coach/job/add.vue +++ b/pages/coach/job/add.vue @@ -3,7 +3,7 @@ - + @@ -24,6 +24,28 @@ + + + + + + + + 图片作业 + + + + + + 视频作业 + + + + + + + + @@ -130,7 +152,7 @@ export default { course_id: '',//课程id(下拉) course_id_name: '',//课程id(中文名字) - content_type: '',//作业类型(单选)|1图片,2视频 + content_type: '1',//作业类型(单选)|1图片,2视频 content_text: '',//文字作业内容 classes_id: '',//班级id(下拉) @@ -221,7 +243,7 @@ export default { //监听选择器-班级 changeClass(e) { console.log('选择器-班级', e); - this.formData.class_id = e.value; // 更新 class_id + this.formData.classes_id = e.value; // 更新 class_id this.formData.classes_id_name = e.text; // 更新 class_name this.show_class = false; // 关闭选择器 }, @@ -247,7 +269,7 @@ export default { this.show_student = false; // 关闭选择器 }, - //监听选择器-作业类型 + //监听选择器-发布类型 changeType(e) { console.log('选择器-作业类型', e); this.formData.type = e.detail.value; // 更新 type @@ -260,6 +282,13 @@ export default { } }, + //监听选择器-作业类型 + changeContentType(e) { + console.log('选择器-作业类型', e); + this.formData.content_type = e.detail.value; // 更新 type + }, + + //表单验证 async validatorForm(data) { let res = await this.$refs.form.validator(data, rules) return res @@ -269,16 +298,13 @@ export default { async submetForm(){ let data = {...this.formData} console.log('提交',data) - let vf = await this.validatorForm(data) + let vf = await this.validatorForm(data)//表单验证 if(!vf.isPassed){ console.log('验证',vf) return } - - - return - + //发布作业 let res = await memberApi.jlPublishJob(data) if (res.code != 1){ uni.showToast({