|
@@ -1,5 +1,5 @@
|
|
|
// import { Component, PropsWithChildren } from 'react'
|
|
|
-import './app.scss'
|
|
|
+import "./app.scss";
|
|
|
|
|
|
// class App extends Component<PropsWithChildren> {
|
|
|
|
|
@@ -17,41 +17,52 @@ import './app.scss'
|
|
|
|
|
|
// export default App
|
|
|
|
|
|
-import { PropsWithChildren } from 'react';
|
|
|
-import { useRequest } from 'ahooks';
|
|
|
-import Taro from '@tarojs/taro';
|
|
|
-import AppContext from './context/appContext';
|
|
|
-import { Provider as ReduxProvider } from 'react-redux';
|
|
|
-import ReduxUtil from './utils/reduxUtil';
|
|
|
-import UserHelper from './helper/userHelper';
|
|
|
+import { PropsWithChildren } from "react";
|
|
|
+import { useRequest } from "ahooks";
|
|
|
+import Taro, { useLaunch } from "@tarojs/taro";
|
|
|
+import AppContext from "./context/appContext";
|
|
|
+import { Provider as ReduxProvider } from "react-redux";
|
|
|
+import ReduxUtil from "./utils/reduxUtil";
|
|
|
+import RouteUtil from "./utils/routeUtil";
|
|
|
+import UserHelper from "./helper/userHelper";
|
|
|
+import { WebView } from "@tarojs/components";
|
|
|
|
|
|
-interface IAppProps {
|
|
|
-
|
|
|
-}
|
|
|
+interface IAppProps {}
|
|
|
|
|
|
const App = (props: PropsWithChildren<IAppProps>) => {
|
|
|
const result = useRequest(Taro.getSystemInfo);
|
|
|
useRequest(() => {
|
|
|
return UserHelper.cacheTabMenu();
|
|
|
- })
|
|
|
+ });
|
|
|
+ useLaunch((options) => {
|
|
|
+ console.log(options);
|
|
|
+ if (options.query.source === "app") {
|
|
|
+ RouteUtil.toWebViewPage({
|
|
|
+ url: "https://mp.weixin.qq.com/s/X0OAslHaFjld6Zf2ifVC5A",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
return (
|
|
|
// (appContext.systemInfo?.screenHeight || 0) - (appContext.systemInfo?.safeArea?.bottom || 0);
|
|
|
- <AppContext.Provider value={{
|
|
|
- systemInfo: result.data,
|
|
|
- screenSize: {
|
|
|
- width: result.data?.screenWidth || 0,
|
|
|
- height: result.data?.screenHeight || 0,
|
|
|
- },
|
|
|
- padding: {
|
|
|
- top: result.data?.safeArea?.top || 0,
|
|
|
- bottom: (result.data?.screenHeight || 0) - (result.data?.safeArea?.bottom || 0),
|
|
|
- }
|
|
|
- }} >
|
|
|
- <ReduxProvider store={ReduxUtil.store} >
|
|
|
- {props.children}
|
|
|
- </ReduxProvider>
|
|
|
+ <AppContext.Provider
|
|
|
+ value={{
|
|
|
+ systemInfo: result.data,
|
|
|
+ screenSize: {
|
|
|
+ width: result.data?.screenWidth || 0,
|
|
|
+ height: result.data?.screenHeight || 0,
|
|
|
+ },
|
|
|
+ padding: {
|
|
|
+ top: result.data?.safeArea?.top || 0,
|
|
|
+ bottom:
|
|
|
+ (result.data?.screenHeight || 0) -
|
|
|
+ (result.data?.safeArea?.bottom || 0),
|
|
|
+ },
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <WebView src="https://mp.weixin.qq.com/s/X0OAslHaFjld6Zf2ifVC5A"></WebView>
|
|
|
+ <ReduxProvider store={ReduxUtil.store}>{props.children}</ReduxProvider>
|
|
|
</AppContext.Provider>
|
|
|
- )
|
|
|
-}
|
|
|
+ );
|
|
|
+};
|
|
|
|
|
|
-export default App;
|
|
|
+export default App;
|