2023.6.28-添加生产环境接口地址可配置
This commit is contained in:
parent
18dd68edd5
commit
d3cf9197ff
@ -213,5 +213,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script type="module" src="/src/main.ts"></script>
|
<script type="module" src="/src/main.ts"></script>
|
||||||
|
<script type="text/javascript" src="/static/config.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite serve --mode development",
|
"dev": "vite serve --mode development",
|
||||||
"build:prod": "vite build --mode production &&vue-tsc --noEmit",
|
"build": "vite build --mode production &&vue-tsc --noEmit",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"lint": "eslint src/**/*.{ts,js,vue} --fix",
|
"lint": "eslint src/**/*.{ts,js,vue} --fix",
|
||||||
"prepare": "husky install",
|
"prepare": "husky install",
|
||||||
|
6548
pnpm-lock.yaml
generated
Normal file
6548
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
3
public/static/config.js
Normal file
3
public/static/config.js
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
window.overallConfigObj = {
|
||||||
|
baseUrl: "http://10.10.110.10:8080",//可自定义配置接口地址
|
||||||
|
};
|
@ -8,7 +8,7 @@ import { errorCode } from '@/utils/errorCode';
|
|||||||
import { LoadingInstance } from 'element-plus/es/components/loading/src/loading';
|
import { LoadingInstance } from 'element-plus/es/components/loading/src/loading';
|
||||||
import FileSaver from 'file-saver';
|
import FileSaver from 'file-saver';
|
||||||
import { getLanguage } from '@/lang';
|
import { getLanguage } from '@/lang';
|
||||||
|
declare const window: Window & { overallConfigObj: any };
|
||||||
let downloadLoadingInstance: LoadingInstance;
|
let downloadLoadingInstance: LoadingInstance;
|
||||||
// 是否显示重新登录
|
// 是否显示重新登录
|
||||||
export const isRelogin = { show: false };
|
export const isRelogin = { show: false };
|
||||||
@ -16,7 +16,7 @@ export const isRelogin = { show: false };
|
|||||||
axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8';
|
axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8';
|
||||||
// 创建 axios 实例
|
// 创建 axios 实例
|
||||||
const service = axios.create({
|
const service = axios.create({
|
||||||
baseURL: import.meta.env.VITE_APP_BASE_API,
|
baseURL: import.meta.env.VITE_APP_ENV == 'development' ? import.meta.env.VITE_APP_BASE_API : window.overallConfigObj.baseUrl,
|
||||||
timeout: 50000
|
timeout: 50000
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user