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
+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)
}
},