This commit is contained in:
@fawn-nine
2023-09-18 09:14:33 +08:00
parent afdb0520db
commit 5e7968faf0
5 changed files with 133 additions and 86 deletions

View File

@@ -86,16 +86,16 @@
</el-checkbox-group>
</el-form-item>
<el-row>
<el-col :span="12">
<!-- <el-col :span="12">
<el-form-item label="原价" prop="price">
<el-input v-model="dataForm.price" placeholder="价格"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
</el-col> -->
<!-- <el-col :span="12">
<el-form-item label="优惠价格" prop="salePrice">
<el-input v-model="dataForm.salePrice" placeholder="优惠价格"></el-input>
</el-form-item>
</el-col>
</el-form-item> -->
<!-- </el-col> -->
<el-col :span="12">
<el-form-item label="是否可听" >
<!-- <el-input v-model="dataForm.salePrice" placeholder="优惠价格"></el-input> -->
@@ -127,21 +127,21 @@
</el-radio-group>
</el-form-item>
<el-form-item label="免费章节数" prop="freeChapterCount">
<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="istop">
<!-- <el-form-item label="置顶" prop="istop">
<el-radio-group v-model="dataForm.istop">
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="秒杀" prop="istop">
</el-form-item> -->
<!-- <el-form-item label="秒杀" prop="istop">
<el-radio-group v-model="dataForm.isSale">
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
</el-form-item>
</el-form-item> -->
<!-- <el-form-item label="出版商名称" prop="publisherId">
<el-input v-model="dataForm.publisherId" placeholder="出版商名称"></el-input>
</el-form-item> -->
@@ -225,12 +225,12 @@ export default {
title: '',
content: '',
type:[],
price: '',
// price: '',
salePrice:'',
istop: '',
// istop: '',
isVip:0,
freeChapterCount:0,
isSale: '',
// isSale: '',
publisherId: [],
images: '',
pid: '',
@@ -323,11 +323,11 @@ export default {
this.dataForm.title = data.book.title
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.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.isSale = data.book.isSale
this.dataForm.freeChapterCount = data.book.freeChapterCount
this.dataForm.splits = data.book.splits
// this.dataForm.publisherId = data.book.publisherId
@@ -384,11 +384,11 @@ export default {
'title': this.dataForm.title,
'content': this.dataForm.content,
'type': this.dataForm.type.join(','),
'price': this.dataForm.price,
'salePrice': this.dataForm.salePrice,
'istop': this.dataForm.istop,
// 'price': this.dataForm.price,
// 'salePrice': this.dataForm.salePrice,
// 'istop': this.dataForm.istop,
'isVip': this.dataForm.isVip,
'isSale': this.dataForm.isSale,
// 'isSale': this.dataForm.isSale,
'freeChapterCount': this.dataForm.freeChapterCount,
'publisherId': this.dataForm.publisherId.join(','),
'images': this.dataForm.images,

View File

@@ -13,19 +13,13 @@
<el-form-item>
<el-button @click="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-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" @selection-change="selectionChangeHandle"
<el-table :data="dataList" border v-loading="dataListLoading"
style="width: 100%;">
<el-table-column type="selection" header-align="center" align="center" width="50">
</el-table-column>
<el-table-column label="序号" width="70" align="center">
<template slot-scope="scope">
{{ (pageIndex - 1) * pageSize + scope.$index + 1 }}
</template>
</el-table-column>
<el-table-column min-width="155px
" prop="state" header-align="center" align="center" label="状态">
<template slot-scope="scope">
@@ -44,8 +38,8 @@
<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="description" header-align="center" align="center" :show-overflow-tooltip="true" label="简介">
</el-table-column> -->
<!-- <el-table-column
prop="title"
header-align="center"
@@ -58,18 +52,18 @@
align="center"
label="内容">
</el-table-column> -->
<el-table-column prop="type" header-align="center" align="center" label="类型">
<!-- <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> -->
<!-- <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="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>
@@ -131,11 +125,11 @@
<el-button type="text" size="small">打卡管理</el-button>
</router-link>
<router-link :to="{path: 'book-bookchapter' , query:{ id : scope.row.id , pageIndex} }">
<el-button v-if="scope.row.chapterStatus == '成功'" type="text" size="small">章节列表</el-button>
<el-button type="text" size="small">章节列表</el-button>
</router-link>
<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.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>
<!-- <el-button v-if="scope.row.contentStatus == '成功' && (scope.row.voicesStatus == '未处理' || scope.row.voicesStatus == '失败') " type="text" size="small" @click="voicesHandle(scope.row.id)">音频处理</el-button> -->
<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>
</template>

View File

@@ -2,7 +2,7 @@
<el-dialog
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
:visible.sync="visible" @close="closeDia">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
<!-- <el-form-item label="图书id" prop="bookId">
<el-input v-model="dataForm.bookId" placeholder="图书id"></el-input>
@@ -16,20 +16,27 @@
<!-- <el-form-item label="章节音频" prop="voice">
<el-input v-model="dataForm.chapter" placeholder="章节"></el-input>
</el-form-item> -->
<el-form-item label="音频文件上传" prop="voices">
<el-upload class="upload-demo" :action= "baseUrl + '/oss/fileoss'" :on-preview="handlePreview"
:on-remove="handleRemove" :on-success="handleVoicesSuccess" multiple :limit="3" :file-list="fileListVoices"
:on-progress="onUpload"
<el-form-item label="音频文件上传" prop="voices" v-loading="loading" element-loading-text="正在保存到服务器,请勿离开..." element-loading-spinner="el-icon-loading"
element-loading-background="rgba(255, 255, 255, 0.8)">
<!-- <el-upload class="upload-demomp4" :action= "baseUrl + '/oss/fileoss'" :on-preview="handlePreview"
:on-remove="handleRemove" :on-success="handleVoicesSuccess" multiple :limit="1" :file-list="fileListVoices"
:on-progress="onUpload" accept=".mp3"
>
<el-button size="small" type="primary">点击上传</el-button>
</el-upload> -->
<el-upload :limit="1" class="el-uploadvideo "
:class="{ uoloadSty: dataForm.showBtnDealImg, disUoloadSty: dataForm.noneBtnImg }"
:action= "baseUrl + '/oss/fileoss'"
:file-list="fileListVoices" :on-success="handleVoicesSuccess" accept=".mp3" :on-remove="handleRemove"
:show-file-list="true"
:on-progress="onUpload">
<!-- <i class="el-icon-plus"></i> -->
<el-button slot="trigger" size="small" type="primary">上传文件</el-button>
</el-upload>
<!-- <el-progress v-show="progressFlag" :percentage="progressPercent"></el-progress> -->
<!-- 进度条 -->
<el-progress
:percentage="progressPercent" :text-inside="true"
:stroke-width="24" status="success">
</el-progress>
<audio controls="controls" hidden src="./static/audio/tsy.wav" ref="audio"></audio>
<!-- <el-progress v-show="progressFlag" :percentage="progressPercent"></el-progress> -->
<!-- <audio controls="controls" hidden src="./static/audio/tsy.wav" ref="audio"></audio> -->
<audio id="resource" :src="dataForm.voices" controls v-show='true'></audio>
</el-form-item>
<el-form-item label="内容" prop="content">
@@ -53,7 +60,7 @@
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
<el-button type="primary" @click="dataFormSubmit()" :disabled="loading">确定</el-button>
</span>
</el-dialog>
</template>
@@ -63,8 +70,10 @@ import global from '../../common/common.vue' //引入共用组间
export default {
data () {
return {
baseUrl:global.baseUrl,
baseUrl: global.baseUrl,
progressFlag:false,
visible: false,
loading:false,
dataForm: {
id: 0,
number:null,
@@ -110,7 +119,12 @@ import global from '../../common/common.vue' //引入共用组间
}
}
},
methods: {
methods: {
closeDia() {
this.$refs.dataForm.resetFields()
this.loading = false
this.fileListVoices = []
},
init (id) {
this.dataForm.id = id || 0
this.visible = true
@@ -128,46 +142,62 @@ import global from '../../common/common.vue' //引入共用组间
this.dataForm.bookId = data.bookChapter.id
this.dataForm.chapter = data.bookChapter.chapter
this.dataForm.content = data.bookChapter.content
this.dataForm.voices = data.bookChapter.voices
if (data.bookChapter.voices != '') {
this.fileListVoices.push({
name:data.bookChapter.chapter,
url: data.bookChapter.voices
})
this.dataForm.voices = data.bookChapter.voices
}
this.dataForm.createTime = data.bookChapter.createTime
this.dataForm.updateTime = data.bookChapter.updateTime
this.dataForm.sort = data.bookChapter.sort
this.dataForm.delFlag = data.bookChapter.delFlag,
this.dataForm.number = data.bookChapter.number
this.dataForm.number = data.bookChapter.number
}
})
}
})
},
handleRemove(file) {
this.dataForm.voices = '';
this.dataForm.voices = '';
this.fileListVoices = []
},
// 上传时进度条
onUpload(event, file, fileList) { //三个参数看情况使用
console.log(event,file,fileList)
this.loading = true
//使用定时器来制作进度条
setTimeout(() => {
// console.log(event, file, fileList)
this.progressFlag = true; // 显示进度条
//progressPercent 进度条数字
this.progressPercent = Math.floor(event.percent)
//这里之所以到72%就结束定时器,下面具体解释
// console.log(this.progressPercent,'event.percent')
// if (Math.floor(this.progressPercent) == 100) {
// clearInterval(this.timer)
// // 这里必须使用this.timer = null否则清除定时器无效
// this.timer = null
// }
},1000)
this.progressPercent = parseInt(event.percent); // 动态获取文件上传进度
if (this.progressPercent >= 100) {
this.progressPercent = 99
this.loading = true
//console.log(this.loading,'上传进度')
// setTimeout( () => {this.progressFlag = false}, 1000) // 一秒后关闭进度条
}
},
handleVoicesSuccess(res, file) {
if (res.msg == "success") {
//console.log(res,'res')
this.dataForm.voices = res.url;
this.progressFlag = false; // 显示进度条
this.loading = false
console.log(this.loading,'上传成功')
this.dataForm.voices = res.url;
this.fileListVoices.push({
name: file.name,
url: res.url
})
this.progressPercent = 100
this.$message.success("上传成功");
} else {
this.$message.error("上传失败");
this.$message.error("上传失败");
this.loading = false
}
},
handlePreview(file) {
@@ -216,3 +246,23 @@ import global from '../../common/common.vue' //引入共用组间
}
}
</script>
<style lang="less" scoped>
/deep/ .el-uploadvideo .el-upload-list li{height: auto !important;}
// .disUoloadSty {
// .el-upload--picture-card {
// display: none;
// /* 上传按钮隐藏 */
// }
// }
// .el-form-item {
// /deep/ .el-form-item__label {
// font-size: 12px;
// }
// }
.el-uploadvideo{
.el-progress {
display: none !important;
}
}
</style>

View File

@@ -6,25 +6,25 @@
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">查询</el-button>
<el-button v-if="isAuth('book:bookchapter:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
<el-button v-if="isAuth('book:bookchapter:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
<router-link :to="{path: 'book-book' , query:{ upPageIndex } }">
<el-button v-if="isAuth('book:bookchapter:save')" type="primary" @click="addOrUpdateHandle()">新增章节</el-button>
<!-- <el-button v-if="isAuth('book:bookchapter:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button> -->
<!-- <router-link :to="{path: 'book-book' , query:{ upPageIndex } }">
<el-button type="primary">返回上一级</el-button>
</router-link>
</router-link> -->
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column
<!-- <el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
</el-table-column> -->
<!-- <el-table-column label="序号" width="70" align="center">
<template slot-scope="scope">
{{ (pageIndex - 1) * pageSize + scope.$index + 1 }}

View File

@@ -43,7 +43,8 @@
</el-form-item> -->
<el-form-item label="视频" >
<el-upload :limit="1" class="el-uploadvideo "
<el-upload :limit="1" class="el-uploadvideo " v-loading="loading" element-loading-text="正在保存到服务器,请勿离开..." element-loading-spinner="el-icon-loading"
element-loading-background="rgba(255, 255, 255, 0.8)"
:class="{ uoloadSty: dataForm.showBtnDealImg, disUoloadSty: dataForm.noneBtnImg }"
:action="baseUrl + '/oss/fileoss'"
:file-list="videoList" :on-success="videohandlePicSuccess" accept=".mp4" :on-remove="videohandleRemove"
@@ -73,7 +74,7 @@
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="handlereset">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
<el-button type="primary" @click="dataFormSubmit()" :disabled="loading">确定</el-button>
</span>
</el-dialog>
</template>
@@ -91,6 +92,7 @@
export default {
data() {
return {
loading: false,
progressFlag: false,
loadProgress: 0,
baseUrl: global.baseUrl,
@@ -351,6 +353,7 @@
console.log('this.loadProgress',this.loadProgress)
if (this.loadProgress >= 100) {
this.loadProgress = 99
this.loading = true
// setTimeout( () => {this.progressFlag = false}, 1000) // 一秒后关闭进度条
}
},
@@ -366,7 +369,7 @@
this.dataForm.video = res.url
// console.log(this.dataForm.productImages,'productImages')
this.loadProgress = 100
setTimeout( () => {this.progressFlag = false;this.$message.success("上传成功");}, 1000) // 一秒后关闭进度条
setTimeout(() => { this.progressFlag = false; this.loading = false; this.$message.success("上传成功");}, 1000) // 一秒后关闭进度条
} else {
this.$message.error("上传失败");
}