课程资讯联调

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 = 'http://121.37.12.51/'
// host = 'https://huorantech.cn/' // host = 'https://huorantech.cn/'
host = 'http://192.168.31.151:9000/'// 榕 host = 'http://192.168.31.151:9000/'// 榕
// host = 'http://192.168.31.137:9000/'// 赓 host = 'http://192.168.31.137:9000/'// 赓
} else if (isPro) { } else if (isPro) {
jumpPath = 'https://www.huorantech.cn/judgmentPoint/' jumpPath = 'https://www.huorantech.cn/judgmentPoint/'
} }

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

@ -148,18 +148,20 @@ export default {
// 理论课程 // 理论课程
delTheoreticalCourse: `occupationlab/theoreticalCourse/batchDeletion`, delTheoreticalCourse: `occupationlab/occupationlab/theoreticalCourse/batchDeletion`,
findTheoreticalCourse: `occupationlab/theoreticalCourse/findById`, findTheoreticalCourse: `occupationlab/occupationlab/theoreticalCourse/findById`,
listTheoreticalCourse: `occupationlab/theoreticalCourse/pageConditionalQueryCourse`, listTheoreticalCourse: `occupationlab/occupationlab/theoreticalCourse/pageConditionalQueryCourse`,
saveTheoreticalCourse: `occupationlab/theoreticalCourse/save`, saveTheoreticalCourse: `occupationlab/occupationlab/theoreticalCourse/save`,
updateTheoreticalCourse: `occupationlab/theoreticalCourse/update`, updateTheoreticalCourse: `occupationlab/occupationlab/theoreticalCourse/update`,
disabledTheoreticalCourse: `occupationlab/occupationlab/theoreticalCourse/disabledEvents`,
checkRepeatTheoreticalCourse: `occupationlab/occupationlab/theoreticalCourse/checkRepeat`,
// 理论课程分类管理 // 理论课程分类管理
checkRepeatClassification: `occupationlab/theoreticalCourseClassification/checkRepeat`, checkRepeatClassification: `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`,
// 栏目管理 // 栏目管理
addColumn: `${host1}occupationlab/occupationlab/information/column/addColumn`, 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> <el-input placeholder="请输入项目名称" prefix-icon="el-icon-search" v-model.trim="projectKeyword" clearable></el-input>
<ul class="systems"> <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"> <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> <el-checkbox v-model="item.check" :label="item.projectName" @change="val => projectChange(val, item)"></el-checkbox>
</li> </li>
@ -449,7 +450,8 @@ export default {
projectKeyword: '', projectKeyword: '',
checkedKeyword: '', checkedKeyword: '',
checkeds: [], checkeds: [],
checkedAll: [] checkedAll: [],
checkAll: false
}; };
}, },
watch: { watch: {
@ -622,6 +624,7 @@ export default {
// } // }
}) })
this.systems = result this.systems = result
this.checkAll = !!checked.find(n => n.systemId == result[0].systemId) //
result.length && this.getProject(result[0]) result.length && this.getProject(result[0])
}).catch(err => {}) }).catch(err => {})
}, },
@ -663,11 +666,13 @@ export default {
checkeds.push(e) checkeds.push(e)
} }
}) })
if (item.systemId == this.curSystem) this.checkAll = true
} else { } else {
res.map(e => { res.map(e => {
const i = checkeds.findIndex(n => n.projectId == e.projectId && n.systemId == e.systemId) const i = checkeds.findIndex(n => n.projectId == e.projectId && n.systemId == e.systemId)
i === -1 || checkeds.splice(i, 1) i === -1 || checkeds.splice(i, 1)
}) })
if (item.systemId == this.curSystem) this.checkAll = false
} }
this.checkedAll = JSON.parse(JSON.stringify(checkeds)) // this.checkedAll = JSON.parse(JSON.stringify(checkeds)) //
}).catch(err => {}) }).catch(err => {})
@ -685,6 +690,7 @@ export default {
}) })
this.checkeds.splice(i, 1) this.checkeds.splice(i, 1)
} }
this.checkAll = !this.projects.find(e => !e.check)
this.checkedAll = JSON.parse(JSON.stringify(this.checkeds)) // this.checkedAll = JSON.parse(JSON.stringify(this.checkeds)) //
}, },
// //

@ -45,7 +45,7 @@
<quill :border="true" v-model="content" :uploading.sync="uploading" :height="400" /> <quill :border="true" v-model="content" :uploading.sync="uploading" :height="400" />
</el-form-item> </el-form-item>
<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-item>
</el-form> </el-form>
</el-card> </el-card>
@ -55,17 +55,15 @@
<script> <script>
import quill from "@/components/quill"; import quill from "@/components/quill";
import util from "@/libs/util"; import util from "@/libs/util";
import Setting from "@/setting";
export default { export default {
name: "addarticle", name: "addarticle",
data() { data() {
return { return {
headers: { headers: {
token: util.local.get(Setting.tokenKey) token: sessionStorage.getItem('token')
}, },
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: [],
@ -122,7 +120,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.$store.state.userName
}; };
if (this.id) { if (this.id) {
this.$put(this.api.editArticle, data).then(res => { this.$put(this.api.editArticle, data).then(res => {

@ -9,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="primary" 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>
@ -24,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 < 6"> <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>
@ -40,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">
@ -52,19 +52,6 @@
<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>
@ -85,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"
} }
}; };
}, },
@ -121,42 +103,14 @@ export default {
}, },
methods: { methods: {
getData() { getData() {
let data = { this.$get(this.api.queryAllColumns, {
platformId: Setting.platformId, 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 => {
}); });
}, },
@ -174,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));
@ -206,22 +170,17 @@ export default {
}); });
}, },
columnSubmit() { columnSubmit() {
if (!this.columnName) return util.warningMsg("请填写栏目名称"); const row = this.curRow
let data = { if (!row.name) return util.warningMsg("请填写栏目名称");
level: 1,
parentId: 1,
name: this.columnName
};
if (this.curRow.id) { if (this.curRow.id) {
data.id = this.curRow.id; this.$put(this.api.editColumn, row).then(res => {
this.$put(this.api.editColumn, data).then(res => { util.successMsg("修改成功");
util.warningMsg("修改成功");
this.columnVisible = false; this.columnVisible = false;
this.getData(); this.getData();
}).catch(res => { }).catch(res => {
}); });
} else { } else {
this.$post(this.api.addColumn, data).then(res => { this.$post(this.api.addColumn, row).then(res => {
util.successMsg("添加成功"); util.successMsg("添加成功");
this.columnVisible = false; this.columnVisible = false;
this.getData(); 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() { cancelSort() {
this.sorting = false; this.sorting = false;
this.listData = JSON.parse(JSON.stringify(this.originalList)); this.listData = JSON.parse(JSON.stringify(this.originalList));
@ -291,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);

@ -112,10 +112,10 @@ export default {
this.getData(); this.getData();
}, },
addArticle() { 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) { 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) { delData(row) {
this.$confirm("此删除操作不可逆,是否确认删除选中项?", "提示", { this.$confirm("此删除操作不可逆,是否确认删除选中项?", "提示", {

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

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

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

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

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