李志伟 3 年之前
父節點
當前提交
079c402210
共有 2 個文件被更改,包括 16 次插入91 次删除
  1. 13
    46
      src/components/BottomMoadl/index.jsx
  2. 3
    45
      src/components/BottomMoadl/style.css

+ 13
- 46
src/components/BottomMoadl/index.jsx 查看文件

@@ -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
+}

+ 3
- 45
src/components/BottomMoadl/style.css 查看文件

@@ -8,52 +8,12 @@
8 8
     background: rgba(0, 0, 0, 0.35);
9 9
   }
10 10
 }
11
-.wrapAnimateOut {
12
-  animation: wrapAnimateOut 0.2s ease forwards;
13
-}
14
-@keyframes wrapAnimateOut {
15
-  0% {
16
-    background: rgba(0, 0, 0, 0.35);
17
-  }
18
-
19
-  100% {
20
-    background: rgba(0, 0, 0, 0);
21
-  }
22
-}
23
-.frameAnimate {
24
-  animation: frameAnimate 0.2s ease forwards;
25
-}
26
-@keyframes frameAnimate {
27
-  0% {
28
-  }
29
-  100% {
30
-    opacity: 1;
31
-    top: 0vh;
32
-  }
33
-}
34
-.frameAnimateOut {
35
-  animation: frameAnimateOut 0.2s ease forwards;
36
-}
37
-@keyframes frameAnimateOut {
38
-  0% {
39
-    opacity: 2;
40
-    top: 0vh;
41
-  }
42
-  50% {
43
-    opacity: 1;
44
-    top: 50vh;
45
-  }
46
-  100% {
47
-    opacity: 0;
48
-    top: 100vh;
49
-  }
50
-}
51 11
 .frame-wrapper {
52 12
   position: fixed;
53 13
   height: 100vh;
54 14
   width: 100vw;
55 15
   z-index: 2;
56
-  top: 50vh;
16
+  top: 0;
57 17
 }
58 18
 .frame {
59 19
   background: #fff;
@@ -84,10 +44,7 @@
84 44
   padding: 0 5vw;
85 45
   margin-right: -5vw;
86 46
 }
87
-/* .flex {
88
-  display: flex;
89
-  align-items: center;
90
-} */
47
+
91 48
 .wrap {
92 49
   position: fixed;
93 50
   z-index: 1;
@@ -109,6 +66,7 @@
109 66
   width: 32px;
110 67
   height: 32px;
111 68
 }
69
+
112 70
 .bottom-text > text {
113 71
   width: 110px;
114 72
   font-size: 30px;