全部提交
This commit is contained in:
@@ -61,6 +61,8 @@ const mainRoutes = {
|
|||||||
{ path: '/commentsList', component: _import('modules/book/commentsList'), name: 'commentsList', meta: { title: '评论管理', isTab: true } },
|
{ path: '/commentsList', component: _import('modules/book/commentsList'), name: 'commentsList', meta: { title: '评论管理', isTab: true } },
|
||||||
{ path: '/course-courseList', component: _import('modules/course/courseList'), name: 'course-courseList', meta: { title: '课程列表', isTab: true } },
|
{ path: '/course-courseList', component: _import('modules/course/courseList'), name: 'course-courseList', meta: { title: '课程列表', isTab: true } },
|
||||||
{ path: '/course-courseCatalogue', component: _import('modules/course/courseCatalogue'), name: 'course-courseCatalogue', meta: { title: '课程目录列表', isTab: true } },
|
{ path: '/course-courseCatalogue', component: _import('modules/course/courseCatalogue'), name: 'course-courseCatalogue', meta: { title: '课程目录列表', isTab: true } },
|
||||||
|
{ path: '/course-courseChapter', component: _import('modules/course/courseChapter'), name: 'course-courseChapter', meta: { title: '课程目录章节列表', isTab: true } },
|
||||||
|
{ path: '/course-courseVideo', component: _import('modules/course/courseVideo'), name: 'course-courseVideo', meta: { title: '课程目录章节视频列表', isTab: true } },
|
||||||
],
|
],
|
||||||
beforeEnter (to, from, next) {
|
beforeEnter (to, from, next) {
|
||||||
let token = Vue.cookie.get('token')
|
let token = Vue.cookie.get('token')
|
||||||
|
|||||||
318
src/views/modules/course/chapter-add-or-update.vue
Normal file
318
src/views/modules/course/chapter-add-or-update.vue
Normal file
@@ -0,0 +1,318 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog :title="!dataForm.id ? '新增' : '修改'" :close-on-click-modal="false" :visible.sync="visible"
|
||||||
|
@close="handlereset">
|
||||||
|
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="80px">
|
||||||
|
<el-form-item label="章节名" prop="title">
|
||||||
|
<el-input v-model="dataForm.title" placeholder="章节名"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<!-- <el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="类型" prop="type">
|
||||||
|
<el-select v-model="dataForm.type" filterable
|
||||||
|
placeholder="请选择类型">
|
||||||
|
<el-option v-for="item in typeList" :key="item.dictType" :label="item.dictValue" :value="item.dictType">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12" v-if='!this.dataForm.id'>
|
||||||
|
<el-form-item label="是否同步创建商品" prop="needCreate" label-width="140px">
|
||||||
|
<el-select v-model="dataForm.needCreate" filterable
|
||||||
|
placeholder="请选择是否">
|
||||||
|
<el-option v-for="item in needCreateList" :key="item.dictType" :label="item.dictValue" :value="item.dictType">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row> -->
|
||||||
|
<el-form-item label="插图" prop="imgUrl">
|
||||||
|
<el-upload :action="baseUrl + '/oss/fileoss'" list-type="picture-card" :on-preview="handlePictureCardPreview"
|
||||||
|
:file-list="fileList" :on-success="handlePicSuccess" :on-remove="handleRemove">
|
||||||
|
<i class="el-icon-plus"></i>
|
||||||
|
</el-upload>
|
||||||
|
<el-dialog :visible.sync="dialogVisible" :append-to-body="true">
|
||||||
|
<img width="100%" :src="dataForm.imgUrl" alt="">
|
||||||
|
</el-dialog>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="内容" prop="content">
|
||||||
|
<el-input v-model="dataForm.content" placeholder="内容"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="排序" prop="sort">
|
||||||
|
<el-input v-model="dataForm.sort" placeholder="排序"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<!-- <el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="作者" prop="authorId">
|
||||||
|
<el-select
|
||||||
|
v-model="dataForm.authorId"
|
||||||
|
multiple
|
||||||
|
filterable
|
||||||
|
allow-create
|
||||||
|
size="small"
|
||||||
|
default-first-option
|
||||||
|
placeholder="请输入作者姓名">
|
||||||
|
<el-option
|
||||||
|
v-for="item in authorList"
|
||||||
|
:key="item.value + ''"
|
||||||
|
:label="item.value"
|
||||||
|
:value="item.id + ''">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="出版社" prop="publisherId">
|
||||||
|
<el-select v-model="dataForm.publisherId" multiple filterable allow-create default-first-option
|
||||||
|
placeholder="请输入出版社名称">
|
||||||
|
<el-option v-for="item in publisherList" :key="item.value + ''" :label="item.value" :value="item.id + ''">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-form-item label="序言" prop="title">
|
||||||
|
<el-input v-model="dataForm.title" placeholder="序言" :rows="3" type="textarea"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="拆分类型" prop="splits">
|
||||||
|
<el-radio-group v-model="dataForm.splits">
|
||||||
|
<el-radio v-for="item in splitsTypeList" :key="item.dictType" :label="item.dictType"
|
||||||
|
:value="item.dictType">{{item.dictValue}}</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="目录" prop="content">
|
||||||
|
<el-input v-model="dataForm.content" placeholder="目录" :rows="5" type="textarea"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="简介" prop="description">
|
||||||
|
<el-input v-model="dataForm.description" placeholder="简介" :rows="5" type="textarea"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="图书分类" prop="bookType">
|
||||||
|
<el-radio-group v-model="dataForm.bookType">
|
||||||
|
<el-radio :label="0">普通</el-radio>
|
||||||
|
<el-radio :label="1">中医经典</el-radio>
|
||||||
|
<el-radio :label="2">国学经典</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="相关古书" prop="relationId">
|
||||||
|
<el-select v-model="dataForm.relationId" filterable allow-create default-first-option
|
||||||
|
placeholder="请选择古书">
|
||||||
|
<el-option :key="0" label="无" :value="0"></el-option>
|
||||||
|
<el-option v-for="item in gushuList" :key="item.id" :label="item.name" :value="item.id">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-row>
|
||||||
|
<el-form-item label="图书类型" prop="medicaldesBookType">
|
||||||
|
<el-checkbox-group v-model="dataForm.medicaldesBookType">
|
||||||
|
<el-checkbox v-for="item in medicaldesBookTypeList" :key="item.dictType" :label="item.dictType"
|
||||||
|
:value="item.dictType">{{item.dictValue}}</el-checkbox>
|
||||||
|
</el-checkbox-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="是否可听">
|
||||||
|
<el-switch style="display: block" v-model="dataForm.canListen" active-color="#13ce66"
|
||||||
|
inactive-color="#ff4949" active-text="可听" inactive-text="不可听">
|
||||||
|
</el-switch>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-form-item label="是否参与打卡" prop="clockIn" label-width="250">
|
||||||
|
<el-radio-group v-model="dataForm.clockIn">
|
||||||
|
<el-radio :label="1">参与打卡</el-radio>
|
||||||
|
<el-radio :label="2">不参与打卡</el-radio>
|
||||||
|
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="是否参与讲书" prop="teachIn" label-width="250">
|
||||||
|
<el-radio-group v-model="dataForm.teachIn">
|
||||||
|
<el-radio :label="1">参与</el-radio>
|
||||||
|
<el-radio :label="0">不参与</el-radio>
|
||||||
|
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="付费类型" prop="isVip">
|
||||||
|
<el-radio-group v-model="dataForm.isVip">
|
||||||
|
<el-radio :label="2">付费</el-radio>
|
||||||
|
<el-radio :label="1">会免</el-radio>
|
||||||
|
<el-radio :label="0">免费</el-radio>
|
||||||
|
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="免费章节数" prop="freeChapterCount" label-width="250">
|
||||||
|
<el-input-number v-model="dataForm.freeChapterCount" :min="0" :max="10" label="免费章节数"></el-input-number>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="文件上传" prop="novel">
|
||||||
|
<el-upload class="upload-demo" :action="baseUrl + '/oss/fileoss'" :on-preview="handlePreview"
|
||||||
|
:on-remove="handleRemoveNovel" :before-remove="beforeRemove" :on-success="handleNovelSuccess" multiple
|
||||||
|
:limit="3" :on-exceed="handleExceed" :file-list="fileListNovel">
|
||||||
|
<el-button size="small" type="primary">点击上传</el-button>
|
||||||
|
</el-upload>
|
||||||
|
</el-form-item> -->
|
||||||
|
<!-- <el-form-item label="排序" prop="sort">
|
||||||
|
<el-input v-model="dataForm.sort" placeholder="排序"></el-input>
|
||||||
|
</el-form-item> -->
|
||||||
|
</el-form>
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="handlereset">取消</el-button>
|
||||||
|
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import global from '../../common/common.vue' //引入共用组间
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
baseUrl: global.baseUrl,
|
||||||
|
visible: false,
|
||||||
|
props: {
|
||||||
|
dictType: '',
|
||||||
|
dictValue: ''
|
||||||
|
},
|
||||||
|
gushuList:[],
|
||||||
|
authorList: [],
|
||||||
|
restaurants: [],
|
||||||
|
author: '',
|
||||||
|
publisherList: [],
|
||||||
|
fileList: [],
|
||||||
|
fileListNovel: [],
|
||||||
|
dialogImageUrl: '',
|
||||||
|
dialogVisible: false,
|
||||||
|
dataForm: {
|
||||||
|
"courseId": 0,
|
||||||
|
"catalogueId": 0,
|
||||||
|
"title": "",
|
||||||
|
"imgUrl": "",
|
||||||
|
"content": "",
|
||||||
|
"sort": 1,
|
||||||
|
},
|
||||||
|
splitsTypeList: [],
|
||||||
|
dataRule: {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
init(row, catalogue_id, courseid) {
|
||||||
|
console.log('row2', row)
|
||||||
|
this.dataForm = row || {}
|
||||||
|
this.dataForm.courseId = courseid || ''
|
||||||
|
this.dataForm.catalogueId = catalogue_id || ''
|
||||||
|
this.visible = true
|
||||||
|
if (this.dataForm.imgUrl && this.dataForm.imgUrl != "") {
|
||||||
|
var img = {
|
||||||
|
name: '',
|
||||||
|
url: this.dataForm.imgUrl
|
||||||
|
}
|
||||||
|
var attr = []
|
||||||
|
attr.push(img)
|
||||||
|
this.fileList = attr
|
||||||
|
}else{
|
||||||
|
this.fileList = []
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
// 表单提交
|
||||||
|
dataFormSubmit() {
|
||||||
|
this.$refs['dataForm'].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
this.$http({
|
||||||
|
url: this.$http.adornUrl(`${!this.dataForm.id ? '/master/course/addCourseCatalogueChapter' : '/master/course/editCourseCatalogueChapter'}`),
|
||||||
|
method: 'post',
|
||||||
|
data: this.$http.adornData({
|
||||||
|
"id": this.dataForm.id || undefined,
|
||||||
|
'courseId': this.dataForm.courseId || undefined,
|
||||||
|
'catalogueId': this.dataForm.catalogueId || undefined,
|
||||||
|
'title': this.dataForm.title,
|
||||||
|
"imgUrl": this.dataForm.imgUrl,
|
||||||
|
"content": this.dataForm.content,
|
||||||
|
"sort": this.dataForm.sort,
|
||||||
|
})
|
||||||
|
}).then(({
|
||||||
|
data
|
||||||
|
}) => {
|
||||||
|
if (data && data.code === 0) {
|
||||||
|
this.$message({
|
||||||
|
message: '操作成功',
|
||||||
|
type: 'success',
|
||||||
|
duration: 1500,
|
||||||
|
onClose: () => {
|
||||||
|
this.visible = false
|
||||||
|
this.$emit('refreshDataList')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.$message.error(data.msg)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handlePicSuccess(res, file) {
|
||||||
|
if (res.msg == "success") {
|
||||||
|
this.dataForm.imgUrl = res.url;
|
||||||
|
this.$message.success("上传成功");
|
||||||
|
} else {
|
||||||
|
this.$message.error("上传失败");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleRemove(file) {
|
||||||
|
this.dataForm.imgUrl = '';
|
||||||
|
},
|
||||||
|
handlePictureCardPreview(file) {
|
||||||
|
this.dataForm.imgUrl = file.url;
|
||||||
|
this.dialogVisible = true;
|
||||||
|
},
|
||||||
|
handleDownload(file) {
|
||||||
|
console.log(file)
|
||||||
|
},
|
||||||
|
handlereset() {
|
||||||
|
this.fileList = [],
|
||||||
|
this.fileListNovel = [],
|
||||||
|
this.visible = false
|
||||||
|
},
|
||||||
|
handlePreview(file) {
|
||||||
|
console.log(file);
|
||||||
|
},
|
||||||
|
handleExceed(files, fileList) {
|
||||||
|
this.$message.warning(`当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
|
||||||
|
},
|
||||||
|
beforeRemove(file, fileList) {
|
||||||
|
return this.$confirm(`确定移除 ${ file.name }?`);
|
||||||
|
},
|
||||||
|
handleRemoveNovel(file) {
|
||||||
|
this.dataForm.novel = '';
|
||||||
|
},
|
||||||
|
handleNovelSuccess(file) {
|
||||||
|
this.dataForm.novel = file.url
|
||||||
|
},
|
||||||
|
// querySearch(queryString, cb) {
|
||||||
|
// var restaurants = this.restaurants;
|
||||||
|
// var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants;
|
||||||
|
// // 调用 callback 返回建议列表的数据
|
||||||
|
// console.log(results)
|
||||||
|
// cb(results);
|
||||||
|
// },
|
||||||
|
// createFilter(queryString) {
|
||||||
|
// return (restaurant) => {
|
||||||
|
// return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
|
||||||
|
// };
|
||||||
|
// },
|
||||||
|
// handleSelect(item) {
|
||||||
|
// this.dataForm.authorId = item.id
|
||||||
|
// console.log(item);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -281,99 +281,21 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getBookList()
|
|
||||||
this.loadAll()
|
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
// this.restaurants = this.loadAll();
|
// this.restaurants = this.loadAll();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
init(id) {
|
init(row) {
|
||||||
this.dataForm.id = id || 0
|
console.log('11111', row)
|
||||||
|
this.dataForm = row || {}
|
||||||
|
// this.dataForm.id = row.id || 0
|
||||||
|
// this.dataForm.title = row.title || ''
|
||||||
this.visible = true
|
this.visible = true
|
||||||
// this.$nextTick(() => {
|
|
||||||
// this.$refs['dataForm'].resetFields()
|
|
||||||
// if (this.dataForm.id) {
|
|
||||||
// this.$http({
|
|
||||||
// url: this.$http.adornUrl(`/book/book/info/${this.dataForm.id}`),
|
|
||||||
// method: 'get',
|
|
||||||
// params: this.$http.adornParams()
|
|
||||||
// }).then(({
|
|
||||||
// data
|
|
||||||
// }) => {
|
|
||||||
// if (data && data.code === 0) {
|
|
||||||
// this.dataForm.name = data.book.name
|
|
||||||
// this.dataForm.publisherName = data.book.dataForm
|
|
||||||
// // this.dataForm.authorId = data.book.authorId
|
|
||||||
// this.dataForm.description = data.book.description
|
|
||||||
// this.dataForm.title = data.book.title
|
|
||||||
// this.dataForm.bookType = data.book.bookType
|
|
||||||
// this.dataForm.content = data.book.content
|
|
||||||
// // this.dataForm.type = data.book.type
|
|
||||||
// // this.dataForm.price = data.book.price
|
|
||||||
// // this.dataForm.salePrice = data.book.salePrice
|
|
||||||
// // this.dataForm.istop = data.book.istop
|
|
||||||
// this.dataForm.isVip = data.book.isVip
|
|
||||||
// // this.dataForm.isSale = data.book.isSale
|
|
||||||
// this.dataForm.freeChapterCount = data.book.freeChapterCount
|
|
||||||
// this.dataForm.splits = data.book.splits
|
|
||||||
// // this.dataForm.publisherId = data.book.publisherId
|
|
||||||
// this.dataForm.images = data.book.images
|
|
||||||
// this.dataForm.pid = data.book.pid
|
|
||||||
// this.dataForm.level = data.book.level
|
|
||||||
// this.dataForm.createTime = data.book.createTime
|
|
||||||
// this.dataForm.updateTime = data.book.updateTime
|
|
||||||
// this.dataForm.sort = data.book.sort
|
|
||||||
// this.dataForm.delFlag = data.book.delFlag
|
|
||||||
// this.dataForm.novel = data.book.novel
|
|
||||||
// this.dataForm.clockIn = data.book.clockIn
|
|
||||||
// this.dataForm.teachIn = data.book.teachIn
|
|
||||||
// this.dataForm.canListen = data.book.canListen
|
|
||||||
// this.dataForm.relationId = data.book.relationId
|
|
||||||
// var checklist = data.book.type
|
|
||||||
// var medicaldeschecklist = data.book.medicaldesBookType
|
|
||||||
// var authorList = data.book.authorId
|
|
||||||
// var publisherlish = data.book.publisherId
|
|
||||||
// if (data.book.authorId != "") {
|
|
||||||
// this.dataForm.authorId = authorList.split(',')
|
|
||||||
// }
|
|
||||||
// if (data.book.publisherId != "") {
|
|
||||||
// this.dataForm.publisherId = publisherlish.split(',')
|
|
||||||
// }
|
|
||||||
|
|
||||||
// this.dataForm.type = checklist.split(',')
|
|
||||||
// this.dataForm.medicaldesBookType = medicaldeschecklist.split(',')
|
|
||||||
// for (let i = 0; i < this.dataForm.medicaldesBookType.length; i++) {
|
|
||||||
// this.dataForm.medicaldesBookType[i] = parseInt(this.dataForm.medicaldesBookType[i]);
|
|
||||||
// }
|
|
||||||
// console.log(this.dataForm.type)
|
|
||||||
// console.log('2222222222', this.dataForm.medicaldesBookType)
|
|
||||||
// if (data.book.images != "") {
|
|
||||||
// var img = {
|
|
||||||
// name: '',
|
|
||||||
// url: data.book.images
|
|
||||||
// }
|
|
||||||
// var attr = []
|
|
||||||
// attr.push(img)
|
|
||||||
// this.fileList = attr
|
|
||||||
// }
|
|
||||||
// if (data.book.novel != "" && data.book.novel != null && data.book.novel != 'undefined') {
|
|
||||||
// var novel = {
|
|
||||||
// name: '电子书文件',
|
|
||||||
// url: data.book.novel
|
|
||||||
// }
|
|
||||||
// var attr = []
|
|
||||||
// attr.push(novel)
|
|
||||||
// this.fileListNovel = attr
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
},
|
},
|
||||||
// 表单提交
|
// 表单提交
|
||||||
dataFormSubmit() {
|
dataFormSubmit() {
|
||||||
console.log('11111', this.dataForm.medicaldesBookType)
|
// console.log('11111', this.dataForm.medicaldesBookType)
|
||||||
// if (this.dataForm.medicaldesBookType.length == 0) {
|
// if (this.dataForm.medicaldesBookType.length == 0) {
|
||||||
// this.$message.error("请选择图书类型");
|
// this.$message.error("请选择图书类型");
|
||||||
// return
|
// return
|
||||||
@@ -439,43 +361,6 @@
|
|||||||
this.$message.error("上传失败");
|
this.$message.error("上传失败");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//图书分类
|
|
||||||
getBookList() {
|
|
||||||
this.$http({
|
|
||||||
url: this.$http.adornUrl('/book/sysdictdata/selectByType/book_type'),
|
|
||||||
method: 'get',
|
|
||||||
// params: this.$http.adornParams({
|
|
||||||
// 'type': 'book_type',
|
|
||||||
// })
|
|
||||||
}).then(({
|
|
||||||
data
|
|
||||||
}) => {
|
|
||||||
console.log(data)
|
|
||||||
// this.bookList = data.dataList
|
|
||||||
})
|
|
||||||
|
|
||||||
// 获取图书拆分类型
|
|
||||||
this.$http({
|
|
||||||
url: this.$http.adornUrl('/book/sysdictdata/selectByType/splitsType'),
|
|
||||||
method: 'get',
|
|
||||||
}).then(({
|
|
||||||
data
|
|
||||||
}) => {
|
|
||||||
this.splitsTypeList = data.dataList
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
// 获取古书
|
|
||||||
this.$http({
|
|
||||||
url: this.$http.adornUrl('/book/book/getAncientBooks'),
|
|
||||||
method: 'post',
|
|
||||||
}).then(({
|
|
||||||
data
|
|
||||||
}) => {
|
|
||||||
this.gushuList= data.books
|
|
||||||
})
|
|
||||||
|
|
||||||
},
|
|
||||||
handleRemove(file) {
|
handleRemove(file) {
|
||||||
this.dataForm.images = '';
|
this.dataForm.images = '';
|
||||||
},
|
},
|
||||||
@@ -518,25 +403,6 @@
|
|||||||
// return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
|
// return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
|
||||||
// };
|
// };
|
||||||
// },
|
// },
|
||||||
loadAll() {
|
|
||||||
this.$http({
|
|
||||||
url: this.$http.adornUrl('/book/author/bookAuthorList'),
|
|
||||||
method: 'get',
|
|
||||||
}).then(({
|
|
||||||
data
|
|
||||||
}) => {
|
|
||||||
this.authorList = data.list
|
|
||||||
})
|
|
||||||
this.$http({
|
|
||||||
url: this.$http.adornUrl('/book/publisher/publisherList'),
|
|
||||||
method: 'get',
|
|
||||||
}).then(({
|
|
||||||
data
|
|
||||||
}) => {
|
|
||||||
this.publisherList = data.list
|
|
||||||
})
|
|
||||||
|
|
||||||
},
|
|
||||||
// handleSelect(item) {
|
// handleSelect(item) {
|
||||||
// this.dataForm.authorId = item.id
|
// this.dataForm.authorId = item.id
|
||||||
// console.log(item);
|
// console.log(item);
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="mod-config">
|
<div class="mod-config">
|
||||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||||
<el-form-item label="课程目录名称">
|
<!-- <el-form-item label="课程目录名称">
|
||||||
<el-input v-model="query.keywords" placeholder="课程目录名称" clearable></el-input>
|
<el-input v-model="query.keywords" placeholder="课程目录名称" clearable></el-input>
|
||||||
</el-form-item>
|
</el-form-item> -->
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button @click="pageIndex = 1;getDataList()">查询</el-button>
|
<el-button @click="pageIndex = 1;getDataList()">查询</el-button>
|
||||||
<el-button v-if="isAuth('book:book:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
<el-button type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<el-table :data="dataList" border v-loading="dataListLoading"
|
<el-table :data="dataList" border v-loading="dataListLoading"
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<router-link :to="{path: 'book-bookchapter' , query:{ id : scope.row.id , pageIndex} }">
|
<router-link :to="{path: 'course-courseChapter' , query:{ id : scope.row.id ,courseid: courseid, pageIndex} }">
|
||||||
<el-button type="text" size="small">章节管理</el-button>
|
<el-button type="text" size="small">章节管理</el-button>
|
||||||
</router-link>
|
</router-link>
|
||||||
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row)">修改</el-button>
|
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row)">修改</el-button>
|
||||||
|
|||||||
252
src/views/modules/course/courseChapter.vue
Normal file
252
src/views/modules/course/courseChapter.vue
Normal file
@@ -0,0 +1,252 @@
|
|||||||
|
<template>
|
||||||
|
<div class="mod-config">
|
||||||
|
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||||
|
<!-- <el-form-item label="课程目录章节名称">
|
||||||
|
<el-input v-model="query.keywords" placeholder="课程目录章节名称" clearable></el-input>
|
||||||
|
</el-form-item> -->
|
||||||
|
<el-form-item>
|
||||||
|
<el-button @click="pageIndex = 1;getDataList()">查询</el-button>
|
||||||
|
<el-button type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<el-table :data="dataList" border v-loading="dataListLoading"
|
||||||
|
style="width: 100%;">
|
||||||
|
<el-table-column prop="title" header-align="center" align="center" label="章节名称">
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column prop="createTime" header-align="center" align="center" label="创建日期">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column header-align="center" align="center" label="图片">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<img v-if="scope.row.imgUrl != ''" :src="scope.row.imgUrl" width="70" height="100" class="tableImg" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="content" header-align="center" align="center" label="内容">
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column fixed="right" header-align="center" align="center" width="250" label="操作">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<router-link :to="{path: 'course-courseVideo' , query:{ id : scope.row.id , pageIndex} }">
|
||||||
|
<el-button type="text" size="small">视频管理</el-button>
|
||||||
|
</router-link>
|
||||||
|
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row)">修改</el-button>
|
||||||
|
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<el-pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" :current-page="pageIndex"
|
||||||
|
:page-sizes="[10, 20, 50, 100]" :page-size="pageSize" :total="totalPage"
|
||||||
|
style="padding: 30px 0; text-align: center;" layout="total, sizes, prev, pager, next, jumper">
|
||||||
|
</el-pagination>
|
||||||
|
<!-- 弹窗, 新增 / 修改 -->
|
||||||
|
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import AddOrUpdate from './chapter-add-or-update'
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
dataForm: {
|
||||||
|
key: ''
|
||||||
|
},
|
||||||
|
query:{
|
||||||
|
type:'',
|
||||||
|
categoryId:'',
|
||||||
|
sociologyId:'',
|
||||||
|
keywords:''
|
||||||
|
},
|
||||||
|
dataList: [],
|
||||||
|
delFlag: false,
|
||||||
|
pageIndex: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
totalPage: 0,
|
||||||
|
dataListLoading: false,
|
||||||
|
dataListSelections: [],
|
||||||
|
addOrUpdateVisible: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
AddOrUpdate
|
||||||
|
},
|
||||||
|
activated() {
|
||||||
|
this.courseid = this.$route.query.courseid;
|
||||||
|
this.catalogue_id = this.$route.query.id;
|
||||||
|
console.log('111', this.courseid)
|
||||||
|
console.log('222', this.catalogue_id)
|
||||||
|
if(this.$route.query.upPageInde != null){
|
||||||
|
this.pageIndex = this.$route.query.upPageIndex;
|
||||||
|
console.log(this.pageIndex)
|
||||||
|
}
|
||||||
|
this.getDataList()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 获取数据列表
|
||||||
|
getDataList() {
|
||||||
|
this.dataListLoading = true
|
||||||
|
this.$http({
|
||||||
|
url: this.$http.adornUrl('/master/course/getCourseCatalogueChapterList'),
|
||||||
|
method: 'post',
|
||||||
|
data: this.$http.adornData({
|
||||||
|
'id': this.catalogue_id,
|
||||||
|
'page': this.pageIndex,
|
||||||
|
'limit': this.pageSize,
|
||||||
|
// "type": this.query.type||0, //类型0全部,1:医学,2:国学
|
||||||
|
// "categoryId": this.query.categoryId, //医学类型id,当type为1时为必填项;为0时代表全部
|
||||||
|
// "sociologyId": this.query.sociologyId, //国学类型id,当type为2时为必填项;为0代表全部
|
||||||
|
// "keywords": this.query.keywords //关键字
|
||||||
|
})
|
||||||
|
}).then(({ data }) => {
|
||||||
|
if (data && data.code === 0) {
|
||||||
|
this.dataList = data.page.records
|
||||||
|
this.totalPage = data.page.total
|
||||||
|
} else {
|
||||||
|
this.dataList = []
|
||||||
|
this.totalPage = 0
|
||||||
|
}
|
||||||
|
this.dataListLoading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 每页数
|
||||||
|
sizeChangeHandle(val) {
|
||||||
|
this.pageSize = val
|
||||||
|
this.pageIndex = 1
|
||||||
|
this.getDataList()
|
||||||
|
},
|
||||||
|
// 当前页
|
||||||
|
currentChangeHandle(val) {
|
||||||
|
this.pageIndex = val
|
||||||
|
this.getDataList()
|
||||||
|
},
|
||||||
|
// 多选
|
||||||
|
selectionChangeHandle(val) {
|
||||||
|
this.dataListSelections = val
|
||||||
|
},
|
||||||
|
// 新增 / 修改
|
||||||
|
addOrUpdateHandle(row) {
|
||||||
|
console.log('row1', row)
|
||||||
|
this.addOrUpdateVisible = true
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.addOrUpdate.init(row, this.catalogue_id, this.courseid)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 删除
|
||||||
|
deleteHandle(id) {
|
||||||
|
// var ids = id ? [id] : this.dataListSelections.map(item => {
|
||||||
|
// return item.id
|
||||||
|
// })
|
||||||
|
this.$confirm(`确定对[id=${id}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
this.$http({
|
||||||
|
url: this.$http.adornUrl('/master/course/delCourseCatalogueChapter'),
|
||||||
|
method: 'post',
|
||||||
|
data: this.$http.adornData({
|
||||||
|
'chapterId': id
|
||||||
|
})
|
||||||
|
}).then(({ data }) => {
|
||||||
|
if (data && data.code === 0) {
|
||||||
|
this.$message({
|
||||||
|
message: '操作成功',
|
||||||
|
type: 'success',
|
||||||
|
duration: 1500,
|
||||||
|
onClose: () => {
|
||||||
|
this.getDataList()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.$message.error(data.msg)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 开关变化
|
||||||
|
SwitchChange(event) {
|
||||||
|
/*点击时他会自动把你绑定的值变更,直接去请求数据就可以了*/
|
||||||
|
var parms = {
|
||||||
|
delFlag: event.delFlag,
|
||||||
|
id: event.id
|
||||||
|
}
|
||||||
|
this.$http({
|
||||||
|
url: this.$http.adornUrl('/book/book/update'),
|
||||||
|
method: 'post',
|
||||||
|
data: parms
|
||||||
|
}).then(res => {
|
||||||
|
this.$message({
|
||||||
|
message: '成功',
|
||||||
|
type: 'success'
|
||||||
|
})
|
||||||
|
this.loading = false
|
||||||
|
this.getDataList()
|
||||||
|
}).catch(error => {
|
||||||
|
this.loading = false
|
||||||
|
console.log(error)
|
||||||
|
})
|
||||||
|
console.log(event)
|
||||||
|
},
|
||||||
|
chapterHandle(id, row) {
|
||||||
|
if (row.novel == '') {
|
||||||
|
this.$alert('请上传电子书文件后在进行此操作', '提示', {
|
||||||
|
confirmButtonText: '好的',
|
||||||
|
});
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
this.$http({
|
||||||
|
url: this.$http.adornUrl('/book/book/getChapter'),
|
||||||
|
method: 'get',
|
||||||
|
params: this.$http.adornParams({
|
||||||
|
'id':id
|
||||||
|
})
|
||||||
|
}).then(res => {
|
||||||
|
this.$message({
|
||||||
|
message: '成功',
|
||||||
|
type: 'success'
|
||||||
|
})
|
||||||
|
this.loading = false
|
||||||
|
this.getDataList()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
contentHandle(id){
|
||||||
|
this.$http({
|
||||||
|
url: this.$http.adornUrl('/book/bookchaptercontent/getBookVoices'),
|
||||||
|
method: 'get',
|
||||||
|
params: this.$http.adornParams({
|
||||||
|
'id':id
|
||||||
|
})
|
||||||
|
}).then(res => {
|
||||||
|
this.$message({
|
||||||
|
message: '成功',
|
||||||
|
type: 'success'
|
||||||
|
})
|
||||||
|
this.loading = false
|
||||||
|
this.getDataList()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
voicesHandle(id){
|
||||||
|
//allVoices
|
||||||
|
this.$http({
|
||||||
|
// url: this.$http.adornUrl('/book/bookchaptercontent/allVoices'),
|
||||||
|
url: this.$http.adornUrl('/book/bookchaptercontent/AllVOices'),
|
||||||
|
method: 'get',
|
||||||
|
params: this.$http.adornParams({
|
||||||
|
'id':id
|
||||||
|
})
|
||||||
|
}).then(res => {
|
||||||
|
console.log('book/bookchaptercontent/AllVOices')
|
||||||
|
this.$message({
|
||||||
|
message: '成功',
|
||||||
|
type: 'success'
|
||||||
|
})
|
||||||
|
this.loading = false
|
||||||
|
this.getDataList()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
</el-form-item> -->
|
</el-form-item> -->
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button @click="pageIndex = 1;getDataList()">查询</el-button>
|
<el-button @click="pageIndex = 1;getDataList()">查询</el-button>
|
||||||
<el-button v-if="isAuth('book:book:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
<el-button type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||||
<!-- <el-button v-if="isAuth('book:book:delete')" type="danger" @click="deleteHandle()"
|
<!-- <el-button v-if="isAuth('book:book:delete')" type="danger" @click="deleteHandle()"
|
||||||
:disabled="dataListSelections.length <= 0">批量删除</el-button> -->
|
:disabled="dataListSelections.length <= 0">批量删除</el-button> -->
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -157,7 +157,7 @@
|
|||||||
<router-link :to="{path: 'course-courseCatalogue' , query:{ id : scope.row.id , pageIndex} }">
|
<router-link :to="{path: 'course-courseCatalogue' , query:{ id : scope.row.id , pageIndex} }">
|
||||||
<el-button type="text" size="small">目录管理</el-button>
|
<el-button type="text" size="small">目录管理</el-button>
|
||||||
</router-link>
|
</router-link>
|
||||||
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
|
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row)">修改</el-button>
|
||||||
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
|
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -248,10 +248,10 @@ export default {
|
|||||||
this.dataListSelections = val
|
this.dataListSelections = val
|
||||||
},
|
},
|
||||||
// 新增 / 修改
|
// 新增 / 修改
|
||||||
addOrUpdateHandle(id) {
|
addOrUpdateHandle(row) {
|
||||||
this.addOrUpdateVisible = true
|
this.addOrUpdateVisible = true
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.addOrUpdate.init(id)
|
this.$refs.addOrUpdate.init(row)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 删除
|
// 删除
|
||||||
|
|||||||
253
src/views/modules/course/courseVideo.vue
Normal file
253
src/views/modules/course/courseVideo.vue
Normal file
@@ -0,0 +1,253 @@
|
|||||||
|
<template>
|
||||||
|
<div class="mod-config">
|
||||||
|
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||||
|
<!-- <el-form-item label="课程目录章节名称">
|
||||||
|
<el-input v-model="query.keywords" placeholder="课程目录章节名称" clearable></el-input>
|
||||||
|
</el-form-item> -->
|
||||||
|
<el-form-item>
|
||||||
|
<el-button @click="pageIndex = 1;getDataList()">查询</el-button>
|
||||||
|
<el-button type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<el-table :data="dataList" border v-loading="dataListLoading"
|
||||||
|
style="width: 100%;">
|
||||||
|
<el-table-column prop="title" header-align="center" align="center" label="视频名称">
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column prop="createTime" header-align="center" align="center" label="创建日期">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column header-align="center" align="center" label="视频">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<img v-if="scope.row.imgUrl != ''" :src="scope.row.imgUrl" width="70" height="100" class="tableImg" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="content" header-align="center" align="center" label="内容">
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column fixed="right" header-align="center" align="center" width="250" label="操作">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<router-link :to="{path: 'course-courseVideo' , query:{ id : scope.row.id , pageIndex} }">
|
||||||
|
<el-button type="text" size="small">视频管理</el-button>
|
||||||
|
</router-link>
|
||||||
|
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row)">修改</el-button>
|
||||||
|
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<el-pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" :current-page="pageIndex"
|
||||||
|
:page-sizes="[10, 20, 50, 100]" :page-size="pageSize" :total="totalPage"
|
||||||
|
style="padding: 30px 0; text-align: center;" layout="total, sizes, prev, pager, next, jumper">
|
||||||
|
</el-pagination>
|
||||||
|
<!-- 弹窗, 新增 / 修改 -->
|
||||||
|
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import AddOrUpdate from './video-add-or-update'
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
dataForm: {
|
||||||
|
key: ''
|
||||||
|
},
|
||||||
|
query:{
|
||||||
|
type:'',
|
||||||
|
categoryId:'',
|
||||||
|
sociologyId:'',
|
||||||
|
keywords:''
|
||||||
|
},
|
||||||
|
dataList: [],
|
||||||
|
delFlag: false,
|
||||||
|
pageIndex: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
totalPage: 0,
|
||||||
|
dataListLoading: false,
|
||||||
|
dataListSelections: [],
|
||||||
|
addOrUpdateVisible: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
AddOrUpdate
|
||||||
|
},
|
||||||
|
activated() {
|
||||||
|
// this.courseid = this.$route.query.courseid;
|
||||||
|
// this.catalogue_id = this.$route.query.id;
|
||||||
|
this.chapter_id = this.$route.query.id;
|
||||||
|
console.log('111', this.courseid)
|
||||||
|
console.log('222', this.catalogue_id)
|
||||||
|
if(this.$route.query.upPageInde != null){
|
||||||
|
this.pageIndex = this.$route.query.upPageIndex;
|
||||||
|
console.log(this.pageIndex)
|
||||||
|
}
|
||||||
|
this.getDataList()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 获取数据列表
|
||||||
|
getDataList() {
|
||||||
|
this.dataListLoading = true
|
||||||
|
this.$http({
|
||||||
|
url: this.$http.adornUrl('/master/course/getCourseCatalogueChapterVideoList'),
|
||||||
|
method: 'post',
|
||||||
|
data: this.$http.adornData({
|
||||||
|
'id': this.chapter_id,
|
||||||
|
'page': this.pageIndex,
|
||||||
|
'limit': this.pageSize,
|
||||||
|
// "type": this.query.type||0, //类型0全部,1:医学,2:国学
|
||||||
|
// "categoryId": this.query.categoryId, //医学类型id,当type为1时为必填项;为0时代表全部
|
||||||
|
// "sociologyId": this.query.sociologyId, //国学类型id,当type为2时为必填项;为0代表全部
|
||||||
|
// "keywords": this.query.keywords //关键字
|
||||||
|
})
|
||||||
|
}).then(({ data }) => {
|
||||||
|
if (data && data.code === 0 && data.page && data.page.records) {
|
||||||
|
this.dataList = data.page.records
|
||||||
|
this.totalPage = data.page.total
|
||||||
|
} else {
|
||||||
|
this.dataList = []
|
||||||
|
this.totalPage = 0
|
||||||
|
}
|
||||||
|
this.dataListLoading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 每页数
|
||||||
|
sizeChangeHandle(val) {
|
||||||
|
this.pageSize = val
|
||||||
|
this.pageIndex = 1
|
||||||
|
this.getDataList()
|
||||||
|
},
|
||||||
|
// 当前页
|
||||||
|
currentChangeHandle(val) {
|
||||||
|
this.pageIndex = val
|
||||||
|
this.getDataList()
|
||||||
|
},
|
||||||
|
// 多选
|
||||||
|
selectionChangeHandle(val) {
|
||||||
|
this.dataListSelections = val
|
||||||
|
},
|
||||||
|
// 新增 / 修改
|
||||||
|
addOrUpdateHandle(row) {
|
||||||
|
console.log('row1', row)
|
||||||
|
this.addOrUpdateVisible = true
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.addOrUpdate.init(row, this.chapter_id)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 删除
|
||||||
|
deleteHandle(id) {
|
||||||
|
// var ids = id ? [id] : this.dataListSelections.map(item => {
|
||||||
|
// return item.id
|
||||||
|
// })
|
||||||
|
this.$confirm(`确定对[id=${id}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
this.$http({
|
||||||
|
url: this.$http.adornUrl('/master/course/delCourseCatalogueChapterVideo'),
|
||||||
|
method: 'post',
|
||||||
|
data: this.$http.adornData({
|
||||||
|
'id': id
|
||||||
|
})
|
||||||
|
}).then(({ data }) => {
|
||||||
|
if (data && data.code === 0) {
|
||||||
|
this.$message({
|
||||||
|
message: '操作成功',
|
||||||
|
type: 'success',
|
||||||
|
duration: 1500,
|
||||||
|
onClose: () => {
|
||||||
|
this.getDataList()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.$message.error(data.msg)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 开关变化
|
||||||
|
SwitchChange(event) {
|
||||||
|
/*点击时他会自动把你绑定的值变更,直接去请求数据就可以了*/
|
||||||
|
var parms = {
|
||||||
|
delFlag: event.delFlag,
|
||||||
|
id: event.id
|
||||||
|
}
|
||||||
|
this.$http({
|
||||||
|
url: this.$http.adornUrl('/book/book/update'),
|
||||||
|
method: 'post',
|
||||||
|
data: parms
|
||||||
|
}).then(res => {
|
||||||
|
this.$message({
|
||||||
|
message: '成功',
|
||||||
|
type: 'success'
|
||||||
|
})
|
||||||
|
this.loading = false
|
||||||
|
this.getDataList()
|
||||||
|
}).catch(error => {
|
||||||
|
this.loading = false
|
||||||
|
console.log(error)
|
||||||
|
})
|
||||||
|
console.log(event)
|
||||||
|
},
|
||||||
|
chapterHandle(id, row) {
|
||||||
|
if (row.novel == '') {
|
||||||
|
this.$alert('请上传电子书文件后在进行此操作', '提示', {
|
||||||
|
confirmButtonText: '好的',
|
||||||
|
});
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
this.$http({
|
||||||
|
url: this.$http.adornUrl('/book/book/getChapter'),
|
||||||
|
method: 'get',
|
||||||
|
params: this.$http.adornParams({
|
||||||
|
'id':id
|
||||||
|
})
|
||||||
|
}).then(res => {
|
||||||
|
this.$message({
|
||||||
|
message: '成功',
|
||||||
|
type: 'success'
|
||||||
|
})
|
||||||
|
this.loading = false
|
||||||
|
this.getDataList()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
contentHandle(id){
|
||||||
|
this.$http({
|
||||||
|
url: this.$http.adornUrl('/book/bookchaptercontent/getBookVoices'),
|
||||||
|
method: 'get',
|
||||||
|
params: this.$http.adornParams({
|
||||||
|
'id':id
|
||||||
|
})
|
||||||
|
}).then(res => {
|
||||||
|
this.$message({
|
||||||
|
message: '成功',
|
||||||
|
type: 'success'
|
||||||
|
})
|
||||||
|
this.loading = false
|
||||||
|
this.getDataList()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
voicesHandle(id){
|
||||||
|
//allVoices
|
||||||
|
this.$http({
|
||||||
|
// url: this.$http.adornUrl('/book/bookchaptercontent/allVoices'),
|
||||||
|
url: this.$http.adornUrl('/book/bookchaptercontent/AllVOices'),
|
||||||
|
method: 'get',
|
||||||
|
params: this.$http.adornParams({
|
||||||
|
'id':id
|
||||||
|
})
|
||||||
|
}).then(res => {
|
||||||
|
console.log('book/bookchaptercontent/AllVOices')
|
||||||
|
this.$message({
|
||||||
|
message: '成功',
|
||||||
|
type: 'success'
|
||||||
|
})
|
||||||
|
this.loading = false
|
||||||
|
this.getDataList()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
360
src/views/modules/course/video-add-or-update.vue
Normal file
360
src/views/modules/course/video-add-or-update.vue
Normal file
@@ -0,0 +1,360 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog :title="!dataForm.id ? '新增' : '修改'" :close-on-click-modal="false" :visible.sync="visible"
|
||||||
|
@close="handlereset">
|
||||||
|
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="80px">
|
||||||
|
<el-form-item label="加密类型" prop="type">
|
||||||
|
<el-select v-model="dataForm.type" filterable
|
||||||
|
placeholder="请选择类型">
|
||||||
|
<el-option v-for="item in typeList" :key="item.dictType" :label="item.dictValue" :value="item.dictType">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="视频" prop="video">
|
||||||
|
<el-upload
|
||||||
|
:limit="1"
|
||||||
|
:on-preview="handlePictureCardPreview"
|
||||||
|
class="el-uploadfeng"
|
||||||
|
ref="files"
|
||||||
|
action="#"
|
||||||
|
:file-list="fileList"
|
||||||
|
:on-change="changeData"
|
||||||
|
accept=".mp3,.mp4,.gif,.mpeg,.mpg"
|
||||||
|
:http-request="handleRequest"
|
||||||
|
:before-remove="handleBeforeRemove"
|
||||||
|
:on-remove="handleRemove"
|
||||||
|
>
|
||||||
|
<!-- <el-button class="btn upload-btn">上传附件</el-button> -->
|
||||||
|
<i
|
||||||
|
class="el-icon-plus"
|
||||||
|
v-if="fileList.length == 0 && !isUpload"
|
||||||
|
></i>
|
||||||
|
</el-upload>
|
||||||
|
<div class="newpro">
|
||||||
|
<el-progress
|
||||||
|
v-if="isUpload"
|
||||||
|
:stroke-width="10"
|
||||||
|
:percentage="progressPercent"
|
||||||
|
style="width: 100%"
|
||||||
|
></el-progress>
|
||||||
|
</div>
|
||||||
|
<!-- <el-upload :action="baseUrl + '/oss/fileoss'" list-type="picture-card" :on-preview="handlePictureCardPreview"
|
||||||
|
:file-list="fileList" :on-success="handlePicSuccess" :on-remove="handleRemove">
|
||||||
|
<i class="el-icon-plus"></i>
|
||||||
|
</el-upload>
|
||||||
|
<el-dialog :visible.sync="dialogVisible" :append-to-body="true">
|
||||||
|
<img width="100%" :src="dataForm.video" alt="">
|
||||||
|
</el-dialog> -->
|
||||||
|
</el-form-item>
|
||||||
|
<!-- <el-form-item label="内容" prop="content">
|
||||||
|
<el-input v-model="dataForm.content" placeholder="内容"></el-input>
|
||||||
|
</el-form-item> -->
|
||||||
|
<el-form-item label="排序" prop="sort">
|
||||||
|
<el-input v-model="dataForm.sort" placeholder="排序"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
|
||||||
|
</el-form>
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="handlereset">取消</el-button>
|
||||||
|
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import global from '../../common/common.vue' //引入共用组间
|
||||||
|
import axios from "axios";
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
baseUrl: global.baseUrl,
|
||||||
|
progressPercent: 0,
|
||||||
|
curPercentage: 0,
|
||||||
|
isUpload: false,
|
||||||
|
uploadTimer: null,
|
||||||
|
visible: false,
|
||||||
|
typeList: [ //类型0普通1加密
|
||||||
|
|
||||||
|
{
|
||||||
|
dictType: 0,
|
||||||
|
dictValue: "普通"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dictType: 1,
|
||||||
|
dictValue: "加密"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
props: {
|
||||||
|
dictType: '',
|
||||||
|
dictValue: ''
|
||||||
|
},
|
||||||
|
gushuList:[],
|
||||||
|
authorList: [],
|
||||||
|
restaurants: [],
|
||||||
|
author: '',
|
||||||
|
publisherList: [],
|
||||||
|
fileList: [],
|
||||||
|
fileListNovel: [],
|
||||||
|
dialogImageUrl: '',
|
||||||
|
dialogVisible: false,
|
||||||
|
dataForm: {
|
||||||
|
"id": 0,
|
||||||
|
"chapterId": 0,
|
||||||
|
"type": "",
|
||||||
|
"video": "",
|
||||||
|
// "content": "",
|
||||||
|
"sort": 1,
|
||||||
|
},
|
||||||
|
splitsTypeList: [],
|
||||||
|
dataRule: {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
isUpload: {
|
||||||
|
handler(val, oldVal) {
|
||||||
|
if (this.isUpload) {
|
||||||
|
this.uploadTimer = setInterval(async () => {
|
||||||
|
//需要定时执行的代码
|
||||||
|
this.progressPercent = await this.getProgress(this.currentFile);
|
||||||
|
}, 1000);
|
||||||
|
} else {
|
||||||
|
//this.uploadTimer = null;
|
||||||
|
clearInterval(this.uploadTimer);
|
||||||
|
this.currentFile = {};
|
||||||
|
}
|
||||||
|
// this.getGoodsTypeList()
|
||||||
|
},
|
||||||
|
deep: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
init(row, chapter_id) {
|
||||||
|
console.log('row2', row)
|
||||||
|
this.dataForm = row || {}
|
||||||
|
this.dataForm.chapterId = chapter_id || ''
|
||||||
|
this.visible = true
|
||||||
|
if (this.dataForm.video && this.dataForm.video != "") {
|
||||||
|
var img = {
|
||||||
|
name: this.dataForm.video,
|
||||||
|
url: this.dataForm.video
|
||||||
|
}
|
||||||
|
var attr = []
|
||||||
|
attr.push(img)
|
||||||
|
this.fileList = attr
|
||||||
|
}else{
|
||||||
|
this.fileList = []
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
// 表单提交
|
||||||
|
dataFormSubmit() {
|
||||||
|
this.$refs['dataForm'].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
this.$http({
|
||||||
|
url: this.$http.adornUrl(`${!this.dataForm.id ? '/master/course/addCourseCatalogueChapterVideo' : '/master/course/editCourseCatalogueChapterVideo'}`),
|
||||||
|
method: 'post',
|
||||||
|
data: this.$http.adornData({
|
||||||
|
"id": this.dataForm.id || undefined,
|
||||||
|
'chapterId': this.dataForm.chapterId || undefined,
|
||||||
|
'type': this.dataForm.type,
|
||||||
|
"video": this.dataForm.video,
|
||||||
|
// "content": this.dataForm.content,
|
||||||
|
"sort": this.dataForm.sort,
|
||||||
|
})
|
||||||
|
}).then(({
|
||||||
|
data
|
||||||
|
}) => {
|
||||||
|
if (data && data.code === 0) {
|
||||||
|
this.$message({
|
||||||
|
message: '操作成功',
|
||||||
|
type: 'success',
|
||||||
|
duration: 1500,
|
||||||
|
onClose: () => {
|
||||||
|
this.visible = false
|
||||||
|
this.$emit('refreshDataList')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.$message.error(data.msg)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
async getProgress(file) {
|
||||||
|
var that = this;
|
||||||
|
|
||||||
|
console.log("🚀 ~ handleRequest ~ data222:", file.uid);
|
||||||
|
var progress = 0;
|
||||||
|
// const config = {
|
||||||
|
// onUploadProgress: (progressEvent) => {
|
||||||
|
// // progressEvent.loaded:已上传文件大小
|
||||||
|
// // progressEvent.total:被上传文件的总大小
|
||||||
|
// this.progressPercent = Number(
|
||||||
|
// ((progressEvent.loaded / progressEvent.total) * 100).toFixed(2)
|
||||||
|
// );
|
||||||
|
// },
|
||||||
|
// };
|
||||||
|
await axios
|
||||||
|
.get(this.$http.adornUrl(`/oss/fileoss/getSchedule?uid=${file.uid}`))
|
||||||
|
.then(async (res) => {
|
||||||
|
console.log("🚀 ~ this.$axios.post ~ res999:", res.data.percent);
|
||||||
|
progress = Number(res.data.percent);
|
||||||
|
if (progress == 100) {
|
||||||
|
this.isUpload = false;
|
||||||
|
clearInterval(this.uploadTimer);
|
||||||
|
that.uploadTimer = null;
|
||||||
|
await that.handlePicSuccess(res.data, file);
|
||||||
|
this.currentFile = {};
|
||||||
|
this.$forceUpdate();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
console.log("🚀 ~ .then ~ progress888:", progress);
|
||||||
|
return progress;
|
||||||
|
},
|
||||||
|
handleRequest(option) {
|
||||||
|
var that = this;
|
||||||
|
const { onProgress, onSuccess, onError } = option;
|
||||||
|
this.progressPercent = 0;
|
||||||
|
|
||||||
|
this.currentFile = option.file;
|
||||||
|
let formdata = new FormData();
|
||||||
|
formdata.append("file", option.file);
|
||||||
|
formdata.append("fileName", option.file.fileNamee);
|
||||||
|
formdata.append("uid", option.file.uid);
|
||||||
|
console.log("🚀 ~ handleRequest ~ formdata:", formdata);
|
||||||
|
|
||||||
|
this.isUpload = true;
|
||||||
|
|
||||||
|
axios
|
||||||
|
.post(this.baseUrl + "/oss/fileoss/uploadFileSchedule", formdata)
|
||||||
|
.then((res) => {
|
||||||
|
console.log("🚀 ~ this.$axios.post ~ res111:", res);
|
||||||
|
if (res.data.code == 0) {
|
||||||
|
that.fileList[that.fileList.length - 1].status = "done";
|
||||||
|
// clearInterval(that.uploadTimer);
|
||||||
|
// that.isUpload = false;
|
||||||
|
// that.currentFile = {};
|
||||||
|
// await that.handlePicSuccess(res.data, data.file);
|
||||||
|
onSuccess();
|
||||||
|
} else {
|
||||||
|
that.fileList[that.fileList.length - 1].ststus = "error";
|
||||||
|
onError();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// var prom = new Promise((resolve, reject) => {});
|
||||||
|
// prom.abort = () => {};
|
||||||
|
// return prom;
|
||||||
|
},
|
||||||
|
handlePictureCardPreview(file) {
|
||||||
|
this.dataForm.video = file.url;
|
||||||
|
this.dialogVisible = true;
|
||||||
|
},
|
||||||
|
handlePicSuccess(res, file) {
|
||||||
|
console.log(res, file, "999999999");
|
||||||
|
if (res.msg == "success") {
|
||||||
|
this.dataForm.video = res.url;
|
||||||
|
this.fileList.push({
|
||||||
|
name: file.name,
|
||||||
|
url: res.url,
|
||||||
|
});
|
||||||
|
this.$message.success("上传成功");
|
||||||
|
this.isUpload = false;
|
||||||
|
} else {
|
||||||
|
this.$message.error("上传失败");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handlePicSuccess(res, file) {
|
||||||
|
if (res.msg == "success") {
|
||||||
|
this.dataForm.video = res.url;
|
||||||
|
this.$message.success("上传成功");
|
||||||
|
} else {
|
||||||
|
this.$message.error("上传失败");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
changeData(file, fileList) {
|
||||||
|
// 数据小于0.1M的时候按KB显示
|
||||||
|
const size =
|
||||||
|
file.size / 1024 / 1024 > 0.1
|
||||||
|
? `(${(file.size / 1024 / 1024).toFixed(1)}M)`
|
||||||
|
: `(${(file.size / 1024).toFixed(1)}KB)`;
|
||||||
|
file.name.indexOf("M") > -1 || file.name.indexOf("KB") > -1
|
||||||
|
? file.name
|
||||||
|
: (file.name += size);
|
||||||
|
},
|
||||||
|
handleBeforeRemove(file, fileList) {
|
||||||
|
console.log(file, fileList, "file, fileListfile, fileListfile, fileList");
|
||||||
|
this.$refs.files.clearFiles();
|
||||||
|
clearInterval(this.uploadTimer);
|
||||||
|
this.isUpload = false;
|
||||||
|
|
||||||
|
this.currentFile = {};
|
||||||
|
this.$forceUpdate();
|
||||||
|
},
|
||||||
|
handleRemove(file, fileList) {
|
||||||
|
this.dataForm.video = "";
|
||||||
|
this.fileList = fileList;
|
||||||
|
//this.uploadTimer = null;
|
||||||
|
clearInterval(this.uploadTimer);
|
||||||
|
this.isUpload = false;
|
||||||
|
|
||||||
|
this.currentFile = {};
|
||||||
|
this.$forceUpdate();
|
||||||
|
|
||||||
|
// this.dataForm.noneBtnImg = fileList.length >= this.dataForm.limitCountImg;
|
||||||
|
},
|
||||||
|
handleDownload(file) {
|
||||||
|
console.log(file)
|
||||||
|
},
|
||||||
|
handlereset() {
|
||||||
|
this.fileList = [],
|
||||||
|
this.fileListNovel = [],
|
||||||
|
this.visible = false
|
||||||
|
},
|
||||||
|
// handlePreview(file) {
|
||||||
|
// console.log(file);
|
||||||
|
// },
|
||||||
|
// handleExceed(files, fileList) {
|
||||||
|
// this.$message.warning(`当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
|
||||||
|
// },
|
||||||
|
// beforeRemove(file, fileList) {
|
||||||
|
// return this.$confirm(`确定移除 ${ file.name }?`);
|
||||||
|
// },
|
||||||
|
// handleRemoveNovel(file) {
|
||||||
|
// this.dataForm.novel = '';
|
||||||
|
// },
|
||||||
|
// handleNovelSuccess(file) {
|
||||||
|
// this.dataForm.novel = file.url
|
||||||
|
// },
|
||||||
|
// querySearch(queryString, cb) {
|
||||||
|
// var restaurants = this.restaurants;
|
||||||
|
// var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants;
|
||||||
|
// // 调用 callback 返回建议列表的数据
|
||||||
|
// console.log(results)
|
||||||
|
// cb(results);
|
||||||
|
// },
|
||||||
|
// createFilter(queryString) {
|
||||||
|
// return (restaurant) => {
|
||||||
|
// return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
|
||||||
|
// };
|
||||||
|
// },
|
||||||
|
// handleSelect(item) {
|
||||||
|
// this.dataForm.authorId = item.id
|
||||||
|
// console.log(item);
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
clearInterval(this.uploadTimer);
|
||||||
|
},
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
Reference in New Issue
Block a user