课程库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"
:show-count="showCount"
:maxlength="maxlength"
:validate="validate"
@blur="validateProName"
@change="validateProName"
/>
<div style="color:red;font-size: 10px" v-if="value && !validate">名称重复请重新输入</div>
</template>
@@ -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);
})
}
</script>
<style lang="scss">
.ant-input-affix-wrapper {
.in{
.ant-input-affix-wrapper {
position: relative;
display: inline-block;
width: 100%;
width: 99%;
min-width: 0;
padding: 0px 17px;
color: rgba(0, 0, 0, 0.85);
@@ -78,4 +84,26 @@ function validateProName() {
transition: all 0.3s;
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>

View File

@@ -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 @@
<!-- 确定新建面授课弹窗 -->
<CourseModal
ref="CourseModalRef"
v-model:xzinputV1="xzinputV1"
@visibleClose="closeOnlineCoursevisible"
/>
<!-- 查看面授课弹框 start -->
@@ -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 @@
<span style="margin-right: 14px">授课教师</span>
</div>
<div class="item_inp">
<div class="i1_input">
<ProjectManager
<div class="select" style="width:436px; " >
<ProjectManager
v-model:value="member.value"
v-model:name="member.name"
></ProjectManager>
@@ -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;

View File

@@ -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) => {