|
|
|
@ -164,7 +164,6 @@ const props = defineProps(['flog']) |
|
|
|
|
const onSubmit = async () => { |
|
|
|
|
// console.log(formModel.value, 'formModel.value') |
|
|
|
|
formModel.value.classhours = formModel.value.classhours.toString() |
|
|
|
|
|
|
|
|
|
await formRef.value.validate() |
|
|
|
|
const isEdit = formModel.value.id |
|
|
|
|
if (isEdit) { |
|
|
|
@ -172,6 +171,7 @@ const onSubmit = async () => { |
|
|
|
|
ElMessage.success('修改成功') |
|
|
|
|
emit('CloseCouresNameChange') |
|
|
|
|
emit('success') |
|
|
|
|
console.log(formModel.value, 'formModel.value') |
|
|
|
|
} else { |
|
|
|
|
console.log(formModel.value, 'formModel.value') |
|
|
|
|
// console.log(formModel.value) |
|
|
|
@ -211,22 +211,7 @@ const courseNameInput = () => { |
|
|
|
|
emit('couresNameChange', formModel.value.name) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// const creditInput = () => { |
|
|
|
|
// if (!props.flog) { |
|
|
|
|
// emit('creditChange', formModel.value.credit) |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// const classhoursInput = () => { |
|
|
|
|
// if (!props.flog) { |
|
|
|
|
// emit('classhoursChange', formModel.value.classhours) |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// watch( |
|
|
|
|
// () => props.flog, |
|
|
|
|
// (newVal) => { |
|
|
|
|
// console.log(newVal) |
|
|
|
|
// }, |
|
|
|
|
// ) |
|
|
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
|
console.log(props.flog) |
|
|
|
|
}) |
|
|
|
@ -252,20 +237,11 @@ const upload = async (option: any) => { |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
|
<el-drawer |
|
|
|
|
:before-close="handleClose" |
|
|
|
|
v-model="visibleDrawer" |
|
|
|
|
direction="rtl" |
|
|
|
|
:title="formModel.id ? '编辑课程' : '添加课程'" |
|
|
|
|
> |
|
|
|
|
<el-drawer :before-close="handleClose" v-model="visibleDrawer" direction="rtl" |
|
|
|
|
:title="formModel.id ? '编辑课程' : '添加课程'"> |
|
|
|
|
<el-form :model="formModel" :rules="rules" ref="formRef"> |
|
|
|
|
<el-form-item label="课程封面" prop="img"> |
|
|
|
|
<el-upload |
|
|
|
|
v-model="formModel.img" |
|
|
|
|
class="avatar-uploader" |
|
|
|
|
:http-request="upload" |
|
|
|
|
:show-file-list="false" |
|
|
|
|
> |
|
|
|
|
<el-upload v-model="formModel.img" class="avatar-uploader" :http-request="upload" :show-file-list="false"> |
|
|
|
|
<img v-if="imgUrl" :src="imgUrl" class="avatar" /> |
|
|
|
|
<el-icon v-else class="avatar-uploader-icon"> |
|
|
|
|
<Plus /> |
|
|
|
@ -304,12 +280,8 @@ const upload = async (option: any) => { |
|
|
|
|
</el-upload> --> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="课程名称" prop="name"> |
|
|
|
|
<el-input |
|
|
|
|
:disabled="nameDisabled" |
|
|
|
|
style="width: 200px" |
|
|
|
|
v-model="formModel.name" |
|
|
|
|
@input="courseNameInput" |
|
|
|
|
></el-input> |
|
|
|
|
<el-input :disabled="nameDisabled" style="width: 200px" v-model="formModel.name" |
|
|
|
|
@input="courseNameInput"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="课程类别" prop="category"> |
|
|
|
|
<el-radio-group v-model="formModel.category"> |
|
|
|
@ -325,20 +297,13 @@ const upload = async (option: any) => { |
|
|
|
|
</el-radio-group> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="课程编码" prop="code"> |
|
|
|
|
<el-input |
|
|
|
|
style="width: 200px" |
|
|
|
|
v-model="formModel.code" |
|
|
|
|
:disabled="codeDisabled" |
|
|
|
|
></el-input> |
|
|
|
|
<el-input style="width: 200px" v-model="formModel.code" :disabled="codeDisabled"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="课程学分" prop="credit"> |
|
|
|
|
<el-input style="width: 200px" v-model="formModel.credit"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="课程学时" prop="classhours"> |
|
|
|
|
<el-input |
|
|
|
|
style="width: 200px" |
|
|
|
|
v-model="formModel.classhours" |
|
|
|
|
></el-input> |
|
|
|
|
<el-input style="width: 200px" v-model="formModel.classhours"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="考核类型" prop="assessmenttype"> |
|
|
|
|
<el-radio-group v-model="formModel.assessmenttype"> |
|
|
|
@ -365,7 +330,7 @@ const upload = async (option: any) => { |
|
|
|
|
</el-form> |
|
|
|
|
|
|
|
|
|
<template #footer> |
|
|
|
|
<span class="dialog-footer" v-if="userStore.userInfo.roleId === 1"> |
|
|
|
|
<span class="dialog-footer" v-if="userStore.userInfo.roleId[0] === '1'"> |
|
|
|
|
<el-button @click="handleClose" size="large">取消</el-button> |
|
|
|
|
<el-button type="primary" size="large" @click="onSubmit()"> |
|
|
|
|
确认 |
|
|
|
@ -383,6 +348,7 @@ const upload = async (option: any) => { |
|
|
|
|
height: 178px; |
|
|
|
|
display: block; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.el-upload { |
|
|
|
|
border: 1px dashed var(--el-border-color); |
|
|
|
|
border-radius: 6px; |
|
|
|
@ -391,9 +357,11 @@ const upload = async (option: any) => { |
|
|
|
|
overflow: hidden; |
|
|
|
|
transition: var(--el-transition-duration-fast); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.el-upload:hover { |
|
|
|
|
border-color: var(--el-color-primary); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.el-icon.avatar-uploader-icon { |
|
|
|
|
font-size: 28px; |
|
|
|
|
color: #8c939d; |
|
|
|
|