dev_202412
yujialong 2 months ago
parent 53725ce4fa
commit ae9e964d61
  1. 2
      src/App.vue
  2. 1
      src/api/index.js
  3. 2
      src/layouts/sidebar/index.vue
  4. 182
      src/pages/lesson/content/index.vue
  5. 27
      src/pages/lesson/content/source.vue
  6. 2
      src/pages/lesson/detail/index.vue
  7. 7
      src/pages/lesson/list/index.vue
  8. 17
      src/store/modules/lesson.js

@ -1,6 +1,6 @@
<template>
<div id="app">
<el-radio-group v-if="Setting.isDev" v-model="ip" @change="ipChange">
<el-radio-group v-if="Setting.isDev" v-model="ip" @change="ipChange" style="z-index: 10;position: fixed;top: 0;">
<el-radio :label="0">刘榕ip</el-radio>
<el-radio :label="1">陈赓ip</el-radio>
<el-radio :label="2">测试服ip</el-radio>

@ -531,6 +531,7 @@ export default {
curriculumTree: `nakadai/nakadai/curriculum/curriculumTree`,
boutiqueCurriculumTree: `occupationlab/occupationlab/theoreticalCourse/boutiqueCurriculumTree`,
combinationResource: `nakadai/nakadai/curriculum/combinationResource`,
replaceResource: `nakadai/nakadai/curriculum/subsection/replaceResource`,
deleteChapterCurriculm: `nakadai/nakadai/curriculum/chapter/deleteChapter`,
editChapterCurriculm: `nakadai/nakadai/curriculum/chapter/editChapter`,
addChapterCurriculm: `nakadai/nakadai/curriculum/chapter/addChapter`,

@ -100,7 +100,7 @@ export default {
<style lang="scss" scoped>
.sidebar {
width: 160px;
height: calc(100vh - 193px);
height: calc(100vh - 173px);
overflow: auto;
transition: .5s;
transform: translateX(-200px);

@ -86,7 +86,7 @@
</span>
</el-dialog>
<el-dialog title="添加小节" :visible.sync="sectionVisible" width="540px" @close="closeSection"
<el-dialog title="本地上传资源" :visible.sync="sectionVisible" width="540px" @close="closeSection"
:close-on-click-modal="false">
<el-form ref="form" :model="sectionForm" label-width="80px" @submit.native.prevent>
<el-form-item label="资源添加">
@ -199,6 +199,13 @@
</span>
</el-dialog>
<el-dialog title="更换内容资源" :visible.sync="switchTypeVisible" width="400px">
<ul class="source-list">
<li @click="sourceVisible = true">系统资源</li>
<li @click="editSection">本地上传</li>
</ul>
</el-dialog>
<Source :visible.sync="sourceVisible" />
</div>
</template>
@ -225,11 +232,11 @@ export default {
uploading: false,
uploadList: [],
chapterVisible: false,
chapterId: "",
chapterName: "",
chapterId: '',
chapterName: '',
sectionVisible: false,
sectionName: "",
sectionId: "",
sectionName: '',
sectionId: '',
switchVisible: false,
sectionNameVisible: false,
@ -243,17 +250,18 @@ export default {
},
keyword: '',
searchTimer: null,
fileId: "",
fileName: "",
fileUrl: "",
originalFileName: "",
fileType: "",
fileId: '',
fileName: '',
fileUrl: '',
originalFileName: '',
fileType: '',
videoSrc: '',
playAuth: "",
playAuth: '',
player: null,
previewImg: "",
iframeSrc: "",
previewImg: '',
iframeSrc: '',
curFile: {},
curSection: {},
isAddSection: false,
isWord: false,
isPPT: false,
@ -263,7 +271,7 @@ export default {
showMask2: false,
loadIns: null,
pdfVisible: false,
pdfSrc: "",
pdfSrc: '',
previewing: false,
showProgress: false,
progressPercent: 0,
@ -285,6 +293,8 @@ export default {
},
sourceVisible: false,
sections: [],
switchTypeVisible: false,
};
},
mounted () {
@ -444,7 +454,7 @@ export default {
//
batchDelSection () {
const list = this.sections.filter(e => e.check)
this.$confirm(list.length ? '此删除操作不可逆,是否确认删除选中项?' : '此删除操作不可逆,是否确认全部资源?', "提示", {
this.$confirm(list.length ? '此删除操作不可逆,是否确认删除选中项?' : '此删除操作不可逆,是否确认删除全部资源?', "提示", {
type: "warning"
}).then(async () => {
await this.$post(this.api.deleteSubsectionBatch, {
@ -563,9 +573,11 @@ export default {
//
showSource () {
this.curSection = {}
this.sourceVisible = true
},
addSection (id) {
//
addSection () {
this.sectionForm.sectionName = ''
this.fileUrl = ''
this.uploadList = []
@ -573,34 +585,40 @@ export default {
this.isAddSection = true
this.sectionVisible = true
},
//
editSection () {
this.sectionForm.sectionName = this.curSection.name
this.fileUrl = ''
this.uploadList = []
this.isAddSection = false
this.sectionVisible = true
},
chapterSubmit () {
if (!this.chapterName) return this.$message.warning("请填写章节名称");
let data = {
if (!this.chapterName) return this.$message.warning("请填写章节名称")
const data = {
cid: this.id,
name: this.chapterName
};
if (this.chapterId) {
data.id = this.chapterId;
data.id = this.chapterId
this.$put(this.api.editChapterCurriculm, data).then(res => {
this.$message.success("修改成功");
this.chapterVisible = false;
this.getData();
})
.catch(err => {
});
this.$message.success("修改成功")
this.chapterVisible = false
this.getData()
}).catch(err => { })
} else {
this.$post(this.api.addChapterCurriculm, data).then(res => {
this.$message.success("添加成功");
this.chapterVisible = false;
this.getData();
this.$message.success("添加成功")
this.chapterVisible = false
this.getData()
}).catch(err => { })
}
},
sectionSubmit (e) {
if (!this.sectionForm.sectionName) return this.$message.warning("请填写小节名称");
if (this.uploading) return this.$message.warning("资源正在上传中,请稍候");
if (!this.fileUrl && !this.fileId) return this.$message.warning("请上传资源");
let data = {
async sectionSubmit (e) {
if (!this.sectionForm.sectionName) return this.$message.warning('请填写小节名称')
if (this.uploading) return this.$message.warning('资源正在上传中,请稍候')
if (!this.fileUrl && !this.fileId) return this.$message.warning('请上传资源')
const data = {
id: this.sectionId,
cid: this.id,
chapterId: this.chapterId,
@ -610,21 +628,24 @@ export default {
fileName: this.fileName,
fileType: this.fileType,
originalFileName: this.originalFileName
};
this.$post(this.api.addSubsectionCurriculm, data).then(res => {
this.$message.success("添加成功");
this.sectionVisible = false;
this.getData();
})
.catch(err => {
})
}
if (this.sectionId) {
await this.$put(this.api.editSubsectionCurriculm, data)
} else {
await this.$post(this.api.addSubsectionCurriculm, data)
}
this.$message.success('添加成功')
this.sectionVisible = false
this.switchTypeVisible = false
this.getData()
},
closeSwitch () {
this.fileId = "";
this.fileName = "";
this.fileType = "";
this.fileUrl = "";
this.sectionId = "";
this.fileId = ''
this.fileName = ''
this.fileType = ''
this.fileUrl = ''
this.sectionId = ''
this.progressPercent = 0
},
//
@ -679,7 +700,7 @@ export default {
this.pdfSrc = row.fileUrl;
this.pdfVisible = true;
} else {
this.$get(`${this.api.getSubsection}/${row.id}`).then(res => {
this.$get(`${this.api.curriculumGetSubsection}/${row.id}`).then(res => {
this.previewing = true;
this.loadIns = Loading.service();
this.$route.fullPath.includes("#file") || history.pushState({ file: true }, "文件预览", "#" + this.$route.fullPath + "#file");
@ -715,20 +736,12 @@ export default {
this.sectionNameVisible = true;
},
switchFile (row) {
this.uploadList = []
this.curFile = {
fileId: row.fileId,
fileName: row.fileName,
fileType: row.fileType,
fileUrl: row.fileUrl
}
this.curSection = row
this.sectionId = row.id
this.sectionForm.sectionName = row.sectionName
this.switchVisible = true;
this.switchTypeVisible = true
},
switchSubmitFile () {
let data = {
this.$put(this.api.editSubsectionCurriculm, {
id: this.sectionId,
cid: this.id,
chapterId: this.chapterId,
@ -738,29 +751,27 @@ export default {
fileType: this.fileType,
fileUrl: this.fileUrl,
originalFileName: this.originalFileName
};
this.$put(this.api.editSubsectionCurriculm, data).then(res => {
this.$message.success("更换成功");
this.switchVisible = false;
this.getData();
}).then(res => {
this.$message.success("更换成功")
this.switchVisible = false
this.getData()
}).catch(err => { })
},
switchSubmit () {
if (this.uploading) return this.$message.warning("资源正在上传中,请稍候");
if (!this.fileUrl && !this.fileId) return this.$message.warning("请上传资源");
this.switchSubmitFile();
if (this.uploading) return this.$message.warning("资源正在上传中,请稍候")
if (!this.fileUrl && !this.fileId) return this.$message.warning("请上传资源")
this.switchSubmitFile()
},
delSection (row) {
this.$confirm("此删除操作不可逆,是否确认删除选中项?", "提示", {
type: "warning"
})
.then(() => {
this.$del(`${this.api.deleteSubsectionCurriculm}/${row.id}`).then(res => {
row.fileUrl && Oss.del(row.fileUrl)
this.$message.success("删除成功")
this.getData()
}).catch(res => { })
}).catch(() => { })
}).then(() => {
this.$del(`${this.api.deleteSubsectionCurriculm}/${row.id}`).then(res => {
row.fileUrl && Oss.del(row.fileUrl)
this.$message.success("删除成功")
this.getData()
}).catch(res => { })
}).catch(() => { })
},
sortChapter (row, type, disabled, index) {
if (!disabled) {
@ -803,7 +814,7 @@ export default {
if (this.previewing) {
this.closeIframe()
} else {
this.$router.push(this.$store.state.referrer || 'list')
this.$router.push(this.$store.state.lesson.referrer || 'list')
}
},
}
@ -1026,4 +1037,25 @@ export default {
}
}
}
/deep/.source-list {
display: flex;
gap: 10px;
li {
flex: 1;
line-height: 80px;
font-size: 16px;
text-align: center;
color: #333;
border-radius: 8px;
background-color: #f6f8fa;
border: 1px solid transparent;
cursor: pointer;
&:hover {
border-color: #062c87;
}
}
}
</style>

@ -54,6 +54,10 @@
</div>
</div>
<div class="right">
<div v-if="$parent.curSection.id" class="m-b-20">
<p class="total m-b-10">原资源共1个</p>
<div v-html="$parent.curSection.name"></div>
</div>
<template v-if="checked.length">
<div class="flex-between m-b-10">
<p class="total">已选资源{{ checked.length }}</p>
@ -134,6 +138,7 @@ export default {
//
init () {
this.getCourse()
this.checked = []
},
//
async getCourse () {
@ -159,8 +164,8 @@ export default {
this.course = list
},
initData () {
this.page = 1;
this.getData();
this.page = 1
this.getData()
},
tabChange (index) {
this.active = index
@ -264,8 +269,24 @@ export default {
type: e.cid ? 0 : 1,
}
})
await this.$post(this.api.combinationResource, result)
const old = this.$parent.curSection //
if (old.id) {
//
await this.$post(this.api.replaceResource, {
chapterId: old.chapterId,
cid: +id,
subsectionId: old.id,
newResource: result
})
} else {
//
await this.$post(this.api.combinationResource, result)
}
this.sourceVisible = false
this.$parent.switchTypeVisible = false
this.$parent.getData()
this.submiting = false
} else {

@ -867,7 +867,7 @@ export default {
//
back () {
this.loadIns && this.loadIns.close()
this.$router.push(this.$store.state.referrer || 'list')
this.$router.push(this.$store.state.lesson.referrer || 'list')
}
}
};

@ -124,6 +124,7 @@
<script>
import Setting from '@/setting'
import Util from '@/libs/util'
import qs from 'qs'
export default {
data () {
return {
@ -137,7 +138,7 @@ export default {
categoryId: +this.$route.query.categoryId || '',
professionalCategoryId: +this.$route.query.professionalCategoryId || '',
professionalId: +this.$route.query.professionalId || '',
curriculumType: this.$route.query.curriculumType ? +this.$route.query.curriculumType : '',
curriculumType: this.$route.query.curriculumType || '',
curriculumName: this.$route.query.curriculumName || ''
},
page: +this.$route.query.page || 1,
@ -231,7 +232,7 @@ export default {
},
// url
setReferrer () {
// this.$store.commit('setReferrer', `${this.$route.path}?${qs.stringify(this.form)}&page=${this.page}`)
this.$store.commit('lesson/setReferrer', `${this.$route.path}?${qs.stringify(this.form)}&page=${this.page}`)
},
//
addcourse () {
@ -357,6 +358,6 @@ export default {
<style scoped>
.card {
min-height: calc(100vh - 300px);
min-height: calc(100vh - 374px);
}
</style>

@ -0,0 +1,17 @@
/**
* 成绩相关
* */
export default {
namespaced: true,
state: {
referrer: '',
},
mutations: {
setReferrer: (state, val) => {
state.referrer = val
},
},
actions: {
}
};
Loading…
Cancel
Save