mirror of
https://github.com/doocs/md.git
synced 2024-11-28 13:36:32 +08:00
希望支持aliyunOSS和tencentCos的自定义域名 #33
This commit is contained in:
parent
ee4ad8dcae
commit
c3689883a7
@ -95,6 +95,9 @@ async function aliOSSFileUpload(content, filename) {
|
|||||||
accessKeySecret: aliOSSConfig.accessKeySecret
|
accessKeySecret: aliOSSConfig.accessKeySecret
|
||||||
});
|
});
|
||||||
const res = await client.put(dir, buffer);
|
const res = await client.put(dir, buffer);
|
||||||
|
if(aliOSSConfig.cdnHost != ''){
|
||||||
|
return aliOSSConfig.cdnHost +'/'+dir;
|
||||||
|
}
|
||||||
return res.url;
|
return res.url;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return Promise.reject(e);
|
return Promise.reject(e);
|
||||||
@ -118,7 +121,12 @@ async function txCOSFileUpload(file) {
|
|||||||
if (err) {
|
if (err) {
|
||||||
reject(err);
|
reject(err);
|
||||||
} else {
|
} 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-form-item label="Bucket 所在区域" :required="true">
|
||||||
<el-input v-model.trim="formAliOSS.region"
|
<el-input v-model.trim="formAliOSS.region"
|
||||||
placeholder="如:oss-cn-shenzhen"></el-input>
|
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>
|
||||||
<el-form-item label="存储路径">
|
<el-form-item label="存储路径">
|
||||||
<el-input v-model.trim="formAliOSS.path"
|
<el-input v-model.trim="formAliOSS.path"
|
||||||
@ -81,6 +85,10 @@
|
|||||||
<el-form-item label="Bucket 所在区域" :required="true">
|
<el-form-item label="Bucket 所在区域" :required="true">
|
||||||
<el-input v-model.trim="formTxCOS.region"
|
<el-input v-model.trim="formTxCOS.region"
|
||||||
placeholder="如:ap-guangzhou"></el-input>
|
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>
|
||||||
<el-form-item label="存储路径">
|
<el-form-item label="存储路径">
|
||||||
<el-input v-model.trim="formTxCOS.path"
|
<el-input v-model.trim="formTxCOS.path"
|
||||||
@ -122,14 +130,16 @@ export default {
|
|||||||
accessKeySecret: "",
|
accessKeySecret: "",
|
||||||
bucket: "",
|
bucket: "",
|
||||||
region: "",
|
region: "",
|
||||||
path: ""
|
path: "",
|
||||||
|
cdnHost:""
|
||||||
},
|
},
|
||||||
formTxCOS: {
|
formTxCOS: {
|
||||||
secretId: "",
|
secretId: "",
|
||||||
secretKey: "",
|
secretKey: "",
|
||||||
bucket: "",
|
bucket: "",
|
||||||
region: "",
|
region: "",
|
||||||
path: ""
|
path: "",
|
||||||
|
cdnHost:""
|
||||||
},
|
},
|
||||||
options: [{
|
options: [{
|
||||||
value: "default",
|
value: "default",
|
||||||
|
Loading…
Reference in New Issue
Block a user