Procházet zdrojové kódy

Merge branch '3.0' of http://git.ycjcjy.com/shigongli/miniapp-v2 into 3.0

Baozhangchao před 3 roky
rodič
revize
e91788cffe

+ 26
- 31
src/pages/MineUserAll/MyTravel/index.jsx Zobrazit soubor

@@ -1,8 +1,8 @@
1 1
 import Taro, { useDidShow } from '@tarojs/taro'
2
-import { Image, Button, View } from '@tarojs/components'
2
+import { Image, View } from '@tarojs/components'
3 3
 import formatTime from '@/utils/formatTime'
4 4
 import withLayout from '@/layouts'
5
-import { useState, useEffect } from "react";
5
+import { useState } from "react";
6 6
 import SlideView from '@/components/SlideView';
7 7
 import editImg from '@/assets/icons/Travel/editimg.png'
8 8
 import CustomNav from '@/components/CustomNav'
@@ -25,8 +25,6 @@ export default withLayout((props) => {
25 25
               duration: 1000
26 26
             })
27 27
           })
28
-        } else if (res.cancel) {
29
-          getList()
30 28
         }
31 29
       }
32 30
     })
@@ -41,41 +39,38 @@ export default withLayout((props) => {
41 39
       setTravelMine(e.records)
42 40
     })
43 41
   }
42
+  //页面切换回来时查询列表   两种情况第一是从个人中心进入  第二是从行程编辑页面返回时重新查询列表
44 43
   useDidShow(() => getList())
45
-
46
-  useEffect(() => {
47
-    getList()
48
-  }, [])
49 44
   return (
50 45
     <View className='page-index box-content'>
51 46
       <View className='index-navbar'>
52 47
         <CustomNav title='我的行程' />
53 48
       </View>
54 49
       <View className='index-container'>
55
-          <scroll-view
56
-            scrollY
57
-            style='height: 100%;'
58
-          >
59
-            <View className='View-box'>
60
-              {
61
-                travelMine.map((item, index) =>
62
-                  <SlideView key={index} del onDelete={() => handelDelete(item)} className='myTravel'>
63
-                    <View className='View-box-Card' onClick={() => handelEdit(item)}>
64
-                      <View className='bottom'>
65
-                        <View className='travelName'>{item.title}</View>
66
-                        <Image src={editImg} className='edit'></Image>
67
-                      </View>
68
-                      <View className='bottom'>
69
-                        <View className='travelDay'>行程时间:{item.dayNum}天</View>
70
-                        <View className='travelDate'>创建时间:{formatTime(item.createDate, "yyyy/MM/dd")}</View>
71
-                      </View>
50
+        <scroll-view
51
+          scrollY
52
+          style='height: 100%;'
53
+        >
54
+          <View className='View-box'>
55
+            {
56
+              travelMine.map((item, index) =>
57
+                <SlideView key={index} del onDelete={() => handelDelete(item)} className='myTravel'>
58
+                  <View className='View-box-Card' onClick={() => handelEdit(item)}>
59
+                    <View className='bottom'>
60
+                      <View className='travelName'>{item.title}</View>
61
+                      <Image src={editImg} className='edit'></Image>
62
+                    </View>
63
+                    <View className='bottom'>
64
+                      <View className='travelDay'>行程时间:{item.dayNum}天</View>
65
+                      <View className='travelDate'>创建时间:{formatTime(item.createDate, "yyyy/MM/dd")}</View>
72 66
                     </View>
73
-                  </SlideView>
74
-                )
75
-              }
76
-              <View className='foot'>这是我的底线</View>
77
-            </View>
78
-          </scroll-view>
67
+                  </View>
68
+                </SlideView>
69
+              )
70
+            }
71
+            <View className='foot'>这是我的底线</View>
72
+          </View>
73
+        </scroll-view>
79 74
       </View>
80 75
     </View >
81 76
   )

+ 37
- 33
src/pages/Travel/Edit/index.jsx Zobrazit soubor

@@ -2,7 +2,7 @@ import Taro from '@tarojs/taro'
2 2
 import { Image, Button, View, Text, Input } from '@tarojs/components'
3 3
 import SpinBox from "@/components/Spin/SpinBox";
4 4
 import CustomCard from '@/components/foodCards/CustomCard/index'
5
-import { useState, useEffect, useRef } from "react";
5
+import { useState, useEffect } from "react";
6 6
 import BottomMoadl from '@/components/BottomMoadl/index'
7 7
 import Travel from '@/assets/icons/Travel/travel.png'
8 8
 import ChangeNext from '@/assets/icons/Travel/ChangeNext.png'
@@ -19,12 +19,17 @@ export default withLayout((props) => {
19 19
   const { id, dayNum } = router.params
20 20
 
21 21
   const [loading, setLoading] = useState(false)
22
+  //判断一天行程还是多天行程的标识位  一天就不用显示上一天下一天按钮
22 23
   const [bottomDayNum, setBottomDayNum] = useState(true)
23 24
 
25
+  //获取当前行程详情不包括标题
24 26
   const [showCutover, setShowCutover] = useState([])
27
+  //获取行程列表包括标题
25 28
   const [travelCustom, setTravelCustom] = useState()
26 29
 
30
+  //文本框弹窗
27 31
   const [showDialog, setShowDialog] = useState(false);
32
+  //行程标题获取弹窗的文本框的值
28 33
   const [inputChangle, setInputChangle] = useState();
29 34
 
30 35
   const handleDelete = (res) => {
@@ -94,9 +99,11 @@ export default withLayout((props) => {
94 99
   }, [id, dayNumber])
95 100
 
96 101
 
97
-
102
+  //删除行程
98 103
   const onDelete = (e) => {
104
+    //这个删除是需要两个id的前一个id是整个行程的id需要根据这个id找到这条行程的全部信息  后面那个itemId是行程数组travelItemList里面的一条当前点击的需要删除的信息的id
99 105
     const itemId = e
106
+    console.log(e)
100 107
     Taro.showModal({
101 108
       title: '提示',
102 109
       content: '确定要删除吗',
@@ -110,7 +117,6 @@ export default withLayout((props) => {
110 117
             })
111 118
             handleDelete()
112 119
           })
113
-        } else if (res.cancel) {
114 120
         }
115 121
       }
116 122
     })
@@ -122,7 +128,6 @@ export default withLayout((props) => {
122 128
     setShowFrame(!showFrame)
123 129
   }
124 130
   //修改行程名字
125
-
126 131
   const handelInput = (e) => {
127 132
     setInputChangle(e.detail.value)
128 133
   }
@@ -150,34 +155,33 @@ export default withLayout((props) => {
150 155
   }
151 156
 
152 157
   return (
153
-    <view className='page-index'>
154
-      <Popup show={showDialog} maskClosable={false}>
155
-
156
-        <view className='travel-box-info-ROOM'>
157
-          <view className='travel-bi-name-ROOM' >
158
-            <view className='travel-bin-title-ROOM'>修改行程名称:</view>
159
-            <Input className='travel-bint-nameInfo-ROOM' value={inputChangle} onInput={handelInput} />
160
-          </view>
161
-        </view>
162
-
163
-        <view className='travel-button-box' >
164
-          <button className='travelButton-Cancel' onClick={ButtonCancel} >取消</button>
165
-          <button className='travelButton-OK' onClick={ButtonOK} >确定</button>
166
-        </view>
167
-      </Popup>
168
-      {/* 
169
-      frameTitle 标题
170
-      flag 弹窗显示 true false
171
-      ico 底部图标
172
-      textNext 底部文字
158
+    <View className='page-index box-content'>
159
+      <View style={{ flex: 'none' }}>
160
+        <Popup show={showDialog} maskClosable={false}>
161
+          <View className='travel-box-info-ROOM'>
162
+            <View className='travel-bi-name-ROOM' >
163
+              <View className='travel-bin-title-ROOM'>修改行程名称:</View>
164
+              <Input className='travel-bint-nameInfo-ROOM' value={inputChangle} onInput={handelInput} />
165
+            </View>
166
+          </View>
167
+          <View className='travel-button-box' >
168
+            <Button className='travelButton-Cancel' onClick={ButtonCancel} >取消</Button>
169
+            <Button className='travelButton-OK' onClick={ButtonOK} >确定</Button>
170
+          </View>
171
+        </Popup>
172
+        {/* 
173
+        frameTitle 标题
174
+        flag 弹窗显示 true false
175
+        ico 底部图标
176
+        textNext 底部文字
173 177
       */}
174
-      <BottomMoadl frameTitle='行程推荐' dayNumber={dayNumber} travelId={id} flag={showFrame} handelAddTravel={handelAddTravel} onRecommend={setRecommend} ico={ChangeNext} textNext='换一批' location={location} />
175
-
176
-      <View className='box-content'>
177
-        <View className='index-navbar'>
178
-          <CustomNav title='定制行程' />
179
-        </View>
180
-        <scroll-view scrollY style='height: calc(100% - 75px);margin-bottom: 40px;' >
178
+        <BottomMoadl frameTitle='行程推荐' dayNumber={dayNumber} travelId={id} flag={showFrame} handelAddTravel={handelAddTravel} onRecommend={setRecommend} ico={ChangeNext} textNext='换一批' location={location} />
179
+      </View>
180
+      <View className='index-navbar'>
181
+        <CustomNav title='定制行程' />
182
+      </View>
183
+      <View className='index-container'>
184
+        <scroll-view scrollY style='height:100%;' >
181 185
           <View className='TravelTitle'>
182 186
             {travelCustom?.title}<Image src={editImg} className='edit' onClick={handleModale} ></Image>
183 187
           </View>
@@ -208,7 +212,7 @@ export default withLayout((props) => {
208 212
             </View>
209 213
           }
210 214
         </scroll-view>
211
-      </View >
212
-    </view>
215
+      </View>
216
+    </View>
213 217
   )
214 218
 })

+ 2
- 1
src/pages/Travel/Edit/style.less Zobrazit soubor

@@ -55,7 +55,8 @@
55 55
     font-weight: bold;
56 56
     color: #333;
57 57
     line-height: 44px;
58
-    margin: 63px 30px 15px;
58
+    margin: 0 30px 15px;
59
+    padding-top: 63px;
59 60
     display: flex;
60 61
     .edit {
61 62
       width: 40px;