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`, //课程列表
createCurriculum: `nakadai/nakadai/curriculum/createCurriculum`, //创建课程
configureCourseProject: `nakadai/nakadai/curriculum/configureCourseProject`,
curriculumDetail: `nakadai/nakadai/curriculum/curriculumDetail`, //课程详情
modifyCourse: `nakadai/nakadai/curriculum/modifyCourse`, //编辑课程
delCourse: `nakadai/nakadai/curriculum/delCourse`, //单个、批量删除课程

@ -1,13 +1,13 @@
<template>
<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">
<el-page-header @back="back" :content="'新建课程'"></el-page-header>
</div>
</el-card>
<div class="page">
<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)">
<span class="circle">1</span>
<p class="text">填写课程信息</p>
@ -42,7 +42,7 @@
<el-form-item class="req" label="适用专业" required>
<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-select v-model="item.categoryId" @change="getProfessionalClass(item)">
<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>
</el-select>
</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 v-if="!isDetail" class="subject-plus" @click="addSubject">
<div class="subject-plus" @click="addSubject">
<i class="el-icon-circle-plus-outline"></i>
</div>
</el-form-item>
@ -104,11 +104,11 @@
<el-form-item label="课程简介" prop="briefIntroduction">
<Editor api-key='rnk6zw9v267xqz7pf98twt1vmrvltmd436je7a642pckltda' v-model="form.briefIntroduction"
:init="editorConfig" :disabled="isDetail" />
:init="editorConfig" />
</el-form-item>
<el-form-item label="详情介绍" prop="teachingObjectives">
<Editor api-key='rnk6zw9v267xqz7pf98twt1vmrvltmd436je7a642pckltda' v-model="form.teachingObjectives"
:init="editorConfig" :disabled="isDetail" />
:init="editorConfig" />
</el-form-item>
</el-form>
@ -215,9 +215,9 @@
</div>
<div v-if="step !== 4" class="btns">
<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 type="primary" @click="save(1)">保存</el-button>
<el-button @click="cancel">{{ editing ? '取消' : '返回' }}</el-button>
<el-button v-else type="primary" @click="save(1)">下一步</el-button>
<el-button type="primary" @click="save()">保存</el-button>
<el-button @click="back">返回</el-button>
</div>
</div>
@ -312,14 +312,13 @@ export default {
},
data () {
return {
cid: this.$route.query.cid,
headers: {
token: sessionStorage.getItem("token")
},
editorConfig,
isDetail: Boolean(this.$route.query.isDetail),
step: 1,
form: {
cid: this.$route.query.cid,
curriculumName: "",
curriculumType: '',
courseType: "",
@ -333,7 +332,7 @@ export default {
systemIdByPractice: [],
supplier: [],
coverUrl: 'https://izhixinyun.com/images/course-cover.png',
mallDisciplines: [
curriculumDisciplines: [
{
professionalClassList: [],
professionalList: [],
@ -347,6 +346,9 @@ export default {
curriculumName: [
{ required: true, message: "请输入课程名称", trigger: "blur" }
],
curriculumType: [
{ required: true, message: "请选择课程类别", trigger: "change" }
],
categoryId: [
{ required: true, message: "请选择学科类别", trigger: "change" }
],
@ -453,11 +455,11 @@ export default {
this.getConfig()
this.getSystem()
this.getSupplier()
this.form.cid && this.getInfoData()
this.cid && this.getInfoData()
},
methods: {
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.categoryId) {
this.$get(this.api.courseProfessionalClass, { disciplineId: data.categoryId }).then(res => {
@ -529,14 +531,14 @@ export default {
professionalCategoryId: 1,
professionalId: 1,
}
this.form.mallDisciplines.push(e)
this.form.curriculumDisciplines.push(e)
this.getProfessionalClassData(e)
},
//
getSubject () {
this.$get(this.api.courseDiscipline).then(res => {
this.subjectList = res.list
this.form.mallDisciplines.forEach(e => {
this.form.curriculumDisciplines.forEach(e => {
e.categoryId === 1 && this.getProfessionalClass(e)
})
}).catch(err => { })
@ -556,7 +558,7 @@ export default {
disciplineId: item.categoryId
}).then(res => {
item.professionalClassList = res.list
this.form.mallDisciplines.forEach(e => {
this.form.curriculumDisciplines.forEach(e => {
e.professionalCategoryId === 1 && this.getProfessional(e)
})
}).catch(err => { })
@ -838,41 +840,100 @@ export default {
this.practiceData.splice(index, 1, row);
},
save () {
this.$refs.form.validate((valid) => {
if (valid) {
if (this.submiting) return false
const form = JSON.parse(JSON.stringify(this.form))
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)'
//
prev () {
this.step--
},
async save (next) {
const { step } = this
//
if (step === 1) {
this.$refs.form.validate(async (valid) => {
if (valid) {
if (this.submiting) return false
const form = JSON.parse(JSON.stringify(this.form))
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 (form.cid) {
this.$post(this.api.modifyCourse, form).then((res) => {
this.$message.success("编辑成功");
}).catch((res) => {
this.submiting = false
this.loadIns.close()
});
if (next) {
this.step = 3
} else {
this.$post(this.api.createCurriculum, form).then((res) => {
this.loadIns.close()
this.$router.push('/curriculum')
}).catch((res) => {
this.submiting = false
this.loadIns.close()
});
this.back()
}
}
} else if (step === 3) {
//
if (!this.assessmentData.length) {
return this.$message.warning("请添加考核项目配置")
} 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 () {

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

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

Loading…
Cancel
Save