李志伟 3 år sedan
förälder
incheckning
0b2e620552

+ 2
- 2
src/components/CustomNav/index.jsx Visa fil

7
 import { View } from '@tarojs/components'
7
 import { View } from '@tarojs/components'
8
 
8
 
9
 export default (props) => {
9
 export default (props) => {
10
-  const { logo, title = '首页', home, noback } = props
10
+  const { logo,home, login, title = '首页', noback,goBack } = props
11
 
11
 
12
   // 菜单胶囊
12
   // 菜单胶囊
13
   const menuBound = useMemo(() => Taro.getMenuButtonBoundingClientRect(), [])
13
   const menuBound = useMemo(() => Taro.getMenuButtonBoundingClientRect(), [])
66
           {
66
           {
67
             !logo && !home && (
67
             !logo && !home && (
68
               !noback && (
68
               !noback && (
69
-                <View style={{ width: '100%', height: '100%' }} onClick={handleAction}>
69
+                <View style={{ width: '100%', height: '100%' }} onClick={!login?handleAction:goBack}>
70
                   <image className='goback' src={goback} />
70
                   <image className='goback' src={goback} />
71
                 </View>
71
                 </View>
72
               )
72
               )

src/pages/login/index.jsx → src/components/LoginModel/index.jsx Visa fil

1
 import Taro from "@tarojs/taro"
1
 import Taro from "@tarojs/taro"
2
 import { useState } from "react"
2
 import { useState } from "react"
3
 import { useModel } from '@/store'
3
 import { useModel } from '@/store'
4
-import { View, Image, Input, Text, Checkbox, Label, Button } from "@tarojs/components"
4
+import { View, Image, Input, Text, Button } from "@tarojs/components"
5
 import CustomNav from "@/components/CustomNav"
5
 import CustomNav from "@/components/CustomNav"
6
-import withLayout from '@/layouts'
7
 import MyButton from "@/components/MyButton"
6
 import MyButton from "@/components/MyButton"
8
 import {updatePhone, setQcode } from '@/services/login'
7
 import {updatePhone, setQcode } from '@/services/login'
9
 import bgi from '@/assets/login/loginImg.png'
8
 import bgi from '@/assets/login/loginImg.png'
13
 
12
 
14
 import './style.less'
13
 import './style.less'
15
 
14
 
16
-export default withLayout((props) => {
15
+export default (props) => {
16
+  const {path,close} = props
17
   const { person,setPerson } = useModel('person')
17
   const { person,setPerson } = useModel('person')
18
 
18
 
19
   const [agreement,setAgreement]=useState(false)
19
   const [agreement,setAgreement]=useState(false)
90
           icon: 'none',
90
           icon: 'none',
91
           duration: 1000
91
           duration: 1000
92
         })
92
         })
93
-        Taro.navigateBack({ detail:1 });
93
+        close()
94
+        Taro.navigateTo({url:path})
94
       }).catch((e) => {
95
       }).catch((e) => {
95
         Taro.showToast({
96
         Taro.showToast({
96
           title: '手机号或者验证码不正确',
97
           title: '手机号或者验证码不正确',
106
     }
107
     }
107
   }
108
   }
108
   return (
109
   return (
109
-    <View className='page-index'>
110
+    <View className='page-index' style={{position:'absolute', zIndex:9999}}>
110
       <View className='index-navbar'>
111
       <View className='index-navbar'>
111
-        <CustomNav home title='登录' />
112
+        <CustomNav login title='登录' goBack={close} />
112
       </View>
113
       </View>
113
       <Image src={bgi} className='loginBgi' />
114
       <Image src={bgi} className='loginBgi' />
114
       <View className='index-container loginContent'>
115
       <View className='index-container loginContent'>
135
       </View>
136
       </View>
136
     </View>
137
     </View>
137
   )
138
   )
138
-})
139
+}

src/pages/login/style.less → src/components/LoginModel/style.less Visa fil

4
   position: absolute;
4
   position: absolute;
5
   top: 0;
5
   top: 0;
6
 }
6
 }
7
+.goback{
8
+  width: 19px;
9
+  height: 35px;
10
+  position: absolute;
11
+  left: 30px;
12
+  top: 67.5px;
13
+}
7
 .loginContent{
14
 .loginContent{
8
   padding: 60px 30px;
15
   padding: 60px 30px;
9
   color: #333333;
16
   color: #333333;
10
   font-weight: bold;
17
   font-weight: bold;
18
+  input{
19
+    font-size: 34px;
20
+  }
11
   .title1{
21
   .title1{
12
     padding: 40px 0;
22
     padding: 40px 0;
13
     font-size: 66px;
23
     font-size: 66px;

+ 2
- 8
src/components/MyCard/index.jsx Visa fil

6
 import './style.less'
6
 import './style.less'
7
 
7
 
8
 export default (props) => {
8
 export default (props) => {
9
-  const { detail, order, job, onClick } = props
10
-  const handleDetail = () => {
11
-    Taro.navigateTo({ url: '/pages/orderDetail/index' });
12
-  }
13
-  const handleClick = () => {
14
-    Taro.navigateTo({ url: '/pages/orderDetail/index' });
15
-  }
9
+  const { detail, order, job, onClick,handleDetail } = props
16
   return (
10
   return (
17
     <View className='card'>
11
     <View className='card'>
18
       <Jianbian status='1' />
12
       <Jianbian status='1' />
19
       <View className='cardHead'>
13
       <View className='cardHead'>
20
         {
14
         {
21
-          job && <MyCell header='需求时间' job action='详情>>' handleAction={handleClick}>2022-06-02</MyCell>
15
+          job && <MyCell header='需求时间' job action='详情>>' handleAction={handleDetail}>2022-06-02</MyCell>
22
         }
16
         }
23
         {
17
         {
24
           !job && <>
18
           !job && <>

+ 1
- 12
src/layouts/index.jsx Visa fil

1
 
1
 
2
 import Taro from '@tarojs/taro'
2
 import Taro from '@tarojs/taro'
3
-import { useEffect , useMemo } from 'react'
3
+import { useMemo } from 'react'
4
 import useRouter from '@/utils/hooks/useRouter'
4
 import useRouter from '@/utils/hooks/useRouter'
5
-import useLogin from '@/utils/hooks/useLogin'
6
 import Spin from "@/components/Spin";
5
 import Spin from "@/components/Spin";
7
 import { useModel } from '@/store'
6
 import { useModel } from '@/store'
8
 
7
 
13
   
12
   
14
   const location = Taro.getStorageSync('location')
13
   const location = Taro.getStorageSync('location')
15
 
14
 
16
-  const { hasPhone } = useLogin()
17
-
18
-
19
-  // Taro.useReady(()=>{
20
-  //   useLogin(person,router)
21
-  // })
22
-  // useEffect(()=>{
23
-  //   useLogin(person,router)
24
-  // },[person, person?.phone, router, router?.path])
25
-
26
   // 确保执行过 login 方法,拿到了 person
15
   // 确保执行过 login 方法,拿到了 person
27
   const isLoged = useMemo(() => !!person?.personId, [person?.personId])
16
   const isLoged = useMemo(() => !!person?.personId, [person?.personId])
28
 
17
 

+ 8
- 4
src/pages/index/components/Job/index.jsx Visa fil

1
+import Taro from "@tarojs/taro";
1
 import { View, ScrollView, Image, Button } from "@tarojs/components"
2
 import { View, ScrollView, Image, Button } from "@tarojs/components"
2
 import MyCard from "@/components/MyCard"
3
 import MyCard from "@/components/MyCard"
3
 import { Popup } from "@antmjs/vantui";
4
 import { Popup } from "@antmjs/vantui";
17
     console.log('开始作业')
18
     console.log('开始作业')
18
     setShow(false)
19
     setShow(false)
19
   }
20
   }
21
+  const handleDetail = () => {
22
+    Taro.navigateTo({ url: '/pages/orderDetail/index' });
23
+  }
20
   return (
24
   return (
21
     <ScrollView scrollY style={{ height: '100%' }}>
25
     <ScrollView scrollY style={{ height: '100%' }}>
22
-      <MyCard job onClick={handleChange} />
23
-      <MyCard job onClick={handleChange} />
24
-      <MyCard job onClick={handleChange} />
25
-      <MyCard job onClick={handleChange} />
26
+      <MyCard job onClick={handleChange} handleDetail={handleDetail} />
27
+      <MyCard job onClick={handleChange} handleDetail={handleDetail} />
28
+      <MyCard job onClick={handleChange} handleDetail={handleDetail} />
29
+      <MyCard job onClick={handleChange} handleDetail={handleDetail} />
26
       <Popup
30
       <Popup
27
         show={show}
31
         show={show}
28
         onClose={onClose}
32
         onClose={onClose}

+ 15
- 7
src/pages/index/components/order/index.jsx Visa fil

4
 import positionImg from '@/assets/comm/position.png'
4
 import positionImg from '@/assets/comm/position.png'
5
 import searchImg from '@/assets/comm/search.png'
5
 import searchImg from '@/assets/comm/search.png'
6
 import orderImg from '@/assets/comm/orderList.png'
6
 import orderImg from '@/assets/comm/orderList.png'
7
+import LoginModel from "@/components/LoginModel";
7
 import Footer from "@/components/Footer";
8
 import Footer from "@/components/Footer";
8
 import MyCard from "@/components/MyCard";
9
 import MyCard from "@/components/MyCard";
10
+import { useModel } from "@/store";
9
 
11
 
10
 
12
 
11
 import { getBannerList } from "@/services/banner";
13
 import { getBannerList } from "@/services/banner";
12
 import './style.less'
14
 import './style.less'
13
 
15
 
14
 
16
 
15
-export default () => {
16
-  const [imgList, setImgList] = useState([])
17
+export default (props) => {
18
+  const {handleMore,handleDetail}=props
19
+  const [imgList, setImgList] = useState([])  
20
+  const [show, setShow] = useState(false)
21
+  const [path, setPath] = useState()
22
+  const { person } = useModel('person')
23
+
17
   const handleSearch = (e) => {
24
   const handleSearch = (e) => {
18
     console.log(e.detail.value)
25
     console.log(e.detail.value)
19
   }
26
   }
20
-  const handleMore = () => {
21
-    Taro.navigateTo({ url: '/pages/moreOrder/index' });
22
-  }
27
+  
23
   useEffect(() => {
28
   useEffect(() => {
24
     getBannerList({ position: 'bannerWorker' })
29
     getBannerList({ position: 'bannerWorker' })
25
       .then(res => {
30
       .then(res => {
33
   }, [])
38
   }, [])
34
   return (
39
   return (
35
     <View className='orderIndex'>
40
     <View className='orderIndex'>
41
+      {
42
+        show && <LoginModel path={path} close={() => setShow(false)} />
43
+      }
36
       <View className='top'>
44
       <View className='top'>
37
         <View className='left'>
45
         <View className='left'>
38
           <Image src={positionImg} className='pImg' />
46
           <Image src={positionImg} className='pImg' />
65
             <Text className='more' onClick={handleMore}>更多>></Text>
73
             <Text className='more' onClick={handleMore}>更多>></Text>
66
           </View>
74
           </View>
67
 
75
 
68
-          <MyCard order />
69
-          <MyCard order />
76
+          <MyCard order handleDetail={handleDetail} />
77
+          <MyCard order handleDetail={handleDetail} />
70
           <Footer />
78
           <Footer />
71
         </View>
79
         </View>
72
       </ScrollView>
80
       </ScrollView>

+ 43
- 17
src/pages/index/index.jsx Visa fil

1
-import Taro from "@tarojs/taro";
1
+import Taro, { useDidShow } from "@tarojs/taro";
2
 import { useState, useEffect } from "react";
2
 import { useState, useEffect } from "react";
3
 import { View, Image } from "@tarojs/components"
3
 import { View, Image } from "@tarojs/components"
4
 import indexImg from "@/assets/comm/index.png";
4
 import indexImg from "@/assets/comm/index.png";
8
 import user from "@/assets/comm/user.png";
8
 import user from "@/assets/comm/user.png";
9
 import userActive from "@/assets/comm/userActive.png";
9
 import userActive from "@/assets/comm/userActive.png";
10
 import CustomNav from "@/components/CustomNav";
10
 import CustomNav from "@/components/CustomNav";
11
-import {setAmap} from '@/services/amap'
11
+import { setAmap } from '@/services/amap'
12
 import withLayout from '@/layouts'
12
 import withLayout from '@/layouts'
13
 import { useModel } from "@/store";
13
 import { useModel } from "@/store";
14
+import LoginModel from "@/components/LoginModel";
14
 import Order from './components/Order'
15
 import Order from './components/Order'
15
 import Job from './components/Job'
16
 import Job from './components/Job'
16
 import User from "./components/User";
17
 import User from "./components/User";
17
 import "./index.less";
18
 import "./index.less";
18
 
19
 
20
+
19
 export default withLayout((props) => {
21
 export default withLayout((props) => {
20
-  const {person}=useModel('person')
22
+  const { person } = useModel('person')
21
   const { router } = props
23
   const { router } = props
22
   let { tab } = router.params
24
   let { tab } = router.params
23
-  const { location,setLocation } = useModel('location')
25
+  const { location, setLocation } = useModel('location')
24
   const [currentTab, setCurrentTab] = useState(0);
26
   const [currentTab, setCurrentTab] = useState(0);
27
+  const [show, setShow] = useState(false)
28
+  const [path, setPath] = useState()
25
   const handleClick = (val) => {
29
   const handleClick = (val) => {
26
-    if (!person.phone) {
27
-      Taro.navigateTo({ url: '/pages/login/index' });
28
-    }      
30
+    if (!person.phone && val != 0) {
31
+      setPath(`/pages/index/index?tab=${val}`)
32
+      setShow(true)
33
+      return
34
+    }
29
     setCurrentTab(val);
35
     setCurrentTab(val);
30
   };
36
   };
31
-  useEffect(() => {  
32
-    if(!location){
37
+  const handleMore = () => {
38
+    if (!person.phone) {
39
+      setPath(`/pages/moreOrder/index`)
40
+      setShow(true)
41
+      return
42
+    }
43
+    Taro.navigateTo({ url: '/pages/moreOrder/index' });
44
+  }
45
+  const handleDetail = () => {
46
+    if (!person.phone) {
47
+      setPath(`/pages/orderDetail/index`)
48
+      setShow(true)
49
+      return
50
+    }
51
+    Taro.navigateTo({ url: '/pages/orderDetail/index' });
52
+  }
53
+  useEffect(() => {
54
+    if (!location) {
33
       Taro.getLocation({
55
       Taro.getLocation({
34
-        type:'gcj02',
35
-        success:function(res){
36
-          setLocation(res.longitude+','+res.latitude)
37
-          setAmap({params:'location='+res.longitude+','+res.latitude,path: '/v3/geocode/regeo'})
38
-        }})
56
+        type: 'gcj02',
57
+        success: function (res) {
58
+          setLocation(res.longitude + ',' + res.latitude)
59
+          setAmap({ params: 'location=' + res.longitude + ',' + res.latitude, path: '/v3/geocode/regeo' })
60
+        }
61
+      })
39
     } else {
62
     } else {
40
-      setAmap({params:'location='+location,path: '/v3/geocode/regeo'})
63
+      setAmap({ params: 'location=' + location, path: '/v3/geocode/regeo' })
41
     }
64
     }
42
-    
65
+
43
     if (tab) {
66
     if (tab) {
44
       setCurrentTab(tab - 0)
67
       setCurrentTab(tab - 0)
45
     }
68
     }
46
   }, [tab])
69
   }, [tab])
47
   return (
70
   return (
48
     <View className='page-index'>
71
     <View className='page-index'>
72
+      {
73
+        show && <LoginModel path={path} close={() => setShow(false)} />
74
+      }
49
       <View className='index-navbar'>
75
       <View className='index-navbar'>
50
         <CustomNav home title={currentTab === 0 ? '首页' : currentTab === 1 ? '作业管理' : '我的'} />
76
         <CustomNav home title={currentTab === 0 ? '首页' : currentTab === 1 ? '作业管理' : '我的'} />
51
       </View>
77
       </View>
52
       <View className='index-container'>
78
       <View className='index-container'>
53
-        {currentTab === 0 && <Order />}
79
+        {currentTab === 0 && <Order handleMore={handleMore} handleDetail={handleDetail} /> }
54
         {currentTab === 1 && <Job />}
80
         {currentTab === 1 && <Job />}
55
         {currentTab === 2 && <User />}
81
         {currentTab === 2 && <User />}
56
       </View>
82
       </View>

+ 0
- 7
src/pages/login/index.config.js Visa fil

1
-export default {
2
-  navigationBarTitleText: '登录',
3
-  navigationStyle: 'custom',
4
-  styleIsolation: 'shared',
5
-  enableShareAppMessage: true,
6
-  disableScroll: true,
7
-}

+ 4
- 4
src/pages/machineryList/index.jsx Visa fil

14
   const goDetail = (val) => {
14
   const goDetail = (val) => {
15
     Taro.navigateTo({ url: `/pages/machineryDetail/index?id=${val}` });
15
     Taro.navigateTo({ url: `/pages/machineryDetail/index?id=${val}` });
16
   }
16
   }
17
-  const goMap = () => {
18
-    Taro.navigateTo({ url: '/pages/machineryMap/index' });
17
+  const goMap = (val) => {
18
+    Taro.navigateTo({ url: `/pages/machineryMap/index?id=${val}` });
19
   }
19
   }
20
   useEffect(() => {
20
   useEffect(() => {
21
     getMachineryList({ location: location }).then((res) => {
21
     getMachineryList({ location: location }).then((res) => {
22
       setMachinery(res.records)
22
       setMachinery(res.records)
23
     })
23
     })
24
-  }, [])
24
+  }, [location])
25
   return (
25
   return (
26
     <View className='page-index'>
26
     <View className='page-index'>
27
       <View className='index-navbar'>
27
       <View className='index-navbar'>
31
         <ScrollView scrollY style={{ height: '100%' }}>
31
         <ScrollView scrollY style={{ height: '100%' }}>
32
           {
32
           {
33
             machinery?.map((item) => {
33
             machinery?.map((item) => {
34
-              return <MachineryCard value={item} onClick={() => goDetail(item.machineryId)} goMap={() => goMap()} />
34
+              return <MachineryCard value={item} key={item.machineryId} onClick={() => goDetail(item.machineryId)} goMap={() => goMap(item.machineryId)} />
35
             })
35
             })
36
           }
36
           }
37
         </ScrollView>
37
         </ScrollView>

+ 20
- 0
src/pages/machineryMap/Model/index.jsx Visa fil

1
+import { View, Image } from "@tarojs/components"
2
+import picon from '@/assets/comm/position.png'
3
+import './style.less'
4
+
5
+export default (props) => {
6
+  const { value,visible, goDetail, goList } = props
7
+  return (
8
+    <View className='showModel' style={{visibility:visible?'inherit':'hidden'}}>
9
+      <View className='goList' onClick={goList}>{'<'}{'<'} 农机列表</View>
10
+      <View className='title'>
11
+        <View className='name'>{value?.name}</View>
12
+        <View className='action' onClick={() => goDetail(value?.machineryId)}>详情 {">"}{">"}</View>
13
+      </View>
14
+      <View className='position'>
15
+        <Image src={picon} className='picon' />
16
+        当前位置:&nbsp;&nbsp;邓州市陈楼
17
+      </View>
18
+    </View>
19
+  )
20
+}

+ 37
- 0
src/pages/machineryMap/Model/style.less Visa fil

1
+.showModel{
2
+  position: absolute;
3
+  bottom: 0;
4
+  width: 100%;
5
+  box-sizing: border-box;
6
+  background: #FFFFFF;
7
+  border-radius: 40px 40px 0px 0px;
8
+  padding: 60px 30px;
9
+  font-weight: bold;
10
+  font-size: 30px;
11
+  color: #222222;
12
+  .goList{
13
+    color: #666666;
14
+  }
15
+  .title{
16
+    display: flex;
17
+    align-items: center;
18
+    margin:60px 0 40px;
19
+    .name{
20
+      font-size: 36px;
21
+    }
22
+    .action{
23
+      color: #666666;
24
+      position: absolute;
25
+      right: 30px;
26
+    }
27
+  }
28
+  .position{
29
+    display: flex;
30
+    align-items: center;
31
+    .picon{
32
+      width: 34px;
33
+      height: 34px;
34
+      margin-right: 16px;    
35
+    }
36
+  }
37
+}

+ 27
- 20
src/pages/machineryMap/index.jsx Visa fil

5
 import { getMachineryList } from '@/services/machinery'
5
 import { getMachineryList } from '@/services/machinery'
6
 import { useModel } from "@/store"
6
 import { useModel } from "@/store"
7
 import CustomNav from "@/components/CustomNav"
7
 import CustomNav from "@/components/CustomNav"
8
+import MachineryModel from './Model'
8
 import m1 from '@/assets/machinery/greenMachinery.png'
9
 import m1 from '@/assets/machinery/greenMachinery.png'
9
 import m2 from '@/assets/machinery/orangeMachinery.png'
10
 import m2 from '@/assets/machinery/orangeMachinery.png'
10
-import picon from '@/assets/comm/position.png'
11
 import './style.less'
11
 import './style.less'
12
 
12
 
13
 
13
 
14
-export default withLayout((props) => {
14
+export default withLayout((props) => {  
15
+  const { router } = props
16
+  const { id } = router.params
15
   const [show, setShow] = useState(false)
17
   const [show, setShow] = useState(false)
16
   const { location } = useModel('location')
18
   const { location } = useModel('location')
17
   const [machineryList, setMachineryList] = useState([])
19
   const [machineryList, setMachineryList] = useState([])
18
   const [markerList, setMarkerList] = useState([])
20
   const [markerList, setMarkerList] = useState([])
19
   const [current, setCurrent] = useState()
21
   const [current, setCurrent] = useState()
22
+  const [lot,setLot]=useState(112.106514)
23
+  const [lat,setLat]=useState(32.685927)
20
 
24
 
21
   const locList = [
25
   const locList = [
22
     {
26
     {
70
   const goList = () => {
74
   const goList = () => {
71
     Taro.navigateTo({ url: '/pages/machineryList/index' });
75
     Taro.navigateTo({ url: '/pages/machineryList/index' });
72
   }
76
   }
77
+  const changeRegion=()=>{
78
+    setShow(false)
79
+  }
80
+  useEffect(()=>{
81
+    if (id&&machineryList&&markerList.length!=0) {
82
+      machineryList.forEach((item,index)=>{
83
+        if(item.machineryId==id){ 
84
+          setLot(markerList[index].longitude)
85
+          setLat(markerList[index].latitude)
86
+          setCurrent(machineryList[index])
87
+          setShow(true)
88
+          return
89
+        }
90
+      })
91
+    }
92
+  },[id, machineryList, markerList])
73
   useEffect(() => {
93
   useEffect(() => {
74
     getMachineryList({ location: location }).then((res) => {
94
     getMachineryList({ location: location }).then((res) => {
75
       setMachineryList(res.records)
95
       setMachineryList(res.records)
85
       }))
105
       }))
86
     })
106
     })
87
   }, [])
107
   }, [])
108
+
88
   return (
109
   return (
89
     <View className='page-index'>
110
     <View className='page-index'>
90
       <View className='index-navbar'>
111
       <View className='index-navbar'>
92
       </View>
113
       </View>
93
       <View className='index-container machineryMap'>
114
       <View className='index-container machineryMap'>
94
         <Map
115
         <Map
95
-          longitude={112.092716}
96
-          latitude={32.681642}
116
+          longitude={lot}
117
+          latitude={lat}
97
           markers={markerList}
118
           markers={markerList}
98
           className='map'
119
           className='map'
99
           onMarkerTap={handleClick}
120
           onMarkerTap={handleClick}
100
-          onRegionChange={() => setShow(false)}
121
+          onRegionChange={changeRegion}
101
         />
122
         />
102
-        {
103
-          show &&
104
-          <View className='showModel'>
105
-            <View className='goList' onClick={goList}>{'<'}{'<'} 农机列表</View>
106
-            <View className='title'>
107
-              <View className='name'>{current.name}</View>
108
-              <View className='action' onClick={() => goDetail(current.machineryId)}>详情 {">"}{">"}</View>
109
-            </View>
110
-            <View className='position'>
111
-              <Image src={picon} className='picon' />
112
-              当前位置:&nbsp;&nbsp;邓州市陈楼
113
-            </View>
114
-          </View>
115
-        }
116
-
123
+        <MachineryModel visible={show} value={current} goDetail={goDetail} goList={goList} />
117
       </View>
124
       </View>
118
     </View>
125
     </View>
119
   )
126
   )

+ 0
- 37
src/pages/machineryMap/style.less Visa fil

4
     width: 100vw;
4
     width: 100vw;
5
     height: 100%;
5
     height: 100%;
6
   }  
6
   }  
7
-  .showModel{
8
-    position: absolute;
9
-    bottom: 0;
10
-    width: 100%;
11
-    box-sizing: border-box;
12
-    background: #FFFFFF;
13
-    border-radius: 40px 40px 0px 0px;
14
-    padding: 60px 30px;
15
-    font-weight: bold;
16
-    font-size: 30px;
17
-    color: #222222;
18
-    .goList{
19
-      color: #666666;
20
-    }
21
-    .title{
22
-      display: flex;
23
-      align-items: center;
24
-      margin:60px 0 40px;
25
-      .name{
26
-        font-size: 36px;
27
-      }
28
-      .action{
29
-        color: #666666;
30
-        position: absolute;
31
-        right: 30px;
32
-      }
33
-    }
34
-    .position{
35
-      display: flex;
36
-      align-items: center;
37
-      .picon{
38
-        width: 34px;
39
-        height: 34px;
40
-        margin-right: 16px;    
41
-      }
42
-    }
43
-  }
44
 }
7
 }

+ 0
- 4
src/routes.js Visa fil

14
     title: '详情',
14
     title: '详情',
15
     page: 'pages/orderDetail/index',
15
     page: 'pages/orderDetail/index',
16
   },
16
   },
17
-  {
18
-    title: '登录',
19
-    page: 'pages/login/index',
20
-  },
21
   {
17
   {
22
     title: '农机列表',
18
     title: '农机列表',
23
     page: 'pages/machineryList/index',
19
     page: 'pages/machineryList/index',

+ 1
- 1
src/store/models/person.js Visa fil

9
   const login = (params) => {
9
   const login = (params) => {
10
     signIn(params).then((res) => {
10
     signIn(params).then((res) => {
11
       const { person: taPerson,  sessionKey: skey } = res;
11
       const { person: taPerson,  sessionKey: skey } = res;
12
-      // taPerson.phone=null
12
+      taPerson.phone=null
13
       setPerson(taPerson);
13
       setPerson(taPerson);
14
       setSessionKey(skey);
14
       setSessionKey(skey);
15
     })
15
     })

+ 0
- 46
src/utils/hooks/useLogin.js Visa fil

1
-import Taro, { useRouter, useDidShow } from "@tarojs/taro";
2
-import { useModel } from '@/store'
3
-import { useEffect , useMemo } from "react";
4
-
5
-const whiteList = [
6
-  "/pages/login/index",
7
-  "/pages/index/index"
8
-]
9
-
10
-export default () => {
11
-  const router = useRouter()
12
-  const {person} = useModel('person')
13
-
14
-  const isInWhiteList = useMemo(() => whiteList.includes(router.path), [router.path])
15
-  const hasPhone = useMemo(() => !!person?.phone, [person?.phone])
16
-
17
-  // 校验跳转
18
-  // useMemo(() => {
19
-    // if (!isInWhiteList && !hasPhone) {
20
-    //   Taro.navigateTo({ url: "/pages/login/index" });
21
-    // }
22
-  // }, [hasPhone, isInWhiteList])
23
-
24
-  // useDidShow(() => {
25
-  //   if (!isInWhiteList && !isLoged) {
26
-  //     Taro.navigateTo({ url: "/pages/login/index" });
27
-  //   }
28
-  // })
29
-
30
-  useEffect (() => {
31
-    if (!isInWhiteList && !hasPhone) {
32
-      Taro.navigateTo({ url: "/pages/login/index" });
33
-    }
34
-  }, [hasPhone, isInWhiteList])
35
-
36
-
37
-  // if (router.path === "/pages/login/index") {
38
-  //   return;
39
-  // }
40
-  // if (router.path !== "/pages/index/index" && !person?.phone) {
41
-  //   Taro.navigateTo({ url: "/pages/login/index" });
42
-  // }
43
-
44
-
45
-  return { hasPhone, isInWhiteList }
46
-};