李志伟 3 yıl önce
ebeveyn
işleme
2eb4a37487

+ 24
- 0
src/pages/index/components/OverPop/index.jsx Dosyayı Görüntüle

@@ -0,0 +1,24 @@
1
+import { View, Input, Button } from "@tarojs/components"
2
+import { Popup } from "@antmjs/vantui";
3
+import './style.less'
4
+
5
+export default (props) => {
6
+  const { showOver, onOverClose, area, setArea, handleOverOk } = props
7
+  const handleArea = (e) => {
8
+    console.log(666)
9
+    setArea(e.detail.value)
10
+  }
11
+  return (
12
+    <Popup
13
+      show={showOver}
14
+      onClose={onOverClose}
15
+      className='tanchuang2'
16
+    >
17
+      <View className='bankInput'>
18
+        <View className='header'>作业面积:</View>
19
+        <Input className='body' type='digit' placeholder='请输入本次作业的面积' value={area} onBlur={handleArea} />
20
+      </View>
21
+      <Button className='btn' onClick={handleOverOk}>确认</Button>
22
+    </Popup>
23
+  )
24
+}

+ 37
- 0
src/pages/index/components/OverPop/style.less Dosyayı Görüntüle

@@ -0,0 +1,37 @@
1
+.tanchuang2{
2
+  text-align: center;
3
+  font-size: 34px;
4
+  font-weight: 800;
5
+  color: #323232;
6
+  width: calc(100vw - 60px);
7
+  padding: 80px 30px;
8
+  box-shadow: 0px 0px 44px 0px rgba(0, 0, 0, 0.08);
9
+  border-radius: 40px;
10
+  .bankInput{
11
+    border: 2px solid #F2F2F2;
12
+    border-radius: 40px;
13
+    display: flex;
14
+    align-items: center;
15
+    padding: 36px 30px;
16
+    box-sizing: border-box;
17
+    .header{
18
+      font-weight: 500;
19
+      color: #333;
20
+      flex: none;
21
+    }
22
+    .body{
23
+      flex: 1;
24
+      font-size: 32px;
25
+      font-weight: 400;
26
+    }
27
+  }
28
+  .btn{
29
+    width: 200px;
30
+    height: 88px;
31
+    background: linear-gradient(0deg, #00AE39, #A0E067);
32
+    border-radius: 34px;
33
+    font-size: 32px;
34
+    color: #FFFFFF;  
35
+    margin-top: 50px;  
36
+  }
37
+}

+ 19
- 30
src/pages/index/components/order/index.jsx Dosyayı Görüntüle

@@ -12,6 +12,7 @@ import positionImg from '@/assets/comm/position.png'
12 12
 import searchImg from '@/assets/comm/search.png'
13 13
 import orderImg from '@/assets/comm/orderList.png'
14 14
 import PositionImg from '@/assets/job/positionImg.png'
15
+import OverPop from '../OverPop'
15 16
 import './style.less'
16 17
 
17 18
 
@@ -63,35 +64,33 @@ export default (props) => {
63 64
       })
64 65
     })
65 66
   }
66
-  const handleArea = (e) => {
67
-    setArea(e.detail.value)
68
-  }
69 67
   const onOverClose = () => {
70 68
     setArea()
71 69
     setShowOver(false)
72 70
   }
73 71
   const handleOverOk = () => {
72
+    console.log(999999)
74 73
     //正整数或两位小数
75 74
     const test2 = /^\d+(\.\d{1,2})?$/.test(area)
76 75
     if (test2) {
77
-      overJob(job.jobId,{...job,area:area}).then(res=>{
78
-        Taro.showToast({
79
-          title: '恭喜完成作业',
80
-          icon: 'none',
81
-        })
82
-        getJobList({ pageNum: currentPage }).then(res2 => {
83
-          const lst = currentPage === 1 ? res2.records || [] : jobList.concat(res2.records || [])
84
-          //长列表加载当下一页没有数据时
85
-          if (res2.records.length == 0 && currentPage != 1) {
86
-            setIsMore(true)
87
-            return
88
-          }
89
-          setJobList(lst)
76
+      // overJob(job.jobId, { ...job, area: area }).then(res => {
77
+      //   Taro.showToast({
78
+      //     title: '恭喜完成作业',
79
+      //     icon: 'none',
80
+      //   })
81
+      //   getJobList({ pageNum: currentPage }).then(res2 => {
82
+      //     const lst = currentPage === 1 ? res2.records || [] : jobList.concat(res2.records || [])
83
+      //     //长列表加载当下一页没有数据时
84
+      //     if (res2.records.length == 0 && currentPage != 1) {
85
+      //       setIsMore(true)
86
+      //       return
87
+      //     }
88
+      //     setJobList(lst)
90 89
           onOverClose()
91
-        })
92
-      })
90
+        // })
91
+      // })
93 92
     }
94
-    else{
93
+    else {
95 94
       Taro.showToast({
96 95
         title: '请输入正确的面积整数或最多两位小数',
97 96
         icon: 'none',
@@ -175,17 +174,7 @@ export default (props) => {
175 174
           <View>{address}</View>
176 175
           <Button className='btn' onClick={handleOk}>确认</Button>
177 176
         </Popup>
178
-        <Popup
179
-          show={showOver}
180
-          onClose={onOverClose}
181
-          className='tanchuang2'
182
-        >
183
-          <View className='bankInput'>
184
-            <View className='header'>作业面积:</View>
185
-            <Input className='body' type='digit' placeholder='请输入本次作业的面积' value={area} onBlur={handleArea} />
186
-          </View>
187
-          <Button className='btn' onClick={handleOverOk}>确认</Button>
188
-        </Popup>
177
+        <OverPop showOver={showOver} onOverClose={onOverClose} area={area} setArea={setArea} handleOverOk={handleOverOk} />
189 178
       </ScrollView>
190 179
     </View>
191 180
   )

+ 1
- 37
src/pages/index/components/order/style.less Dosyayı Görüntüle

@@ -143,42 +143,6 @@
143 143
       margin-top: 100px;  
144 144
     }
145 145
   }
146
-  .tanchuang2{
147
-    text-align: center;
148
-    font-size: 34px;
149
-    font-weight: 800;
150
-    color: #323232;
151
-    width: calc(100vw - 60px);
152
-    padding: 80px 30px;
153
-    box-shadow: 0px 0px 44px 0px rgba(0, 0, 0, 0.08);
154
-    border-radius: 40px;
155
-    .bankInput{
156
-      border: 2px solid #F2F2F2;
157
-      border-radius: 40px;
158
-      display: flex;
159
-      align-items: center;
160
-      padding: 36px 30px;
161
-      box-sizing: border-box;
162
-      .header{
163
-        font-weight: 500;
164
-        color: #333;
165
-        flex: none;
166
-      }
167
-      .body{
168
-        flex: 1;
169
-        font-size: 32px;
170
-        font-weight: 400;
171
-      }
172
-    }
173
-    .btn{
174
-      width: 200px;
175
-      height: 88px;
176
-      background: linear-gradient(0deg, #00AE39, #A0E067);
177
-      border-radius: 34px;
178
-      font-size: 32px;
179
-      color: #FFFFFF;  
180
-      margin-top: 50px;  
181
-    }
182
-  }
146
+  
183 147
 }
184 148
 

+ 10
- 16
src/pages/index/index.jsx Dosyayı Görüntüle

@@ -24,7 +24,6 @@ export default withLayout((props) => {
24 24
   let { tab } = router.params
25 25
   const { location, setLocation, setAddress } = useModel('location')
26 26
   const { person } = useModel('person')
27
-  const [currentTab, setCurrentTab] = useState(0)
28 27
   const handleClick = (val) => {
29 28
     if (!person.phone && val != 0) {
30 29
       Taro.navigateTo({url:`/pages/Login/index?tab=${val}`})
@@ -51,41 +50,36 @@ export default withLayout((props) => {
51 50
       })
52 51
     }
53 52
   }, [])
54
-  useEffect(() => {
55
-    if (tab) {
56
-      setCurrentTab(tab - 0)
57
-    }
58
-  }, [tab])
59 53
   return (
60 54
     <View className='page-index'>
61 55
       <View className='index-navbar'>
62
-        <CustomNav home title={currentTab == 0 ? '首页' : currentTab == 1 ? '订单列表' : '我的'} />
56
+        <CustomNav home title={(!tab||tab==0) ? '首页' : tab == 1 ? '订单列表' : '我的'} />
63 57
       </View>
64 58
       <View className='index-container'>
65
-        {currentTab == 0 && <Order />}
66
-        {currentTab == 1 && <Job />}
67
-        {currentTab == 2 && <User />}
59
+        {(!tab||tab==0) && <Order />}
60
+        {tab == 1 && <Job />}
61
+        {tab == 2 && <User />}
68 62
       </View>
69 63
       <View className='index-tabbar'>
70 64
         <View
71
-          className={['tabberItem', currentTab == 0 ? "activeTabber" : '']}
65
+          className={['tabberItem', (!tab||tab==0) ? "activeTabber" : '']}
72 66
           onClick={() => handleClick(0)}
73 67
         >
74
-          <Image className='tabberImg' src={currentTab == 0 ? indexActive : indexImg}></Image>
68
+          <Image className='tabberImg' src={(!tab||tab==0) ? indexActive : indexImg}></Image>
75 69
           <View className='text'>首页</View>
76 70
         </View>
77 71
         <View
78
-          className={['tabberItem', currentTab === 1 ? "activeTabber" : '']}
72
+          className={['tabberItem', tab === 1 ? "activeTabber" : '']}
79 73
           onClick={() => handleClick(1)}
80 74
         >
81
-          <Image className='tabberImg' src={currentTab == 1 ? jobActive : job}></Image>
75
+          <Image className='tabberImg' src={tab == 1 ? jobActive : job}></Image>
82 76
           <View className='text'>订单列表</View>
83 77
         </View>
84 78
         <View
85
-          className={['tabberItem', currentTab === 2 ? "activeTabber" : '']}
79
+          className={['tabberItem', tab === 2 ? "activeTabber" : '']}
86 80
           onClick={() => handleClick(2)}
87 81
         >
88
-          <Image className='tabberImg' src={currentTab == 2 ? userActive : user}></Image>
82
+          <Image className='tabberImg' src={tab == 2 ? userActive : user}></Image>
89 83
           <View className='text'>个人中心</View>
90 84
         </View>
91 85
       </View>