|
@@ -1,21 +1,15 @@
|
1
|
1
|
import Taro, { useDidShow } from '@tarojs/taro'
|
2
|
2
|
import { Image, Button, View } from '@tarojs/components'
|
3
|
|
-import SpinBox from "@/components/Spin/SpinBox";
|
4
|
3
|
import formatTime from '@/utils/formatTime'
|
5
|
4
|
import withLayout from '@/layouts'
|
6
|
|
-
|
7
|
5
|
import { useState, useEffect } from "react";
|
8
|
6
|
import SlideView from '@/components/SlideView';
|
9
|
7
|
import editImg from '@/assets/icons/Travel/editimg.png'
|
10
|
8
|
import CustomNav from '@/components/CustomNav'
|
11
|
9
|
import { getTravelMine, deleteTravel } from '@/services/travel'
|
12
|
|
-
|
13
|
10
|
import './style.less'
|
14
|
11
|
|
15
|
12
|
export default withLayout((props) => {
|
16
|
|
-
|
17
|
|
- const [loading, setLoading] = useState(false)
|
18
|
|
-
|
19
|
13
|
//删除
|
20
|
14
|
const handelDelete = (e) => {
|
21
|
15
|
Taro.showModal({
|
|
@@ -23,45 +17,34 @@ export default withLayout((props) => {
|
23
|
17
|
content: '确定要删除吗',
|
24
|
18
|
success: function (res) {
|
25
|
19
|
if (res.confirm) {
|
26
|
|
-
|
27
|
20
|
deleteTravel(e.travelId).then(r => {
|
28
|
21
|
getList()
|
29
|
|
-
|
30
|
22
|
Taro.showToast({
|
31
|
23
|
title: '删除成功',
|
32
|
24
|
icon: 'none',
|
33
|
25
|
duration: 1000
|
34
|
26
|
})
|
35
|
|
-
|
36
|
27
|
})
|
37
|
|
-
|
38
|
28
|
} else if (res.cancel) {
|
39
|
29
|
getList()
|
40
|
|
-
|
41
|
|
-
|
42
|
30
|
}
|
43
|
31
|
}
|
44
|
32
|
})
|
45
|
|
-
|
46
|
33
|
}
|
47
|
34
|
const handelEdit = (item) => {
|
48
|
|
-
|
49
|
|
- Taro.navigateTo({ url: `/pages/Travel/Edit/index?id=${item.travelId}&dayNum=${item.dayNum}&travelId=${item.travelId}` })
|
|
35
|
+ Taro.navigateTo({ url: `/pages/Travel/Edit/index?id=${item.travelId}&dayNum=${item.dayNum}` })
|
50
|
36
|
}
|
51
|
37
|
|
52
|
38
|
const [travelMine, setTravelMine] = useState([])
|
53
|
39
|
const getList = () => {
|
54
|
40
|
getTravelMine({ pageNum: 1, pageSize: 99, }).then(e => {
|
55
|
41
|
setTravelMine(e.records)
|
56
|
|
-
|
57
|
|
-
|
58
|
42
|
})
|
59
|
43
|
}
|
60
|
44
|
useDidShow(() => getList())
|
61
|
45
|
|
62
|
46
|
useEffect(() => {
|
63
|
47
|
getList()
|
64
|
|
-
|
65
|
48
|
}, [])
|
66
|
49
|
return (
|
67
|
50
|
<View className='page-index box-content'>
|
|
@@ -69,7 +52,6 @@ export default withLayout((props) => {
|
69
|
52
|
<CustomNav title='我的行程' />
|
70
|
53
|
</View>
|
71
|
54
|
<View className='index-container'>
|
72
|
|
- <SpinBox loading={loading}>
|
73
|
55
|
<scroll-view
|
74
|
56
|
scrollY
|
75
|
57
|
style='height: 100%;'
|
|
@@ -77,7 +59,6 @@ export default withLayout((props) => {
|
77
|
59
|
<View className='View-box'>
|
78
|
60
|
{
|
79
|
61
|
travelMine.map((item, index) =>
|
80
|
|
-
|
81
|
62
|
<SlideView key={index} del onDelete={() => handelDelete(item)} className='myTravel'>
|
82
|
63
|
<View className='View-box-Card' onClick={() => handelEdit(item)}>
|
83
|
64
|
<View className='bottom'>
|
|
@@ -90,14 +71,11 @@ export default withLayout((props) => {
|
90
|
71
|
</View>
|
91
|
72
|
</View>
|
92
|
73
|
</SlideView>
|
93
|
|
-
|
94
|
74
|
)
|
95
|
75
|
}
|
96
|
|
-
|
97
|
76
|
<View className='foot'>这是我的底线</View>
|
98
|
77
|
</View>
|
99
|
78
|
</scroll-view>
|
100
|
|
- </SpinBox>
|
101
|
79
|
</View>
|
102
|
80
|
</View >
|
103
|
81
|
)
|