6
6
<div style =" color : #666 ; font-size : 12px ; text-align :center ; margin : 5px ;" >使用代码前请确认相应的组件库已集成至项目</div >
7
7
<div style =" text-align :center ;" >
8
8
<el-row >
9
- <el-col :span =" 12 " >
9
+ <el-col :span =" 10 " >
10
10
输出形式:
11
11
<el-radio-group v-model =" outputMode" >
12
12
<el-radio label =" vue" >Vue</el-radio >
13
13
<el-radio label =" html" >单页Html</el-radio >
14
14
</el-radio-group >
15
+
15
16
</el-col >
16
- <el-col :span =" 12 " >
17
+ <el-col :span =" 14 " style = " display : flex ; align-items : center ; justify-content : center ; " >
17
18
<el-tooltip effect =" dark" content =" 拷贝" placement =" left" >
18
19
<img class =" round-icon" :src =" iconCopy" alt =" " @click =" copyCheck" >
19
20
</el-tooltip >
20
21
<el-tooltip effect =" dark" content =" 下载" placement =" right" >
21
22
<img class =" round-icon" :src =" iconDownload" alt =" " @click =" download" >
22
23
</el-tooltip >
24
+ <div style =" display : inline-block ;margin-left : 10px ;" >
25
+ <el-button size =" small" type =" danger" :loading =" loading" @click =" release" >
26
+ 一键部署至VCC静态页面托管服务</el-button >
27
+ <div v-if =" accessUrl" >部署成功:<a :href =" accessUrl" target =" _blank" >{{accessUrl}}</a ></div >
28
+ </div >
23
29
</el-col >
24
30
</el-row >
25
31
</div >
@@ -36,6 +42,7 @@ import { saveAs } from "file-saver";
36
42
37
43
import CodeEditor from ' ./CodeEditor.vue'
38
44
import singleIndexOutput from ' ../libs/singleIndexOutput.js' ;
45
+ import { createUniqueId } from ' @/utils/common' ;
39
46
40
47
export default {
41
48
props: [' rawCode' , ' codeDialogVisible' ],
@@ -49,6 +56,8 @@ export default {
49
56
outputMode: " vue" ,
50
57
iconCopy: (" https://static.imonkey.xueersi.com/download/vcc-resource/icon/copy-outline.svg" ),
51
58
iconDownload: (" https://static.imonkey.xueersi.com/download/vcc-resource/icon/code-download-outline.svg" ),
59
+ loading: false ,
60
+ accessUrl: ' '
52
61
};
53
62
},
54
63
beforeCreate () { },
@@ -59,9 +68,15 @@ export default {
59
68
updated () { },
60
69
destoryed () { },
61
70
methods: {
62
- // 在此自动生成
63
- request () {
64
- // 网络请求,可选
71
+ release () {
72
+ this .loading = true ;
73
+ axios .post (' https://apis.sahadev.tech/v1/file/upload' , { " id" : ` index${ createUniqueId ()} ` , " content" : this .singleIndex }).then (res => {
74
+ this .accessUrl = res .data .data ;
75
+ this .loading = false ;
76
+ }).catch (err => {
77
+ this .loading = false ;
78
+ this .$message .error (' 发布失败,可能服务暂时不可用.' );
79
+ });
65
80
},
66
81
handleClose () {
67
82
this .$emit (" update:codeDialogVisible" , false );
0 commit comments