课程库bug

This commit is contained in:
zhangyc
2022-12-13 00:41:11 +08:00
parent 178b3fd212
commit 89e889506b
3 changed files with 75 additions and 10 deletions

View File

@@ -4,7 +4,10 @@
:placeholder="placeholder" :placeholder="placeholder"
:show-count="showCount" :show-count="showCount"
:maxlength="maxlength" :maxlength="maxlength"
:validate="validate"
@blur="validateProName" @blur="validateProName"
@change="validateProName"
/> />
<div style="color:red;font-size: 10px" v-if="value && !validate">名称重复请重新输入</div> <div style="color:red;font-size: 10px" v-if="value && !validate">名称重复请重新输入</div>
</template> </template>
@@ -18,7 +21,7 @@ const props = defineProps({
}, },
validate: { validate: {
type: Boolean, type: Boolean,
default: true default:true
}, },
id: { id: {
type: String, type: String,
@@ -55,17 +58,20 @@ watch(modelV, () => {
}) })
function validateProName() { function validateProName() {
emit('update:finished', false);
props.value && validateName({name: props.value, type: props.type, id: props.id}).then(res => { props.value && validateName({name: props.value, type: props.type, id: props.id}).then(res => {
emit('update:validate', res.data.data !== 1) emit('update:validate', res.data.data !== 1)
emit('update:finished', true);
}) })
} }
</script> </script>
<style lang="scss"> <style lang="scss">
.ant-input-affix-wrapper { .in{
.ant-input-affix-wrapper {
position: relative; position: relative;
display: inline-block; display: inline-block;
width: 100%; width: 99%;
min-width: 0; min-width: 0;
padding: 0px 17px; padding: 0px 17px;
color: rgba(0, 0, 0, 0.85); color: rgba(0, 0, 0, 0.85);
@@ -78,4 +84,26 @@ function validateProName() {
transition: all 0.3s; transition: all 0.3s;
display: inline-flex; display: inline-flex;
} }
}
.b_input,.i1_input{
.ant-input-affix-wrapper {
position: relative;
display: inline-block;
width: 88%;
min-width: 0;
padding: 8px 17px;
color: rgba(0, 0, 0, 0.85);
font-size: 14px;
line-height: 1.5715;
background-color: #fff;
background-image: none;
border: 1px solid #d9d9d9;
border-radius: 8px;
transition: all 0.3s;
display: inline-flex;
}
}
</style> </style>

View File

@@ -145,6 +145,7 @@
placeholder="请输入课程名称" placeholder="请输入课程名称"
v-model:value="xzinputV1" v-model:value="xzinputV1"
v-model:validate="validate" v-model:validate="validate"
v-model:finished="finished"
:maxlength="20" :maxlength="20"
show-count show-count
:type="2" :type="2"
@@ -306,6 +307,7 @@
<!-- 确定新建面授课弹窗 --> <!-- 确定新建面授课弹窗 -->
<CourseModal <CourseModal
ref="CourseModalRef" ref="CourseModalRef"
v-model:xzinputV1="xzinputV1"
@visibleClose="closeOnlineCoursevisible" @visibleClose="closeOnlineCoursevisible"
/> />
<!-- 查看面授课弹框 start --> <!-- 查看面授课弹框 start -->
@@ -364,6 +366,7 @@
placeholder="请输入课程名称" placeholder="请输入课程名称"
v-model:value="qdms_inputV1" v-model:value="qdms_inputV1"
v-model:validate="validate" v-model:validate="validate"
v-model:finished="finished"
:maxlength="20" :maxlength="20"
show-count show-count
:type="2" :type="2"
@@ -628,8 +631,8 @@
<span style="margin-right: 14px">授课教师</span> <span style="margin-right: 14px">授课教师</span>
</div> </div>
<div class="item_inp"> <div class="item_inp">
<div class="i1_input"> <div class="select" style="width:436px; " >
<ProjectManager <ProjectManager
v-model:value="member.value" v-model:value="member.value"
v-model:name="member.name" v-model:name="member.name"
></ProjectManager> ></ProjectManager>
@@ -2798,6 +2801,7 @@ import {
onBeforeUnmount, onBeforeUnmount,
watch, watch,
} from "vue"; } from "vue";
import * as api from "../../api/indexInvist.js"; import * as api from "../../api/indexInvist.js";
import { message } from "ant-design-vue"; import { message } from "ant-design-vue";
@@ -3552,7 +3556,7 @@ export default defineComponent({
value4: "", value4: "",
//选择线上还是面授 //选择线上还是面授
xzinputV1: "", xzinputV1: "",
valueE1: 2, valueE1: "",
valueE2: "", valueE2: "",
//确定面授 //确定面授
ft_eidt: false, ft_eidt: false,
@@ -3643,6 +3647,7 @@ export default defineComponent({
codevisible: false, //二维码弹窗 codevisible: false, //二维码弹窗
codeInfo: null, //二维码内容 codeInfo: null, //二维码内容
codeUrl: codeUrl, codeUrl: codeUrl,
finished:false,
// 课程三级分类 // 课程三级分类
options2222: [ options2222: [
{ {
@@ -4545,16 +4550,26 @@ export default defineComponent({
message.destroy(); message.destroy();
return message.warning("请输入必填项"); return message.warning("请输入必填项");
} }
console.log("state.validate",state.validate); console.log("state.validate",state.validate);
if (!state.validate) { if(!state.finished){
return;
}
if (!state.validate && state.finished) {
message.destroy(); message.destroy();
return message.warning("面授课名称已存在"); return message.warning("该课程名称已存在");
} }
console.log( console.log(
"state.bs_hs && state.valueE1 == 2", "state.bs_hs && state.valueE1 == 2",
state.bs_hs, state.bs_hs,
state.valueE1 == 2 state.valueE1 == 2
); );
if( !state.valueE1 && !state.valueE2){
message.destroy();
return message.warning("请选择课程形式");
}
if (state.valueE1 === 2) { if (state.valueE1 === 2) {
state.of_hs = false; state.of_hs = false;

View File

@@ -393,6 +393,7 @@ import {
// onMounted, // onMounted,
onUnmounted, onUnmounted,
} from "vue"; } from "vue";
import {validateName} from "@/api/index1";
import {message} from "ant-design-vue"; import {message} from "ant-design-vue";
import {edit, detail, handle} from "@/api/indexCourse"; import {edit, detail, handle} from "@/api/indexCourse";
import {fileUp} from "../../api/indexEval"; import {fileUp} from "../../api/indexEval";
@@ -405,6 +406,7 @@ import FJUpload from "@/components/common/FJUpload";
import * as moment from "moment"; import * as moment from "moment";
import * as api2 from "../../api/indexAudit"; import * as api2 from "../../api/indexAudit";
export default defineComponent({ export default defineComponent({
components: { components: {
Editor, Editor,
@@ -413,12 +415,18 @@ export default defineComponent({
NameInput, NameInput,
ProjectManager, ProjectManager,
}, },
props: {
xzinputV1: {
type: String,
default: null,
},
},
setup(props, {expose, emit}) { setup(props, {expose, emit}) {
const state = reactive({ const state = reactive({
hideshow: true, hideshow: true,
ft_eidt: false, ft_eidt: false,
attach: "", attach: "",
validate: true, validate:false,
ft_hs: false, ft_hs: false,
addLoading: false, addLoading: false,
statusJuJue: 0, statusJuJue: 0,
@@ -575,6 +583,7 @@ export default defineComponent({
state.ft_hs = true; state.ft_hs = true;
state.ft_eidt = false; state.ft_eidt = false;
state.qdms_inputV1 = name; state.qdms_inputV1 = name;
console.log(" state.qdms_inputV1 ",state.qdms_inputV1 );
} }
}; };
const visibleClose = () => { const visibleClose = () => {
@@ -766,7 +775,8 @@ export default defineComponent({
}; };
//保存面授课 //保存面授课
const handlePush = (param) => { const handlePush = async (param) => {
let files = ""; let files = "";
if (state.imgList.length) { if (state.imgList.length) {
state.imgList.forEach((item) => { state.imgList.forEach((item) => {
@@ -775,6 +785,15 @@ export default defineComponent({
} }
files = files.slice(0, files.length - 1); files = files.slice(0, files.length - 1);
console.log("filesfiles", files); 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 = { const postData = {
offcourseId: state.offcourseId, //不传代表新增 offcourseId: state.offcourseId, //不传代表新增
name: state.qdms_inputV1, name: state.qdms_inputV1,
@@ -831,6 +850,9 @@ export default defineComponent({
//编辑面授课渲染绑定 //编辑面授课渲染绑定
const handleEditInfo = async (offcourseId) => { const handleEditInfo = async (offcourseId) => {
console.log("jjjaj");
state.validate =true;
state.qdms_inputV1 = "";
const item = await detail({ const item = await detail({
offcourseId: Number(offcourseId), offcourseId: Number(offcourseId),
}).then((res) => { }).then((res) => {