Przeglądaj źródła

替换 阿里云返回路径

王飞 1 rok temu
rodzic
commit
ee8e5a207b

+ 2 - 3
src/api/common/index.ts

@@ -11,10 +11,9 @@ export const getDictOneApi = async () => {
 }
 
 export const uploadFile = async (file: any) => {
-  const res = (await getParam()) as any
-  const resData = res.data as any
-  console.log(file)
   if (file.size > 1024 * 1000) {
+    const res = (await getParam()) as any
+    const resData = res.data as any
     const client = new OSS({
       region: 'oss-cn-nanjing', // OSS地域节点
       accessKeyId: resData.keyId, // 访问密钥ID

+ 4 - 1
src/views/Manage/Company/CompanyPage.vue

@@ -231,7 +231,10 @@ const crudSchemas: CrudSchema[] = [
             if (file.size <= 1024 * 1000) {
               resUrl = response.data.virtualPath
             } else {
-              resUrl = response.url
+              resUrl = response.url.replace(
+                'xn-back.oss-cn-nanjing.aliyuncs.com',
+                'oss.dacundianzi.com'
+              )
             }
             wechatImg.value = resUrl
             currentRow.value.wechatImg = resUrl

+ 4 - 2
src/views/Manage/File/FilePage.vue

@@ -144,7 +144,6 @@ const crudSchemas: CrudSchema[] = [
       component: 'Upload',
       componentProps: {
         httpRequest: (data: any) => {
-
           delLoading.value = true
           let file = data.file
           let formData = new FormData()
@@ -155,7 +154,10 @@ const crudSchemas: CrudSchema[] = [
             if (file.size <= 1024 * 1000) {
               resUrl = response.data.virtualPath
             } else {
-              resUrl = response.url
+              resUrl = response.url.replace(
+                'xn-back.oss-cn-nanjing.aliyuncs.com',
+                'oss.dacundianzi.com'
+              )
             }
             currentRow.value = {
               ...currentRow.value,

+ 4 - 1
src/views/Manage/Img/ImgPage.vue

@@ -143,7 +143,10 @@ const crudSchemas: CrudSchema[] = [
             if (file.size <= 1024 * 1000) {
               resUrl = response.data.virtualPath
             } else {
-              resUrl = response.url
+              resUrl = response.url.replace(
+                'xn-back.oss-cn-nanjing.aliyuncs.com',
+                'oss.dacundianzi.com'
+              )
             }
             console.log(resUrl)
             currentRow.value.bannerUrl = resUrl

+ 4 - 1
src/views/Manage/News/components/Write.vue

@@ -116,7 +116,10 @@ const schema = reactive<FormSchema[]>([
           if (file.size <= 1024 * 1000) {
             resUrl = response.data.virtualPath
           } else {
-            resUrl = response.url
+            resUrl = response.url.replace(
+              'xn-back.oss-cn-nanjing.aliyuncs.com',
+              'oss.dacundianzi.com'
+            )
           }
           setValues({
             articlePic: resUrl

+ 4 - 1
src/views/Manage/Product/components/Write.vue

@@ -93,7 +93,10 @@ const schema = reactive<FormSchema[]>([
           if (file.size <= 1024 * 1000) {
             resUrl = response.data.virtualPath
           } else {
-            resUrl = response.url
+            resUrl = response.url.replace(
+              'xn-back.oss-cn-nanjing.aliyuncs.com',
+              'oss.dacundianzi.com'
+            )
           }
           setValues({
             productPic: resUrl