From 146176c4bfc7e936026fc02d96fdc175738d9e14 Mon Sep 17 00:00:00 2001 From: inleft <inleft@qq.com> Date: Tue, 09 Aug 2022 19:04:51 +0800 Subject: [PATCH] 我的音乐模块优化啊 --- src/components/mini/box10-add.vue | 49 ++++++++++++++++++++++++++++++++++--------------- 1 files changed, 34 insertions(+), 15 deletions(-) diff --git a/src/components/mini/box10-add.vue b/src/components/mini/box10-add.vue index 70509ef..5a8b1f0 100644 --- a/src/components/mini/box10-add.vue +++ b/src/components/mini/box10-add.vue @@ -67,14 +67,18 @@ </a-form-model-item> <a-form-model-item label=" 日志类型"> - <a-radio-group v-model="form.blogType"> - <a-radio value="Markdown"> + <a-select v-model="form.blogType" mode="default" placeholder="" + :getPopupContainer="getCalendarContainer()"> + <a-select-option value="1"> markdown - </a-radio> - <a-radio value="Html"> + </a-select-option> + <a-select-option value="2"> html - </a-radio> - </a-radio-group> + </a-select-option> + <a-select-option value="5"> + fast(闪念) + </a-select-option> + </a-select> </a-form-model-item> @@ -110,6 +114,7 @@ </a-upload> --> <a-upload :customRequest="customRequest" name="file" :showUploadList="true" list-type="picture" + @change="handleChangeCoverFile" :default-file-list="form.coverFileList"> <a-button> <a-icon type="upload" />jpg/png/jpeg.. @@ -155,16 +160,16 @@ <div v-show="form.lock "> <a-form-model-item label="阅读权限"> <a-radio-group v-model="form.auth"> - <a-radio value="private"> + <a-radio value="2"> 私人 </a-radio> - <a-radio value="password"> + <a-radio value="3"> 密码授权 </a-radio> </a-radio-group> </a-form-model-item> - <a-form-model-item label="授权密码" v-show="form.auth=='password'"> + <a-form-model-item label="授权密码" v-show="form.auth==3"> <a-input-password v-model="form.password" autocomplete='new-password' type="password" placeholder="独立密码"> <a-icon slot="prefix" type="lock" style="color:rgba(0,0,0,.25)" /> @@ -209,7 +214,7 @@ } else { console.log("文件未传"); this.$refs.myForm.validateField('blogFileList') - if (this.form.blogFileList == null || this.form.blogFileList.length == 0) { + if (this.form.fileId == null) { callback(new Error('文件未传')); } } @@ -235,12 +240,15 @@ content: '', class: [], tempSave: false, - blogType: "Markdown", + blogType: "1", publishDate: "", lock: false, top: false, - auth: "private", + sliderValue:50, + auth: 1, password: "", + fileId: null, + coverFile: null, blogFileList: [], coverFileList: [], }, @@ -288,10 +296,8 @@ }, methods: { beforeUpload(file, fileList) { - console.log(333); - console.log(this.blogFileList); return new Promise((resolve, reject) => { - if (fileList.length >= 2) { + if (this.form.fileId != null) { this.$message.error('这里最多上传一个文件'); return reject(false); } @@ -316,6 +322,18 @@ console.log(info.file, info.fileList); } if (info.file.status === 'done') { + this.form.fileId = info.file.response.data; + this.$message.success(`${info.file.name} file uploaded successfully`); + } else if (info.file.status === 'error') { + this.$message.error(`${info.file.name} file upload failed.`); + } + }, + handleChangeCoverFile(info) { + if (info.file.status !== 'uploading') { + console.log(info.file, info.fileList); + } + if (info.file.status === 'done') { + this.form.coverFile = info.file.response.data; this.$message.success(`${info.file.name} file uploaded successfully`); } else if (info.file.status === 'error') { this.$message.error(`${info.file.name} file upload failed.`); @@ -330,6 +348,7 @@ sysFileInfoUpload(formData).then((res) => { if (res.success) { this.$message.success('上传成功') + option.onSuccess(res, option.file) } else { this.$message.error('上传失败:' + res.message) -- Gitblit v1.9.1