dev_202412
yujialong 4 months ago
parent 0d1cbd6ed0
commit 9356e4debe
  1. 1
      src/utils/api.js
  2. 157
      src/views/course/Add.vue
  3. 2
      src/views/course/Curriculum.vue
  4. 4
      src/views/course/contentSettings.vue

@ -157,6 +157,7 @@ export default {
//课程管理 //课程管理
curriculumList: `nakadai/nakadai/curriculum/curriculumList`, //课程列表 curriculumList: `nakadai/nakadai/curriculum/curriculumList`, //课程列表
createCurriculum: `nakadai/nakadai/curriculum/createCurriculum`, //创建课程 createCurriculum: `nakadai/nakadai/curriculum/createCurriculum`, //创建课程
configureCourseProject: `nakadai/nakadai/curriculum/configureCourseProject`,
curriculumDetail: `nakadai/nakadai/curriculum/curriculumDetail`, //课程详情 curriculumDetail: `nakadai/nakadai/curriculum/curriculumDetail`, //课程详情
modifyCourse: `nakadai/nakadai/curriculum/modifyCourse`, //编辑课程 modifyCourse: `nakadai/nakadai/curriculum/modifyCourse`, //编辑课程
delCourse: `nakadai/nakadai/curriculum/delCourse`, //单个、批量删除课程 delCourse: `nakadai/nakadai/curriculum/delCourse`, //单个、批量删除课程

@ -1,13 +1,13 @@
<template> <template>
<div class="wrap"> <div class="wrap">
<el-card v-if="!id" shadow="hover" class="m-b-20"> <el-card shadow="hover" class="m-b-20">
<div class="flex-between"> <div class="flex-between">
<el-page-header @back="back" :content="'新建课程'"></el-page-header> <el-page-header @back="back" :content="'新建课程'"></el-page-header>
</div> </div>
</el-card> </el-card>
<div class="page"> <div class="page">
<div class="overflow"> <div class="overflow">
<ul :class="['steps', { pointer: !editing && id && publishStatus }]"> <ul :class="['steps', { pointer: cid }]">
<li :class="{ active: step === 1, done: step > 1 }" @click="toStep(1)"> <li :class="{ active: step === 1, done: step > 1 }" @click="toStep(1)">
<span class="circle">1</span> <span class="circle">1</span>
<p class="text">填写课程信息</p> <p class="text">填写课程信息</p>
@ -42,7 +42,7 @@
<el-form-item class="req" label="适用专业" required> <el-form-item class="req" label="适用专业" required>
<div class="subject"> <div class="subject">
<div v-for="(item, i) in form.mallDisciplines" :key="i" class="line"> <div v-for="(item, i) in form.curriculumDisciplines" :key="i" class="line">
<el-form-item label="学科类别"> <el-form-item label="学科类别">
<el-select v-model="item.categoryId" @change="getProfessionalClass(item)"> <el-select v-model="item.categoryId" @change="getProfessionalClass(item)">
<el-option v-for="(item, index) in subjectList" :key="index" :label="item.disciplineName" <el-option v-for="(item, index) in subjectList" :key="index" :label="item.disciplineName"
@ -62,10 +62,10 @@
:label="item.professionalName" :value="item.professionalId"></el-option> :label="item.professionalName" :value="item.professionalId"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<i v-if="i && !isDetail" class="del el-icon-delete" @click="form.mallDisciplines.splice(i, 1)"></i> <i v-if="i" class="del el-icon-delete" @click="form.curriculumDisciplines.splice(i, 1)"></i>
</div> </div>
</div> </div>
<div v-if="!isDetail" class="subject-plus" @click="addSubject"> <div class="subject-plus" @click="addSubject">
<i class="el-icon-circle-plus-outline"></i> <i class="el-icon-circle-plus-outline"></i>
</div> </div>
</el-form-item> </el-form-item>
@ -104,11 +104,11 @@
<el-form-item label="课程简介" prop="briefIntroduction"> <el-form-item label="课程简介" prop="briefIntroduction">
<Editor api-key='rnk6zw9v267xqz7pf98twt1vmrvltmd436je7a642pckltda' v-model="form.briefIntroduction" <Editor api-key='rnk6zw9v267xqz7pf98twt1vmrvltmd436je7a642pckltda' v-model="form.briefIntroduction"
:init="editorConfig" :disabled="isDetail" /> :init="editorConfig" />
</el-form-item> </el-form-item>
<el-form-item label="详情介绍" prop="teachingObjectives"> <el-form-item label="详情介绍" prop="teachingObjectives">
<Editor api-key='rnk6zw9v267xqz7pf98twt1vmrvltmd436je7a642pckltda' v-model="form.teachingObjectives" <Editor api-key='rnk6zw9v267xqz7pf98twt1vmrvltmd436je7a642pckltda' v-model="form.teachingObjectives"
:init="editorConfig" :disabled="isDetail" /> :init="editorConfig" />
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -215,9 +215,9 @@
</div> </div>
<div v-if="step !== 4" class="btns"> <div v-if="step !== 4" class="btns">
<el-button v-if="step === 2 || step === 3" type="primary" @click="prev">上一步</el-button> <el-button v-if="step === 2 || step === 3" type="primary" @click="prev">上一步</el-button>
<el-button v-else type="primary" @click="save(0, 2)">下一步</el-button> <el-button v-else type="primary" @click="save(1)">下一步</el-button>
<el-button type="primary" @click="save(1)">保存</el-button> <el-button type="primary" @click="save()">保存</el-button>
<el-button @click="cancel">{{ editing ? '取消' : '返回' }}</el-button> <el-button @click="back">返回</el-button>
</div> </div>
</div> </div>
@ -312,14 +312,13 @@ export default {
}, },
data () { data () {
return { return {
cid: this.$route.query.cid,
headers: { headers: {
token: sessionStorage.getItem("token") token: sessionStorage.getItem("token")
}, },
editorConfig, editorConfig,
isDetail: Boolean(this.$route.query.isDetail),
step: 1, step: 1,
form: { form: {
cid: this.$route.query.cid,
curriculumName: "", curriculumName: "",
curriculumType: '', curriculumType: '',
courseType: "", courseType: "",
@ -333,7 +332,7 @@ export default {
systemIdByPractice: [], systemIdByPractice: [],
supplier: [], supplier: [],
coverUrl: 'https://izhixinyun.com/images/course-cover.png', coverUrl: 'https://izhixinyun.com/images/course-cover.png',
mallDisciplines: [ curriculumDisciplines: [
{ {
professionalClassList: [], professionalClassList: [],
professionalList: [], professionalList: [],
@ -347,6 +346,9 @@ export default {
curriculumName: [ curriculumName: [
{ required: true, message: "请输入课程名称", trigger: "blur" } { required: true, message: "请输入课程名称", trigger: "blur" }
], ],
curriculumType: [
{ required: true, message: "请选择课程类别", trigger: "change" }
],
categoryId: [ categoryId: [
{ required: true, message: "请选择学科类别", trigger: "change" } { required: true, message: "请选择学科类别", trigger: "change" }
], ],
@ -453,11 +455,11 @@ export default {
this.getConfig() this.getConfig()
this.getSystem() this.getSystem()
this.getSupplier() this.getSupplier()
this.form.cid && this.getInfoData() this.cid && this.getInfoData()
}, },
methods: { methods: {
getInfoData () { getInfoData () {
this.$post(`${this.api.curriculumDetail}?cid=${this.form.cid}`).then(({ data }) => { this.$post(`${this.api.curriculumDetail}?cid=${this.cid}`).then(({ data }) => {
if (data.supplier) data.supplier = data.supplier.split(',').map(e => +e) if (data.supplier) data.supplier = data.supplier.split(',').map(e => +e)
if (data.categoryId) { if (data.categoryId) {
this.$get(this.api.courseProfessionalClass, { disciplineId: data.categoryId }).then(res => { this.$get(this.api.courseProfessionalClass, { disciplineId: data.categoryId }).then(res => {
@ -529,14 +531,14 @@ export default {
professionalCategoryId: 1, professionalCategoryId: 1,
professionalId: 1, professionalId: 1,
} }
this.form.mallDisciplines.push(e) this.form.curriculumDisciplines.push(e)
this.getProfessionalClassData(e) this.getProfessionalClassData(e)
}, },
// //
getSubject () { getSubject () {
this.$get(this.api.courseDiscipline).then(res => { this.$get(this.api.courseDiscipline).then(res => {
this.subjectList = res.list this.subjectList = res.list
this.form.mallDisciplines.forEach(e => { this.form.curriculumDisciplines.forEach(e => {
e.categoryId === 1 && this.getProfessionalClass(e) e.categoryId === 1 && this.getProfessionalClass(e)
}) })
}).catch(err => { }) }).catch(err => { })
@ -556,7 +558,7 @@ export default {
disciplineId: item.categoryId disciplineId: item.categoryId
}).then(res => { }).then(res => {
item.professionalClassList = res.list item.professionalClassList = res.list
this.form.mallDisciplines.forEach(e => { this.form.curriculumDisciplines.forEach(e => {
e.professionalCategoryId === 1 && this.getProfessional(e) e.professionalCategoryId === 1 && this.getProfessional(e)
}) })
}).catch(err => { }) }).catch(err => { })
@ -838,41 +840,100 @@ export default {
this.practiceData.splice(index, 1, row); this.practiceData.splice(index, 1, row);
}, },
save () { //
this.$refs.form.validate((valid) => { prev () {
if (valid) { this.step--
if (this.submiting) return false },
const form = JSON.parse(JSON.stringify(this.form)) async save (next) {
form.supplier = form.supplier.join() const { step } = this
//
this.submiting = true if (step === 1) {
this.loadIns = this.$loading({ this.$refs.form.validate(async (valid) => {
lock: true, if (valid) {
text: 'Loading', if (this.submiting) return false
spinner: 'el-icon-loading', const form = JSON.parse(JSON.stringify(this.form))
background: 'rgba(0, 0, 0, 0.7)' form.supplier = form.supplier.join()
this.submiting = true
this.loadIns = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
if (this.cid) {
this.$post(this.api.modifyCourse, form).then((res) => {
this.$message.success("编辑成功");
}).catch((res) => {
this.submiting = false
this.loadIns.close()
});
} else {
this.$post(this.api.createCurriculum, form).then(({ cid }) => {
this.loadIns.close()
if (next) {
this.step = 2
this.cid = cid
this.$router.replace('add?cid=' + cid)
} else {
this.back()
}
}).catch((res) => {
this.submiting = false
this.loadIns.close()
})
}
}
})
} else if (step === 2) {
//
if (!this.practiceData.length) {
return this.$message.warning("请添加练习项目配置")
} else {
const list = this.practiceData.map(i => {
let obj = {
isShow: i.isShow,
projectId: i.projectId || '',
paperId: i.paperId || '',
sort: Number(i.sort),
systemId: i.systemId
}
return obj
});
list.sort((a, b) => a.sort - b.sort)
await this.$post(this.api.configureCourseProject, {
cid: this.cid,
systemIdByPractice: list
}) })
debugger if (next) {
if (form.cid) { this.step = 3
this.$post(this.api.modifyCourse, form).then((res) => {
this.$message.success("编辑成功");
}).catch((res) => {
this.submiting = false
this.loadIns.close()
});
} else { } else {
this.$post(this.api.createCurriculum, form).then((res) => { this.back()
this.loadIns.close()
this.$router.push('/curriculum')
}).catch((res) => {
this.submiting = false
this.loadIns.close()
});
} }
}
} else if (step === 3) {
//
if (!this.assessmentData.length) {
return this.$message.warning("请添加考核项目配置")
} else { } else {
return false; const list = this.assessmentData.map(i => {
let obj = {
isShow: i.isShow,
projectId: i.projectId,
paperId: i.paperId || '',
sort: Number(i.sort),
systemId: i.systemId
};
return obj;
});
list.sort((a, b) => a.sort - b.sort)
await this.$post(this.api.configureCourseProject, {
cid: this.cid,
systemIdByAssessment: list
})
this.step = 4
} }
}); }
}, },
// //
back () { back () {

@ -223,7 +223,7 @@ export default {
// //
edit (row) { edit (row) {
this.setReferrer() this.setReferrer()
this.$router.push(`/addcurriculum?cid=${row.cid}`); this.$router.push(`/curriculum/add?cid=${row.cid}`);
}, },
// //
config (row) { config (row) {

@ -6,8 +6,7 @@
</div> </div>
</el-card> </el-card>
<!--内容设置--> <!--内容设置-->
<el-card shadow="hover" class="mgb20"> <div class="page mgb20">
<div class="page">
<div class="relative"> <div class="relative">
<div class="p-title">内容设置</div> <div class="p-title">内容设置</div>
<div class="btns"> <div class="btns">
@ -191,7 +190,6 @@
<Pdf :visible.sync="pdfVisible" :src.sync="pdfSrc" /> <Pdf :visible.sync="pdfVisible" :src.sync="pdfSrc" />
</div> </div>
</div> </div>
</el-card>
<div class="player-download" id="playerDownload"></div> <div class="player-download" id="playerDownload"></div>
<el-dialog title="资源移动" :visible.sync="moveVisible" :close-on-click-modal="false" width="330px"> <el-dialog title="资源移动" :visible.sync="moveVisible" :close-on-click-modal="false" width="330px">

Loading…
Cancel
Save