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);
};

View File

@@ -29,6 +29,7 @@ import type {
import { getParticipatingJobs } from '@/services/jobportal/outdoorFairDetail';
import { getDictSelectOption, getDictValueEnum } from '@/services/system/dict';
import { getVenueInfoList } from '@/services/jobportal/venueInfo';
import { normalizePublicUrl } from '@/utils/publicUrl';
import EditModal from './components/EditModal';
import JobEditModal from './Detail/components/JobEditModal';
@@ -175,7 +176,11 @@ const OutdoorFairList: React.FC = () => {
const openQrCode = async (record: OutdoorFairItem) => {
const res = await getMyOutdoorFairQrCode(record.id);
if (res.code === 200) {
setQrInfo(res.data);
setQrInfo({
...res.data,
h5Url: normalizePublicUrl(res.data.h5Url) || res.data.h5Url,
qrCodeContent: normalizePublicUrl(res.data.qrCodeContent) || res.data.qrCodeContent,
});
setQrModalOpen(true);
} else {
message.error(res.msg || '二维码加载失败');