|
@@ -1,105 +1,72 @@
|
1
|
1
|
import Taro from '@tarojs/taro'
|
2
|
|
-import { View, Text } from '@tarojs/components'
|
3
|
|
-import DeleteTravel from '@/assets/icons/Travel/delete.png'
|
|
2
|
+import { View } from '@tarojs/components'
|
4
|
3
|
import RecommendedCard from '@/components/foodCards/RecommendedCard'
|
5
|
4
|
import SpinBox from "@/components/Spin/SpinBox";
|
6
|
|
-
|
7
|
|
-import { useState, useEffect } from 'react'
|
8
|
|
-import { deleteTravel, getRecommendList } from '@/services/travel'
|
9
|
|
-
|
|
5
|
+import { useState, useEffect,useRef } from 'react'
|
|
6
|
+import { getRecommendList } from '@/services/travel'
|
10
|
7
|
import './style.css'
|
11
|
8
|
|
12
|
9
|
|
13
|
10
|
export default (props) => {
|
14
|
11
|
const { frameTitle, onRecommend, flag, ico, textNext, location, dayNumber, travelId, handelAddTravel } = props
|
15
|
12
|
|
16
|
|
- // const [flag, setFlag] = useState(false)
|
17
|
|
- // const [wrapAnimate, setWrapAnimate] = useState('wrap wrapAnimate')
|
18
|
|
- // const [frameAnimate, setFrameAnimate] = useState('frame-wrapper frameAnimate')
|
19
|
13
|
let wrapAnimate = 'wrap wrapAnimate'
|
20
|
|
- let frameAnimate = 'frame-wrapper frameAnimate'
|
|
14
|
+ let frameAnimate = 'frame-wrapper'
|
21
|
15
|
const [textNextSum, setTextNext] = useState(1)
|
22
|
16
|
const [recommendContent, setRecommendContent] = useState([])
|
23
|
17
|
const [loading, setLoading] = useState(false)
|
24
|
18
|
|
25
|
19
|
const hideFrame = () => {
|
26
|
|
- wrapAnimate = 'wrap wrapAnimateOut'
|
27
|
|
- frameAnimate = 'frame-wrapper frameAnimateOut'
|
28
|
20
|
onRecommend()
|
29
|
|
-
|
30
|
|
- }
|
31
|
|
-
|
32
|
|
- const catchNone = () => {
|
33
|
|
- //阻止冒泡
|
34
|
|
-
|
35
|
|
- }
|
36
|
|
- const handelText = () => {
|
37
|
|
- handleTextNext()
|
38
|
|
-
|
39
|
21
|
}
|
40
|
22
|
|
41
|
|
-
|
42
|
23
|
useEffect(() => {
|
43
|
24
|
setLoading(true)
|
44
|
25
|
getRecommendList({ location: location, pageNum: textNextSum, pageSize: 3 }).then(e => {
|
45
|
26
|
setRecommendContent(e.records)
|
46
|
27
|
setLoading(false)
|
47
|
|
-
|
48
|
28
|
}).catch(s => {
|
49
|
29
|
setLoading(false)
|
50
|
|
-
|
51
|
30
|
})
|
52
|
31
|
}, [location, textNextSum])
|
53
|
32
|
|
54
|
|
-
|
|
33
|
+ //用来让下面的小图标旋转
|
|
34
|
+ const rotateRef=useRef()
|
|
35
|
+ const [r,setR]=useState(90)
|
55
|
36
|
//换一批
|
56
|
37
|
const handleTextNext = (e) => {
|
|
38
|
+ rotateRef.current.style.transform=`rotate(${r}deg)`
|
|
39
|
+ setR(r+90)
|
57
|
40
|
setTextNext(textNextSum + 1)
|
58
|
|
-
|
59
|
41
|
e.stopPropagation()
|
60
|
|
-
|
61
|
|
-
|
62
|
42
|
}
|
63
|
43
|
|
64
|
44
|
return (
|
65
|
|
- flag && <view >
|
|
45
|
+ flag && <view>
|
66
|
46
|
<view className={wrapAnimate} style='background:rgba(0,0,0,0);'></view>
|
67
|
47
|
<view onClick={hideFrame} className={frameAnimate}>
|
68
|
|
- <view onClick={catchNone} className='frame'>
|
|
48
|
+ <view className='frame'>
|
69
|
49
|
{/* 标题 */}
|
70
|
50
|
<view className='title-wrapper '>
|
71
|
51
|
<view>{frameTitle}</view>
|
72
|
|
- {/* <image onClick={hideFrame} src={DeleteTravel} mode='widthFix'></image> */}
|
73
|
52
|
</view>
|
74
|
53
|
{/* 内容 */}
|
75
|
|
-
|
76
|
54
|
<View style='overflow-x: hidden;'>
|
77
|
55
|
<SpinBox loading={loading}>
|
78
|
|
-
|
79
|
56
|
{
|
80
|
57
|
recommendContent.map((item, index) =>
|
81
|
|
-
|
82
|
|
-
|
83
|
|
-
|
84
|
58
|
<RecommendedCard key={index} item={item} det={item} editable='1' location={location} travelId={travelId} dayNumber={dayNumber} handelAddTravel={handelAddTravel} />
|
85
|
59
|
)
|
86
|
60
|
}
|
87
|
61
|
{props.children}
|
88
|
62
|
</SpinBox>
|
89
|
|
-
|
90
|
63
|
<view className='bottom-text' onClick={handleTextNext}>
|
91
|
|
- <image src={ico} />
|
|
64
|
+ <image ref={rotateRef} src={ico} />
|
92
|
65
|
<text>{textNext}</text>
|
93
|
66
|
</view>
|
94
|
67
|
</View>
|
95
|
|
-
|
96
|
68
|
</view>
|
97
|
|
-
|
98
|
69
|
</view>
|
99
|
|
-
|
100
|
70
|
</view>
|
101
|
71
|
)
|
102
|
|
-
|
103
|
|
-
|
104
|
|
-
|
105
|
|
-}
|
|
72
|
+}
|