From adfdde99b47fbfe11e40267825107b41c23493df Mon Sep 17 00:00:00 2001 From: liutong <836164388@qq.com> Date: Thu, 10 Apr 2025 17:56:34 +0800 Subject: [PATCH] =?UTF-8?q?feat(coach):=20=E4=BC=98=E5=8C=96=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E5=8F=91=E5=B8=83=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 根据作业类型显示不同表单字段 - 添加发布班级作业和学生作业的逻辑 - 增加表单验证和提示消息 - 优化用户交互和体验 --- pages/coach/job/add.vue | 44 +++++++++++++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/pages/coach/job/add.vue b/pages/coach/job/add.vue index fdd25a5..bff5e65 100644 --- a/pages/coach/job/add.vue +++ b/pages/coach/job/add.vue @@ -46,7 +46,7 @@ - + 提交 + + + @@ -101,11 +104,11 @@ import AQTabber from "@/components/AQ/AQTabber.vue" //校验规则 const rules = [ - { - name: "classes_id_name", - rule: ["required"], - msg: ["请选择班级"] - }, + // { + // name: "classes_id_name", + // rule: ["required"], + // msg: ["请选择班级"] + // }, { name: "course_id_name", rule: ["required"], @@ -279,6 +282,10 @@ export default { //清空学员选择信息 this.formData.students_ids = '' this.formData.students_ids_name = '' + }else{ + // 2=学生作业 + this.formData.classes_id = '' + this.formData.classes_id_name = '' } }, @@ -294,11 +301,36 @@ export default { return res }, + //吸顶消息意识 + showMsg(msg) { + let options = {} + //text值可不传 + options.text = msg + this.$refs.tips.show(options) + }, + //发布作业 async submetForm(){ let data = {...this.formData} console.log('提交',data) let vf = await this.validatorForm(data)//表单验证 + + + if(data.type == 1){ + //班级作业 + if(!data.classes_id){ + this.showMsg('请选择班级') + return + } + }else{ + //学生作业 + if(!data.students_ids){ + this.showMsg('请选择学员') + return + } + } + + if(!vf.isPassed){ console.log('验证',vf) return