commit | author | age
|
b505f3
|
1 |
<template> |
I |
2 |
<div class="myModal"> |
|
3 |
<a-modal v-model="visible" title="日志添加" on-ok="handleOk" |
|
4 |
:bodyStyle="{'overflow':'overlay','maxHeight': '550px'}"> |
|
5 |
<template slot="footer"> |
|
6 |
<a-button key="reset" @click="reset" type="danger"> |
|
7 |
擦掉重来 |
|
8 |
</a-button> |
|
9 |
<a-button key="back" @click="handleCancel"> |
|
10 |
歇会 |
|
11 |
</a-button> |
|
12 |
<a-button key="submit" type="primary" :loading="loading" @click="handleOk"> |
|
13 |
完事<span style="font-size: 10px;">儿</span>.. |
|
14 |
</a-button> |
|
15 |
</template> |
|
16 |
<box10 ref="modalBox"></box10> |
|
17 |
</a-modal> |
|
18 |
</div> |
|
19 |
|
|
20 |
</template> |
|
21 |
|
|
22 |
<script> |
|
23 |
import box10 from "../mini/box10-add.vue" |
c23efb
|
24 |
|
63f511
|
25 |
import { |
I |
26 |
blogAdd |
|
27 |
} from '../../api/blogArticle.js' |
c23efb
|
28 |
import md5 from 'js-md5'; |
b505f3
|
29 |
export default { |
I |
30 |
components: { |
|
31 |
box10 |
|
32 |
}, |
|
33 |
data() { |
|
34 |
return { |
|
35 |
visible: false, |
|
36 |
loading: false, |
|
37 |
} |
|
38 |
}, |
|
39 |
methods: { |
|
40 |
getCalendarContainer(trigger) { |
|
41 |
return this.$refs.myModal; |
|
42 |
}, |
|
43 |
showModal() { |
|
44 |
this.visible = true; |
|
45 |
}, |
|
46 |
handleOk(e) { |
|
47 |
console.log(this.$refs.modalBox.form); |
c23efb
|
48 |
var res; |
I |
49 |
this.$refs.modalBox.$refs.myForm.validate(valid => { |
b505f3
|
50 |
if (valid) { |
I |
51 |
this.$message.info("校验通过") |
c23efb
|
52 |
res = true; |
b505f3
|
53 |
} else { |
I |
54 |
this.$message.info("校验失败") |
c23efb
|
55 |
res = false; |
b505f3
|
56 |
} |
I |
57 |
}); |
|
58 |
|
|
59 |
if (!res) return; |
|
60 |
this.$message.info("提交表单") |
|
61 |
|
c23efb
|
62 |
let tempData = this.$refs.modalBox.form; |
I |
63 |
var param = { |
|
64 |
secret: tempData.secret, |
|
65 |
title: tempData.title, |
|
66 |
articleTypeId: tempData.class, |
|
67 |
isOnline: !tempData.online ? 1 : 0, |
|
68 |
articleFileId: tempData.fileId, |
|
69 |
content: tempData.content, |
|
70 |
articleFileType: tempData.blogType, |
|
71 |
introduce: "", |
|
72 |
coverFileId: tempData.coverFile, |
|
73 |
publishDate: tempData.publishDate, |
|
74 |
isTop: tempData.top ? 1 : 0, |
|
75 |
topValue: tempData.sliderValue, |
|
76 |
isLock: tempData.lock ? 1 : 0, |
|
77 |
authStatus: tempData.auth, |
|
78 |
authPassword: tempData.password == "" ? null : md5(tempData.password), |
|
79 |
editorStatus: !tempData.tempSave?1:0 |
|
80 |
} |
|
81 |
console.log(param) |
b505f3
|
82 |
this.loading = true; |
c23efb
|
83 |
blogAdd(param).then((res) => { |
I |
84 |
this.$message.info("生成日志成功..") |
b505f3
|
85 |
this.visible = false; |
I |
86 |
this.loading = false; |
c23efb
|
87 |
}); |
I |
88 |
// setTimeout(() => { |
|
89 |
// this.visible = false; |
|
90 |
// this.loading = false; |
|
91 |
// }, 3000); |
b505f3
|
92 |
}, |
I |
93 |
reset(e) { |
|
94 |
var res = this.$refs.modalBox.$refs.myForm.resetFields() |
|
95 |
}, |
|
96 |
handleCancel(e) { |
|
97 |
this.visible = false; |
|
98 |
}, |
|
99 |
|
|
100 |
}, |
|
101 |
} |
|
102 |
</script> |
|
103 |
|
|
104 |
<style> |
|
105 |
</style> |