[baozhangchao] 2 лет назад
Родитель
Сommit
6579b53504

+ 2
- 2
config/dev.js Просмотреть файл

@@ -3,8 +3,8 @@ module.exports = {
3 3
     NODE_ENV: '"development"'
4 4
   },
5 5
   defineConstants: {
6
-    // HOST: '"https://machine.njyunzhi.com"',
7
-    HOST: '"http://192.168.89.25:7080"',
6
+    HOST: '"https://machine.njyunzhi.com"',
7
+    // HOST: '"http://192.168.89.25:7080"',
8 8
     OSS: '""',
9 9
     // VERSION: '"2.0.33"',
10 10
   },

+ 1
- 1
src/components/CustomNav/index.jsx Просмотреть файл

@@ -47,8 +47,8 @@ export default (props) => {
47 47
 
48 48
   const handleAction = () => {
49 49
     if (home || logo) return;
50
-
51 50
     if (Taro.getCurrentPages().length > 1) {
51
+
52 52
       Taro.navigateBack({ delta: 1 })
53 53
     }
54 54
   }

+ 5
- 1
src/components/LoginModel/index.jsx Просмотреть файл

@@ -16,7 +16,7 @@ import './style.less'
16 16
 
17 17
 export default (props) => {
18 18
 
19
-  const { isLoginVisible, loginType } = props
19
+  const { isLoginVisible, loginType, tab } = props
20 20
 
21 21
   const { person, setPerson } = useModel('userData')
22 22
 
@@ -94,6 +94,8 @@ export default (props) => {
94 94
 
95 95
 
96 96
   const getUserLogin = () => {
97
+    Taro.navigateTo({ url: `/pages/index/index?tab=${tab}` });
98
+
97 99
     if (InputPhoneValue === '' || !(/^1[3456789]\d{9}$/.test(InputPhoneValue))) {
98 100
       console.log('提示')
99 101
       Taro.showToast({
@@ -115,9 +117,11 @@ export default (props) => {
115 117
           setPerson(e.person)
116 118
           // Taro.navigateTo({ url: path });
117 119
           if (loginType) {
120
+
118 121
             Taro.navigateBack({
119 122
               delta: 1
120 123
             })
124
+
121 125
           } else {
122 126
             myClosure()
123 127
 

+ 0
- 5
src/layouts/index.jsx Просмотреть файл

@@ -13,13 +13,8 @@ import useLogin from '@/utils/hooks/useLogin'
13 13
 export default (Child) => (props) => {
14 14
   const { person } = useModel('userData')
15 15
   const router = useRouter()
16
-  console.log("🚀 ~ file: index.jsx ~ line 16 ~ router", router)
17
-
18
-
19 16
   const { loginVisible } = useLogin()
20 17
 
21
-
22
-
23 18
   // 确保执行过 login 方法,拿到了 person
24 19
   const isLoged = useMemo(() => !!person?.personId, [person?.personId])
25 20
 

+ 2
- 2
src/pages/LoginPage/index.jsx Просмотреть файл

@@ -11,7 +11,7 @@ export default (props) => {
11 11
   const [isShow, setIsShow] = useState(false)
12 12
 
13 13
   const $instance = Taro.getCurrentInstance()
14
-  const { login } = $instance.router.params
14
+  const { login, tab } = $instance.router.params
15 15
 
16 16
   useEffect(() => {
17 17
     setIsShow(true)
@@ -20,7 +20,7 @@ export default (props) => {
20 20
   return (
21 21
     <View className='page-index'>
22 22
       <View>
23
-        <LoginModel isLoginVisible={isShow} loginType={login} />
23
+        <LoginModel isLoginVisible={isShow} loginType={login} tab={tab} />
24 24
       </View>
25 25
     </View>
26 26
   )

+ 8
- 23
src/pages/index/index.jsx Просмотреть файл

@@ -37,12 +37,8 @@ export default withLayout((props) => {
37 37
 
38 38
 
39 39
   console.log("🚀 ~ file: index.jsx ~ line 24 ~ withLayout ~ tab", tab)
40
-
41 40
   const [currentTab, setCurrentTab] = useState(0)
42
-
43 41
   const [isDidShow, setIsDidShow] = useState(0)
44
-
45
-
46 42
   const [tabsIndex, setTabsIndex] = useState(0)
47 43
 
48 44
 
@@ -51,44 +47,33 @@ export default withLayout((props) => {
51 47
 
52 48
 
53 49
   useDidShow(() => {
54
-    setIsDidShow(isDidShow + 1)
50
+    console.log('useDidShow',);
51
+
55 52
     if (!person?.phone) {
56 53
       console.log('还是未登录',);
57 54
       setCurrentTab(0)
58
-
59
-
60
-    } else {
61
-      setCurrentTab(tabsIndex)
62
-      // handleTabChange(tabsIndex)
63
-
64
-      console.log('已登陆',);
65
-
66 55
     }
67 56
   })
68 57
 
69 58
   useEffect(() => {
59
+    // setCurrentTab(index)
60
+
70 61
     if (tab) {
71 62
       setCurrentTab(tab - 0)
72
-
73
-
74 63
     }
75 64
     // setIsShow(true)
76 65
   }, [tab,])
77 66
 
78
-
79 67
   const handleClick = (index) => {
80 68
     // Taro.switchTab({
81 69
     //   url: '/pages/InformationPage/index'
82 70
     // })
83
-
84
-
85 71
     if (!person?.phone) {
86
-      setTabsIndex(index)
87
-      Taro.navigateTo({ url: `/pages/LoginPage/index?login=true` })
72
+      Taro.navigateTo({ url: `/pages/LoginPage/index?login=true&tab=${index}` })
88 73
       // setIsShow(true)
89 74
     } else {
90
-      setCurrentTab(index)
91
-
75
+      Taro.redirectTo({ url: `/pages/index/index?tab=${index}` });
76
+      // setCurrentTab(index)
92 77
     }
93 78
   }
94 79
 
@@ -106,7 +91,7 @@ export default withLayout((props) => {
106 91
         {currentTab === 1 && <Orders router={router} />}
107 92
         {currentTab === 2 && <Information router={router} />}
108 93
 
109
-        {currentTab === 3 && <Mine isDidShow={isDidShow} router={router} />}
94
+        {currentTab === 3 && <Mine router={router} />}
110 95
       </view>
111 96
       <view className='index-tabbar'>
112 97
         <View

+ 0
- 1
src/pages/index/tabs/Information.jsx Просмотреть файл

@@ -16,7 +16,6 @@ export default withLayout((props) => {
16 16
 
17 17
   const goInfoMationInfo = (res) => {
18 18
     Taro.navigateTo({ url: `/pages/InformationInfo/index?id=${res}` })
19
-
20 19
   }
21 20
   useEffect(() => {
22 21
     getNewsList().then((res) => {