feat: 开放服务器切换并修复扫码方式列表

This commit is contained in:
2026-09-24 16:33:01 +08:00
parent 3f2481d1eb
commit fa0ff1614b
4 changed files with 78 additions and 80 deletions
+9 -18
View File
@@ -21,18 +21,15 @@ try{
// 初始化API URL
function initApiUrl() {
if (config.isDevelopment) {
// 开发环境:从存储读取,如果没有则使用测试环境
try {
const savedApiUrl = uni.getStorageSync('ApiUrl');
return savedApiUrl || config.devApiUrlOptions[0].value;
} catch (e) {
console.log('读取存储的 apiurl 失败', e);
return config.devApiUrlOptions[0].value;
}
} else {
// 生产环境:使用固定的生产URL
return config.productionApiUrl;
const fallbackUrl = config.isDevelopment
? config.devApiUrlOptions[0].value
: ((config.devApiUrlOptions.find(item => item.label === '正式环境') || {}).value || config.productionApiUrl);
try {
const savedApiUrl = uni.getStorageSync('ApiUrl');
return savedApiUrl || fallbackUrl;
} catch (e) {
console.log('读取存储的 apiurl 失败', e);
return fallbackUrl;
}
}
@@ -105,13 +102,7 @@ const store = new Vuex.Store({
state.vuex_notificationAudio = audio;
},
SET_API_URL(state, url) {
// 生产环境不允许修改URL
if (!config.isDevelopment) {
console.warn('生产环境不允许修改API URL');
return;
}
state.apiurl = url
// 同时保存到本地存储
uni.setStorageSync('ApiUrl', url)
}
},