feat(storegoods): 新增加工进仓模块并适配智盛ERP
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+14
-4
@@ -19,20 +19,29 @@ try{
|
||||
|
||||
}
|
||||
|
||||
// 本分支统一使用 hcscm 服务前缀
|
||||
function normalizeApiUrl(url) {
|
||||
return String(url || '').replace(/hcscm_weave/g, 'hcscm');
|
||||
}
|
||||
|
||||
// 初始化API URL
|
||||
function initApiUrl() {
|
||||
if (config.isDevelopment) {
|
||||
// 开发环境:从存储读取,如果没有则使用测试环境
|
||||
try {
|
||||
const savedApiUrl = uni.getStorageSync('ApiUrl');
|
||||
return savedApiUrl || config.devApiUrlOptions[0].value;
|
||||
const url = normalizeApiUrl(savedApiUrl || config.devApiUrlOptions[0].value);
|
||||
if (savedApiUrl && url !== savedApiUrl) {
|
||||
uni.setStorageSync('ApiUrl', url);
|
||||
}
|
||||
return url;
|
||||
} catch (e) {
|
||||
console.log('读取存储的 apiurl 失败', e);
|
||||
return config.devApiUrlOptions[0].value;
|
||||
}
|
||||
} else {
|
||||
// 生产环境:使用固定的生产URL
|
||||
return config.productionApiUrl;
|
||||
return normalizeApiUrl(config.productionApiUrl);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,9 +119,10 @@ const store = new Vuex.Store({
|
||||
console.warn('生产环境不允许修改API URL');
|
||||
return;
|
||||
}
|
||||
state.apiurl = url
|
||||
const nextUrl = normalizeApiUrl(url);
|
||||
state.apiurl = nextUrl
|
||||
// 同时保存到本地存储
|
||||
uni.setStorageSync('ApiUrl', url)
|
||||
uni.setStorageSync('ApiUrl', nextUrl)
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user