zdc 2 年之前
父节点
当前提交
95abef1499

+ 1 - 1
config/dev.js

@@ -10,4 +10,4 @@ module.exports = {
   },
   mini: {},
   h5: {}
-}
+}

+ 2 - 20
src/component/layout/index.tsx

@@ -16,22 +16,6 @@ interface ILayoutProps extends ViewProps {
     safe?: boolean;
     bottomBarIndex?: number;
 }
-const barList = [
-    {
-        icon: require('../../assets/icon_bottom_bar_apply.png'),
-        activeIcon: require('../../assets/icon_bottom_bar_apply_active.png'),
-        label: "申请",
-        index: 0,
-        mustLogin: false,
-    },
-    {
-        icon: require('../../assets/icon_bottom_bar_mine.png'),
-        activeIcon: require('../../assets/icon_bottom_bar_mine_active.png'),
-        label: "我的",
-        mustLogin: true,
-        index: 1
-    }
-]
 
 const BottomNavBar = () => {
     const appContext = useContext(AppContext);
@@ -42,13 +26,13 @@ const BottomNavBar = () => {
             <Flex style={{ height: pxTransform(104) }} direction="row" alignItem="center" justifyContent="center" >
                 {
                     menu.map(p => {
-                        let _index = p.code === "home" ? 0 : 1;
+                        let _index = ["home", "user_center"].findIndex(sp => sp === p.code);
                         return (
                             <Flex key={p.code} onClick={() => {
                                 UserHelper.afterLogin({
                                     callback: async () => {
                                         if (['home', 'user_center'].includes(p.code)) {
-                                            bottomBarContext.switchTo(_index);
+                                            bottomBarContext.switchTo(_index as number);
                                         }
                                         else {
                                             RouteUtil.toWebViewPage({
@@ -59,9 +43,7 @@ const BottomNavBar = () => {
                                 })
                                 return;
                             }} flex={1} alignItem="center" justifyContent="center" >
-                                {/* <Image className='bottom-nav-icon' src={p.icon} /> */}
                                 <Image className='bottom-nav-icon' src={_index === bottomBarContext?.index ? p.iconActive : p.icon} />
-                                {/* <Label size="sm" type={"default"} > */}
                                 <Label size="sm" type={_index === bottomBarContext?.index ? "default" : "secondary"} >
                                     {p.name}
                                 </Label>

+ 5 - 3
src/helper/userHelper.ts

@@ -50,8 +50,9 @@ export default class UserHelper {
     public static afterLogin<T = any>(options: {
         toLoginPage?: boolean,
         callbackBeforeRoute?: boolean,
-    } & Omit<ILoginParms<T>, "callbackBeforeRoute">) {
-        const { toLoginPage = true, callback, callbackBeforeRoute = false, page, params } = options;
+        pop?: boolean
+    } & Omit<ILoginParms<T>, "callbackBeforeRoute" | "pop">) {
+        const { toLoginPage = true, callback, callbackBeforeRoute = false, pop = true, page, params } = options;
         this.callback = callback;
         if (UserHelper.isLogin()) {
             callback?.();
@@ -61,7 +62,8 @@ export default class UserHelper {
                 params: {
                     page: page,
                     params,
-                    callbackBeforeRoute: callbackBeforeRoute ? 1 : 0
+                    callbackBeforeRoute: callbackBeforeRoute ? 1 : 0,
+                    pop: pop ? 1 : 0
                 }
             });
         }

+ 2 - 6
src/pages/bottomNavBar/index.tsx

@@ -1,16 +1,12 @@
-import { PropsWithChildren, useContext, useState } from 'react';
+import { useState } from 'react';
 import Home from '../home';
 import Mine from '../user/mine';
 import BottomBarContext from '@/context/bottomBarContext';
 import useStore from '@/hooks/useRedux';
 
-interface IBottomNavBarProps {
 
-}
-
-const BottomNavBar = (props: PropsWithChildren<IBottomNavBarProps>) => {
+const BottomNavBar = () => {
     const [index, setIndex] = useState(0);
-    const bottomBarContext = useContext(BottomBarContext);
     const menu = useStore(p => p.tabMenu);
     return (
         <BottomBarContext.Provider value={{

+ 13 - 11
src/pages/home/index.scss

@@ -19,34 +19,36 @@
     }
 
     .index-back-se {
-        font-size: 24px;
-        font-weight: 200;
+        font-size: 28px;
+        font-weight: 400;
     }
-    
-    .index-iocn-title{
+
+    .index-iocn-title {
         width: 220px;
-        height: 40px;
+        height: 44px;
     }
 
     .index-back-amount {
-        font-size: 70px;
+        font-size: 80px;
+        font-weight: 500;
     }
 
     .index-back-btn {
         width: 354px;
-        // height: 84px;
-        padding: 16px 0;
+        height: 84px;
     }
-    .index-process-img{
+
+    .index-process-img {
         width: 104px;
         height: 104px;
     }
 
-    .background-content-i{
+    .background-content-i {
         width: 40px;
         height: 40px;
     }
-    .background-content-wrap{
+
+    .background-content-wrap {
         padding: 24px;
     }
 }

+ 4 - 5
src/pages/home/index.tsx

@@ -52,7 +52,7 @@ import './index.scss'
 const Home = () => {
     const appContext = useContext(AppContext);
     const { screenWidth } = appContext.systemInfo!;
-   
+
     const indexInfoResult = useRequest(() => {
         return UserApi.getIndexInfoUsingPost({
             params: { appId: APPConfig.APPID }
@@ -88,15 +88,14 @@ const Home = () => {
                             <Label className='index-back-amount' >200,000.00</Label>
                             <Button onClick={() => {
                                 UserHelper.afterLogin({
-                                    callbackBeforeRoute: true,
+                                    pop: false,
                                     callback: async () => {
                                         indexInfoResult.data && RouteUtil.toWebViewPage({
-                                            // url: "http://localhost:8080/br/chengyr"
                                             url: indexInfoResult.data.link,
-                                        })
+                                        }, { replace: true })
                                     }
                                 })
-                            }} className='index-back-btn' color="white" fill >{indexInfoResult.data?.name||"立即申请"}</Button>
+                            }} className='index-back-btn' color="white" fill >{indexInfoResult.data?.name || "立即申请"}</Button>
                         </Flex>
                     </View>
                 </Padding>

+ 6 - 3
src/pages/user/login/index.tsx

@@ -23,7 +23,8 @@ export interface ILoginParms<T = any> {
     page?: IRoutesUrls,
     params?: T;
     /**回调函数是否先于路由动作之前执行 */
-    callbackBeforeRoute?: number
+    callbackBeforeRoute?: number;
+    pop?: number;
 }
 
 export class LoginCallback {
@@ -40,6 +41,7 @@ const Login = (props: PropsWithChildren<ILoginProps>) => {
             UserHelper.callback = undefined;
         }
     })
+    const { pop = 1 } = params;
     return (
         <Layout className='login' >
             <Flex className='login-back' >
@@ -51,13 +53,14 @@ const Login = (props: PropsWithChildren<ILoginProps>) => {
                 <Padding padding={EdgeInsets.symmetric({ horizontal: 80 })} >
                     <Flex alignItem='center' rowGap={12} >
                         <Button openType="getPhoneNumber" onGetPhoneNumber={async (e) => {
+                            console.log(5555,pop);
                             if (e.detail.code && await UserHelper.userWxLogin(e.detail.code) === true) {
                                 if (params.callbackBeforeRoute?.toString() === "1") {
                                     if (params.page) {
                                         RouteUtil.replace(params.page, { params: params.params });
                                     }
                                     else {
-                                        RouteUtil.pop();
+                                       +pop && RouteUtil.pop();
                                     }
                                 }
 
@@ -69,7 +72,7 @@ const Login = (props: PropsWithChildren<ILoginProps>) => {
                                         RouteUtil.replace(params.page, { params: params.params });
                                     }
                                     else {
-                                        RouteUtil.pop();
+                                        +pop && RouteUtil.pop();
                                     }
                                 }
                             }

+ 3 - 2
src/utils/routeUtil.ts

@@ -38,8 +38,9 @@ export default class RouteUtil {
 
     }
 
-    public static toWebViewPage(options: IWebViewParams) {
+    public static toWebViewPage(options: IWebViewParams, obj?: { replace: boolean }) {
+        const { replace } = obj || {};
         options.url = encodeURIComponent(options.url);
-        RouteUtil.push<IWebViewParams>("/pages/webView/index", { params: options })
+        RouteUtil[replace ? "replace" : "push"]<IWebViewParams>("/pages/webView/index", { params: options })
     }
 }