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

+ 26
- 31
src/pages/MineUserAll/MyTravel/index.jsx Dosyayı Görüntüle

1
 import Taro, { useDidShow } from '@tarojs/taro'
1
 import Taro, { useDidShow } from '@tarojs/taro'
2
-import { Image, Button, View } from '@tarojs/components'
2
+import { Image, View } from '@tarojs/components'
3
 import formatTime from '@/utils/formatTime'
3
 import formatTime from '@/utils/formatTime'
4
 import withLayout from '@/layouts'
4
 import withLayout from '@/layouts'
5
-import { useState, useEffect } from "react";
5
+import { useState } from "react";
6
 import SlideView from '@/components/SlideView';
6
 import SlideView from '@/components/SlideView';
7
 import editImg from '@/assets/icons/Travel/editimg.png'
7
 import editImg from '@/assets/icons/Travel/editimg.png'
8
 import CustomNav from '@/components/CustomNav'
8
 import CustomNav from '@/components/CustomNav'
25
               duration: 1000
25
               duration: 1000
26
             })
26
             })
27
           })
27
           })
28
-        } else if (res.cancel) {
29
-          getList()
30
         }
28
         }
31
       }
29
       }
32
     })
30
     })
41
       setTravelMine(e.records)
39
       setTravelMine(e.records)
42
     })
40
     })
43
   }
41
   }
42
+  //页面切换回来时查询列表   两种情况第一是从个人中心进入  第二是从行程编辑页面返回时重新查询列表
44
   useDidShow(() => getList())
43
   useDidShow(() => getList())
45
-
46
-  useEffect(() => {
47
-    getList()
48
-  }, [])
49
   return (
44
   return (
50
     <View className='page-index box-content'>
45
     <View className='page-index box-content'>
51
       <View className='index-navbar'>
46
       <View className='index-navbar'>
52
         <CustomNav title='我的行程' />
47
         <CustomNav title='我的行程' />
53
       </View>
48
       </View>
54
       <View className='index-container'>
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
                     </View>
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
       </View>
74
       </View>
80
     </View >
75
     </View >
81
   )
76
   )

+ 31
- 32
src/pages/Travel/Edit/index.jsx Dosyayı Görüntüle

2
 import { Image, Button, View, Text, Input } from '@tarojs/components'
2
 import { Image, Button, View, Text, Input } from '@tarojs/components'
3
 import SpinBox from "@/components/Spin/SpinBox";
3
 import SpinBox from "@/components/Spin/SpinBox";
4
 import CustomCard from '@/components/foodCards/CustomCard/index'
4
 import CustomCard from '@/components/foodCards/CustomCard/index'
5
-import { useState, useEffect, useRef } from "react";
5
+import { useState, useEffect } from "react";
6
 import BottomMoadl from '@/components/BottomMoadl/index'
6
 import BottomMoadl from '@/components/BottomMoadl/index'
7
 import Travel from '@/assets/icons/Travel/travel.png'
7
 import Travel from '@/assets/icons/Travel/travel.png'
8
 import ChangeNext from '@/assets/icons/Travel/ChangeNext.png'
8
 import ChangeNext from '@/assets/icons/Travel/ChangeNext.png'
16
 
16
 
17
 export default withLayout((props) => {
17
 export default withLayout((props) => {
18
   const { router, location } = props
18
   const { router, location } = props
19
-  const { id, dayNum} = router.params
19
+  const { id, dayNum } = router.params
20
 
20
 
21
   const [loading, setLoading] = useState(false)
21
   const [loading, setLoading] = useState(false)
22
   const [bottomDayNum, setBottomDayNum] = useState(true)
22
   const [bottomDayNum, setBottomDayNum] = useState(true)
133
   }
133
   }
134
   //确认
134
   //确认
135
   const ButtonOK = () => {
135
   const ButtonOK = () => {
136
-    seaveTravelID(id, { title: inputChangle}).then(val => {
136
+    seaveTravelID(id, { title: inputChangle }).then(val => {
137
       Taro.showToast({
137
       Taro.showToast({
138
         title: '修改成功',
138
         title: '修改成功',
139
         icon: 'none',
139
         icon: 'none',
150
   }
150
   }
151
 
151
 
152
   return (
152
   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 底部文字
153
+    <View className='page-index box-content'>
154
+      <View style={{ flex: 'none' }}>
155
+        <Popup show={showDialog} maskClosable={false}>
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
+          <View className='travel-button-box' >
163
+            <Button className='travelButton-Cancel' onClick={ButtonCancel} >取消</Button>
164
+            <Button className='travelButton-OK' onClick={ButtonOK} >确定</Button>
165
+          </View>
166
+        </Popup>
167
+        {/* 
168
+        frameTitle 标题
169
+        flag 弹窗显示 true false
170
+        ico 底部图标
171
+        textNext 底部文字
173
       */}
172
       */}
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;' >
173
+        <BottomMoadl frameTitle='行程推荐' dayNumber={dayNumber} travelId={id} flag={showFrame} handelAddTravel={handelAddTravel} onRecommend={setRecommend} ico={ChangeNext} textNext='换一批' location={location} />
174
+      </View>
175
+      <View className='index-navbar'>
176
+        <CustomNav title='定制行程' />
177
+      </View>
178
+      <View className='index-container'>
179
+        <scroll-view scrollY style='height:100%;' >
181
           <View className='TravelTitle'>
180
           <View className='TravelTitle'>
182
             {travelCustom?.title}<Image src={editImg} className='edit' onClick={handleModale} ></Image>
181
             {travelCustom?.title}<Image src={editImg} className='edit' onClick={handleModale} ></Image>
183
           </View>
182
           </View>
208
             </View>
207
             </View>
209
           }
208
           }
210
         </scroll-view>
209
         </scroll-view>
211
-      </View >
212
-    </view>
210
+      </View>
211
+    </View>
213
   )
212
   )
214
 })
213
 })

+ 2
- 1
src/pages/Travel/Edit/style.less Dosyayı Görüntüle

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