课程资讯联调

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`, // 查看实验报告
schoolCourseByAchievement: `nakadai/nakadai/curriculum/schoolCourseByAchievement`, // 获取学校购买订单后的课程
spliceClass: `occupationlab/occupationlab/achievement/spliceClass`,
exportLabReport: `occupationlab/occupationlab/achievement/exportLabReport`,
exportBankExperimentReport: `occupationlab/occupationlab/achievement/exportBankExperimentReport`,
// 项目管理
getSystemIdBySchool: `occupationlab/occupationlab/projectManage/getSystemIdBySchool`, // 获取学校下拥有的系统
@ -158,20 +160,20 @@ export default {
articleSort: `${host2}occupationlab/occupationlab/information/article/articleSort`,
// 课程管理
queryCourseByCondition: `occupationlab/occupationlab/management/edu/course/queryCourseByCondition`, // 课程列表分页条件查询
addCourse: `occupationlab/occupationlab/management/edu/course/addCourse`, // 添加课程
deleteCourse: `occupationlab/occupationlab/management/edu/course/deleteCourse`, // 根据id删除课程
deleteCourses: `occupationlab/occupationlab/management/edu/course/deleteCourses`, // 批量删除课程
editCourse: `occupationlab/occupationlab/management/edu/course/editCourse`, // 修改课程
enableCourse: `occupationlab/occupationlab/management/schoolCourse/enableGlCourse`, // 是否启用管理端课程
getCourse: `occupationlab/occupationlab/management/edu/course/getCourse`, // 根据id查询课程
delTheoreticalCourse: `occupationlab/occupationlab/theoreticalCourse/batchDeletion`,
findTheoreticalCourse: `occupationlab/occupationlab/theoreticalCourse/findById`,
listTheoreticalCourse: `occupationlab/occupationlab/theoreticalCourse/pageConditionalQueryCourse`,
saveTheoreticalCourse: `occupationlab/occupationlab/theoreticalCourse/save`,
updateTheoreticalCourse: `occupationlab/occupationlab/theoreticalCourse/update`,
disabledTheoreticalCourse: `occupationlab/occupationlab/theoreticalCourse/disabledEvents`,
checkRepeatTheoreticalCourse: `occupationlab/occupationlab/theoreticalCourse/checkRepeat`,
// 分类管理
checkRepeat: `occupationlab/theoreticalCourseClassification/checkRepeat`,
delClassification: `occupationlab/theoreticalCourseClassification/delete`,
findClassification: `occupationlab/theoreticalCourseClassification/findById`,
listClassification: `occupationlab/theoreticalCourseClassification/pagingQuery`,
saveClassification: `occupationlab/theoreticalCourseClassification/save`,
updateClassification: `occupationlab/theoreticalCourseClassification/update`,
checkRepeat: `occupationlab/occupationlab/theoreticalCourseClassification/checkRepeat`,
delClassification: `occupationlab/occupationlab/theoreticalCourseClassification/delete`,
findClassification: `occupationlab/occupationlab/theoreticalCourseClassification/findById`,
listClassification: `occupationlab/occupationlab/theoreticalCourseClassification/pagingQuery`,
saveClassification: `occupationlab/occupationlab/theoreticalCourseClassification/save`,
updateClassification: `occupationlab/occupationlab/theoreticalCourseClassification/update`,
// 课程章节管理
addChapter: `occupationlab/occupationlab/management/edu/courseChapter/addChapter`,
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>
<div class="content">
<div class="text-right">
<el-button type="primary" @click="exportPage">导出报告</el-button>
</div>
<h6 class="r-title">标准实验报告</h6>
<div class="info">
<h6 class="l-title">
@ -131,6 +134,7 @@
</template>
<script>
import util from "@/libs/util";
export default {
data() {
return {
@ -172,7 +176,27 @@ export default {
userName: form.userName
}
}).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>

@ -7,39 +7,43 @@
</el-card>
<el-card shadow="hover" class="m-b-20">
<el-form :disabled="isDetail" label-width="100px" label-suffix=":">
<el-form-item label="课程名称">
<el-form :model="form" :rules="rules" ref="form" :disabled="isDetail" label-width="110px" label-suffix=":">
<el-form-item prop="courseName" label="课程名称">
<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>
</el-form-item>
<el-form-item label="课程类型">
<el-form-item prop="courseType" label="课程类型">
<div class="d-inline-block">
<el-select v-model="form.classificationId" placeholder="请选择课程类型">
<el-option label="免费" value="1"></el-option>
<el-select v-model="form.courseType" placeholder="请选择课程类型">
<el-option label="免费" :value="0"></el-option>
<!-- <el-option label="付费" :value="1"></el-option> -->
</el-select>
</div>
</el-form-item>
<el-form-item label="可见范围">
<div class="d-inline-block">
<el-radio v-model="form.classificationId">本校</el-radio>
</div>
<div>
<el-radio v-model="form.visibleRange" :label="1">全平台</el-radio>
</div>
<div>
<el-radio v-model="form.visibleRange" :label="0">仅本校</el-radio>
</div>
</el-form-item>
<el-form-item label="课程分类">
<el-form-item prop="schoolClassificationsIds" label="课程分类">
<div class="d-inline-block">
<el-select v-model="form.classificationId" placeholder="请选择课程分类">
<el-option v-for="item in classificationList" :key="item.id" :label="item.name" :value="item.id"></el-option>
<el-select v-model="form.schoolClassificationsIds" placeholder="请选择课程分类" multiple>
<el-option v-for="item in classificationList" :key="item.id" :label="item.classificationName" :value="item.id"></el-option>
</el-select>
</div>
</el-form-item>
<el-form-item label="平台课程分类">
<el-form-item prop="platformClassificationIds" label="平台课程分类">
<div class="d-inline-block">
<el-select v-model="form.classificationId" placeholder="平台请选择课程分类">
<el-option v-for="item in classificationList" :key="item.id" :label="item.name" :value="item.id"></el-option>
<el-select v-model="form.platformClassificationIds" placeholder="请选择平台课程分类" multiple>
<el-option v-for="item in platformClassificationList" :key="item.id" :label="item.classificationName" :value="item.id"></el-option>
</el-select>
</div>
</el-form-item>
<el-form-item label="课程封面">
<el-form-item prop="coverUrl" label="课程封面">
<el-upload
class="avatar-uploader"
accept=".jpg,.png,.jpeg"
@ -66,10 +70,10 @@
</el-upload>
</el-form-item>
<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-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>
</el-card>
@ -82,25 +86,116 @@ import Setting from "@/setting";
import quill from "@/components/quill";
export default {
name: "courseAddEdit",
data() {
const that = this
return {
headers: {
token: util.local.get(Setting.tokenKey)
token: util.local.get(Setting.tokenKey)
},
isDetail: Boolean(this.$route.query.show),
form: {
id: this.$route.query.id,
classificationId: '',
courseIntroduction: '',
courseName: '',
courseType: 0,
coverUrl: '',
name: '',
description: '',
distinguish: 1
platformSource: Setting.platformSource,
platformClassificationIds: [],
schoolClassificationsIds: [],
visibleRange: 1
},
rules: {
courseName: [
{ required: true, message: '请输入课程名称', trigger: 'blur' }
],
// platformClassificationIds: [
// { required: true, message: '', trigger: 'change' }
// ],
coverUrl: [
{ required: true, message: '请选择课程封面', trigger: 'change' }
]
},
platformClassificationList: [],
classificationList: [],
uploadList: [],
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: {
@ -113,58 +208,96 @@ export default {
}
},
mounted() {
this.getClassification();
this.form.id && this.getData();
this.getClassification()
this.form.id && this.getData()
},
components: {
quill
},
methods: {
getClassification() {
this.$get(this.api.queryGlClassification).then(res => {
this.classificationList = res.classificationList;
}).catch(res => {});
},
getData() {
this.$get(`${this.api.getCourse}/${this.form.id}`).then(({ course }) => {
this.form = course
this.uploadList.push({
name: "cover.jpg",
url: course.coverUrl
})
}).catch(err => {})
},
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() {
//
getClassification() {
//
this.$post(this.api.listClassification, {
pageNum: 1,
pageSize: 1000,
platformSource: 0
}).then(({ page }) => {
this.platformClassificationList = page.records
}).catch(res => {})
//
this.$post(this.api.listClassification, {
pageNum: 1,
pageSize: 1000,
platformSource: Setting.platformSource
}).then(({ page }) => {
this.classificationList = page.records
}).catch(res => {})
},
getData() {
this.$post(`${this.api.findTheoreticalCourse}?id=${this.form.id}`).then(({ data }) => {
// id
if (data.platformClassificationList) {
data.platformClassificationIds = data.platformClassificationList.map(e => e.classificationId)
delete data.platformClassificationList
}
if (data.schoolClassificationsList) {
data.schoolClassificationsIds = data.schoolClassificationsList.map(e => e.classificationId)
delete data.schoolClassificationsList
}
this.form = data
this.uploadList.push({
name: "cover.jpg",
url: data.coverUrl
})
}).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
const { form } = this
if (!form.name) return util.warningMsg("请填写课程名称")
if (!form.classificationId) return util.warningMsg("请选择课程分类")
if (!form.coverUrl) return util.warningMsg("请上传课程封面")
this.submiting = true
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;
util.successMsg("修改成功");
this.$router.back();
@ -172,14 +305,14 @@ export default {
this.submiting = false;
});
} else {
this.$post(this.api.addCourse, form).then(res => {
this.$post(this.api.saveTheoreticalCourse, form).then(res => {
this.submiting = false;
this.$confirm("课程创建成功,是否马上进行课程内容设置?", "提示", {
type: "success",
confirmButtonText: "马上设置",
cancelButtonText: "稍后操作"
}).then(() => {
this.$router.push(`/course/contentSettings?id=${res.courseId}`);
this.$router.push(`/setTheoreticalCourse?id=${res.id}`);
}).catch(() => {
this.$router.back();
});
@ -187,27 +320,29 @@ export default {
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>
@ -279,4 +414,13 @@ $avatar-width: 104px;
width: 100%;
}
}
.range-check {
display: inline-block;
margin: 0 0 10px 10px;
}
/deep/.range-cas {
.el-tag {
display: none;
}
}
</style>

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

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

@ -1,11 +1,6 @@
<template>
<div>
<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">
<template v-if="sorting">
<el-button class="action-btn" type="primary" round @click="cancelSort">取消</el-button>
@ -14,7 +9,7 @@
<template v-if="!sorting">
<el-button v-auth="'栏目管理:更改排序'" class="action-btn" type="primary" round @click="openSort">更改排序
</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>
</template>
</div>
@ -29,12 +24,12 @@
<el-tree :data="listData" node-key="id" default-expand-all @node-drop="handleDrop"
:draggable="sorting" :allow-drop="allowDrop" :allow-drag="allowDrag">
<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">
<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>
<template v-if="node.level == 1">
<el-button v-auth="'栏目管理:新增'" type="text" @click.stop="addType(data)">新增</el-button>
<template v-if="node.level < 4">
<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>
</template>
<el-button v-auth="'栏目管理:删除'" type="text" @click.stop="delData(data)">删除</el-button>
@ -45,11 +40,11 @@
</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">
<el-form>
<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>
<span slot="footer" class="dialog-footer">
@ -57,25 +52,12 @@
<el-button type="primary" @click="columnSubmit"> </el-button>
</span>
</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>
</template>
<script>
import util from "@/libs/util";
import Setting from '@/setting'
export default {
name: "columnManage",
data() {
@ -90,20 +72,15 @@ export default {
multipleSelection: [],
pageNo: 1,
pageSize: 10,
totals: 0,
total: 0,
columnVisible: false,
columnName: "",
typeVisible: false,
typeName: "",
curRow: {},
sortObj: null,
sorting: false,
curParentId: "",
isAddColumn: false,
parentId: '',
isAddType: false,
defaultProps: {
children: "children",
label: "label"
label: "name"
}
};
},
@ -126,41 +103,14 @@ export default {
},
methods: {
getData() {
let data = {
this.$get(this.api.queryAllColumns, {
platformId: Setting.platformId,
page: this.pageNo,
size: this.pageSize
};
this.$get(this.api.queryAllColumns, data).then(res => {
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;
}).then(({ columnTree }) => {
this.listData = columnTree
this.originalList = JSON.parse(JSON.stringify(this.listData));
this.totals = total;
if (!this.listData.length && this.totals) {
this.pageNo--;
this.getData();
}
this.total = columnTree.length
}).catch(res => {
});
},
@ -178,9 +128,19 @@ export default {
.catch(() => {
});
},
addColumn() {
this.isAddColumn = true;
this.columnVisible = true;
handleColumn(row, parentId, level) {
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() {
let list = JSON.parse(JSON.stringify(this.listData));
@ -210,70 +170,23 @@ export default {
});
},
columnSubmit() {
if (!this.columnName) return util.warningMsg("请填写栏目名称");
let data = {
level: 1,
parentId: 1,
name: this.columnName
};
if (this.curRow.id) {
data.id = this.curRow.id;
this.$put(this.api.editColumn, data).then(res => {
util.warningMsg("修改成功");
this.columnVisible = false;
this.getData();
}).catch(res => {
});
} else {
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 => {
});
}
const row = this.curRow
if (!row.name) return util.warningMsg("请填写栏目名称");
if (this.curRow.id) {
this.$put(this.api.editColumn, row).then(res => {
util.successMsg("修改成功");
this.columnVisible = false;
this.getData();
}).catch(res => {
});
} else {
this.$post(this.api.addColumn, row).then(res => {
util.successMsg("添加成功");
this.columnVisible = false;
this.getData();
}).catch(res => {
});
}
},
cancelSort() {
this.sorting = false;
@ -295,12 +208,7 @@ export default {
this.getData();
},
closeColumn() {
this.columnName = "";
this.curRow = {};
},
closeType() {
this.typeName = "";
this.curRow = {};
this.curRow = {}
},
handleDrop(draggingNode, dropNode, dropType, ev) {
// console.log('tree drop: ', dropNode, dropType);

@ -11,19 +11,7 @@
:default-active="activeName"
@select="handleSelect"
>
<template v-for="item in menuList">
<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>
<menuTree :menuList="menuList"></menuTree>
</el-menu>
</div>
</el-col>
@ -35,18 +23,20 @@
</template>
<script>
import menuTree from '@/components/menuTree'
import ContentList from "./contentList";
import Setting from '@/setting'
import { mapActions } from "vuex";
export default {
name: "contentManage",
components: {
menuTree,
ContentList
},
data() {
return {
menuList: [],
activeName: this.$store.state.info.columnId,
activeName: this.$store.state.columnId,
columnId: ""
};
},
@ -58,16 +48,20 @@ export default {
"setColumnId"
]),
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;
if (this.menuList.length) {
if (this.menuList[0].secondColumn && this.menuList[0].secondColumn.length) {
this.columnId = this.menuList[0].secondColumn[0].id;
if (this.menuList[0].children && this.menuList[0].children.length) {
this.columnId = this.menuList[0].children[0].id;
} else {
this.columnId = this.menuList[0].id;
}
if (!this.$store.state.info.columnId) {
this.setColumnId(this.columnId);
this.setColumnId(this.columnId)
} else {
this.columnId = this.$store.state.info.columnId;
}
@ -77,7 +71,7 @@ export default {
},
handleSelect(key, keyPath) {
this.columnId = key;
this.setColumnId(key);
this.setColumnId(key)
}
}
};

Loading…
Cancel
Save