diff --git a/src/api/file.js b/src/api/file.js index 110067e..7f1b5ed 100644 --- a/src/api/file.js +++ b/src/api/file.js @@ -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); + } + } }); }) diff --git a/src/components/CodemirrorEditor/uploadImgDialog.vue b/src/components/CodemirrorEditor/uploadImgDialog.vue index 2c598cf..ae637f5 100644 --- a/src/components/CodemirrorEditor/uploadImgDialog.vue +++ b/src/components/CodemirrorEditor/uploadImgDialog.vue @@ -52,6 +52,10 @@ + + + + + +