1111111
This commit is contained in:
+22
-1
@@ -1,12 +1,22 @@
|
||||
// app.ts
|
||||
import { startSSE, stopSSE } from './utils/server-sent-events'
|
||||
import { checkUpdate } from './utils/updateManager'
|
||||
import { BASE_URL } from './env'
|
||||
// @ts-ignore
|
||||
const systemInfo = wx.getWindowInfo();
|
||||
|
||||
// 域名包含 .test. 则为测试环境,不拦截登录
|
||||
const isTestDomain = (): boolean => BASE_URL.includes('.test.');
|
||||
|
||||
// 判断是否在 PC/Windows 环境运行
|
||||
const isPCEnvironment = (): boolean => {
|
||||
const sysInfo = wx.getSystemInfoSync();
|
||||
return ['windows', 'mac'].includes(sysInfo.platform);
|
||||
};
|
||||
export { };
|
||||
App<IAppOption>({
|
||||
globalData: {
|
||||
isLogin: false, // 当前是否登录
|
||||
isLogin: false, //
|
||||
wasLogin: false, // 之前是否登录过,用来判断是不是 登录状态失效
|
||||
safeBottom: systemInfo.safeArea.bottom - systemInfo.safeArea.height,
|
||||
safeTop: systemInfo.safeArea.top * 2,
|
||||
@@ -20,6 +30,17 @@ App<IAppOption>({
|
||||
isModalShowing: false, //防止有多个登录弹窗打开
|
||||
},
|
||||
async onLaunch(props: any) {
|
||||
// 非测试环境在 PC 端打开时提示无法使用
|
||||
if (!isTestDomain() && isPCEnvironment()) {
|
||||
wx.showModal({
|
||||
title: "提示",
|
||||
content: "该环境无法使用",
|
||||
showCancel: false,
|
||||
confirmText: "我知道了"
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
wx.removeStorageSync("state");
|
||||
if (props.query.state) {
|
||||
wx.setStorageSync("state", props.query.state)
|
||||
|
||||
Reference in New Issue
Block a user