From c23efbe2832d1a9eecd4ef5d20d984661b24dd22 Mon Sep 17 00:00:00 2001
From: inleft <inleft@qq.com>
Date: Tue, 22 Feb 2022 01:21:52 +0800
Subject: [PATCH] 文章添加补充

---
 src/components/group/MyModal.vue |   41 +++++++++++++++++++++++++++++++++--------
 1 files changed, 33 insertions(+), 8 deletions(-)

diff --git a/src/components/group/MyModal.vue b/src/components/group/MyModal.vue
index 6ccd798..55de7de 100644
--- a/src/components/group/MyModal.vue
+++ b/src/components/group/MyModal.vue
@@ -21,11 +21,11 @@
 
 <script>
 	import box10 from "../mini/box10-add.vue"
-	
+
 	import {
 		blogAdd
 	} from '../../api/blogArticle.js'
-	
+	import md5 from 'js-md5';
 	export default {
 		components: {
 			box10
@@ -45,25 +45,50 @@
 			},
 			handleOk(e) {
 				console.log(this.$refs.modalBox.form);
-				var res = this.$refs.modalBox.$refs.myForm.validate(valid => {
+				var res;
+				this.$refs.modalBox.$refs.myForm.validate(valid => {
 					if (valid) {
 						this.$message.info("校验通过")
+						res = true;
 					} else {
 						this.$message.info("校验失败")
-						return false;
+						res = false;
 					}
 				});
 
-
 				if (!res) return;
-
 				this.$message.info("提交表单")
 
+				let tempData = this.$refs.modalBox.form;
+				var param = {
+					secret: tempData.secret,
+					title: tempData.title,
+					articleTypeId: tempData.class,
+					isOnline: !tempData.online ? 1 : 0,
+					articleFileId: tempData.fileId,
+					content: tempData.content,
+					articleFileType: tempData.blogType,
+					introduce: "",
+					coverFileId: tempData.coverFile,
+					publishDate: tempData.publishDate,
+					isTop: tempData.top ? 1 : 0,
+					topValue: tempData.sliderValue,
+					isLock: tempData.lock ? 1 : 0,
+					authStatus: tempData.auth,
+					authPassword: tempData.password == "" ? null : md5(tempData.password),
+					editorStatus: !tempData.tempSave?1:0
+				}
+				console.log(param)
 				this.loading = true;
-				setTimeout(() => {
+				blogAdd(param).then((res) => {
+					this.$message.info("生成日志成功..")
 					this.visible = false;
 					this.loading = false;
-				}, 3000);
+				});
+				// setTimeout(() => {
+				// 	this.visible = false;
+				// 	this.loading = false;
+				// }, 3000);
 			},
 			reset(e) {
 				var res = this.$refs.modalBox.$refs.myForm.resetFields()

--
Gitblit v1.9.1