fix: 更新正式环境地址并去掉路径改写

This commit is contained in:
2026-10-30 11:01:43 +08:00
parent 2903972e55
commit f56c40bb6d
4 changed files with 10 additions and 21 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
NODE_ENV = production
VUE_APP_ENV_NAME = zhoushang环境
VUE_APP_UPGRADE_NAME = erp_pda_zhoushang
VUE_APP_PRODUCTION_API_URL = https://hcscmtest.zzfzyc.com/hcscm_weave/pda/v1
VUE_APP_DEV_API_URL = https://hcscmtest.zzfzyc.com/hcscm_weave/pda/v1
VUE_APP_PRODUCTION_API_URL = https://zsfz.yushangfangzhi.com/server/hcscm/pda/v1
VUE_APP_DEV_API_URL = https://zsfz.yushangfangzhi.com/server/hcscm/pda/v1
+2 -2
View File
@@ -1,5 +1,5 @@
NODE_ENV = production
VUE_APP_ENV_NAME = zhoushang环境
VUE_APP_UPGRADE_NAME = erp_pda_zhoushang
VUE_APP_PRODUCTION_API_URL = https://zsfz.yushangfangzhi.com/server/pda/v1
VUE_APP_DEV_API_URL = https://zsfz.yushangfangzhi.com/server/pda/v1
VUE_APP_PRODUCTION_API_URL = https://zsfz.yushangfangzhi.com/server/hcscm/pda/v1
VUE_APP_DEV_API_URL = https://zsfz.yushangfangzhi.com/server/hcscm/pda/v1
+2 -2
View File
@@ -26,8 +26,8 @@ const config = {
// 开发环境API URL选项(服务名段 hcscm)
devApiUrlOptions: [
{ label: '测试环境', value: 'https://hcscmtest.zzfzyc.com/hcscm/pda/v1' },
{ label: '本地环境', value: 'http://192.168.1.66:7010/hcscm/pda/v1' },
{ label: '本地穿透', value: 'https://2yd52gx88533.vicp.fun/hcscm/pda/v1' },
// { label: '本地环境', value: 'http://192.168.1.66:7010/hcscm/pda/v1' },
// { label: '本地穿透', value: 'https://2yd52gx88533.vicp.fun/hcscm/pda/v1' },
{ label: '正式环境', value: process.env.VUE_APP_PRODUCTION_API_URL },
{ label: '自定义', value: 'custom' }
]
+4 -15
View File
@@ -19,24 +19,14 @@ try{
}
// 本分支统一使用 hcscm 服务前缀
function normalizeApiUrl(url) {
return String(url || '').replace(/hcscm_weave/g, 'hcscm');
}
// 初始化API URL
function initApiUrl() {
const fallbackUrl = (config.devApiUrlOptions.find(item => item.label === '正式环境') || {}).value || config.productionApiUrl;
try {
const savedApiUrl = uni.getStorageSync('ApiUrl');
const url = normalizeApiUrl(savedApiUrl || fallbackUrl);
if (savedApiUrl && url !== savedApiUrl) {
uni.setStorageSync('ApiUrl', url);
}
return url;
return uni.getStorageSync('ApiUrl') || fallbackUrl;
} catch (e) {
console.log('读取存储的 apiurl 失败', e);
return normalizeApiUrl(fallbackUrl);
return fallbackUrl;
}
}
@@ -109,9 +99,8 @@ const store = new Vuex.Store({
state.vuex_notificationAudio = audio;
},
SET_API_URL(state, url) {
const nextUrl = normalizeApiUrl(url);
state.apiurl = nextUrl
uni.setStorageSync('ApiUrl', nextUrl)
state.apiurl = url
uni.setStorageSync('ApiUrl', url)
}
},