48
48
<el-button type =" info" size =" medium" icon =" el-icon-close" @click =" saveUpyun(false)" >清除配置</el-button >
49
49
</el-form >
50
50
</el-card >
51
+
52
+ <el-card >
53
+ <div slot =" header" >
54
+ <span >腾讯云存储配置</span >
55
+ </div >
56
+ <el-form :model =" txyunConfig" label-width =" 100px" >
57
+ <el-form-item label =" secret-id" >
58
+ <el-input v-model =" txyunConfig.secretId" ></el-input >
59
+ </el-form-item >
60
+ <el-form-item label =" secret-key" >
61
+ <el-input v-model =" txyunConfig.secretKey" ></el-input >
62
+ </el-form-item >
63
+ <el-form-item label =" 存储空间名" >
64
+ <el-input v-model =" txyunConfig.bucketName" ></el-input >
65
+ </el-form-item >
66
+ <el-form-item label =" 地域" >
67
+ <el-input v-model =" txyunConfig.region" ></el-input >
68
+ </el-form-item >
69
+ <el-form-item label =" CDN访问域名" >
70
+ <el-input v-model =" txyunConfig.domain" ></el-input >
71
+ </el-form-item >
72
+ <el-button type =" primary" size =" medium" icon =" el-icon-check" :disabled =" !isTxyunSave" @click =" saveTxyun(true)" >保存配置</el-button >
73
+ <el-button type =" info" size =" medium" icon =" el-icon-close" @click =" saveTxyun(false)" >清除配置</el-button >
74
+ </el-form >
75
+ </el-card >
51
76
</div >
52
77
</template >
53
78
@@ -70,11 +95,21 @@ export default {
70
95
bucketName: ' ' ,
71
96
domain: ' '
72
97
},
98
+ txyunConfig: {
99
+ secretId: ' ' ,
100
+ secretKey: ' ' ,
101
+ bucketName: ' ' ,
102
+ region: ' ' ,
103
+ domain: ' '
104
+ },
73
105
}
74
106
},
75
107
computed: {
76
108
isUpyunSave () {
77
109
return this .upyunConfig .username && this .upyunConfig .password && this .upyunConfig .bucketName && this .upyunConfig .domain
110
+ },
111
+ isTxyunSave () {
112
+ return this .txyunConfig .secretId && this .txyunConfig .secretKey && this .txyunConfig .bucketName && this .txyunConfig .region && this .txyunConfig .domain
78
113
}
79
114
},
80
115
created () {
@@ -92,6 +127,11 @@ export default {
92
127
this .upyunConfig = JSON .parse (upyunConfig)
93
128
}
94
129
130
+ const txyunConfig = localStorage .getItem (' txyunConfig' )
131
+ if (txyunConfig) {
132
+ this .txyunConfig = JSON .parse (txyunConfig)
133
+ }
134
+
95
135
const userJson = window .localStorage .getItem (' user' ) || ' {}'
96
136
const user = JSON .parse (userJson)
97
137
if (userJson !== ' {}' && user .role !== ' ROLE_admin' ) {
@@ -131,6 +171,16 @@ export default {
131
171
this .msgSuccess (' 清除成功' )
132
172
}
133
173
}
174
+ ,
175
+ saveTxyun (save ) {
176
+ if (save) {
177
+ localStorage .setItem (' txyunConfig' , JSON .stringify (this .txyunConfig ))
178
+ this .msgSuccess (' 保存成功' )
179
+ } else {
180
+ localStorage .removeItem (' txyunConfig' )
181
+ this .msgSuccess (' 清除成功' )
182
+ }
183
+ }
134
184
}
135
185
,
136
186
}
0 commit comments