课程资讯联调

Branch_d40a2540
yujialong 2 years ago
parent 9ba8896318
commit 6de1bfc0ed
  1. 28
      src/api/index.js
  2. 35
      src/components/menuTree/index.vue
  3. 26
      src/pages/achievement/show/index.vue
  4. 322
      src/pages/course/add/index.vue
  5. 148
      src/pages/course/list/courseManagement/index.vue
  6. 13
      src/pages/information/addarticle/index.vue
  7. 186
      src/pages/information/columnManage/index.vue
  8. 34
      src/pages/information/contentManage/index.vue

@ -83,6 +83,8 @@ export default {
reportDetail: `occupationlab/occupationlab/achievement/reportDetail`, // 查看实验报告 reportDetail: `occupationlab/occupationlab/achievement/reportDetail`, // 查看实验报告
schoolCourseByAchievement: `nakadai/nakadai/curriculum/schoolCourseByAchievement`, // 获取学校购买订单后的课程 schoolCourseByAchievement: `nakadai/nakadai/curriculum/schoolCourseByAchievement`, // 获取学校购买订单后的课程
spliceClass: `occupationlab/occupationlab/achievement/spliceClass`, spliceClass: `occupationlab/occupationlab/achievement/spliceClass`,
exportLabReport: `occupationlab/occupationlab/achievement/exportLabReport`,
exportBankExperimentReport: `occupationlab/occupationlab/achievement/exportBankExperimentReport`,
// 项目管理 // 项目管理
getSystemIdBySchool: `occupationlab/occupationlab/projectManage/getSystemIdBySchool`, // 获取学校下拥有的系统 getSystemIdBySchool: `occupationlab/occupationlab/projectManage/getSystemIdBySchool`, // 获取学校下拥有的系统
@ -158,20 +160,20 @@ export default {
articleSort: `${host2}occupationlab/occupationlab/information/article/articleSort`, articleSort: `${host2}occupationlab/occupationlab/information/article/articleSort`,
// 课程管理 // 课程管理
queryCourseByCondition: `occupationlab/occupationlab/management/edu/course/queryCourseByCondition`, // 课程列表分页条件查询 delTheoreticalCourse: `occupationlab/occupationlab/theoreticalCourse/batchDeletion`,
addCourse: `occupationlab/occupationlab/management/edu/course/addCourse`, // 添加课程 findTheoreticalCourse: `occupationlab/occupationlab/theoreticalCourse/findById`,
deleteCourse: `occupationlab/occupationlab/management/edu/course/deleteCourse`, // 根据id删除课程 listTheoreticalCourse: `occupationlab/occupationlab/theoreticalCourse/pageConditionalQueryCourse`,
deleteCourses: `occupationlab/occupationlab/management/edu/course/deleteCourses`, // 批量删除课程 saveTheoreticalCourse: `occupationlab/occupationlab/theoreticalCourse/save`,
editCourse: `occupationlab/occupationlab/management/edu/course/editCourse`, // 修改课程 updateTheoreticalCourse: `occupationlab/occupationlab/theoreticalCourse/update`,
enableCourse: `occupationlab/occupationlab/management/schoolCourse/enableGlCourse`, // 是否启用管理端课程 disabledTheoreticalCourse: `occupationlab/occupationlab/theoreticalCourse/disabledEvents`,
getCourse: `occupationlab/occupationlab/management/edu/course/getCourse`, // 根据id查询课程 checkRepeatTheoreticalCourse: `occupationlab/occupationlab/theoreticalCourse/checkRepeat`,
// 分类管理 // 分类管理
checkRepeat: `occupationlab/theoreticalCourseClassification/checkRepeat`, checkRepeat: `occupationlab/occupationlab/theoreticalCourseClassification/checkRepeat`,
delClassification: `occupationlab/theoreticalCourseClassification/delete`, delClassification: `occupationlab/occupationlab/theoreticalCourseClassification/delete`,
findClassification: `occupationlab/theoreticalCourseClassification/findById`, findClassification: `occupationlab/occupationlab/theoreticalCourseClassification/findById`,
listClassification: `occupationlab/theoreticalCourseClassification/pagingQuery`, listClassification: `occupationlab/occupationlab/theoreticalCourseClassification/pagingQuery`,
saveClassification: `occupationlab/theoreticalCourseClassification/save`, saveClassification: `occupationlab/occupationlab/theoreticalCourseClassification/save`,
updateClassification: `occupationlab/theoreticalCourseClassification/update`, updateClassification: `occupationlab/occupationlab/theoreticalCourseClassification/update`,
// 课程章节管理 // 课程章节管理
addChapter: `occupationlab/occupationlab/management/edu/courseChapter/addChapter`, addChapter: `occupationlab/occupationlab/management/edu/courseChapter/addChapter`,
chapterReorder: `occupationlab/occupationlab/management/edu/courseChapter/chapterReorder`, chapterReorder: `occupationlab/occupationlab/management/edu/courseChapter/chapterReorder`,

@ -0,0 +1,35 @@
<template>
<div>
<template v-for="item in this.menuList">
<el-submenu :key="item.id" :index="item.id" v-if="item.children && item.children.length">
<template slot="title">
<span slot="title">{{item.name}}</span>
</template>
<menuTree :menuList="item.children"></menuTree>
</el-submenu>
<el-menu-item :key="item.id" :index="item.id" v-else>
<span slot="title">{{item.name}}</span>
</el-menu-item>
</template>
</div>
</template>
<script>
export default {
name: 'menuTree',
props: {
menuList: {
type: Array,
default: []
}
},
data () {
return {}
},
mounted () {},
methods: {}
}
</script>
<style lang="scss" scoped>
</style>

@ -5,6 +5,9 @@
</el-card> </el-card>
<div class="content"> <div class="content">
<div class="text-right">
<el-button type="primary" @click="exportPage">导出报告</el-button>
</div>
<h6 class="r-title">标准实验报告</h6> <h6 class="r-title">标准实验报告</h6>
<div class="info"> <div class="info">
<h6 class="l-title"> <h6 class="l-title">
@ -131,6 +134,7 @@
</template> </template>
<script> <script>
import util from "@/libs/util";
export default { export default {
data() { data() {
return { return {
@ -172,7 +176,27 @@ export default {
userName: form.userName userName: form.userName
} }
}).catch(res => {}) }).catch(res => {})
} },
exportPage() {
const form = JSON.parse(JSON.stringify(this.form))
const list = JSON.parse(JSON.stringify(this.expData))
list.map((e, i) => {
e.id = i + 1
if (e.referenceAnswer && typeof e.referenceAnswer === 'string') e.referenceAnswer = e.referenceAnswer.replace(/<[^>]+>/g, '').replace(/(&nbsp;|&amp;|%s)/g, '').replace(/>/g, '&gt;').replace(/</g, '&lt;')
if (e.answer && typeof e.answer === 'string') e.answer = e.answer.replace(/<[^>]+>/g, '').replace(/(&nbsp;|&amp;|%s)/g, '').replace(/>/g, '&gt;').replace(/</g, '&lt;')
})
for (const i in form) {
if (form[i] && typeof form[i] === 'string') form[i] = form[i].replace(/<[^>]+>/g, '')
}
form.purpose = form.purpose.replace(/<[^>]+>/g, '')
this.$post(this.project ? this.api.exportBankExperimentReport : this.api.exportLabReport, {
...form,
experimentalData: list
}).then(res => {
console.log(res)
util.downloadFileDirect(`实验报告.docx`,new Blob([res]))
}).catch(res => {})
},
} }
}; };
</script> </script>

@ -7,39 +7,43 @@
</el-card> </el-card>
<el-card shadow="hover" class="m-b-20"> <el-card shadow="hover" class="m-b-20">
<el-form :disabled="isDetail" label-width="100px" label-suffix=":"> <el-form :model="form" :rules="rules" ref="form" :disabled="isDetail" label-width="110px" label-suffix=":">
<el-form-item label="课程名称"> <el-form-item prop="courseName" label="课程名称">
<div class="d-inline-block"> <div class="d-inline-block">
<el-input placeholder="请输入课程名称" v-model="form.name" clearable maxlength="25"></el-input> <el-input placeholder="请输入课程名称" v-model="form.courseName" clearable maxlength="25" @change="nameChange"></el-input>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="课程类型"> <el-form-item prop="courseType" label="课程类型">
<div class="d-inline-block"> <div class="d-inline-block">
<el-select v-model="form.classificationId" placeholder="请选择课程类型"> <el-select v-model="form.courseType" placeholder="请选择课程类型">
<el-option label="免费" value="1"></el-option> <el-option label="免费" :value="0"></el-option>
<!-- <el-option label="付费" :value="1"></el-option> -->
</el-select> </el-select>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="可见范围"> <el-form-item label="可见范围">
<div class="d-inline-block"> <div>
<el-radio v-model="form.classificationId">本校</el-radio> <el-radio v-model="form.visibleRange" :label="1">全平台</el-radio>
</div> </div>
<div>
<el-radio v-model="form.visibleRange" :label="0">仅本校</el-radio>
</div>
</el-form-item> </el-form-item>
<el-form-item label="课程分类"> <el-form-item prop="schoolClassificationsIds" label="课程分类">
<div class="d-inline-block"> <div class="d-inline-block">
<el-select v-model="form.classificationId" placeholder="请选择课程分类"> <el-select v-model="form.schoolClassificationsIds" placeholder="请选择课程分类" multiple>
<el-option v-for="item in classificationList" :key="item.id" :label="item.name" :value="item.id"></el-option> <el-option v-for="item in classificationList" :key="item.id" :label="item.classificationName" :value="item.id"></el-option>
</el-select> </el-select>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="平台课程分类"> <el-form-item prop="platformClassificationIds" label="平台课程分类">
<div class="d-inline-block"> <div class="d-inline-block">
<el-select v-model="form.classificationId" placeholder="平台请选择课程分类"> <el-select v-model="form.platformClassificationIds" placeholder="请选择平台课程分类" multiple>
<el-option v-for="item in classificationList" :key="item.id" :label="item.name" :value="item.id"></el-option> <el-option v-for="item in platformClassificationList" :key="item.id" :label="item.classificationName" :value="item.id"></el-option>
</el-select> </el-select>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="课程封面"> <el-form-item prop="coverUrl" label="课程封面">
<el-upload <el-upload
class="avatar-uploader" class="avatar-uploader"
accept=".jpg,.png,.jpeg" accept=".jpg,.png,.jpeg"
@ -66,10 +70,10 @@
</el-upload> </el-upload>
</el-form-item> </el-form-item>
<el-form-item label="课程介绍"> <el-form-item label="课程介绍">
<quill :border="true" :readonly="isDetail" v-model="form.description" :height="400" /> <quill :border="true" :readonly="isDetail" v-model="form.courseIntroduction" :height="400" />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" v-throttle @click="save" v-show="!isDetail">{{ form.id ? "更新" : "创建" }}</el-button> <el-button type="primary" @click="save" v-show="!isDetail">{{ form.id ? "更新" : "创建" }}</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-card> </el-card>
@ -82,25 +86,116 @@ import Setting from "@/setting";
import quill from "@/components/quill"; import quill from "@/components/quill";
export default { export default {
name: "courseAddEdit",
data() { data() {
const that = this
return { return {
headers: { headers: {
token: util.local.get(Setting.tokenKey) token: util.local.get(Setting.tokenKey)
}, },
isDetail: Boolean(this.$route.query.show), isDetail: Boolean(this.$route.query.show),
form: { form: {
id: this.$route.query.id, id: this.$route.query.id,
classificationId: '', courseIntroduction: '',
courseName: '',
courseType: 0,
coverUrl: '', coverUrl: '',
name: '', platformSource: Setting.platformSource,
description: '', platformClassificationIds: [],
distinguish: 1 schoolClassificationsIds: [],
visibleRange: 1
}, },
rules: {
courseName: [
{ required: true, message: '请输入课程名称', trigger: 'blur' }
],
// platformClassificationIds: [
// { required: true, message: '', trigger: 'change' }
// ],
coverUrl: [
{ required: true, message: '请选择课程封面', trigger: 'change' }
]
},
platformClassificationList: [],
classificationList: [], classificationList: [],
uploadList: [], uploadList: [],
submiting: false, submiting: false,
updateTime: 0 updateTime: 0,
rangeVisible: false,
range: [],
rangeInit: [],
rangeName: '',
rangeChecked: [],
schools: [],
rangeList: [],
rangeTimer: null,
//
props: {
multiple: true,
checkStrictly: true,
lazy: true,
lazyLoad (node, resolve) {
//
const input = document.querySelector('.el-cascader__search-input')
const checked = that.rangeChecked
if (input && input.value.trim()) {
const val = input.value.trim()
return that.schools.filter(e => e.label.includes(val))
}
const { level, value } = node
//
if (!level) {
that.$get(that.api.queryProvince).then(({ list }) => {
const data = []
list.map(e => {
e.value = e.provinceId
e.label = e.provinceName
e.children = []
e.disabled = !!checked.find(n => n.provinceId == e.provinceId && !n.cityId)
data.push(e)
})
resolve(data)
}).catch(res => {})
} else if (level === 1) {
//
that.$get(that.api.queryCity, {
provinceId: value
}).then(({ list }) => {
const data = []
list.map(e => {
e.value = e.cityId
e.label = e.cityName
e.children = []
e.disabled = !!checked.find(n => n.cityId == e.cityId && n.provinceId == e.provinceId && !n.schoolId)
data.push(e)
})
resolve(data)
}).catch(res => {})
} else if (level === 2) {
//
that.$get(that.api.getSchoolsByProvince, {
provinceId: node.data.provinceId,
cityId: value,
schoolName: ''
}).then(({ list }) => {
const data = []
list.map(e => {
e.value = e.schoolId
e.label = e.schoolName
e.leaf = true
e.disabled = !!checked.find(n => n.schoolId == e.schoolId && n.cityId == e.cityId && n.provinceId == e.provinceId)
data.push(e)
})
resolve(data)
}).catch(res => {})
} else {
resolve([])
}
}
},
nameRepeat: false
}; };
}, },
watch: { watch: {
@ -113,58 +208,96 @@ export default {
} }
}, },
mounted() { mounted() {
this.getClassification(); this.getClassification()
this.form.id && this.getData(); this.form.id && this.getData()
}, },
components: { components: {
quill quill
}, },
methods: { methods: {
getClassification() { //
this.$get(this.api.queryGlClassification).then(res => { getClassification() {
this.classificationList = res.classificationList; //
}).catch(res => {}); this.$post(this.api.listClassification, {
}, pageNum: 1,
getData() { pageSize: 1000,
this.$get(`${this.api.getCourse}/${this.form.id}`).then(({ course }) => { platformSource: 0
this.form = course }).then(({ page }) => {
this.uploadList.push({ this.platformClassificationList = page.records
name: "cover.jpg", }).catch(res => {})
url: course.coverUrl
}) //
}).catch(err => {}) this.$post(this.api.listClassification, {
}, pageNum: 1,
handleExceed(files, fileList) { // pageSize: 1000,
util.warningMsg("当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!"); platformSource: Setting.platformSource
}, }).then(({ page }) => {
uploadSuccess(res, file, fileList) { this.classificationList = page.records
this.form.coverUrl = res.data.filesResult.fileUrl }).catch(res => {})
}, },
uploadError(err, file, fileList) { getData() {
this.$message({ this.$post(`${this.api.findTheoreticalCourse}?id=${this.form.id}`).then(({ data }) => {
message: "上传出错,请重试!", // id
type: "error", if (data.platformClassificationList) {
center: true data.platformClassificationIds = data.platformClassificationList.map(e => e.classificationId)
}); delete data.platformClassificationList
}, }
beforeRemove(file, fileList) { if (data.schoolClassificationsList) {
return this.$confirm(`确定移除 ${file.name}`); data.schoolClassificationsIds = data.schoolClassificationsList.map(e => e.classificationId)
}, delete data.schoolClassificationsList
handleRemove(file, fileList) { }
let fileName = this.form.coverUrl.replace('https://huoran.oss-cn-shenzhen.aliyuncs.com/', ""); this.form = data
this.$del(`${this.api.fileDeletion}?keys=${fileName}`).then(res => { this.uploadList.push({
this.form.coverUrl = '' name: "cover.jpg",
}).catch(res => {}); url: data.coverUrl
}, })
save() { }).catch(err => {})
},
//
nameChange(val) {
this.$post(this.api.checkRepeatTheoreticalCourse, {
id: this.form.id,
courseName: val,
platformSource: Setting.platformSource
}).then(res => {
this.nameRepeat = false
}).catch(err => {
this.nameRepeat = true
})
},
handleExceed(files, fileList) { //
util.warningMsg("当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!");
},
uploadSuccess(res, file, fileList) {
this.form.coverUrl = res.data.filesResult.fileUrl
},
uploadError(err, file, fileList) {
this.$message({
message: "上传出错,请重试!",
type: "error",
center: true
});
},
beforeRemove(file, fileList) {
return this.$confirm(`确定移除 ${file.name}`);
},
handleRemove(file, fileList) {
let fileName = this.form.coverUrl.replace('https://huoran.oss-cn-shenzhen.aliyuncs.com/', "");
this.$del(`${this.api.fileDeletion}?keys=${fileName}`).then(res => {
this.form.coverUrl = ''
}).catch(res => {});
},
save() {
this.$refs.form.validate((valid) => {
if (valid) {
if (this.nameRepeat) return util.errorMsg('当前课程名已存在!')
if (this.submiting) return false if (this.submiting) return false
const { form } = this const { form } = this
if (!form.name) return util.warningMsg("请填写课程名称")
if (!form.classificationId) return util.warningMsg("请选择课程分类")
if (!form.coverUrl) return util.warningMsg("请上传课程封面")
this.submiting = true this.submiting = true
if (form.id) { if (form.id) {
this.$put(this.api.editCourse, form).then(res => { form.courseId = form.id
form.platformSource = Setting.platformSource
this.$post(this.api.updateTheoreticalCourse, form).then(res => {
this.submiting = false; this.submiting = false;
util.successMsg("修改成功"); util.successMsg("修改成功");
this.$router.back(); this.$router.back();
@ -172,14 +305,14 @@ export default {
this.submiting = false; this.submiting = false;
}); });
} else { } else {
this.$post(this.api.addCourse, form).then(res => { this.$post(this.api.saveTheoreticalCourse, form).then(res => {
this.submiting = false; this.submiting = false;
this.$confirm("课程创建成功,是否马上进行课程内容设置?", "提示", { this.$confirm("课程创建成功,是否马上进行课程内容设置?", "提示", {
type: "success", type: "success",
confirmButtonText: "马上设置", confirmButtonText: "马上设置",
cancelButtonText: "稍后操作" cancelButtonText: "稍后操作"
}).then(() => { }).then(() => {
this.$router.push(`/course/contentSettings?id=${res.courseId}`); this.$router.push(`/setTheoreticalCourse?id=${res.id}`);
}).catch(() => { }).catch(() => {
this.$router.back(); this.$router.back();
}); });
@ -187,27 +320,29 @@ export default {
this.submiting = false; this.submiting = false;
}); });
} }
},
//
backPage() {
this.$router.back()
},
back() {
const { id } = this.form
const updateTime = this.updateTime
//
if ((id && updateTime > 2) || (!id && updateTime)) {
this.$confirm(`编辑的内容未保存,是否保存?`, '提示', {
type: 'warning'
}).then(() => {
this.save()
}).catch(() => {
this.backPage()
})
} else {
this.backPage()
} }
})
},
//
backPage() {
this.$router.back()
},
back() {
const { id } = this.form
const updateTime = this.updateTime
//
if ((id && updateTime > 2) || (!id && updateTime)) {
this.$confirm(`编辑的内容未保存,是否保存?`, '提示', {
type: 'warning'
}).then(() => {
this.save()
}).catch(() => {
this.backPage()
})
} else {
this.backPage()
} }
}
} }
}; };
</script> </script>
@ -279,4 +414,13 @@ $avatar-width: 104px;
width: 100%; width: 100%;
} }
} }
.range-check {
display: inline-block;
margin: 0 0 10px 10px;
}
/deep/.range-cas {
.el-tag {
display: none;
}
}
</style> </style>

@ -5,9 +5,9 @@
<ul class="filter" style="align-items: flex-start"> <ul class="filter" style="align-items: flex-start">
<li> <li>
<label>课程分类</label> <label>课程分类</label>
<el-select v-model="classificationId" clearable placeholder="请选择课程分类" @change="getData"> <el-select v-model="categoryId" clearable placeholder="请选择课程分类" @change="initData">
<el-option label="不限" value=""></el-option> <el-option label="不限" value=""></el-option>
<el-option v-for="(item,index) in classificationList" :key="index" :label="item.name" :value="item.id"></el-option> <el-option v-for="(item,index) in classificationList" :key="index" :label="item.classificationName" :value="item.id"></el-option>
</el-select> </el-select>
</li> </li>
<li> <li>
@ -21,26 +21,21 @@
</div> </div>
</div> </div>
<el-table :data="courseData" class="table" ref="table" stripe header-align="center" @selection-change="handleSelectionChange" row-key="id"> <el-table :data="list" class="table" ref="table" stripe header-align="center" @selection-change="handleSelectionChange" row-key="id">
<el-table-column type="selection" width="80" align="center" :reserve-selection="true"></el-table-column> <el-table-column type="selection" width="80" align="center" :reserve-selection="true"></el-table-column>
<el-table-column type="index" width="100" label="序号" align="center"> <el-table-column type="index" width="100" label="序号" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.$index + (current - 1) * pageSize + 1 }} {{ scope.$index + (page - 1) * pageSize + 1 }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="name" label="课程名称"> <el-table-column prop="courseName" label="课程名称">
</el-table-column> </el-table-column>
<el-table-column prop="classification" label="课程分类"> <el-table-column prop="courseClassification" label="课程分类">
</el-table-column> </el-table-column>
<el-table-column prop="gmtCreate" label="创建时间" align="center"> <el-table-column prop="createTime" label="创建时间" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="founder" label="创建人" align="center"> <el-table-column prop="founder" label="创建人" align="center">
</el-table-column> </el-table-column>
<el-table-column label="章节数" align="center">
<template slot-scope="scope">
{{ scope.row.chapterNum ? scope.row.chapterNum : 0 }}({{ scope.row.subsectionNum ? scope.row.subsectionNum : 0 }}小节)
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="250"> <el-table-column label="操作" align="center" width="250">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button v-auth="'课程管理:编辑信息'" type="text" @click="editCourse(scope.row)">编辑信息</el-button> <el-button v-auth="'课程管理:编辑信息'" type="text" @click="editCourse(scope.row)">编辑信息</el-button>
@ -54,20 +49,22 @@
</el-table-column> </el-table-column>
<el-table-column label="可授权状态" align="center" width="120"> <el-table-column label="可授权状态" align="center" width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<!-- 列表展示中台的禁启用依据zt_open展示职站的禁启用依据is_open展示 -->
<!-- 中台禁用了这个学校发布的学校这边还能看到但是学校这边不能启用 -->
<el-switch <el-switch
v-auth="'课程管理:禁用'" v-auth="'课程管理:禁用'"
v-model="scope.row.isEnable" v-model="scope.row.isOpen"
:active-value="0" :active-value="0"
:inactive-value="1" :inactive-value="1"
style="margin: 0 5px" style="margin: 0 10px 0 5px"
:active-text="scope.row.isEnable ? '关' : '开'" :active-text="scope.row.isOpen ? '关' : '开'"
@change="switchOff($event,scope.row,scope.$index)" @change="switchOff($event,scope.row,scope.$index)"
></el-switch> ></el-switch>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<div class="pagination"> <div class="pagination">
<el-pagination background layout="total, prev, pager, next" :total="totals" @current-change="handleCurrentChange" :current-page="current"> <el-pagination background layout="total, prev, pager, next" :total="total" @current-change="handleCurrentChange" :current-page="page">
</el-pagination> </el-pagination>
</div> </div>
</div> </div>
@ -75,19 +72,19 @@
<script> <script>
import util from "@/libs/util"; import util from "@/libs/util";
import Setting from '@/setting'
export default { export default {
name: "courseManagement", name: "courseManagement",
data() { data() {
return { return {
keyword: "", keyword: "",
classificationId: "", categoryId: '',
courseData: [], list: [],
multipleSelection: [], multipleSelection: [],
classificationList: [], classificationList: [],
current: +this.$route.query.page || 1, // page: +this.$route.query.page || 1, //
pageSize: 10, pageSize: 10,
totals: 0 total: 0
}; };
}, },
watch: { watch: {
@ -104,33 +101,35 @@ export default {
}, },
methods: { methods: {
getData() { getData() {
let data = { this.$post(this.api.listTheoreticalCourse, {
classificationId: this.classificationId, pageNum: this.page,
name: this.keyword pageSize: this.pageSize,
}; keyWord: this.keyword,
this.$get(`${this.api.queryCourseByCondition}/${this.current}/${this.pageSize}`, data).then(res => { createPlatform: 1,
this.courseData = res.courseList; platformSource: Setting.platformSource,
this.totals = res.total; categoryId: this.categoryId
if (!this.courseData.length && this.totals) { }).then(({ page }) => {
this.current--; this.list = page.records;
this.total = page.total;
if (!this.list.length && this.total) {
this.page--;
this.getData(); this.getData();
} }
}).catch(res => { }).catch(res => {
}); });
}, },
initData() { initData() {
this.current = 1; this.page = 1;
this.getData(); this.getData();
}, },
getClassification() { getClassification() {
this.$get(this.api.queryGlClassification).then(res => { this.$post(this.api.listClassification, {
this.classificationList = res.classificationList; pageNum: 1,
}).catch(res => { pageSize: 1000,
}); platformSource: Setting.platformSource
}, }).then(({ page }) => {
changeType(type) { this.classificationList = page.records
this.classificationId = type; }).catch(res => {})
this.initData();
}, },
preview(row) { preview(row) {
this.$router.push(`/course/preview?id=${row.id}`); this.$router.push(`/course/preview?id=${row.id}`);
@ -149,7 +148,7 @@ export default {
type: "warning" type: "warning"
}) })
.then(() => { .then(() => {
this.$del(`${this.api.deleteCourse}/${row.id}`).then(res => { this.$post(`${this.api.delTheoreticalCourse}?ids=${row.id}`).then(res => {
util.successMsg("删除成功"); util.successMsg("删除成功");
this.initData(); this.initData();
}).catch(res => { }).catch(res => {
@ -158,54 +157,45 @@ export default {
.catch(() => { .catch(() => {
}); });
}, },
getRowKeys(row) {
return row.customerId;
},
handleSelectionChange(val) { handleSelectionChange(val) {
this.multipleSelection = val; this.multipleSelection = val;
}, },
delAllData() { delAllData() {
if (this.multipleSelection.length != "") { const list = this.multipleSelection
let newArr = this.multipleSelection; if (list.length != "") {
let delList = newArr.map(item => { this.$confirm(`确定要删除吗?`, "提示", {
return item.id; type: "warning"
}); })
this.$confirm(`此批量删除操作不可逆,是否确认删除${newArr[0].name}${newArr.length}个选中项?`, "提示", { .then(() => {
type: "warning" const data = []
}) list.map(e => {
.then(() => { data.push('ids=' + e.id)
let data = { })
courseIds: delList.join() this.$post(`${this.api.delTheoreticalCourse}?${data.join('&')}`).then(res => {
}; this.$refs.table.clearSelection();
this.$del(this.api.deleteCourses, data).then(res => { util.successMsg("删除成功");
this.multipleSelection = []; this.initData();
this.$refs.table.clearSelection(); }).catch(res => {
util.successMsg("删除成功"); });
this.initData(); }).catch(() => {
}).catch(res => { });
}); } else {
if(this.multipleSelection.length === this.courseData.length && this.current>1) { util.errorMsg("请先选择数据 !");
this.handleCurrentChange(this.current - 1) }
}
}).catch(() => {
});
} else {
util.errorMsg("请先选择数据 !");
}
}, },
handleCurrentChange(val) { handleCurrentChange(val) {
this.current = val; this.page = val;
this.$router.push(`list?page=${val}`) this.$router.push(`list?page=${val}`)
this.getData(); this.getData();
}, },
switchOff(val, row, index) { switchOff(val, row) {
this.$put(`${this.api.enableCourse}?courseId=${row.id}&isEnable=${val}`) this.$post(this.api.disabledTheoreticalCourse, {
.then(res => { courseId: row.id,
this.getData(); isOpen: val,
val == 1 ? util.warningMsg("该教学资源已隐藏,对学生端用户不可见") : util.successMsg("该教学资源已公开,对学生端用户可见"); type: 1 // (01)
}) }).then(res => {
.catch(err => { val == 1 ? util.warningMsg('禁用成功') : util.successMsg('启用成功')
}); }).catch(err => {})
} }
} }
}; };

@ -53,6 +53,7 @@
</template> </template>
<script> <script>
import { mapState } from "vuex";
import quill from "@/components/quill"; import quill from "@/components/quill";
import util from "@/libs/util"; import util from "@/libs/util";
import Setting from "@/setting"; import Setting from "@/setting";
@ -64,8 +65,8 @@ export default {
headers: { headers: {
token: util.local.get(Setting.tokenKey) token: util.local.get(Setting.tokenKey)
}, },
columnId: this.$route.query.columnId, columnId: +this.$route.query.columnId,
sort: this.$route.query.sort, sort: +this.$route.query.sort,
id: "", id: "",
coverUrl: "", coverUrl: "",
uploadList: [], uploadList: [],
@ -81,6 +82,11 @@ export default {
components: { components: {
quill quill
}, },
computed: {
...mapState("user", [
"userName", "customerName"
])
},
mounted() { mounted() {
this.id = this.$route.query.id; this.id = this.$route.query.id;
this.id && this.getData(); this.id && this.getData();
@ -122,7 +128,8 @@ export default {
date: this.date, date: this.date,
title: this.title, title: this.title,
content: this.content, content: this.content,
sort: this.sort sort: this.sort,
createUser: this.customerName || this.userName
}; };
if (this.id) { if (this.id) {
this.$put(this.api.editArticle, data).then(res => { this.$put(this.api.editArticle, data).then(res => {

@ -1,11 +1,6 @@
<template> <template>
<div> <div>
<div class="page"> <div class="page">
<!--
<div class='tabs'>
<a class='item' v-for='(item,index) in tabs' :key='index' :class='{active: index == activeName}' @click='tabChange(index)'>{{ item }}</a>
</div>
-->
<div class="btn-wrap"> <div class="btn-wrap">
<template v-if="sorting"> <template v-if="sorting">
<el-button class="action-btn" type="primary" round @click="cancelSort">取消</el-button> <el-button class="action-btn" type="primary" round @click="cancelSort">取消</el-button>
@ -14,7 +9,7 @@
<template v-if="!sorting"> <template v-if="!sorting">
<el-button v-auth="'栏目管理:更改排序'" class="action-btn" type="primary" round @click="openSort">更改排序 <el-button v-auth="'栏目管理:更改排序'" class="action-btn" type="primary" round @click="openSort">更改排序
</el-button> </el-button>
<el-button v-auth="'栏目管理:添加栏目'" class="action-btn" type="info" round @click="addColumn">添加栏目 <el-button v-auth="'栏目管理:添加栏目'" class="action-btn" type="primary" round @click="handleColumn(false, 0, 0)">添加栏目
</el-button> </el-button>
</template> </template>
</div> </div>
@ -29,12 +24,12 @@
<el-tree :data="listData" node-key="id" default-expand-all @node-drop="handleDrop" <el-tree :data="listData" node-key="id" default-expand-all @node-drop="handleDrop"
:draggable="sorting" :allow-drop="allowDrop" :allow-drag="allowDrag"> :draggable="sorting" :allow-drop="allowDrop" :allow-drag="allowDrag">
<span class="custom-tree-node" slot-scope="{ node, data }"> <span class="custom-tree-node" slot-scope="{ node, data }">
<span class="name">{{ node.label }}</span> <span class="name">{{ data.name }}</span>
<span class="action" v-show="!sorting"> <span class="action" v-show="!sorting">
<el-button v-auth="'栏目管理:编辑'" type="text" @click.stop="editType(data)">编辑</el-button> <el-button v-auth="'栏目管理:编辑'" type="text" @click.stop="handleColumn(data)">编辑</el-button>
<el-divider v-auth="'栏目管理:编辑'" direction="vertical"></el-divider> <el-divider v-auth="'栏目管理:编辑'" direction="vertical"></el-divider>
<template v-if="node.level == 1"> <template v-if="node.level < 4">
<el-button v-auth="'栏目管理:新增'" type="text" @click.stop="addType(data)">新增</el-button> <el-button v-auth="'栏目管理:新增'" type="text" @click.stop="handleColumn(data, data.id, data.level + 1)">新增</el-button>
<el-divider v-auth="'栏目管理:新增'" direction="vertical"></el-divider> <el-divider v-auth="'栏目管理:新增'" direction="vertical"></el-divider>
</template> </template>
<el-button v-auth="'栏目管理:删除'" type="text" @click.stop="delData(data)">删除</el-button> <el-button v-auth="'栏目管理:删除'" type="text" @click.stop="delData(data)">删除</el-button>
@ -45,11 +40,11 @@
</div> </div>
</div> </div>
<el-dialog :title="isAddColumn ? '添加栏目' : '编辑栏目'" :visible.sync="columnVisible" width="400px" <el-dialog :title="!curRow.id ? '添加栏目' : '编辑栏目'" :visible.sync="columnVisible" width="400px"
:close-on-click-modal="false" @close="closeColumn"> :close-on-click-modal="false" @close="closeColumn">
<el-form> <el-form>
<el-form-item> <el-form-item>
<el-input placeholder="栏目名称" v-model="columnName"></el-input> <el-input placeholder="栏目名称" v-model="curRow.name"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
@ -57,25 +52,12 @@
<el-button type="primary" @click="columnSubmit"> </el-button> <el-button type="primary" @click="columnSubmit"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
<el-dialog :title="isAddType ? '添加分类' : '编辑分类'" :visible.sync="typeVisible" width="400px"
:close-on-click-modal="false" @close="closeType">
<el-form>
<el-form-item>
<el-input placeholder="分类名称" v-model="typeName"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="typeVisible = false"> </el-button>
<el-button type="primary" @click="typeSubmit"> </el-button>
</span>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import util from "@/libs/util"; import util from "@/libs/util";
import Setting from '@/setting'
export default { export default {
name: "columnManage", name: "columnManage",
data() { data() {
@ -90,20 +72,15 @@ export default {
multipleSelection: [], multipleSelection: [],
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
totals: 0, total: 0,
columnVisible: false, columnVisible: false,
columnName: "",
typeVisible: false,
typeName: "",
curRow: {}, curRow: {},
sortObj: null, sortObj: null,
sorting: false, sorting: false,
curParentId: "", parentId: '',
isAddColumn: false,
isAddType: false, isAddType: false,
defaultProps: { defaultProps: {
children: "children", label: "name"
label: "label"
} }
}; };
}, },
@ -126,41 +103,14 @@ export default {
}, },
methods: { methods: {
getData() { getData() {
let data = { this.$get(this.api.queryAllColumns, {
platformId: Setting.platformId,
page: this.pageNo, page: this.pageNo,
size: this.pageSize size: this.pageSize
}; }).then(({ columnTree }) => {
this.$get(this.api.queryAllColumns, data).then(res => { this.listData = columnTree
let columnTree = res.columnTree;
let total = columnTree.length;
let list = [];
columnTree.forEach((n, k) => {
list.push({
id: n.id,
label: n.name,
level: n.level,
parentId: n.parentId,
sort: n.sort,
children: []
});
n.secondColumn.forEach((j, i) => {
list[k].children.push({
id: j.id,
label: j.name,
level: j.level,
parentId: j.parentId,
sort: j.sort
});
});
total += n.secondColumn.length;
});
this.listData = list;
this.originalList = JSON.parse(JSON.stringify(this.listData)); this.originalList = JSON.parse(JSON.stringify(this.listData));
this.totals = total; this.total = columnTree.length
if (!this.listData.length && this.totals) {
this.pageNo--;
this.getData();
}
}).catch(res => { }).catch(res => {
}); });
}, },
@ -178,9 +128,19 @@ export default {
.catch(() => { .catch(() => {
}); });
}, },
addColumn() { handleColumn(row, parentId, level) {
this.isAddColumn = true; this.columnVisible = true
this.columnVisible = true; if (row) {
this.curRow = JSON.parse(JSON.stringify(row))
}
if (typeof parentId === 'number') {
this.curRow = {
parentId,
level,
name: '',
platformId: Setting.platformId
}
}
}, },
sortSubmit() { sortSubmit() {
let list = JSON.parse(JSON.stringify(this.listData)); let list = JSON.parse(JSON.stringify(this.listData));
@ -210,70 +170,23 @@ export default {
}); });
}, },
columnSubmit() { columnSubmit() {
if (!this.columnName) return util.warningMsg("请填写栏目名称"); const row = this.curRow
let data = { if (!row.name) return util.warningMsg("请填写栏目名称");
level: 1, if (this.curRow.id) {
parentId: 1, this.$put(this.api.editColumn, row).then(res => {
name: this.columnName util.successMsg("修改成功");
}; this.columnVisible = false;
if (this.curRow.id) { this.getData();
data.id = this.curRow.id; }).catch(res => {
this.$put(this.api.editColumn, data).then(res => { });
util.warningMsg("修改成功"); } else {
this.columnVisible = false; this.$post(this.api.addColumn, row).then(res => {
this.getData(); util.successMsg("添加成功");
}).catch(res => { this.columnVisible = false;
}); this.getData();
} else { }).catch(res => {
this.$post(this.api.addColumn, data).then(res => { });
util.successMsg("添加成功"); }
this.columnVisible = false;
this.getData();
}).catch(res => {
});
}
},
addType(row) {
this.isAddType = true;
this.curRow = row;
this.typeVisible = true;
},
editType(row) {
this.curRow = row;
if (row.level == 1) {
this.isAddColumn = false;
this.columnVisible = true;
this.columnName = row.label;
} else {
this.isAddType = false;
this.typeVisible = true;
this.typeName = row.label;
}
},
typeSubmit(row) {
if (!this.typeName) return util.warningMsg("请填写分类名称");
let data = {
level: 2,
name: this.typeName
};
if (this.curRow.level == 2) {
data.id = this.curRow.id;
data.parentId = this.curRow.parentId;
this.$put(this.api.editColumn, data).then(res => {
util.successMsg("修改成功");
this.typeVisible = false;
this.getData();
}).catch(res => {
});
} else {
data.parentId = this.curRow.id;
this.$post(this.api.addColumn, data).then(res => {
util.successMsg("新增成功");
this.typeVisible = false;
this.getData();
}).catch(res => {
});
}
}, },
cancelSort() { cancelSort() {
this.sorting = false; this.sorting = false;
@ -295,12 +208,7 @@ export default {
this.getData(); this.getData();
}, },
closeColumn() { closeColumn() {
this.columnName = ""; this.curRow = {}
this.curRow = {};
},
closeType() {
this.typeName = "";
this.curRow = {};
}, },
handleDrop(draggingNode, dropNode, dropType, ev) { handleDrop(draggingNode, dropNode, dropType, ev) {
// console.log('tree drop: ', dropNode, dropType); // console.log('tree drop: ', dropNode, dropType);

@ -11,19 +11,7 @@
:default-active="activeName" :default-active="activeName"
@select="handleSelect" @select="handleSelect"
> >
<template v-for="item in menuList"> <menuTree :menuList="menuList"></menuTree>
<template v-if="item.secondColumn && item.secondColumn.length">
<el-submenu :index="item.id">
<template slot="title">
<span>{{ item.name }}</span>
</template>
<el-menu-item v-for="item2 in item.secondColumn" :index="item2.id">{{ item2.name }}</el-menu-item>
</el-submenu>
</template>
<template v-else>
<el-menu-item :index="item.id">{{ item.name }}</el-menu-item>
</template>
</template>
</el-menu> </el-menu>
</div> </div>
</el-col> </el-col>
@ -35,18 +23,20 @@
</template> </template>
<script> <script>
import menuTree from '@/components/menuTree'
import ContentList from "./contentList"; import ContentList from "./contentList";
import Setting from '@/setting'
import { mapActions } from "vuex"; import { mapActions } from "vuex";
export default { export default {
name: "contentManage", name: "contentManage",
components: { components: {
menuTree,
ContentList ContentList
}, },
data() { data() {
return { return {
menuList: [], menuList: [],
activeName: this.$store.state.info.columnId, activeName: this.$store.state.columnId,
columnId: "" columnId: ""
}; };
}, },
@ -58,16 +48,20 @@ export default {
"setColumnId" "setColumnId"
]), ]),
getMenuData() { getMenuData() {
this.$get(this.api.queryAllColumns, { page: 1, size: 10000 }).then(res => { this.$get(this.api.queryAllColumns, {
platformId: Setting.platformId,
page: 1,
size: 1000
}).then(res => {
this.menuList = res.columnTree; this.menuList = res.columnTree;
if (this.menuList.length) { if (this.menuList.length) {
if (this.menuList[0].secondColumn && this.menuList[0].secondColumn.length) { if (this.menuList[0].children && this.menuList[0].children.length) {
this.columnId = this.menuList[0].secondColumn[0].id; this.columnId = this.menuList[0].children[0].id;
} else { } else {
this.columnId = this.menuList[0].id; this.columnId = this.menuList[0].id;
} }
if (!this.$store.state.info.columnId) { if (!this.$store.state.info.columnId) {
this.setColumnId(this.columnId); this.setColumnId(this.columnId)
} else { } else {
this.columnId = this.$store.state.info.columnId; this.columnId = this.$store.state.info.columnId;
} }
@ -77,7 +71,7 @@ export default {
}, },
handleSelect(key, keyPath) { handleSelect(key, keyPath) {
this.columnId = key; this.columnId = key;
this.setColumnId(key); this.setColumnId(key)
} }
} }
}; };

Loading…
Cancel
Save