feat: 默认测试环境并优化出仓与网络提示

This commit is contained in:
2026-09-24 17:56:06 +08:00
parent 53a059f16b
commit 26c7085ab2
10 changed files with 182 additions and 43 deletions
+5 -8
View File
@@ -1,7 +1,7 @@
/**
* Copyright (c) 2013-Now http://aidex.vip All rights reserved.
*/
import config from '@/common/config.js';
import config, { getTestApiUrl } from '@/common/config.js';
import util from '@/common/util.js';
import Vue from 'vue'
import Vuex from 'vuex'
@@ -21,16 +21,13 @@ try{
// 初始化API URL
function initApiUrl() {
const fallbackUrl = config.isDevelopment
? config.devApiUrlOptions[0].value
: ((config.devApiUrlOptions.find(item => item.label === '正式环境') || {}).value || config.productionApiUrl);
const testUrl = getTestApiUrl();
try {
const savedApiUrl = uni.getStorageSync('ApiUrl');
return savedApiUrl || fallbackUrl;
uni.setStorageSync('ApiUrl', testUrl);
} catch (e) {
console.log('读取存储的 apiurl 失败', e);
return fallbackUrl;
console.log('写入测试环境地址失败', e);
}
return testUrl;
}
// 需要永久存储,且下次APP启动需要取出的,在state中的变量名