Browse Source

上传文件地址修改

wangwei 3 years ago
parent
commit
c86528ef9e
4 changed files with 5 additions and 4 deletions
  1. 1 1
      .env.development
  2. 1 1
      .env.production
  3. 2 2
      src/api/sys/upload.ts
  4. 1 0
      src/views/general/attachment/index.vue

+ 1 - 1
.env.development

@@ -22,7 +22,7 @@ VITE_GLOB_API_URL=
 
 # File upload address, optional
 # VITE_GLOB_UPLOAD_URL=http://139.186.154.72:80/admin/upload
-VITE_GLOB_UPLOAD_URL=http://localhost:8888/admin/upload
+VITE_GLOB_UPLOAD_URL=http://localhost:8888/admin
 
 # Interface prefix
 VITE_GLOB_API_URL_PREFIX= /admin

+ 1 - 1
.env.production

@@ -18,7 +18,7 @@ VITE_GLOB_API_URL=http://139.186.154.72:80/admin
 
 # File upload address, optional
 # It can be forwarded by nginx or write the actual address directly
-VITE_GLOB_UPLOAD_URL=http://139.186.154.72:80/admin/upload
+VITE_GLOB_UPLOAD_URL=http://139.186.154.72:80/admin
 # VITE_GLOB_UPLOAD_URL=http://localhost:8888/admin/upload
 
 # Interface prefix

+ 2 - 2
src/api/sys/upload.ts

@@ -3,7 +3,7 @@ import { defHttp } from '/@/utils/http/axios';
 import { UploadFileParams } from '/@/utils/http/axios/types';
 import { useGlobSetting } from '/@/hooks/setting';
 
-const { /*uploadUrl = '', */ urlPrefix } = useGlobSetting();
+const { uploadUrl = '' /* urlPrefix */ } = useGlobSetting();
 
 enum Api {
   uploadUrl = '/general/file',
@@ -17,7 +17,7 @@ export function uploadApi(
 ) {
   return defHttp.uploadFile<UploadApiResult>(
     {
-      url: urlPrefix + Api.uploadUrl,
+      url: uploadUrl + Api.uploadUrl,
       // onUploadProgress,
     },
     params

+ 1 - 0
src/views/general/attachment/index.vue

@@ -106,6 +106,7 @@
             error('文件上传失败');
             console.log(`err`, err);
           });
+        return false;
       }
 
       function getTableAction() {