From 0dd41bd8cee430d3a948b89c664cb511c400993c Mon Sep 17 00:00:00 2001
From: inleft <inleft@qq.com>
Date: Fri, 12 Aug 2022 19:11:46 +0800
Subject: [PATCH] 新增链接添加按钮,优化Dplayer播放

---
 src/components/mini/box10-add.vue |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/components/mini/box10-add.vue b/src/components/mini/box10-add.vue
index ef07260..8800027 100644
--- a/src/components/mini/box10-add.vue
+++ b/src/components/mini/box10-add.vue
@@ -187,6 +187,7 @@
 	} from '../../api/blogArticleType.js'
 
 	import myConstant from "../../config/myConstant.js"
+	import md5 from 'js-md5';
 
 	export default {
 		beforeMount() {
@@ -259,7 +260,7 @@
 					],
 					secret: [{
 						required: true,
-						message: '不正经的人..',
+						message: '好像这里错了..',
 						trigger: 'blur'
 					}],
 					common: [{
@@ -293,6 +294,11 @@
 			},
 			beforeUploadCover(file, fileList) {
 				return new Promise((resolve, reject) => {
+					if (this.form.secret == null || this.form.secret == "") {
+						this.$message.error('需要正确的授权码');
+						return reject(false);
+					}
+
 					if (this.form.coverFileList.length >= 1) {
 						this.$message.error('这里最多上传一个文件');
 						return reject(false);
@@ -306,6 +312,11 @@
 			},
 			beforeUpload(file, fileList) {
 				return new Promise((resolve, reject) => {
+					if (this.form.secret == null || this.form.secret == "") {
+						this.$message.error('需要正确的口令..');
+						return reject(false);
+					}
+
 					if (this.form.blogFileList.length >= 1) {
 						this.$message.error('这里最多上传一个文件');
 						return reject(false);
@@ -360,7 +371,7 @@
 				const formData = new FormData()
 				formData.append('file', option.file)
 				formData.append('fileType', option.data.fileType)
-				formData.append('authCode', this.form.secret)
+				formData.append('authCode', this.form.secret == "" ? "" : md5(this.form.secret))
 				myFileInfoUpload(formData).then((res) => {
 					if (res.success) {
 						this.$message.success('上传成功')

--
Gitblit v1.9.1