Add utility functions for handling public URLs and update API base URL logic

- Implement getProductionApiBaseUrl and normalizePublicUrl functions to manage API URLs based on the browser's origin.
- Update API base URL in request configuration to use getProductionApiBaseUrl.
- Enhance QR code handling in ParticipatingCompaniesTab and OutdoorFairList components to normalize URLs.
- Create a deployment script for frontend builds and server uploads.
- Add tests for the new URL utility functions.
This commit is contained in:
2026-07-15 08:46:40 +08:00
parent 5672bfcbc6
commit 00ba967685
7 changed files with 241 additions and 6 deletions

View File

@@ -23,6 +23,7 @@ import {
import { PageEnum } from './enums/pagesEnums';
import { stringify } from 'querystring';
import { message } from 'antd';
import { getProductionApiBaseUrl } from './utils/publicUrl';
const isDev = process.env.NODE_ENV === 'development';
const loginOut = async () => {
@@ -44,6 +45,8 @@ const loginOut = async () => {
}
};
/**
* @see https://umijs.org/zh-CN/plugins/plugin-initial-state
* */
@@ -268,7 +271,7 @@ export const request = {
// baseURL: process.env.NODE_ENV === 'development' ? '' : 'http://ks.zhaopinzao8dian.com/api/ks',
// baseURL: process.env.NODE_ENV === 'development' ? '' : 'http://36.105.163.21:30081/api/ks',
// baseURL: process.env.NODE_ENV === 'development' ? '' : 'https://xjshzly.longbiosphere.com:30081/api/ks',
baseURL: process.env.NODE_ENV === 'development' ? '' : 'http://39.98.44.136:6024/api/shihezi/',
baseURL: process.env.NODE_ENV === 'development' ? '' : getProductionApiBaseUrl(),
// baseURL: 'http://39.98.44.136:8080',
requestInterceptors: [
(url: any, options: { headers: any }) => {
@@ -321,4 +324,3 @@ export const request = {
},
],
};