课程资讯联调

fixAuth
yujialong 2 years ago
parent cae83ba5ee
commit 28e4da3e49
  1. 35
      src/components/menuTree/index.vue
  2. 2
      src/setting.js
  3. 6
      src/store/index.js
  4. 24
      src/utils/api.js
  5. 8
      src/views/course/AddCurriculum.vue
  6. 13
      src/views/information/addArticle/index.vue
  7. 154
      src/views/information/columnManage/index.vue
  8. 4
      src/views/information/contentManage/contentList.vue
  9. 27
      src/views/information/contentManage/index.vue
  10. 4
      src/views/information/list/index.vue
  11. 46
      src/views/theoreticalCourse/add/index.vue
  12. 30
      src/views/theoreticalCourse/list/buildPlatform/index.vue
  13. 54
      src/views/theoreticalCourse/list/courseManagement/index.vue

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

@ -12,7 +12,7 @@ if (isDev) {
host = 'http://121.37.12.51/'
// host = 'https://huorantech.cn/'
host = 'http://192.168.31.151:9000/'// 榕
// host = 'http://192.168.31.137:9000/'// 赓
host = 'http://192.168.31.137:9000/'// 赓
} else if (isPro) {
jumpPath = 'https://www.huorantech.cn/judgmentPoint/'
}

@ -24,7 +24,8 @@ const store = new Vuex.Store({
customerPage: 1,
matchPage: 1,
platformSource: 0,
columnId: ''
columnId: '',
tabId: '1'
},
actions: {
setSystemId({ state,commit },systemId) {
@ -95,6 +96,9 @@ const store = new Vuex.Store({
setColumnId: (state, columnId) => {
state.columnId = columnId
},
setInfoTab: (state, tabId) => {
state.tabId = tabId
},
}
});

@ -148,18 +148,20 @@ export default {
// 理论课程
delTheoreticalCourse: `occupationlab/theoreticalCourse/batchDeletion`,
findTheoreticalCourse: `occupationlab/theoreticalCourse/findById`,
listTheoreticalCourse: `occupationlab/theoreticalCourse/pageConditionalQueryCourse`,
saveTheoreticalCourse: `occupationlab/theoreticalCourse/save`,
updateTheoreticalCourse: `occupationlab/theoreticalCourse/update`,
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`,
// 理论课程分类管理
checkRepeatClassification: `occupationlab/theoreticalCourseClassification/checkRepeat`,
delClassification: `occupationlab/theoreticalCourseClassification/delete`,
findClassification: `occupationlab/theoreticalCourseClassification/findById`,
listClassification: `occupationlab/theoreticalCourseClassification/pagingQuery`,
saveClassification: `occupationlab/theoreticalCourseClassification/save`,
updateClassification: `occupationlab/theoreticalCourseClassification/update`,
checkRepeatClassification: `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`,
// 栏目管理
addColumn: `${host1}occupationlab/occupationlab/information/column/addColumn`,

@ -296,6 +296,7 @@
<el-input placeholder="请输入项目名称" prefix-icon="el-icon-search" v-model.trim="projectKeyword" clearable></el-input>
<ul class="systems">
<el-checkbox v-if="projects.length" v-model="checkAll" label="全选" @change="val => systemChange(val, { systemId: projects[0].systemId })"></el-checkbox>
<li v-for="(item, i) in projects" :key="i" :title="item.projectName">
<el-checkbox v-model="item.check" :label="item.projectName" @change="val => projectChange(val, item)"></el-checkbox>
</li>
@ -449,7 +450,8 @@ export default {
projectKeyword: '',
checkedKeyword: '',
checkeds: [],
checkedAll: []
checkedAll: [],
checkAll: false
};
},
watch: {
@ -622,6 +624,7 @@ export default {
// }
})
this.systems = result
this.checkAll = !!checked.find(n => n.systemId == result[0].systemId) //
result.length && this.getProject(result[0])
}).catch(err => {})
},
@ -663,11 +666,13 @@ export default {
checkeds.push(e)
}
})
if (item.systemId == this.curSystem) this.checkAll = true
} else {
res.map(e => {
const i = checkeds.findIndex(n => n.projectId == e.projectId && n.systemId == e.systemId)
i === -1 || checkeds.splice(i, 1)
})
if (item.systemId == this.curSystem) this.checkAll = false
}
this.checkedAll = JSON.parse(JSON.stringify(checkeds)) //
}).catch(err => {})
@ -685,6 +690,7 @@ export default {
})
this.checkeds.splice(i, 1)
}
this.checkAll = !this.projects.find(e => !e.check)
this.checkedAll = JSON.parse(JSON.stringify(this.checkeds)) //
},
//

@ -45,7 +45,7 @@
<quill :border="true" v-model="content" :uploading.sync="uploading" :height="400" />
</el-form-item>
<el-form-item>
<el-button type="primary" v-throttle @click="saveData">确定</el-button>
<el-button type="primary" @click="saveData">确定</el-button>
</el-form-item>
</el-form>
</el-card>
@ -55,17 +55,15 @@
<script>
import quill from "@/components/quill";
import util from "@/libs/util";
import Setting from "@/setting";
export default {
name: "addarticle",
data() {
return {
headers: {
token: util.local.get(Setting.tokenKey)
token: sessionStorage.getItem('token')
},
columnId: this.$route.query.columnId,
sort: this.$route.query.sort,
columnId: +this.$route.query.columnId,
sort: +this.$route.query.sort,
id: "",
coverUrl: "",
uploadList: [],
@ -122,7 +120,8 @@ export default {
date: this.date,
title: this.title,
content: this.content,
sort: this.sort
sort: this.sort,
createUser: this.$store.state.userName
};
if (this.id) {
this.$put(this.api.editArticle, data).then(res => {

@ -9,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="primary" round @click="addColumn">添加栏目
<el-button v-auth="'栏目管理:添加栏目'" class="action-btn" type="primary" round @click="handleColumn(false, 0, 0)">添加栏目
</el-button>
</template>
</div>
@ -24,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 < 6">
<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>
@ -40,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">
@ -52,19 +52,6 @@
<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>
@ -85,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"
}
};
},
@ -121,42 +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 => {
});
},
@ -174,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));
@ -206,22 +170,17 @@ export default {
});
},
columnSubmit() {
if (!this.columnName) return util.warningMsg("请填写栏目名称");
let data = {
level: 1,
parentId: 1,
name: this.columnName
};
const row = this.curRow
if (!row.name) return util.warningMsg("请填写栏目名称");
if (this.curRow.id) {
data.id = this.curRow.id;
this.$put(this.api.editColumn, data).then(res => {
util.warningMsg("修改成功");
this.$put(this.api.editColumn, row).then(res => {
util.successMsg("修改成功");
this.columnVisible = false;
this.getData();
}).catch(res => {
});
} else {
this.$post(this.api.addColumn, data).then(res => {
this.$post(this.api.addColumn, row).then(res => {
util.successMsg("添加成功");
this.columnVisible = false;
this.getData();
@ -229,48 +188,6 @@ export default {
});
}
},
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() {
this.sorting = false;
this.listData = JSON.parse(JSON.stringify(this.originalList));
@ -291,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);

@ -112,10 +112,10 @@ export default {
this.getData();
},
addArticle() {
this.$router.push(`/information/addarticle?columnId=${this.columnId}&sort=${this.listData.length + 1}`);
this.$router.push(`/addArticle?columnId=${this.columnId}&sort=${this.listData.length + 1}`);
},
editArticle(scope) {
this.$router.push(`/information/addarticle?columnId=${this.columnId}&id=${scope.row.id}&sort=${scope.$index + 1}`);
this.$router.push(`/addArticle?columnId=${this.columnId}&id=${scope.row.id}&sort=${scope.$index + 1}`);
},
delData(row) {
this.$confirm("此删除操作不可逆,是否确认删除选中项?", "提示", {

@ -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,10 +23,13 @@
</template>
<script>
import menuTree from '@/components/menuTree'
import ContentList from "./contentList";
import Setting from '@/setting'
export default {
name: "contentManage",
components: {
menuTree,
ContentList
},
data() {
@ -53,11 +44,15 @@ export default {
},
methods: {
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;
}

@ -24,12 +24,12 @@ export default {
},
data() {
return {
tabsName: '1'
tabsName: this.$store.state.tabId
};
},
methods: {
handleClick(tab, event) {
// this.setTabsName(tab.name);
this.$store.commit('setInfoTab', tab.name)
}
},
mounted() {

@ -10,7 +10,7 @@
<el-form :model="form" :rules="rules" ref="form" :disabled="isDetail" label-width="100px" label-suffix=":">
<el-form-item prop="courseName" label="课程名称">
<div class="d-inline-block">
<el-input placeholder="请输入课程名称" v-model="form.courseName" 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 prop="platformClassificationIds" label="课程分类">
@ -223,6 +223,7 @@ export default {
}
}
},
nameRepeat: false
};
},
watch: {
@ -254,6 +255,11 @@ export default {
},
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
}
this.form = data
this.uploadList.push({
name: "cover.jpg",
@ -326,7 +332,16 @@ export default {
// id
const data = []
const checked = this.rangeChecked
const promises = []
checked.map(e => {
if (e.cityId && !e.schoolId) {
promises.push(new Promise((resolve, reject) => {
this.$get(this.api.getSchoolsByProvince, {
provinceId: e.provinceId,
cityId: e.cityId,
schoolName: ''
}).then(({ list }) => {
list.map(e => {
data.push({
provinceId: e.provinceId || '',
cityId: e.cityId || '',
@ -334,8 +349,21 @@ export default {
type: e.schoolId ? 0 : 1
})
})
resolve()
}).catch(res => {})
}))
} else {
data.push({
provinceId: e.provinceId || '',
cityId: e.cityId || '',
schoolId: e.schoolId || '',
type: e.schoolId ? 0 : 1
})
}
})
Promise.all(promises).then(_ => {
this.form.courseRangeList = data
console.log("🚀 ~ file: index.vue ~ line 343 ~ rangeSubmit ~ data", data)
// name
const name = []
checked.map(e => {
@ -344,6 +372,19 @@ export default {
this.rangeName = name.join('、')
this.rangeVisible = false
})
},
//
nameChange(val) {
this.$post(this.api.checkRepeatTheoreticalCourse, {
id: this.form.id,
courseName: val,
platformSource: this.form.platformSource
}).then(res => {
this.nameRepeat = false
}).catch(err => {
this.nameRepeat = true
})
},
handleExceed(files, fileList) { //
util.warningMsg("当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!");
@ -370,6 +411,7 @@ export default {
save() {
this.$refs.form.validate((valid) => {
if (valid) {
if (this.nameRepeat) return util.errorMsg('当前课程名已存在!')
if (this.submiting) return false
const { form } = this
this.submiting = true

@ -72,12 +72,12 @@
<el-table-column label="可授权状态" align="center" width="120">
<template slot-scope="scope">
<el-switch
v-auth="'课程管理:用'"
v-model="scope.row.isEnable"
v-auth="'课程管理:用'"
v-model="scope.row.ztOpen"
: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.ztOpen ? '关' : '开'"
@change="switchOff($event,scope.row,scope.$index)"
></el-switch>
</template>
@ -104,12 +104,12 @@ export default {
name: '不限'
},
{
id: 0,
id: 1,
name: '全平台'
},
{
id: 1,
name: '指定院校'
id: 2,
name: '指定院校区域'
}
],
types: [
@ -245,14 +245,14 @@ export default {
this.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: 0 // (01)
}).then(res => {
val == 1 ? util.warningMsg('禁用成功') : util.successMsg('启用成功')
}).catch(err => {})
}
}
};

@ -72,12 +72,12 @@
<el-table-column label="可授权状态" align="center" width="120">
<template slot-scope="scope">
<el-switch
v-auth="'课程管理:用'"
v-model="scope.row.isEnable"
v-auth="'课程管理:用'"
v-model="scope.row.ztOpen"
: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.ztOpen ? '关' : '开'"
@change="switchOff($event,scope.row,scope.$index)"
></el-switch>
</template>
@ -104,12 +104,12 @@ export default {
name: '不限'
},
{
id: 0,
id: 1,
name: '全平台'
},
{
id: 1,
name: '指定院校'
id: 2,
name: '指定院校区域'
}
],
types: [
@ -180,7 +180,7 @@ export default {
this.$post(this.api.listClassification, {
pageNum: 1,
pageSize: 1000,
platformSource: Setting.platformSource
platformSource: 1
}).then(({ page }) => {
this.classificationList = page.records
}).catch(res => {})
@ -245,14 +245,40 @@ export default {
this.page = val;
this.getData();
},
disable(val, row) {
this.$post(this.api.disabledTheoreticalCourse, {
courseId: row.id,
isOpen: val,
type: 0 // (01)
}).then(res => {
val == 1 ? util.warningMsg('禁用成功') : util.successMsg('启用成功')
}).catch(err => {})
},
switchOff(val, row, index) {
this.$put(`${this.api.enableCourse}?courseId=${row.id}&isEnable=${val}`)
.then(res => {
this.getData();
val == 1 ? util.warningMsg("该教学资源已隐藏,对学生端用户不可见") : util.successMsg("该教学资源已公开,对学生端用户可见");
if (val) {
this.disable(val, row)
} else if (!row.publishStatus) {
this.$confirm('是否发布该课程?', '提示', {
type: 'success'
}).then(() => {
this.$post(this.api.disabledTheoreticalCourse, {
courseId: row.id,
isOpen: val,
type: 0 // (01)
}).then(res => {
row.courseId = row.id
row.publishStatus = 1
this.$post(this.api.updateTheoreticalCourse, row).then(res => {
this.getData()
val == 1 ? util.warningMsg('禁用成功') : util.successMsg('启用成功')
}).catch(err => {})
}).catch(err => {})
}).catch(() => {
row.ztOpen = 1
})
.catch(err => {
});
} else {
this.disable(val, row)
}
}
}
};

Loading…
Cancel
Save