Commit 1415ef0a authored by Nicholas's avatar Nicholas

fix

parent ff1760c2
VITE_APP_ENV=development
VITE_MESSAGE_BASE_URL=https://api-staging.cmviking.com/message
VITE_STREAMS_TYPE=ticket
VITE_STREAMS_TICKET=cydz5uLSWULm1gu5ACUWEXor1mrrBzr0
VITE_MIDDLE_QUERY_DEVIATION_PATH=/client/salesforce/call/DeviationAgreementService
VITE_MIDDLE_CREATE_DEVIATION_PATH=/client/salesforce/call/DeviationAgreementService
VITE_MIDDLE_TERMS_PATH=/record/query
VITE_MIDDLE_TERMS_PAGE_SIZE=20
VITE_USE_MOCK=false
VITE_MESSAGE_BASE_URL=https://api.vikingcruises.cn/message
VITE_APP_ENV=production
VITE_STREAMS_BASE_URL=https://streams.vikingcruises.cn/api/
VITE_STREAMS_TYPE=ticket
VITE_STREAMS_TICKET=ODJuvaIno8PUnnHhCCZSuFpJVD7ZJCJh
VITE_MIDDLE_QUERY_DEVIATION_PATH=/client/salesforce/call/DeviationAgreementService
VITE_MIDDLE_CREATE_DEVIATION_PATH=/client/salesforce/call/DeviationAgreementService
VITE_MIDDLE_TERMS_PATH=/record/query
VITE_MIDDLE_TERMS_PAGE_SIZE=20
VITE_USE_MOCK=false
VITE_APP_ENV=production
VITE_MESSAGE_BASE_URL=https://api.vikingcruises.cn/message
VITE_STREAMS_BASE_URL=https://streams.vikingcruises.cn/api/
VITE_STREAMS_TYPE=ticket
VITE_STREAMS_TICKET=ODJuvaIno8PUnnHhCCZSuFpJVD7ZJCJh
VITE_MIDDLE_QUERY_DEVIATION_PATH=/client/salesforce/call/DeviationAgreementService
VITE_MIDDLE_CREATE_DEVIATION_PATH=/client/salesforce/call/DeviationAgreementService
VITE_MIDDLE_TERMS_PATH=/record/query
VITE_MIDDLE_TERMS_PAGE_SIZE=20
VITE_USE_MOCK=false
VITE_APP_ENV=staging
VITE_MESSAGE_BASE_URL=https://api-staging.cmviking.com/message
VITE_STREAMS_BASE_URL=https://viking-test.streams7.com/api/
VITE_STREAMS_TYPE=ticket
VITE_STREAMS_TICKET=cydz5uLSWULm1gu5ACUWEXor1mrrBzr0
VITE_MIDDLE_QUERY_DEVIATION_PATH=/client/salesforce/call/DeviationAgreementService
VITE_MIDDLE_CREATE_DEVIATION_PATH=/client/salesforce/call/DeviationAgreementService
VITE_MIDDLE_TERMS_PATH=/record/query
VITE_MIDDLE_TERMS_PAGE_SIZE=20
VITE_USE_MOCK=false
...@@ -2,3 +2,5 @@ ...@@ -2,3 +2,5 @@
dist dist
.env .env
.DS_Store .DS_Store
*.local.sh
river-refunds-*.zip
{
"name": "Streams River Refunds UI",
"version": "1.1",
"build": "abc",
"description": "river refunds",
"date": "2026-07-15 18:34:09",
"author": "Nicholas",
"spa": false
}
...@@ -157,9 +157,6 @@ ...@@ -157,9 +157,6 @@
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
"libc": [
"glibc"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
...@@ -176,9 +173,6 @@ ...@@ -176,9 +173,6 @@
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
"libc": [
"musl"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
...@@ -195,9 +189,6 @@ ...@@ -195,9 +189,6 @@
"cpu": [ "cpu": [
"ppc64" "ppc64"
], ],
"libc": [
"glibc"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
...@@ -214,9 +205,6 @@ ...@@ -214,9 +205,6 @@
"cpu": [ "cpu": [
"s390x" "s390x"
], ],
"libc": [
"glibc"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
...@@ -233,9 +221,6 @@ ...@@ -233,9 +221,6 @@
"cpu": [ "cpu": [
"x64" "x64"
], ],
"libc": [
"glibc"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
...@@ -252,9 +237,6 @@ ...@@ -252,9 +237,6 @@
"cpu": [ "cpu": [
"x64" "x64"
], ],
"libc": [
"musl"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
...@@ -547,9 +529,6 @@ ...@@ -547,9 +529,6 @@
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
"libc": [
"glibc"
],
"license": "MPL-2.0", "license": "MPL-2.0",
"optional": true, "optional": true,
"os": [ "os": [
...@@ -570,9 +549,6 @@ ...@@ -570,9 +549,6 @@
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
"libc": [
"musl"
],
"license": "MPL-2.0", "license": "MPL-2.0",
"optional": true, "optional": true,
"os": [ "os": [
...@@ -593,9 +569,6 @@ ...@@ -593,9 +569,6 @@
"cpu": [ "cpu": [
"x64" "x64"
], ],
"libc": [
"glibc"
],
"license": "MPL-2.0", "license": "MPL-2.0",
"optional": true, "optional": true,
"os": [ "os": [
...@@ -616,9 +589,6 @@ ...@@ -616,9 +589,6 @@
"cpu": [ "cpu": [
"x64" "x64"
], ],
"libc": [
"musl"
],
"license": "MPL-2.0", "license": "MPL-2.0",
"optional": true, "optional": true,
"os": [ "os": [
......
import { get as middleGet, post as middlePost } from './streamsRequest.js'; import { get as middleGet, post as middlePost } from './streamsRequest.js';
const messageBaseUrl = import.meta.env.VITE_MESSAGE_BASE_URL || 'https://api.vikingcruises.cn/message'; // 运行时按访问域名区分环境(同一份构建产物,测试/生产通用)
const PROD_HOSTS = ['streams.vikingcruises.cn'];
const isProd = PROD_HOSTS.includes(window.location.hostname);
const messageBaseUrl = isProd
? 'https://api.vikingcruises.cn/message'
: 'https://api-staging.cmviking.com/message';
const middleDeviationPath = '/client/salesforce/call/DeviationAgreementService'; const middleDeviationPath = '/client/salesforce/call/DeviationAgreementService';
const middleTermsPath = import.meta.env.VITE_MIDDLE_TERMS_PATH || '/record/query'; const middleTermsPath = '/record/query';
const middleQueryDeviationPath = const middleQueryDeviationPath = middleDeviationPath;
import.meta.env.VITE_MIDDLE_QUERY_DEVIATION_PATH || middleDeviationPath; const middleCreateDeviationPath = middleDeviationPath;
const middleCreateDeviationPath =
import.meta.env.VITE_MIDDLE_CREATE_DEVIATION_PATH || middleDeviationPath;
export const useMock = import.meta.env.VITE_USE_MOCK === 'true'; export const useMock = false;
async function parseJson(response) { async function parseJson(response) {
const text = await response.text(); const text = await response.text();
...@@ -94,7 +97,7 @@ export async function fetchDeviationTerms() { ...@@ -94,7 +97,7 @@ export async function fetchDeviationTerms() {
const payload = await middlePost(middleTermsPath, { const payload = await middlePost(middleTermsPath, {
subject: 'deviation', subject: 'deviation',
page: 0, page: 0,
page_size: Number(import.meta.env.VITE_MIDDLE_TERMS_PAGE_SIZE || 20), page_size: 20,
filter: {}, filter: {},
full: false, full: false,
select: null, select: null,
......
const env = // 运行时按访问域名区分环境(同一份构建产物,测试/生产通用)
import.meta.env.VITE_APP_ENV || const PROD_HOSTS = ['streams.vikingcruises.cn'];
import.meta.env.VITE_STREAMS_ENV || const isProd = PROD_HOSTS.includes(window.location.hostname);
(import.meta.env.DEV ? 'development' : 'production');
// 本地开发经 vite 的 /api2 代理转发到 viking-test,避免跨域;线上直连对应域名
const STREAMS_CONFIG = { const BASE_URL = import.meta.env.DEV
development: { ? '/api2'
url: '/api2', : isProd
ticket: 'cydz5uLSWULm1gu5ACUWEXor1mrrBzr0', ? 'https://streams.vikingcruises.cn/api/'
type: 'ticket', : 'https://viking-test.streams7.com/api/';
}, const TICKET = isProd
staging: { ? 'ODJuvaIno8PUnnHhCCZSuFpJVD7ZJCJh'
url: 'https://streams.vikingcruises.cn/api/', : 'cydz5uLSWULm1gu5ACUWEXor1mrrBzr0';
ticket: 'ODJuvaIno8PUnnHhCCZSuFpJVD7ZJCJh', const TYPE = 'ticket';
type: 'ticket',
},
production: {
url: 'https://streams.vikingcruises.cn/api/',
ticket: 'ODJuvaIno8PUnnHhCCZSuFpJVD7ZJCJh',
type: 'ticket',
},
};
const currentConfig = STREAMS_CONFIG[env] || STREAMS_CONFIG.production;
const BASE_URL = import.meta.env.VITE_STREAMS_BASE_URL || currentConfig.url;
const TICKET = import.meta.env.VITE_STREAMS_TICKET || currentConfig.ticket;
const TYPE = import.meta.env.VITE_STREAMS_TYPE || currentConfig.type;
const TOKEN_KEY = 'streamsToken'; const TOKEN_KEY = 'streamsToken';
const TOKEN_EXPIRE_KEY = 'streamsTokenExpireTime'; const TOKEN_EXPIRE_KEY = 'streamsTokenExpireTime';
const TOKEN_TTL = 2 * 60 * 60 * 1000; const TOKEN_TTL = 2 * 60 * 60 * 1000;
......
import { defineConfig } from 'vite'; import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react'; import react from '@vitejs/plugin-react';
export default defineConfig({ export default defineConfig(({ command }) => ({
base: '/river-refunds/', base: command === 'build' ? '/river-refunds/' : '/',
plugins: [react()], plugins: [react()],
server: { server: {
proxy: { proxy: {
...@@ -13,4 +13,4 @@ export default defineConfig({ ...@@ -13,4 +13,4 @@ export default defineConfig({
}, },
}, },
}, },
}); }));
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment