李志伟 3 년 전
부모
커밋
d4de5eb8fc

+ 3
- 1
src/components/CustomNav/style.less 파일 보기

@@ -25,7 +25,9 @@
25 25
     &-content {
26 26
       flex: none;
27 27
       text-align: center;
28
-      font-size: 32px;
28
+      font-size: 34px;
29
+      font-weight: bold;
30
+      color: #333;
29 31
       cursor: none;
30 32
       pointer-events: none;
31 33
       text-overflow: ellipsis;

+ 7
- 0
src/components/MyButton/index.jsx 파일 보기

@@ -0,0 +1,7 @@
1
+import { View } from "@tarojs/components"
2
+import './style.less'
3
+
4
+export default (props) => {
5
+  const { value, onClick } = props
6
+  return <View className='myBtn' onClick={onClick}>{value}</View>
7
+}

+ 13
- 0
src/components/MyButton/style.less 파일 보기

@@ -0,0 +1,13 @@
1
+
2
+  .myBtn{
3
+    height: 94px;
4
+    font-size: 34px;
5
+    font-weight: bold;
6
+    line-height: 94px;
7
+    text-align: center;
8
+    color: #fff;
9
+    background: linear-gradient(0deg, #00AE39,#A0E067);
10
+    border-radius: 49px;
11
+    width: 100%;
12
+    margin: 25px 0 18px;
13
+  }

+ 8
- 4
src/components/MyCard/index.jsx 파일 보기

@@ -1,13 +1,17 @@
1 1
 import Taro from "@tarojs/taro"
2 2
 import { View, Text } from '@tarojs/components'
3 3
 import MyCell from "../MyCell"
4
+import MyButton from "../MyButton"
4 5
 import './style.less'
5 6
 
6 7
 export default (props) => {
7
-  const { detail, order, job,changeJob } = props
8
+  const { detail, order, job, onClick } = props
8 9
   const handleDetail = () => {
9 10
     Taro.navigateTo({ url: '/pages/orderDetail/index' });
10 11
   }
12
+  const handleClick = () => {
13
+    Taro.navigateTo({ url: '/pages/orderDetail/index' });
14
+  }
11 15
   return (
12 16
     <View className='card'>
13 17
       <View className='jianbian'>
@@ -15,7 +19,7 @@ export default (props) => {
15 19
       </View>
16 20
       <View className='cardHead'>
17 21
         {
18
-          job && <MyCell header='需求时间' job action='详情>>'>2022-06-02</MyCell>
22
+          job && <MyCell header='需求时间' job action='详情>>' handleAction={handleClick}>2022-06-02</MyCell>
19 23
         }
20 24
         {
21 25
           !job && <>
@@ -36,8 +40,8 @@ export default (props) => {
36 40
       }
37 41
       <MyCell header='作业时间'>上午06:00--晚上21:00</MyCell>
38 42
       {
39
-        job&&<View className='jobbtn' onClick={changeJob}>开始作业</View>
40
-      }      
43
+        job && <MyButton value='开始作业' onClick={onClick} />
44
+      }
41 45
       {
42 46
         order && <View className='line' />
43 47
       }

+ 0
- 12
src/components/MyCard/style.less 파일 보기

@@ -43,18 +43,6 @@
43 43
     opacity: 0.1;
44 44
     margin: 15.5px 0;
45 45
   }
46
-  .jobbtn{
47
-    height: 94px;
48
-    font-size: 34px;
49
-    font-weight: bold;
50
-    line-height: 94px;
51
-    text-align: center;
52
-    color: #fff;
53
-    background: linear-gradient(0deg, #A0E067, #00AE39);
54
-    border-radius: 49px;
55
-    width: 100%;
56
-    margin: 25px 0 18px;
57
-  }
58 46
   .footer{
59 47
     width: 100%;
60 48
     text-align: center;

+ 19
- 12
src/components/MyCell/index.jsx 파일 보기

@@ -1,19 +1,26 @@
1 1
 import Taro from "@tarojs/taro"
2
-import { View } from "@tarojs/components"
2
+import { View,Image } from "@tarojs/components"
3 3
 import './style.less'
4 4
 
5 5
 export default (props) => {
6
-  const { job } = props
7
-  const handleClick = () => {
8
-    if (job) {
9
-      Taro.navigateTo({ url: '/pages/orderDetail/index' });
10
-    }
11
-  }
6
+  const { job, user, handleAction } = props
7
+  
12 8
   return (
13
-    <View className='Mycell'>
14
-      <View className='cell-header'>{props.header}</View>:
15
-      <View className='cell-body'>{props.children}</View>
16
-      <View className='cell-action' style={{marginRight:job?'30rpx':''}} onClick={handleClick}>{props.action}</View>
17
-    </View>
9
+    <View className='Mycell' onClick={user?handleAction:null}>
10
+      {
11
+        !user && <>
12
+          <View className='cell-header'>{props.header}</View>:
13
+          <View className='cell-body'>{props.children}</View>
14
+          <View className='cell-action' style={{ marginRight: job ? '30rpx' : '' }} onClick={handleAction}>{props.action}</View>
15
+        </>
16
+      }
17
+      {
18
+        user&&<>
19
+        <Image src={props.icon} className='cell-header-icon' />
20
+        <View className='cell-body-user'>{props.children}</View>
21
+        <Image className='cell-action-user' src={props.action} />
22
+      </>
23
+      }
24
+      </View>
18 25
   )
19 26
 }

+ 20
- 1
src/components/MyCell/style.less 파일 보기

@@ -6,7 +6,7 @@
6 6
   color: #606060;
7 7
   padding:18px 0;
8 8
 
9
-  .cell-header, .cell-action {
9
+  .cell-header, .cell-action,.cell-header-icon,.cell-action-user {
10 10
     flex: none;
11 11
   }
12 12
   .cell-header{
@@ -22,4 +22,23 @@
22 22
     line-height: 46px;
23 23
     word-break: break-all;
24 24
   }
25
+
26
+
27
+  .cell-header-icon{
28
+    width: 32px;
29
+    height: 38px;
30
+    margin-right: 23px;
31
+    position: relative;
32
+    top: 4px;
33
+  }
34
+  .cell-body-user{
35
+    color: #333333;
36
+    flex: 1;
37
+  }
38
+  .cell-action-user{
39
+    width: 21px;
40
+    height: 36px;  
41
+    position: relative;
42
+    top: 4px;
43
+  }
25 44
 }

+ 2
- 2
src/pages/index/components/Job/index.jsx 파일 보기

@@ -31,8 +31,8 @@ export default (props) => {
31 31
         <View>河南省南阳市邓州市孟楼镇</View>
32 32
         <Button className='btn' onClick={handleOk}>确认</Button>
33 33
       </Popup>
34
-      <MyCard job changeJob={handleChange} />
35
-      <MyCard job changeJob={handleChange} />
34
+      <MyCard job onClick={handleChange} />
35
+      <MyCard job onClick={handleChange} />
36 36
     </ScrollView>
37 37
   )
38 38
 }

+ 90
- 0
src/pages/index/components/User/index.jsx 파일 보기

@@ -0,0 +1,90 @@
1
+import { View, Image, ScrollView } from "@tarojs/components"
2
+import userBgi from '@/assets/user/userBgi.png'
3
+import avatar from '@/assets/user/defaultAvatar.png'
4
+import MyCell from "@/components/MyCell"
5
+import account from '@/assets/user/account.png'
6
+import aboutUs from '@/assets/user/aboutUs.png'
7
+import update from '@/assets/user/update.png'
8
+import feedback from '@/assets/user/feedback.png'
9
+import goto from '@/assets/user/goto.png'
10
+import machinery from '@/assets/user/machinery.png'
11
+import wallet from '@/assets/user/wallet.png'
12
+import bankCard from '@/assets/user/bankCard.png'
13
+import banner1 from '@/assets/banner/1.jpg'
14
+import './style.less'
15
+import { useState } from "react"
16
+
17
+export default (props) => {
18
+  const { isLogin } = props
19
+  const [islogin, setIsLogin] = useState(false)
20
+  const handleAccount = () => { console.log(5555) }
21
+  const handleAboutUs = () => { }
22
+  const handleUpdate = () => { }
23
+  const handleFeedback = () => { }
24
+  const handleLogin = () => { setIsLogin(true) }
25
+  const goMachinery = () => { }
26
+  const goWallet = () => { }
27
+  const goBank = () => { }
28
+  const signOut = () => { setIsLogin(false) }
29
+  return (
30
+    <ScrollView scrollY style={{ height: '100%' }}>
31
+      <View className='userHead'>
32
+        <Image src={userBgi} className='userBgi' />
33
+        <View className='headcontent' onClick={handleLogin}>
34
+          <Image src={islogin ? banner1 : avatar} className='avatar' />
35
+          {
36
+            islogin ? <View>
37
+              <View>张三</View>
38
+              <View>13612345678</View>
39
+            </View> : <View>点击登录</View>
40
+          }
41
+        </View>
42
+      </View>
43
+      {
44
+        islogin &&
45
+        <View className='userCard'>
46
+          <View
47
+            className='cardItem'
48
+            onClick={() => goMachinery()}
49
+          >
50
+            <Image className='cardImg' src={machinery}></Image>
51
+            <View className='text'>我的农机</View>
52
+          </View>
53
+          <View
54
+            className='cardItem'
55
+            onClick={() => goWallet()}
56
+          >
57
+            <Image className='cardImg' src={wallet}></Image>
58
+            <View className='text'>我的钱包</View>
59
+          </View>
60
+          <View
61
+            className='cardItem'
62
+            onClick={() => goBank()}
63
+          >
64
+            <Image className='cardImg' src={bankCard}></Image>
65
+            <View className='text'>我的银行卡</View>
66
+          </View>
67
+
68
+        </View>
69
+      }
70
+      <View className='userContent'>
71
+        <View className='userBox'>
72
+          <MyCell icon={account} action={goto} user handleAction={handleAccount} >账号与安全</MyCell>
73
+        </View>
74
+        <View className='userBox'>
75
+          <MyCell icon={aboutUs} action={goto} user handleAction={handleAboutUs}>关于我们</MyCell>
76
+        </View>
77
+        <View className='userBox'>
78
+          <MyCell icon={update} action={goto} user handleAction={handleUpdate}>版本更新</MyCell>
79
+        </View>
80
+        <View className='userBox'>
81
+          <MyCell icon={feedback} action={goto} user handleAction={handleFeedback}>意见反馈</MyCell>
82
+        </View>
83
+        {
84
+          islogin && <View className='signOut' onClick={signOut}>退出登录</View>
85
+        }
86
+      </View>
87
+
88
+    </ScrollView>
89
+  )
90
+}

+ 71
- 0
src/pages/index/components/User/style.less 파일 보기

@@ -0,0 +1,71 @@
1
+.userHead{
2
+  width: 100%;
3
+  height: 50vw;
4
+  .userBgi{
5
+    width: 100%;
6
+    height: 50vw;
7
+  }
8
+  .headcontent{
9
+    position: absolute;
10
+    top: calc(25vw - 63px);
11
+    display: flex;
12
+    align-items: center;
13
+    left: 90px;
14
+    font-size: 34px;
15
+    font-weight: 500;
16
+    color: #FFF;
17
+    text-shadow: 0px 2px 0px rgba(0, 0, 0, 0.4);
18
+    .avatar{
19
+      width: 126px;
20
+      height: 126px;
21
+      border-radius: 63px;
22
+      margin-right: 20px;
23
+    }
24
+    view+view{
25
+      margin-top: 38px;
26
+    }
27
+  }
28
+}
29
+.userContent{
30
+  padding: 0 30px;
31
+  .userBox{
32
+    box-shadow: 0px 2px 0px 0px rgba(0, 0, 0, 0.12);
33
+    padding: 20px 35px;
34
+  }
35
+  .signOut{
36
+    width: 100%;
37
+    height: 98px;
38
+    background: #F8F8F8;
39
+    border-radius: 49px;
40
+    font-size: 40px;
41
+    text-align: center;
42
+    line-height: 98px;
43
+    font-weight: bold;
44
+    color: #333333;
45
+    margin: 60px 0;
46
+  }
47
+}
48
+.userCard{
49
+  display: flex;
50
+  align-items: center;
51
+  text-align: center;
52
+  height: 202px;
53
+  box-shadow: 0px 0px 44px 0px rgba(0, 0, 0, 0.08);
54
+  border-radius: 40px;
55
+  margin:0 30px;
56
+  position: relative;
57
+  top: -30px;
58
+  background-color: #fff;
59
+  .cardItem{
60
+    flex: 1;
61
+    .cardImg{
62
+      width: 60px;
63
+      height: 60px;
64
+    }
65
+    .text{
66
+      font-size: 34px;
67
+      font-weight: bold;
68
+      color: #333333;
69
+    }
70
+  }
71
+}

+ 2
- 1
src/pages/index/index.jsx 파일 보기

@@ -10,6 +10,7 @@ import userActive from "@/assets/comm/userActive.png";
10 10
 import CustomNav from "@/components/CustomNav";
11 11
 import Order from './components/Order'
12 12
 import Job from './components/Job'
13
+import User from "./components/User";
13 14
 import "./index.less";
14 15
 
15 16
 export default (props) => {
@@ -26,7 +27,7 @@ export default (props) => {
26 27
       <View className='index-container'>
27 28
         {currentTab === 0 && <Order />}
28 29
         {currentTab === 1 && <Job />}
29
-        {currentTab === 2 && <View>999</View>}
30
+        {currentTab === 2 && <User />}
30 31
       </View>
31 32
       <View className='index-tabbar'>
32 33
         <View