dns域名添加
This commit is contained in:
+13
-36
@@ -33,9 +33,9 @@ import { reactive } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { jumpAdv } from '@/utils/index';
|
||||
import { useGlobalStore } from '@/stores/global';
|
||||
import axios from 'axios';
|
||||
import setTheme from '@/assets/theme/index';
|
||||
import { markHomeOldUserGuidePendingFromSplash } from '@/utils/paymentGuide';
|
||||
import { detectLine } from '@/utils/detectLine';
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
@@ -50,7 +50,6 @@ const state = reactive({
|
||||
checkTimer: <any>null, //检测图片是否加载成功定时器
|
||||
checkTime: 3, //图片加载成功检测时间
|
||||
isResLock: false, // 请求结果锁
|
||||
lineFailCount: 0, // 已失败的线路数
|
||||
loading: true, // 选线loading
|
||||
isUpgrade: true, //是否升级
|
||||
});
|
||||
@@ -349,16 +348,6 @@ const getConfig = async (): Promise<boolean> => {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @description 选线失败:同安卓,失败不做处理(不弹重试/线路异常弹窗)。
|
||||
* 全部线路都不通就收起「选线中...」,启动流程停在启动页
|
||||
*/
|
||||
const onLineCheckFail = (hosts: any) => {
|
||||
state.lineFailCount++;
|
||||
if (state.lineFailCount >= hosts.length && !state.isResLock) {
|
||||
state.loading = false;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* 初始化
|
||||
*/
|
||||
@@ -367,30 +356,18 @@ const init = async () => {
|
||||
route.query.isAppStore
|
||||
? localStorage.setItem('isAppStore', route.query.isAppStore.toString())
|
||||
: localStorage.setItem('isAppStore', ''); // 保存是否来自商店包,用于判断是否跳转外链
|
||||
const baseUrls: string = process.env.VITE_BASE_URL || '[]';
|
||||
const hosts = JSON.parse(baseUrls);
|
||||
hosts.forEach((url: any) => {
|
||||
axios({
|
||||
method: 'GET',
|
||||
url: url + '/api/app/ping/check',
|
||||
timeout: 1000 * 10, // 10秒超时
|
||||
})
|
||||
.then(async (res) => {
|
||||
if (res.data.code == 200) {
|
||||
if (!state.isResLock) {
|
||||
state.isResLock = true;
|
||||
//选线成功
|
||||
useConfigStore().saveBaseUrl(url);
|
||||
await ensureAuthAndConfig();
|
||||
}
|
||||
} else {
|
||||
onLineCheckFail(hosts);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
onLineCheckFail(hosts);
|
||||
});
|
||||
});
|
||||
// 选线:本地线路 → 全挂则 DNS 解析兜底,同安卓 DetectLineManager
|
||||
const line = await detectLine();
|
||||
// 选线失败:同安卓,失败不做处理(不弹重试/线路异常弹窗),
|
||||
// 收起「选线中...」,启动流程停在启动页
|
||||
if (!line) {
|
||||
state.loading = false;
|
||||
return;
|
||||
}
|
||||
if (state.isResLock) return;
|
||||
state.isResLock = true;
|
||||
configStore.saveBaseUrl(line);
|
||||
await ensureAuthAndConfig();
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user