lijiaqi 4 months ago
parent be30aa3792
commit 780823ce9b
  1. 54
      src/views/course/basicCourseInformation.vue
  2. 58
      src/views/course/components/courseEdit.vue

@ -110,7 +110,7 @@ const onSuccess = () => {
getCourseList()
loading.value = false
}
//
//
const onDeleteCourse = async (id: any) => {
await ElMessageBox.confirm('您确定删除这条课程信息吗', '温馨提示', {
confirmButtonText: '确认',
@ -174,12 +174,8 @@ const CloseCouresNameChangeEvent = () => {
<el-form inline v-if="userStore.userInfo.roleId[0] === '1'">
<el-form-item label="课程教师:" class="short-form-item">
<el-select v-model="params.teacher">
<el-option
v-for="teachers in teacherList"
:key="teachers.username"
:value="teachers.username"
:label="teachers.name"
></el-option>
<el-option v-for="teachers in teacherList" :key="teachers.username" :value="teachers.username"
:label="teachers.name"></el-option>
</el-select>
</el-form-item>
<el-form-item label="课程类别:" class="short-form-item">
@ -208,11 +204,7 @@ const CloseCouresNameChangeEvent = () => {
</el-form>
<div class="course">
<ul class="course_list">
<li
v-if="userStore.userInfo.roleId === 1"
@click="onAddCourse()"
class="add_course"
>
<li v-if="userStore.userInfo.roleId[0] === '1'" @click="onAddCourse()" class="add_course">
<div class="plus">
<el-icon class="avatar-uploader-icon">
<Plus />
@ -242,36 +234,19 @@ const CloseCouresNameChangeEvent = () => {
<el-icon class="del" @click="onDeleteCourse(item.id)">
<Delete />
</el-icon>
<el-button
class="object"
round
plain
@click="onGetCourseObject(item.id)"
>
<el-button class="object" round plain @click="onGetCourseObject(item.id)">
查看课程目标
</el-button>
</li>
</ul>
</div>
<el-pagination
v-model:current-page="params.pageNo"
v-model:page-size="params.pageSize"
:page-sizes="[2, 5, 7, 10]"
:background="true"
layout="jumper,total, sizes, prev, pager, next "
:total="total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
style="margin-top: 10px; justify-content: center"
/>
<el-pagination v-model:current-page="params.pageNo" v-model:page-size="params.pageSize"
:page-sizes="[2, 5, 7, 10]" :background="true" layout="jumper,total, sizes, prev, pager, next " :total="total"
@size-change="handleSizeChange" @current-change="handleCurrentChange"
style="margin-top: 10px; justify-content: center" />
</div>
<course-edit
ref="drawer"
@success="onSuccess"
@couresNameChange="couresNameChangeEvent"
@CloseCouresNameChange="CloseCouresNameChangeEvent"
:flog="flog"
></course-edit>
<course-edit ref="drawer" @success="onSuccess" @couresNameChange="couresNameChangeEvent"
@CloseCouresNameChange="CloseCouresNameChangeEvent" :flog="flog"></course-edit>
</div>
</div>
</template>
@ -317,6 +292,7 @@ const CloseCouresNameChangeEvent = () => {
}
.course {
// display: flex;
// flex: 0 0 25%;
// justify-content: space-between;
@ -354,6 +330,7 @@ const CloseCouresNameChangeEvent = () => {
margin-left: 30px;
margin-top: 10px;
font-weight: bold;
&:hover {
cursor: pointer;
}
@ -399,6 +376,7 @@ const CloseCouresNameChangeEvent = () => {
.plus {
width: 100%;
height: 178px;
&:hover {
cursor: pointer;
}
@ -413,8 +391,10 @@ const CloseCouresNameChangeEvent = () => {
text-align: center;
}
}
.add_course {
border: 2px dashed rgb(143, 139, 139);
h2 {
font-size: 40px;
text-align: center;
@ -422,11 +402,13 @@ const CloseCouresNameChangeEvent = () => {
color: #535050;
font-weight: bold;
margin-top: 20px;
&:hover {
cursor: pointer;
}
}
}
.short-form-item {
width: 250px;
margin-right: 65px;

@ -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;

Loading…
Cancel
Save