mirror of
https://github.com/PlayEdu/frontend.git
synced 2025-06-08 04:47:55 +08:00
手机浏览跳转h5
This commit is contained in:
parent
d47f1a9250
commit
2949eaafda
@ -9,6 +9,7 @@ import {
|
|||||||
import { loginAction } from "../../store/user/loginUserSlice";
|
import { loginAction } from "../../store/user/loginUserSlice";
|
||||||
import { Header, NoHeader, Footer } from "../../compenents";
|
import { Header, NoHeader, Footer } from "../../compenents";
|
||||||
import { useParams, useLocation } from "react-router-dom";
|
import { useParams, useLocation } from "react-router-dom";
|
||||||
|
import { isMobile } from "../../utils/index";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
loginData?: any;
|
loginData?: any;
|
||||||
@ -72,6 +73,10 @@ export const InitPage = (props: Props) => {
|
|||||||
props.configData["player-bullet-secret-opacity"],
|
props.configData["player-bullet-secret-opacity"],
|
||||||
};
|
};
|
||||||
dispatch(saveConfigAction(config));
|
dispatch(saveConfigAction(config));
|
||||||
|
if (isMobile() && props.configData["system-h5-url"] !== "") {
|
||||||
|
let url = props.configData["system-h5-url"];
|
||||||
|
window.location.href = url;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
setInit(true);
|
setInit(true);
|
||||||
}, [props]);
|
}, [props]);
|
||||||
|
@ -30,7 +30,19 @@ if (getToken()) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
RootPage = <InitPage />;
|
RootPage = lazy(async () => {
|
||||||
|
return new Promise<any>(async (resolve) => {
|
||||||
|
try {
|
||||||
|
let configRes: any = await system.config();
|
||||||
|
|
||||||
|
resolve({
|
||||||
|
default: <InitPage configData={configRes.data} />,
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
console.error("系统初始化失败", e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 懒加载
|
// 懒加载
|
||||||
|
@ -104,3 +104,10 @@ export function changeAppUrl(str: string) {
|
|||||||
return str + "/";
|
return str + "/";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function isMobile() {
|
||||||
|
let flag = navigator.userAgent.match(
|
||||||
|
/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
|
||||||
|
);
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user