李志伟 3 gadus atpakaļ
vecāks
revīzija
eb5506b473

+ 11
- 0
babel.config.js Parādīt failu

@@ -6,5 +6,16 @@ module.exports = {
6 6
       framework: 'react',
7 7
       ts: false
8 8
     }]
9
+  ],
10
+  "plugins": [
11
+    [
12
+      "import",
13
+      {
14
+        "libraryName": "@antmjs/vantui",
15
+        "libraryDirectory": "es",
16
+        "style": true
17
+      },
18
+      "@antmjs/vantui"
19
+    ]
9 20
   ]
10 21
 }

+ 2
- 0
package.json Parādīt failu

@@ -35,6 +35,7 @@
35 35
   ],
36 36
   "author": "",
37 37
   "dependencies": {
38
+    "@antmjs/vantui": "^1.5.1",
38 39
     "@babel/runtime": "^7.7.7",
39 40
     "@tarojs/components": "3.3.15",
40 41
     "@tarojs/react": "3.3.15",
@@ -49,6 +50,7 @@
49 50
     "@tarojs/webpack-runner": "3.3.15",
50 51
     "@types/react": "^17.0.2",
51 52
     "@types/webpack-env": "^1.13.6",
53
+    "babel-plugin-import": "^1.13.3",
52 54
     "babel-preset-taro": "3.3.15",
53 55
     "eslint": "^6.8.0",
54 56
     "eslint-config-taro": "3.3.15",

+ 49
- 0
src/components/MyCard/index.jsx Parādīt failu

@@ -0,0 +1,49 @@
1
+import Taro from "@tarojs/taro"
2
+import { View, Text } from '@tarojs/components'
3
+import MyCell from "../MyCell"
4
+import './style.less'
5
+
6
+export default (props) => {
7
+  const { detail, order, job,changeJob } = props
8
+  const handleDetail = () => {
9
+    Taro.navigateTo({ url: '/pages/orderDetail/index' });
10
+  }
11
+  return (
12
+    <View className='card'>
13
+      <View className='jianbian'>
14
+        <View className='text'>待作业</View>
15
+      </View>
16
+      <View className='cardHead'>
17
+        {
18
+          job && <MyCell header='需求时间' job action='详情>>'>2022-06-02</MyCell>
19
+        }
20
+        {
21
+          !job && <>
22
+            <MyCell header='需求时间'>2022-06-02</MyCell>
23
+            <Text className='price'><Text style={{ fontSize: '44rpx' }}>600</Text>元</Text>
24
+          </>
25
+        }
26
+      </View>
27
+      <View className='line' />
28
+      <MyCell header='农机名称'>收割机001</MyCell>
29
+      <MyCell header='下单人'>张三</MyCell>
30
+      {
31
+        detail && <MyCell header='手机号'>13613949434</MyCell>
32
+      }
33
+      <MyCell header='订单时间'>2022-03-08</MyCell>
34
+      {
35
+        detail && <MyCell header='服务地址'>河南省南阳市邓州市孟楼镇</MyCell>
36
+      }
37
+      <MyCell header='作业时间'>上午06:00--晚上21:00</MyCell>
38
+      {
39
+        job&&<View className='jobbtn' onClick={changeJob}>开始作业</View>
40
+      }      
41
+      {
42
+        order && <View className='line' />
43
+      }
44
+      {
45
+        order && <View className='footer' onClick={handleDetail}>详情{">"}{">"}</View>
46
+      }
47
+    </View>
48
+  )
49
+}

src/components/OrderCard/style.less → src/components/MyCard/style.less Parādīt failu

@@ -43,6 +43,18 @@
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
+  }
46 58
   .footer{
47 59
     width: 100%;
48 60
     text-align: center;

+ 8
- 2
src/components/MyCell/index.jsx Parādīt failu

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

+ 1
- 0
src/components/MyCell/style.less Parādīt failu

@@ -20,5 +20,6 @@
20 20
     flex: 1;
21 21
     color: #101010;
22 22
     line-height: 46px;
23
+    word-break: break-all;
23 24
   }
24 25
 }

+ 0
- 41
src/components/OrderCard/index.jsx Parādīt failu

@@ -1,41 +0,0 @@
1
-import Taro from "@tarojs/taro"
2
-import { View, Text } from '@tarojs/components'
3
-import MyCell from "../MyCell"
4
-import './style.less'
5
-
6
-export default (props) => {
7
-  const { detail } = props
8
-  const handleDetail = () => {
9
-    Taro.navigateTo({ url: '/pages/orderDetail/index' });
10
-  }
11
-  return (
12
-    <View className='card'>
13
-      <View className='jianbian'>
14
-        <View className='text'>待作业</View>
15
-      </View>
16
-      <View className='cardHead'>
17
-        <MyCell header='需求时间'>2022-06-02</MyCell>
18
-        <Text className='price'><Text style={{ fontSize: '44rpx' }}>600</Text>元</Text>
19
-      </View>
20
-      <View className='line' />
21
-      <View>
22
-        <MyCell header='农机名称'>收割机001</MyCell>
23
-        <MyCell header='下单人'>张三</MyCell>
24
-        {
25
-          detail && <MyCell header='手机号'>13613949434</MyCell>
26
-        }
27
-        <MyCell header='订单时间'>2022-03-08</MyCell>
28
-        {
29
-          detail && <MyCell header='服务地址'>河南省南阳市邓州市孟楼镇</MyCell>
30
-        }
31
-        <MyCell header='作业时间'>上午06:00--晚上21:00</MyCell>
32
-      </View> 
33
-      {
34
-        !detail && <View className='line' />
35
-      }
36
-      {
37
-        !detail && <View className='footer' onClick={handleDetail}>详情>></View>
38
-      }
39
-    </View>
40
-  )
41
-}

+ 38
- 0
src/pages/index/components/Job/index.jsx Parādīt failu

@@ -0,0 +1,38 @@
1
+import { View, ScrollView, Image, Button } from "@tarojs/components"
2
+import MyCard from "@/components/MyCard"
3
+import { Popup } from "@antmjs/vantui";
4
+import { useState } from "react";
5
+import PositionImg from '@/assets/job/positionImg.png'
6
+import './style.less'
7
+
8
+export default (props) => {
9
+  const [show, setShow] = useState(false)
10
+  const handleChange = () => {
11
+    setShow(true)
12
+  }
13
+  const onClose = () => {
14
+    setShow(false)
15
+  }
16
+  const handleOk=()=>{
17
+    console.log('开始作业')
18
+    setShow(false)
19
+  }
20
+  return (
21
+    <ScrollView scrollY style={{ height: '100%' }}>
22
+      <MyCard job changeJob={handleChange} />
23
+      <MyCard job changeJob={handleChange} />
24
+      <Popup
25
+        show={show}
26
+        onClose={onClose}
27
+        className='tanchuang'
28
+      >
29
+        <Image src={PositionImg} className='pImg' />
30
+        <View>当前位置在</View>
31
+        <View>河南省南阳市邓州市孟楼镇</View>
32
+        <Button className='btn' onClick={handleOk}>确认</Button>
33
+      </Popup>
34
+      <MyCard job changeJob={handleChange} />
35
+      <MyCard job changeJob={handleChange} />
36
+    </ScrollView>
37
+  )
38
+}

+ 26
- 0
src/pages/index/components/Job/style.less Parādīt failu

@@ -0,0 +1,26 @@
1
+.tanchuang{
2
+  text-align: center;
3
+  font-size: 34px;
4
+  font-weight: 800;
5
+  color: #323232;
6
+  width: calc(100vw - 60px);
7
+  padding: 142px 130px;
8
+  .pImg{
9
+    width: 80px;
10
+    height: 77px;
11
+    margin-bottom: 52px;
12
+  }
13
+  view{
14
+    text-align: left;
15
+    line-height: 46px;
16
+  }
17
+  .btn{
18
+    width: 200px;
19
+    height: 88px;
20
+    background: linear-gradient(0deg, #A0E067, #00AE39);
21
+    border-radius: 34px;
22
+    font-size: 32px;
23
+    color: #FFFFFF;  
24
+    margin-top: 100px;  
25
+  }
26
+}

+ 27
- 26
src/pages/index/components/order/index.jsx Parādīt failu

@@ -1,11 +1,11 @@
1 1
 import React, { useState } from "react"
2 2
 import Taro from "@tarojs/taro";
3
-import { View, Input, Swiper, Image, SwiperItem, Text,ScrollView } from "@tarojs/components"
3
+import { View, Input, Swiper, Image, SwiperItem, Text, ScrollView } from "@tarojs/components"
4 4
 import positionImg from '@/assets/comm/position.png'
5 5
 import searchImg from '@/assets/comm/search.png'
6 6
 import orderImg from '@/assets/comm/orderList.png'
7 7
 import Footer from "@/components/Footer";
8
-import OrderCard from "@/components/OrderCard";
8
+import MyCard from "@/components/MyCard";
9 9
 import './style.less'
10 10
 
11 11
 export default () => {
@@ -23,7 +23,7 @@ export default () => {
23 23
   const handleSearch = (e) => {
24 24
     console.log(e.detail.value)
25 25
   }
26
-  const handleMore=()=>{
26
+  const handleMore = () => {
27 27
     Taro.navigateTo({ url: '/pages/moreOrder/index' });
28 28
   }
29 29
   return (
@@ -39,30 +39,31 @@ export default () => {
39 39
           <Image src={searchImg} className='searchImg' />
40 40
         </View>
41 41
       </View>
42
-      <ScrollView scrollY style={{height:'calc(100% - 50px)'}}>
43
-      <View>
44
-        <Swiper
45
-          circular
46
-          autoplay
47
-          className='swiper'
48
-        >
49
-          {imglist.map((item, inx) => (
50
-            <SwiperItem key={inx}>
51
-              <Image src={item.url} mode='widthFix' className='storeImage' />
52
-            </SwiperItem>
53
-          ))}
54
-        </Swiper></View>
55
-      <View className='orderList'>
56
-        <View className='head'>
57
-          <Image className='headIcon' src={orderImg} />
58
-          <Text className='title'>订单列表</Text>
59
-          <Text className='more' onClick={handleMore}>更多>></Text>
42
+      <ScrollView scrollY style={{ height: 'calc(100% - 50px)' }}>
43
+        <View>
44
+          <Swiper
45
+            circular
46
+            autoplay
47
+            className='swiper'
48
+          >
49
+            {imglist.map((item, inx) => (
50
+              <SwiperItem key={inx}>
51
+                <Image src={item.url} mode='widthFix' className='storeImage' />
52
+              </SwiperItem>
53
+            ))}
54
+          </Swiper>
55
+        </View>
56
+        <View className='orderList'>
57
+          <View className='head'>
58
+            <Image className='headIcon' src={orderImg} />
59
+            <Text className='title'>订单列表</Text>
60
+            <Text className='more' onClick={handleMore}>更多>></Text>
61
+          </View>
62
+
63
+          <MyCard order />
64
+          <MyCard order />
65
+          <Footer />
60 66
         </View>
61
-        
62
-        <OrderCard />
63
-        <OrderCard />
64
-        <Footer />
65
-      </View>
66 67
       </ScrollView>
67 68
     </View>
68 69
   )

+ 7
- 5
src/pages/index/index.jsx Parādīt failu

@@ -1,5 +1,5 @@
1 1
 import Taro from "@tarojs/taro";
2
-import { useState } from "react";
2
+import { useState,useEffect } from "react";
3 3
 import { View, Image } from "@tarojs/components"
4 4
 import indexImg from "@/assets/comm/index.png";
5 5
 import indexActive from "@/assets/comm/indexActive.png";
@@ -8,22 +8,24 @@ import jobActive from "@/assets/comm/jobActive.png";
8 8
 import user from "@/assets/comm/user.png";
9 9
 import userActive from "@/assets/comm/userActive.png";
10 10
 import CustomNav from "@/components/CustomNav";
11
-import Order from './components/order'
11
+import Order from './components/Order'
12
+import Job from './components/Job'
12 13
 import "./index.less";
13 14
 
14
-export default () => {
15
+export default (props) => {
15 16
   const [currentTab, setCurrentTab] = useState(0);
16 17
   const handleClick = (val) => {
17 18
     setCurrentTab(val);
18 19
   };
20
+  
19 21
   return (
20 22
     <View className='page-index'>
21 23
       <View className='index-navbar'>
22
-        <CustomNav home />
24
+        <CustomNav home title={currentTab === 0?'首页':currentTab === 1?'作业管理':'我的'} />
23 25
       </View>
24 26
       <View className='index-container'>
25 27
         {currentTab === 0 && <Order />}
26
-        {currentTab === 1 && <View>888</View>}
28
+        {currentTab === 1 && <Job />}
27 29
         {currentTab === 2 && <View>999</View>}
28 30
       </View>
29 31
       <View className='index-tabbar'>

+ 4
- 4
src/pages/moreOrder/index.jsx Parādīt failu

@@ -2,7 +2,7 @@ import { View, Input, Image, Text, ScrollView } from "@tarojs/components"
2 2
 import CustomNav from "@/components/CustomNav";
3 3
 import searchImg from '@/assets/comm/search.png'
4 4
 import { useState } from "react";
5
-import OrderCard from "@/components/OrderCard";
5
+import MyCard from "@/components/MyCard";
6 6
 import Footer from "@/components/Footer";
7 7
 import './style.less'
8 8
 
@@ -74,9 +74,9 @@ export default () => {
74 74
       <View className='index-container'>
75 75
         <ScrollView scrollY style={{ height: '100%' }}>
76 76
           {currentTab}
77
-          <OrderCard />
78
-          <OrderCard />
79
-          <OrderCard />
77
+          <MyCard />
78
+          <MyCard />
79
+          <MyCard />
80 80
           <Footer />
81 81
         </ScrollView>
82 82
         {/* {currentTab === 0 && <View>777</View>}

+ 2
- 2
src/pages/orderDetail/index.jsx Parādīt failu

@@ -1,6 +1,6 @@
1 1
 import { View } from "@tarojs/components"
2 2
 import CustomNav from "@/components/CustomNav"
3
-import OrderCard from "@/components/OrderCard"
3
+import MyCard from "@/components/MyCard"
4 4
 
5 5
 export default () => {
6 6
   return (
@@ -9,7 +9,7 @@ export default () => {
9 9
         <CustomNav title='更多' />
10 10
       </View>
11 11
       <View className='index-container'>
12
-        <OrderCard detail />
12
+        <MyCard detail />
13 13
       </View>
14 14
     </View>
15 15
   )