From 859ec7a60a9a1f30c898dbf1ae05c50dccfc40e5 Mon Sep 17 00:00:00 2001
From: inleft <inleft@qq.com>
Date: Thu, 11 Aug 2022 01:51:55 +0800
Subject: [PATCH] 优化视频模块内页

---
 src/components/mini/box10-add.vue |   61 +++++++++++++++++-------------
 1 files changed, 34 insertions(+), 27 deletions(-)

diff --git a/src/components/mini/box10-add.vue b/src/components/mini/box10-add.vue
index 6a4b427..705e398 100644
--- a/src/components/mini/box10-add.vue
+++ b/src/components/mini/box10-add.vue
@@ -21,17 +21,11 @@
 				</span>
 			</a-form-model-item>
 
-
 			<a-form-model-item label="日志文件" v-show="!form.online">
-				<!-- <a-upload action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
-					:default-file-list="form.blogFileList">
-					<a-button>
-						<a-icon type="upload" /> 限 markdown/html
-					</a-button>
-				</a-upload> -->
 
 				<a-upload :customRequest="customRequest" name="file" :showUploadList="true" @change="handleChange"
-					:default-file-list="form.blogFileList" :beforeUpload="beforeUpload">
+					:default-file-list="form.blogFileList" :beforeUpload="beforeUpload"
+					:data="{'fileType':fileTypeMarkDown}">
 
 					<a-button>
 						<a-icon type="upload" />限 markdown/html
@@ -67,14 +61,21 @@
 				</a-form-model-item>
 
 				<a-form-model-item label=" 日志类型">
-					<a-radio-group v-model="form.blogType">
-						<a-radio value="1">
+					<a-select v-model="form.blogType" mode="default" placeholder=""
+						:getPopupContainer="getCalendarContainer()">
+						<a-select-option value="1">
 							markdown
-						</a-radio>
-						<a-radio value="2">
+						</a-select-option>
+						<a-select-option value="2">
 							html
-						</a-radio>
-					</a-radio-group>
+						</a-select-option>
+						<a-select-option value="3">
+							video
+						</a-select-option>
+						<a-select-option value="5">
+							fast(闪念)
+						</a-select-option>
+					</a-select>
 				</a-form-model-item>
 
 
@@ -102,16 +103,9 @@
 
 
 				<a-form-model-item label="封面">
-					<!-- <a-upload action="https://www.mocky.io/v2/5cc8019d300000980a055e76" list-type="picture"
-						:default-file-list="form.coverFileList" class="upload-list-inline">
-						<a-button>
-							<a-icon type="upload" /> jpg/png/jpeg..
-						</a-button>
-					</a-upload> -->
-
 					<a-upload :customRequest="customRequest" name="file" :showUploadList="true" list-type="picture"
-						@change="handleChangeCoverFile"
-						:default-file-list="form.coverFileList">
+						@change="handleChangeCoverFile" :default-file-list="form.coverFileList" 
+						:beforeUpload="beforeUploadCover" :data="{'fileType':fileTypeCover}">
 						<a-button>
 							<a-icon type="upload" />jpg/png/jpeg..
 						</a-button>
@@ -165,7 +159,7 @@
 							</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)" />
@@ -184,13 +178,15 @@
 <script>
 	import moment from "moment";
 	import {
-		sysFileInfoUpload
+		sysFileInfoUpload,
+		myFileInfoUpload
 	} from '../../api/fileManage.js';
 
 	import {
 		queryBlogArticleType
 	} from '../../api/blogArticleType.js'
 
+	import myConstant from "../../config/myConstant.js"
 
 	export default {
 		beforeMount() {
@@ -218,6 +214,8 @@
 			};
 
 			return {
+				fileTypeMarkDown: myConstant.fileTypeMarkDown,
+				fileTypeCover: myConstant.fileTypeCover,
 				blogArticleType: [],
 				tags: [],
 				inputVisible: false,
@@ -240,7 +238,7 @@
 					publishDate: "",
 					lock: false,
 					top: false,
-					sliderValue:50,
+					sliderValue: 50,
 					auth: 1,
 					password: "",
 					fileId: null,
@@ -291,6 +289,13 @@
 			};
 		},
 		methods: {
+
+			beforeUploadCover(file, fileList) {
+				if (this.form.coverFileList.length > 1) {
+					this.$message.error('这里最多上传一个文件');
+					return false;
+				}
+			},
 			beforeUpload(file, fileList) {
 				return new Promise((resolve, reject) => {
 					if (this.form.fileId != null) {
@@ -341,7 +346,9 @@
 			customRequest(option) {
 				const formData = new FormData()
 				formData.append('file', option.file)
-				sysFileInfoUpload(formData).then((res) => {
+				formData.append('fileType', option.data.fileType)
+				formData.append('authCode', this.form.secret)
+				myFileInfoUpload(formData).then((res) => {
 					if (res.success) {
 						this.$message.success('上传成功')
 

--
Gitblit v1.9.1