mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-11 11:50:24 +08:00
refactor: 前端文件夹名称调整
This commit is contained in:
21
frontend/src/common/config.ts
Normal file
21
frontend/src/common/config.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
function getBaseApiUrl() {
|
||||
let path = window.location.pathname;
|
||||
if (path == '/') {
|
||||
return window.location.host;
|
||||
}
|
||||
if (path.endsWith('/')) {
|
||||
// 去除最后一个/
|
||||
return window.location.host + path.replace(/\/$/, '');
|
||||
}
|
||||
return window.location.host + path;
|
||||
}
|
||||
|
||||
const config = {
|
||||
baseApiUrl: `${(window as any).globalConfig.BaseApiUrl || location.protocol + '//' + getBaseApiUrl()}/api`,
|
||||
baseWsUrl: `${(window as any).globalConfig.BaseWsUrl || `${location.protocol == 'https:' ? 'wss:' : 'ws:'}//${getBaseApiUrl()}`}/api`,
|
||||
|
||||
// 系统版本
|
||||
version: 'v1.9.0',
|
||||
};
|
||||
|
||||
export default config;
|
||||
Reference in New Issue
Block a user