From 89e889506b5aea2f20720aed07d7a56739a188ea Mon Sep 17 00:00:00 2001 From: zhangyc Date: Tue, 13 Dec 2022 00:41:11 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=BA=93bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/project/NameInput.vue | 34 ++++++++++++++++++-- src/views/courselibrary/CoursewareManage.vue | 25 +++++++++++--- src/views/courselibrary/courseModal.vue | 26 +++++++++++++-- 3 files changed, 75 insertions(+), 10 deletions(-) diff --git a/src/components/project/NameInput.vue b/src/components/project/NameInput.vue index 80541242..6f92741c 100644 --- a/src/components/project/NameInput.vue +++ b/src/components/project/NameInput.vue @@ -4,7 +4,10 @@ :placeholder="placeholder" :show-count="showCount" :maxlength="maxlength" + :validate="validate" @blur="validateProName" + @change="validateProName" + />
名称重复,请重新输入
@@ -18,7 +21,7 @@ const props = defineProps({ }, validate: { type: Boolean, - default: true + default:true }, id: { type: String, @@ -55,17 +58,20 @@ watch(modelV, () => { }) function validateProName() { + emit('update:finished', false); props.value && validateName({name: props.value, type: props.type, id: props.id}).then(res => { emit('update:validate', res.data.data !== 1) + emit('update:finished', true); }) } \ No newline at end of file diff --git a/src/views/courselibrary/CoursewareManage.vue b/src/views/courselibrary/CoursewareManage.vue index 89190a69..d61e206c 100644 --- a/src/views/courselibrary/CoursewareManage.vue +++ b/src/views/courselibrary/CoursewareManage.vue @@ -145,6 +145,7 @@ placeholder="请输入课程名称" v-model:value="xzinputV1" v-model:validate="validate" + v-model:finished="finished" :maxlength="20" show-count :type="2" @@ -306,6 +307,7 @@ @@ -364,6 +366,7 @@ placeholder="请输入课程名称" v-model:value="qdms_inputV1" v-model:validate="validate" + v-model:finished="finished" :maxlength="20" show-count :type="2" @@ -628,8 +631,8 @@ 授课教师
-
- + @@ -2798,6 +2801,7 @@ import { onBeforeUnmount, watch, } from "vue"; + import * as api from "../../api/indexInvist.js"; import { message } from "ant-design-vue"; @@ -3552,7 +3556,7 @@ export default defineComponent({ value4: "", //选择线上还是面授 xzinputV1: "", - valueE1: 2, + valueE1: "", valueE2: "", //确定面授 ft_eidt: false, @@ -3643,6 +3647,7 @@ export default defineComponent({ codevisible: false, //二维码弹窗 codeInfo: null, //二维码内容 codeUrl: codeUrl, + finished:false, // 课程三级分类 options2222: [ { @@ -4545,16 +4550,26 @@ export default defineComponent({ message.destroy(); return message.warning("请输入必填项"); } + console.log("state.validate",state.validate); - if (!state.validate) { + if(!state.finished){ + return; + } + + if (!state.validate && state.finished) { message.destroy(); - return message.warning("面授课名称已存在"); + return message.warning("该课程名称已存在"); } console.log( "state.bs_hs && state.valueE1 == 2", state.bs_hs, state.valueE1 == 2 ); + if( !state.valueE1 && !state.valueE2){ + message.destroy(); + return message.warning("请选择课程形式"); + } + if (state.valueE1 === 2) { state.of_hs = false; diff --git a/src/views/courselibrary/courseModal.vue b/src/views/courselibrary/courseModal.vue index a222578a..104673b8 100644 --- a/src/views/courselibrary/courseModal.vue +++ b/src/views/courselibrary/courseModal.vue @@ -393,6 +393,7 @@ import { // onMounted, onUnmounted, } from "vue"; +import {validateName} from "@/api/index1"; import {message} from "ant-design-vue"; import {edit, detail, handle} from "@/api/indexCourse"; import {fileUp} from "../../api/indexEval"; @@ -405,6 +406,7 @@ import FJUpload from "@/components/common/FJUpload"; import * as moment from "moment"; import * as api2 from "../../api/indexAudit"; + export default defineComponent({ components: { Editor, @@ -413,12 +415,18 @@ export default defineComponent({ NameInput, ProjectManager, }, + props: { + xzinputV1: { + type: String, + default: null, + }, + }, setup(props, {expose, emit}) { const state = reactive({ hideshow: true, ft_eidt: false, attach: "", - validate: true, + validate:false, ft_hs: false, addLoading: false, statusJuJue: 0, @@ -575,6 +583,7 @@ export default defineComponent({ state.ft_hs = true; state.ft_eidt = false; state.qdms_inputV1 = name; + console.log(" state.qdms_inputV1 ",state.qdms_inputV1 ); } }; const visibleClose = () => { @@ -766,7 +775,8 @@ export default defineComponent({ }; //保存面授课 - const handlePush = (param) => { + const handlePush = async (param) => { + let files = ""; if (state.imgList.length) { state.imgList.forEach((item) => { @@ -775,6 +785,15 @@ export default defineComponent({ } files = files.slice(0, files.length - 1); console.log("filesfiles", files); + + const offName = await validateName({name: state.qdms_inputV1, type:2, id:state.offcourseId}).then(res => { + return res.data.data == 1; + }); + if(offName){ + message.destroy(); + return message.warning("课程名称重复,请重新填写"); + } + const postData = { offcourseId: state.offcourseId, //不传代表新增 name: state.qdms_inputV1, @@ -831,6 +850,9 @@ export default defineComponent({ //编辑面授课渲染绑定 const handleEditInfo = async (offcourseId) => { + console.log("jjjaj"); + state.validate =true; + state.qdms_inputV1 = ""; const item = await detail({ offcourseId: Number(offcourseId), }).then((res) => {