tangning 9 months ago
parent
commit
4355d4b465
2 changed files with 6 additions and 5 deletions
  1. 2 2
      .env.production
  2. 4 3
      src/views/sys/login/LoginForm.vue

+ 2 - 2
.env.production

@@ -19,14 +19,14 @@ VITE_BUILD_COMPRESS = 'none'
 VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE = false
 
 # Basic interface address SPA
-VITE_GLOB_API_URL=./
+VITE_GLOB_API_URL=
 
 # File upload address, optional
 # It can be forwarded by nginx or write the actual address directly
 VITE_GLOB_UPLOAD_URL=/service/manage/common/upload/files
 
 # Interface prefix
-VITE_GLOB_API_URL_PREFIX=
+VITE_GLOB_API_URL_PREFIX=../
 
 # Whether to enable image compression
 VITE_USE_IMAGEMIN= true

+ 4 - 3
src/views/sys/login/LoginForm.vue

@@ -97,7 +97,7 @@
 </template>
 <script lang="ts" setup>
   import { reactive, ref, unref, computed, onMounted } from 'vue';
-
+  import { useGlobSetting } from '/@/hooks/setting';
   import { Checkbox, Form, Input, Row, Col, Button, } from 'ant-design-vue';//  Divider
   // import {
   //   GithubFilled,
@@ -124,7 +124,8 @@
   const { notification, createErrorModal } = useMessage();
   const { prefixCls } = useDesign('login');
   const userStore = useUserStore();
-
+  const globSetting = useGlobSetting();
+  const urlPrefix = globSetting.urlPrefix;
   const { setLoginState, getLoginState } = useLoginState();
   const { getFormRules } = useFormRules();
   console.log(getFormRules, 'getFormRules')
@@ -136,7 +137,7 @@
       return v.toString(16);
     });
   };
-  const baseURL = ''
+  const baseURL = urlPrefix || './'
   let getCode = '/service/manage/getLoginAuthCode'
   const imgKey = ref(guid());
   const refer = () => (imgKey.value = guid());