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

@@ -4,6 +4,7 @@ import { PlusOutlined } from '@ant-design/icons';
import type { ActionType, ProColumns } from '@ant-design/pro-components';
import { ProTable } from '@ant-design/pro-components';
import { getDictValueEnum } from '@/services/system/dict';
import { normalizePublicUrl } from '@/utils/publicUrl';
import {
getParticipatingCompanyQrCode,
getParticipatingCompanies,
@@ -98,7 +99,11 @@ const ParticipatingCompaniesTab: React.FC<Props> = ({ fairId }) => {
message.error(res.msg || '二维码内容获取失败');
return;
}
setQrInfo(res.data);
setQrInfo({
...res.data,
h5Url: normalizePublicUrl(res.data.h5Url) || res.data.h5Url,
qrCodeContent: normalizePublicUrl(res.data.qrCodeContent) || res.data.qrCodeContent,
});
setQrCompanyName(record.companyName);
setQrModalOpen(true);
};