dev_2022-04-07 V2.4.0
yujialong 3 years ago
parent 45504f258c
commit 200dd525bf
  1. 4
      src/setting.js
  2. 131
      src/views/course/contentSettings.vue
  3. 2
      src/views/order/AddOrder.vue

@ -9,8 +9,8 @@ let jumpPath = `${location.origin}/judgmentPoint`
let host = `${location.origin}:9000/` let host = `${location.origin}:9000/`
if (isDev) { if (isDev) {
jumpPath = "http://192.168.31.125:8087/"; // 本地调试-需要启动本地判分点系统 jumpPath = "http://192.168.31.125:8087/"; // 本地调试-需要启动本地判分点系统
// host = 'http://39.108.250.202:9000/' host = 'http://39.108.250.202:9000/'
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 = "http://www.huorantech.cn/judgmentPoint/"; jumpPath = "http://www.huorantech.cn/judgmentPoint/";

@ -2,7 +2,7 @@
<div> <div>
<el-card shadow="hover" class="mgb20"> <el-card shadow="hover" class="mgb20">
<div class="flex-between"> <div class="flex-between">
<el-page-header @back="goBack" :content="'内容设置'"></el-page-header> <el-page-header @back="goBack" :content="sorting? '更改排序' : '内容设置'"></el-page-header>
</div> </div>
</el-card> </el-card>
<!--内容设置--> <!--内容设置-->
@ -40,8 +40,12 @@
</div> </div>
</div> </div>
<el-table :data="chapter.subsectionList" class="table" stripe header-align="center" @selection-change="handleSelectionChange" row-key="id"> <el-table :data="chapter.subsectionList" class="table" stripe header-align="center" row-key="id">
<el-table-column v-if="sorting" type="selection" width="55" align="center"></el-table-column> <el-table-column v-if="sorting" width="55" align="center">
<template slot-scope="scope">
<el-checkbox v-model="scope.row.check"></el-checkbox>
</template>
</el-table-column>
<el-table-column type="index" width="100" label="序号" align="center"></el-table-column> <el-table-column type="index" width="100" label="序号" align="center"></el-table-column>
<el-table-column prop="name" label="资源名称"> <el-table-column prop="name" label="资源名称">
</el-table-column> </el-table-column>
@ -80,7 +84,7 @@
</span> </span>
</el-dialog> </el-dialog>
<el-dialog title="添加小节" :visible.sync="sectionVisible" width="24%" @close="closeSection" :close-on-click-modal="false"> <el-dialog title="添加小节" :visible.sync="sectionVisible" width="28%" @close="closeSection" :close-on-click-modal="false">
<el-form label-width="80px"> <el-form label-width="80px">
<el-form-item label="资源添加"> <el-form-item label="资源添加">
<el-upload <el-upload
@ -218,6 +222,7 @@ export default {
token: sessionStorage.getItem('token') token: sessionStorage.getItem('token')
}, },
id: this.$route.query.cid, id: this.$route.query.cid,
originChapters: [],
chapters: [], chapters: [],
multipleSelection: [], multipleSelection: [],
sorting: false, sorting: false,
@ -255,6 +260,7 @@ export default {
showProgress: false, showProgress: false,
progressPercent: 0, progressPercent: 0,
moveVisible: false, moveVisible: false,
checkList: [],
sortList: [ sortList: [
{ {
id: 'bottom', id: 'bottom',
@ -268,7 +274,8 @@ export default {
moveForm: { moveForm: {
id: '', id: '',
sort: 'bottom' sort: 'bottom'
} },
moved: false //
}; };
}, },
components: { pdf }, components: { pdf },
@ -299,15 +306,30 @@ export default {
this.multipleSelection = val this.multipleSelection = val
}, },
goBack() { goBack() {
if (this.previewing) { //
this.closeIframe(); if (this.previewing) {
} else { this.closeIframe();
if (this.sorting) { } else {
this.sorting = false //
if (this.sorting) {
//
if (this.moved) {
this.$confirm(`编辑的内容未保存,是否保存?`, '提示', {
type: 'warning'
}).then(() => {
this.saveSort()
this.moved = false
}).catch(() => {
this.sorting = false
this.chapters = JSON.parse(JSON.stringify(this.originChapters))
})
} else { } else {
this.$router.back() this.sorting = false
} }
} else {
this.$router.back()
} }
}
}, },
iframeOnload() { iframeOnload() {
document.querySelector("#fileIframe").onload = e => { document.querySelector("#fileIframe").onload = e => {
@ -419,11 +441,20 @@ export default {
this.chapterVisible = true; this.chapterVisible = true;
}, },
sort() { sort() {
this.sorting = true; this.originChapters = JSON.parse(JSON.stringify(this.chapters))
this.sorting = true;
}, },
// //
move() { move() {
if (this.multipleSelection.length) { const list = this.chapters
const checkList = []
list.map(e => {
e.subsectionList.map(n => {
n.check && checkList.push(n)
})
})
this.checkList = checkList
if (checkList.length) {
this.moveForm = { this.moveForm = {
id: '', id: '',
sort: 'bottom' sort: 'bottom'
@ -466,62 +497,40 @@ export default {
} }
] ]
}, },
//
moveSubmit() {
const { moveForm } = this
let { id, sort } = moveForm
if (typeof sort === 'string') sort = sort === 'top' ? 0 : this.sortList.length - 2 //
const list = this.multipleSelection
const promises = []
//
list.map(e => {
promises.push(new Promise((resolve, reject) => {
this.$put(this.api.editSubsection, {
id: e.id,
cid: this.id,
chapterId: id,
sort
}).then(res => {
resolve()
}).catch(err => {
reject()
})
}))
})
// sort
Promise.all(promises).then(() => {
this.$get(`${this.api.queryChaptersAndSubsections}/${this.id}`).then(({ chapterList }) => {
chapterList.forEach((n, k) => {
n.sort = k + 1
n.subsectionList.forEach((j, i) => {
j.sort = i + 1
})
})
this.$post(this.api.reorder, {
chapterVOList: chapterList
}).then(res => {
this.$message.success('移动成功!')
this.getData()
}).catch(res => {})
}).catch(err => {})
})
},
// //
moveConfirm() { moveConfirm() {
const { moveForm } = this let { id, sort } = this.moveForm
let { id, sort } = moveForm
if (!id) return this.$message.warning('请选择目标章节') if (!id) return this.$message.warning('请选择目标章节')
if (sort === '') return this.$message.warning('请选择目标排序') if (sort === '') return this.$message.warning('请选择目标排序')
if (typeof sort === 'string') sort = sort === 'top' ? 0 : this.sortList.length - 2 //
this.moveVisible = false this.moveVisible = false
const list = this.checkList
list.map(e => e.check = false)
const ids = list.map(e => e.id)
const { chapters } = this
chapters.map(e => {
e.children = []
e.subsectionList.map(n => {
if (!ids.includes(n.id)) {
e.children.push(n)
}
})
e.subsectionList = e.children
delete e.children
if (e.id === id) e.subsectionList.splice(sort, 0, ...list)
})
this.moved = true
}, },
cancelSort() { cancelSort() {
this.sorting = false; this.chapters = JSON.parse(JSON.stringify(this.originChapters))
this.sorting = false;
}, },
saveSort() { saveSort() {
this.chapters.forEach((n, k) => { this.chapters.forEach((n, k) => {
n.sort = k + 1; n.sort = k + 1;
n.subsectionList.forEach((j, i) => { n.subsectionList.forEach((j, i) => {
j.sort = i + 1; j.sort = i + 1
j.chapterId = n.id
}); });
}); });
let data = { let data = {
@ -529,7 +538,6 @@ export default {
}; };
this.$post(this.api.reorder, data).then(res => { this.$post(this.api.reorder, data).then(res => {
this.sorting = false; this.sorting = false;
this.moveSubmit()
}).catch(res => {}) }).catch(res => {})
}, },
editChapter(item) { editChapter(item) {
@ -781,6 +789,7 @@ export default {
}, },
sortSection(chapterIndex, type, disabled, index) { sortSection(chapterIndex, type, disabled, index) {
if (!disabled) { if (!disabled) {
this.moved = true
let list = this.chapters[chapterIndex].subsectionList; let list = this.chapters[chapterIndex].subsectionList;
if (type == "up") { if (type == "up") {
let tempItem = list.splice(index - 1, 1)[0]; let tempItem = list.splice(index - 1, 1)[0];
@ -790,7 +799,6 @@ export default {
list.splice(index, 0, tempItem); list.splice(index, 0, tempItem);
} }
this.chapters[chapterIndex].subsectionList = list; this.chapters[chapterIndex].subsectionList = list;
} }
}, },
sectionNameSubmit() { sectionNameSubmit() {
@ -852,7 +860,10 @@ export default {
cursor: not-allowed cursor: not-allowed
} }
} }
/deep/.el-progress-bar {
padding-right: 70px;
margin-right: -70px;
}
.el-image-viewer__wrapper { .el-image-viewer__wrapper {
transform: translateY(-10px); transform: translateY(-10px);
transition: transform .5s; transition: transform .5s;

@ -65,7 +65,7 @@
v-model="form.customerName" placeholder="请选择客户"></el-input> v-model="form.customerName" placeholder="请选择客户"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="orderType" label="订单类型"> <el-form-item prop="orderType" label="订单类型">
<el-select :disabled="viewDisabled || renewDisabled" <el-select :disabled="viewDisabled"
v-model="form.orderType" clearable placeholder="请选择订单类型"> v-model="form.orderType" clearable placeholder="请选择订单类型">
<el-option v-for="(item,index) in orderTypeList" :key="index" <el-option v-for="(item,index) in orderTypeList" :key="index"
:label="item.name" :value="item.value"></el-option> :label="item.name" :value="item.value"></el-option>

Loading…
Cancel
Save