diff --git a/src/views/modules/book/book-add-or-update.vue b/src/views/modules/book/book-add-or-update.vue index cd774d9..191e86a 100644 --- a/src/views/modules/book/book-add-or-update.vue +++ b/src/views/modules/book/book-add-or-update.vue @@ -86,16 +86,16 @@ - + + + @@ -127,21 +127,21 @@ - + - + + @@ -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, diff --git a/src/views/modules/book/book.vue b/src/views/modules/book/book.vue index 3a75e1b..9a9461a 100644 --- a/src/views/modules/book/book.vue +++ b/src/views/modules/book/book.vue @@ -13,19 +13,13 @@ 查询 新增 - 批量删除 + - - - - - - + - - + - + - - + diff --git a/src/views/modules/book/bookchapter-add-or-update.vue b/src/views/modules/book/bookchapter-add-or-update.vue index e0cb75d..34cf604 100644 --- a/src/views/modules/book/bookchapter-add-or-update.vue +++ b/src/views/modules/book/bookchapter-add-or-update.vue @@ -2,7 +2,7 @@ + :visible.sync="visible" @close="closeDia"> - - + + + + 上传文件 - - - - - + + + + @@ -53,7 +60,7 @@ 取消 - 确定 + 确定 @@ -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(() => { - //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) + // console.log(event, file, fileList) + this.progressFlag = true; // 显示进度条 + + //progressPercent 进度条数字 + 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' //引入共用组间 } } + diff --git a/src/views/modules/book/bookchapter.vue b/src/views/modules/book/bookchapter.vue index 93ebd8c..a3b2ba8 100644 --- a/src/views/modules/book/bookchapter.vue +++ b/src/views/modules/book/bookchapter.vue @@ -6,25 +6,25 @@ 查询 - 新增 - 批量删除 - + 新增章节 + + - - + --> - 取消 - 确定 + 确定 @@ -90,7 +91,8 @@ export default { data() { - return { + 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) // 一秒后关闭进度条 } }, @@ -365,8 +368,8 @@ }) this.dataForm.video = res.url // console.log(this.dataForm.productImages,'productImages') - this.loadProgress = 100 - setTimeout( () => {this.progressFlag = false;this.$message.success("上传成功");}, 1000) // 一秒后关闭进度条 + this.loadProgress = 100 + setTimeout(() => { this.progressFlag = false; this.loading = false; this.$message.success("上传成功");}, 1000) // 一秒后关闭进度条 } else { this.$message.error("上传失败"); }