课程和目录提交

This commit is contained in:
liqianyouyou
2024-03-26 22:27:24 +08:00
parent f148efa6e5
commit 8b57a99914
7 changed files with 1587 additions and 0 deletions

View File

@@ -59,6 +59,8 @@ const mainRoutes = {
{ path: '/medicineArt', component: _import('modules/medicine/medicineArt'), name: 'medicineArt', meta: { title: '方药文章管理', isTab: true } }, { path: '/medicineArt', component: _import('modules/medicine/medicineArt'), name: 'medicineArt', meta: { title: '方药文章管理', isTab: true } },
{ path: '/countyManagement', component: _import('modules/county/countyManagement'), name: 'countyManagement', meta: { title: '国家区域管理', isTab: true } }, { path: '/countyManagement', component: _import('modules/county/countyManagement'), name: 'countyManagement', meta: { title: '国家区域管理', isTab: true } },
{ 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-courseCatalogue', component: _import('modules/course/courseCatalogue'), name: 'course-courseCatalogue', meta: { title: '课程目录列表', isTab: true } },
], ],
beforeEnter (to, from, next) { beforeEnter (to, from, next) {
let token = Vue.cookie.get('token') let token = Vue.cookie.get('token')

View File

@@ -0,0 +1,426 @@
<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 :key="0" label="无" :value="0"></el-option> -->
<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 :key="0" label="无" :value="0"></el-option> -->
<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="halfFee">
<el-input v-model="dataForm.halfFee" placeholder="半年价格"></el-input>
</el-form-item>
<el-form-item label="全年价格" prop="fee">
<el-input v-model="dataForm.fee" 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="images">
<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.images" alt="">
</el-dialog>
</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,
typeList: [{ //类型0免费1普通收费2超v课程
dictType: 0,
dictValue: "免费"
},
{
dictType: 1,
dictValue: "普通收费"
},
{
dictType: 2,
dictValue: "超v课程"
}
],
needCreateList: [{ ////是否同步创建商品0否1是
dictType: 0,
dictValue: "否"
},
{
dictType: 1,
dictValue: "是"
}
],
medicaldesBookTypeList: [{
dictType: 1,
dictValue: "中医基础"
},
{
dictType: 2,
dictValue: "中医经典"
},
{
dictType: 3,
dictValue: "各家学说"
},
{
dictType: 4,
dictValue: "中医临床"
},
{
dictType: 5,
dictValue: "文学"
},
{
dictType: 6,
dictValue: "哲学"
},
],
props: {
dictType: '',
dictValue: ''
},
gushuList:[],
authorList: [],
restaurants: [],
author: '',
publisherList: [],
fileList: [],
fileListNovel: [],
dialogImageUrl: '',
dialogVisible: false,
dataForm: {
"id": 0,
"courseId": 0,
"type": 0, //类型0免费1普通收费2超v课程
"title": "",
"halfFee": 0, //半年价格
"fee": 0, //全年价格
"sort": 1,
"needCreate": 0 //是否同步创建商品0否1是
},
splitsTypeList: [],
dataRule: {
}
}
},
created() {
this.getBookList()
this.loadAll()
},
mounted() {
// this.restaurants = this.loadAll();
},
methods: {
init(row, courseid) {
console.log('row2', row)
this.dataForm = row || {}
this.dataForm.courseId = courseid || ''
this.visible = true
},
// 表单提交
dataFormSubmit() {
console.log('11111', this.dataForm.medicaldesBookType)
// if (this.dataForm.medicaldesBookType.length == 0) {
// this.$message.error("请选择图书类型");
// return
// }
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`${!this.dataForm.id ? '/master/course/addCourseCatalogue' : '/master/course/editCourseCatalogue'}`),
method: 'post',
data: this.$http.adornData({
'courseId': this.dataForm.courseId || undefined,
'id': this.dataForm.id || undefined,
'title': this.dataForm.title,
"type": this.dataForm.type, //类型0免费1普通收费2超v课程
"halfFee": this.dataForm.halfFee, //半年价格
"fee": this.dataForm.fee, //全年价格
"sort": this.dataForm.sort,
"needCreate": this.dataForm.needCreate //是否同步创建商品0否1是
})
}).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.images = res.url;
this.$message.success("上传成功");
} else {
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) {
this.dataForm.images = '';
},
handlePictureCardPreview(file) {
this.dataForm.images = 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);
// };
// },
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) {
// this.dataForm.authorId = item.id
// console.log(item);
// }
}
}
</script>

View File

@@ -0,0 +1,547 @@
<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="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="images">
<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.images" alt="">
</el-dialog>
</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,
bookList: [{
dictType: 0,
dictValue: "普通"
},
{
dictType: 1,
dictValue: "中医经典"
},
{
dictType: 2,
dictValue: "国学经典"
}
],
medicaldesBookTypeList: [{
dictType: 1,
dictValue: "中医基础"
},
{
dictType: 2,
dictValue: "中医经典"
},
{
dictType: 3,
dictValue: "各家学说"
},
{
dictType: 4,
dictValue: "中医临床"
},
{
dictType: 5,
dictValue: "文学"
},
{
dictType: 6,
dictValue: "哲学"
},
],
props: {
dictType: '',
dictValue: ''
},
gushuList:[],
authorList: [],
restaurants: [],
author: '',
publisherList: [],
fileList: [],
fileListNovel: [],
dialogImageUrl: '',
dialogVisible: false,
dataForm: {
id: 0,
title: '',
// publisherName: '',
// splits: 0,
// authorId: [],
// description: '',
// title: '',
// bookType: 0,
// content: '',
// type: [],
// medicaldesBookType: [],
// // price: '',
// salePrice: '',
// // istop: '',
// isVip: 0,
// freeChapterCount: 0,
// // isSale: '',
// publisherId: [],
// images: '',
// pid: '',
// level: '',
// createTime: '',
// updateTime: '',
// sort: '',
// delFlag: '',
// novel: '',
// canListen: false,
// clockIn: 2,
// teachIn: 0,
// relationId:0,
},
splitsTypeList: [],
dataRule: {
// name: [
// { required: true, message: '书名不能为空', trigger: 'blur' }
// ],
// authorId: [
// { required: true, message: '作者id不能为空', trigger: 'blur' }
// ],
// description: [
// { required: true, message: '简介不能为空', trigger: 'blur' }
// ],
// title: [
// { required: true, message: '序言不能为空', trigger: 'blur' }
// ],
// content: [
// { required: true, message: '内容不能为空', trigger: 'blur' }
// ],
// type: [
// { required: true, message: '类型不能为空', trigger: 'blur' }
// ],
// price: [
// { required: true, message: '价格不能为空', trigger: 'blur' }
// ],
// istop: [
// { required: true, message: '置顶不能为空', trigger: 'blur' }
// ],
// publisherId: [
// { required: true, message: '出版商id不能为空', trigger: 'blur' }
// ],
// images: [
// { required: true, message: '插图不能为空', trigger: 'blur' }
// ],
// pid: [
// { required: true, message: '父id不能为空', trigger: 'blur' }
// ],
// level: [
// { required: true, message: '层级不能为空', trigger: 'blur' }
// ],
// createTime: [
// { required: true, message: '创建日期不能为空', trigger: 'blur' }
// ],
// updateTime: [
// { required: true, message: '更新日期不能为空', trigger: 'blur' }
// ],
// sort: [
// { required: true, message: '排序不能为空', trigger: 'blur' }
// ],
// splits: [
// { required: true, message: '拆分类类型不能为空', trigger: 'blur' }
// ]
}
}
},
created() {
this.getBookList()
this.loadAll()
},
mounted() {
// this.restaurants = this.loadAll();
},
methods: {
init(id) {
this.dataForm.id = id || 0
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() {
console.log('11111', this.dataForm.medicaldesBookType)
// if (this.dataForm.medicaldesBookType.length == 0) {
// this.$message.error("请选择图书类型");
// return
// }
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`${!this.dataForm.id ? '/master/course/addCourse' : '/master/course/editCourse'}`),
method: 'post',
data: this.$http.adornData({
'id': this.dataForm.id || undefined,
'title': this.dataForm.title,
// 'authorId': this.dataForm.authorId.join(','),
// 'description': this.dataForm.description,
// 'title': this.dataForm.title,
// 'bookType': this.dataForm.bookType,
// 'publisherName': this.dataForm.publisherName,
// 'content': this.dataForm.content,
// 'type': this.dataForm.type.join(','),
// "medicaldesBookType": this.dataForm.medicaldesBookType.join(','),
// 'isVip': this.dataForm.isVip,
// 'freeChapterCount': this.dataForm.freeChapterCount,
// 'publisherId': this.dataForm.publisherId.join(','),
// 'images': this.dataForm.images,
// 'pid': this.dataForm.pid,
// 'level': this.dataForm.level,
// 'createTime': this.dataForm.createTime,
// 'updateTime': this.dataForm.updateTime,
// 'sort': this.dataForm.sort,
// 'delFlag': this.dataForm.delFlag,
// 'novel': this.dataForm.novel,
// 'splits': this.dataForm.splits,
// 'canListen': this.dataForm.canListen,
// 'relationId': this.dataForm.relationId,
// 'clockIn': this.dataForm.clockIn,
// 'teachIn': this.dataForm.teachIn
})
}).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.images = res.url;
this.$message.success("上传成功");
} else {
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) {
this.dataForm.images = '';
},
handlePictureCardPreview(file) {
this.dataForm.images = 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);
// };
// },
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) {
// this.dataForm.authorId = item.id
// console.log(item);
// }
}
}
</script>

View File

@@ -0,0 +1,242 @@
<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 v-if="isAuth('book:book:save')" 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 fixed="right" header-align="center" align="center" width="250" label="操作">
<template slot-scope="scope">
<div>
<router-link :to="{path: 'book-bookchapter' , 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 './catalogue-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.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/getCourseCatalogues'),
method: 'post',
data: this.$http.adornData({
'id': this.courseid,
// '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.catalogues
// 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.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/delCourseCatalogue'),
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>

View File

@@ -0,0 +1,370 @@
<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 label="出版社名称">
<el-input v-model="query.publisherName" placeholder="出版社名称" clearable></el-input>
</el-form-item>
<el-form-item label="作者姓名">
<el-input v-model="query.authorName" placeholder="作者姓名" clearable></el-input>
</el-form-item> -->
<el-form-item>
<el-button @click="pageIndex = 1;getDataList()">查询</el-button>
<el-button v-if="isAuth('book:book:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
<!-- <el-button v-if="isAuth('book:book:delete')" type="danger" @click="deleteHandle()"
:disabled="dataListSelections.length <= 0">批量删除</el-button> -->
</el-form-item>
</el-form>
<el-table :data="dataList" border v-loading="dataListLoading"
style="width: 100%;">
<!-- <el-table-column min-width="155px
" prop="delFlag" header-align="center" align="center" label="状态">
<template slot-scope="scope">
<el-switch :active-value=1 :inactive-value=0 style="display: block" v-model="scope.row.delFlag" disabled
@change="SwitchChange(scope.row)" active-color="#13ce66" inactive-color="#ff4949" active-text="未删"
inactive-text="已删">
</el-switch>
</template>
</el-table-column> -->
<el-table-column prop="title" header-align="center" align="center" label="课程名">
</el-table-column>
<!-- <el-table-column prop="authorName" 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.images != ''" :src="scope.row.images" width="70" height="100" class="tableImg" />
</template>
</el-table-column> -->
<!-- <el-table-column prop="description" header-align="center" align="center" :show-overflow-tooltip="true" label="简介">
</el-table-column> -->
<!-- <el-table-column
prop="title"
header-align="center"
align="center"
label="序言">
</el-table-column>
<el-table-column
prop="content"
header-align="center"
align="center"
label="内容">
</el-table-column> -->
<!-- <el-table-column prop="type" header-align="center" align="center" label="类型">
</el-table-column>
<el-table-column prop="price" header-align="center" align="center" label="价格">
</el-table-column> -->
<!-- <el-table-column
prop="istop"
header-align="center"
align="center"
label="置顶">
</el-table-column> -->
<!-- <el-table-column prop="publisherName" header-align="center" align="center" label="出版商名称">
</el-table-column> -->
<!-- <el-table-column prop="chapterStatus" header-align="center" align="center" label="章节拆分">
<template slot-scope="scope">
<span v-if="scope.row.chapterStatus == '成功'" style="color:blue">{{scope.row.chapterStatus}}</span>
<span v-if="scope.row.chapterStatus == '失败'" style="color: red">{{scope.row.chapterStatus}}</span>
<span v-if="scope.row.chapterStatus == '处理中'">{{scope.row.chapterStatus}}</span>
<span v-if="scope.row.chapterStatus == '未处理'">{{scope.row.chapterStatus}}</span>
</template>
</el-table-column>
<el-table-column prop="contentStatus" header-align="center" align="center" label="单句拆分">
<template slot-scope="scope">
<span v-if="scope.row.contentStatus == '成功'" style="color:blue">{{scope.row.contentStatus}}</span>
<span v-if="scope.row.contentStatus == '失败'" style="color: red">{{scope.row.contentStatus}}</span>
<span v-if="scope.row.contentStatus == '处理中'">{{scope.row.contentStatus}}</span>
<span v-if="scope.row.contentStatus == '未处理'">{{scope.row.contentStatus}}</span>
</template>
</el-table-column>
<el-table-column prop="voicesStatus" header-align="center" align="center" label="音频处理">
<template slot-scope="scope">
<span v-if="scope.row.voicesStatus == '成功'" style="color:blue">{{scope.row.voicesStatus}}</span>
<span v-if="scope.row.voicesStatus == '失败'" style="color: red">{{scope.row.voicesStatus}}</span>
<span v-if="scope.row.voicesStatus == '处理中'">{{scope.row.voicesStatus}}</span>
<span v-if="scope.row.voicesStatus == '未处理'">{{scope.row.voicesStatus}}</span>
</template>
</el-table-column> -->
<!-- <el-table-column
prop="pid"
header-align="center"
align="center"
label="父id">
</el-table-column>
<el-table-column
prop="level"
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 prop="updateTime" header-align="center" align="center" label="更新日期">
</el-table-column> -->
<!-- <el-table-column
prop="sort"
header-align="center"
align="center"
label="排序">
</el-table-column>
<el-table-column
prop="delFlag"
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">
<!-- <el-dropdown style="border: 1px solid #17B3A3; border-radius: 5px; padding: 4px;">
<span class="el-dropdown-link" style="color:#17B3A3">
操作管理<i class="el-icon-arrow-down el-icon--right"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item>
<router-link :to="{path: 'book-comments' , query:{ id : scope.row.id} }">
<el-button type="text" size="small">书评管理</el-button>
</router-link>
</el-dropdown-item>
<el-dropdown-item>
<router-link :to="{path: 'clock' , query:{ id : scope.row.id} }">
<el-button type="text" size="small">打卡管理</el-button>
</router-link>
</el-dropdown-item>
<el-dropdown-item>
<router-link :to="{path: 'book-bookchapter' , query:{ id : scope.row.id , pageIndex} }">
<el-button type="text" size="small">章节管理</el-button>
</router-link>
</el-dropdown-item>
<el-dropdown-item>
<router-link :to="{path: 'talkBook' , query:{ id : scope.row.id , pageIndex} }">
<el-button type="text" size="small">讲书管理</el-button>
</router-link>
</el-dropdown-item>
<el-dropdown-item>
<router-link :to="{path: 'yian' , query:{ id : scope.row.id , pageIndex} }">
<el-button type="text" size="small">医案管理</el-button>
</router-link>
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown> -->
<!-- <el-button v-if="scope.row.chapterStatus == '未处理' || scope.row.chapterStatus == '失败'" type="text" size="small" @click="chapterHandle(scope.row.id,scope.row)">章节拆分</el-button> -->
<!-- <el-button v-if="scope.row.chapterStatus == '成功' && (scope.row.contentStatus == '未处理' || scope.row.contentStatus == '失败') " type="text" size="small" @click="contentHandle(scope.row.id)">单句拆分</el-button> -->
<!-- <el-button v-if="scope.row.contentStatus == '成功' && (scope.row.voicesStatus == '未处理' || scope.row.voicesStatus == '失败') " type="text" size="small" @click="voicesHandle(scope.row.id)">音频处理</el-button> -->
<div>
<router-link :to="{path: 'course-courseCatalogue' , 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.id)">修改</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 './course-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() {
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/getCourseList'),
method: 'post',
data: this.$http.adornData({
'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(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
// 删除
deleteHandle(id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.id
})
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/master/course/delCourse?id='+ ids),
method: 'post',
// data: this.$http.adornData(ids, false)
}).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>