mirror of
https://github.com/doocs/md.git
synced 2024-11-24 19:10:34 +08:00
commit
9848a76c84
@ -95,6 +95,9 @@ async function aliOSSFileUpload(content, filename) {
|
||||
accessKeySecret: aliOSSConfig.accessKeySecret
|
||||
});
|
||||
const res = await client.put(dir, buffer);
|
||||
if(aliOSSConfig.cdnHost != ''){
|
||||
return aliOSSConfig.cdnHost +'/'+dir;
|
||||
}
|
||||
return res.url;
|
||||
} catch (e) {
|
||||
return Promise.reject(e);
|
||||
@ -118,7 +121,12 @@ async function txCOSFileUpload(file) {
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else {
|
||||
resolve("https://" + data.Location);
|
||||
if(txCOSConfig.cdnHost != ''){
|
||||
resolve(txCOSConfig.cdnHost+'/'+txCOSConfig.path + '/' + dateFilename);
|
||||
}else{
|
||||
resolve(data.Location);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
})
|
||||
|
@ -52,6 +52,10 @@
|
||||
<el-form-item label="Bucket 所在区域" :required="true">
|
||||
<el-input v-model.trim="formAliOSS.region"
|
||||
placeholder="如:oss-cn-shenzhen"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="自定义CDN域名" :required="false">
|
||||
<el-input v-model.trim="formAliOSS.cdnHost"
|
||||
placeholder="如:https://imagecdn.alidaodao.com"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="存储路径">
|
||||
<el-input v-model.trim="formAliOSS.path"
|
||||
@ -81,6 +85,10 @@
|
||||
<el-form-item label="Bucket 所在区域" :required="true">
|
||||
<el-input v-model.trim="formTxCOS.region"
|
||||
placeholder="如:ap-guangzhou"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="自定义CDN域名" :required="false">
|
||||
<el-input v-model.trim="formTxCOS.cdnHost"
|
||||
placeholder="如:https://imagecdn.alidaodao.com"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="存储路径">
|
||||
<el-input v-model.trim="formTxCOS.path"
|
||||
@ -122,14 +130,16 @@ export default {
|
||||
accessKeySecret: "",
|
||||
bucket: "",
|
||||
region: "",
|
||||
path: ""
|
||||
path: "",
|
||||
cdnHost:""
|
||||
},
|
||||
formTxCOS: {
|
||||
secretId: "",
|
||||
secretKey: "",
|
||||
bucket: "",
|
||||
region: "",
|
||||
path: ""
|
||||
path: "",
|
||||
cdnHost:""
|
||||
},
|
||||
options: [{
|
||||
value: "default",
|
||||
|
Loading…
Reference in New Issue
Block a user