Baozhangchao 3 years ago
parent
commit
1d1c6c7afd

+ 84
- 6
src/components/CollectList/MyCollect/index.jsx View File

13
 const Action = CouponCard.Action
13
 const Action = CouponCard.Action
14
 export default (props) => {
14
 export default (props) => {
15
   const { item, cardNavigateTo } = props
15
   const { item, cardNavigateTo } = props
16
+  console.log("🚀 ~ file: index.jsx ~ line 16 ~ item", item)
16
 
17
 
17
   const targetType = item.targetType
18
   const targetType = item.targetType
18
   const star = parseFloat(((item.sweetScore + item.environmentScore + item.serviceScore) / 3).toFixed(1));
19
   const star = parseFloat(((item.sweetScore + item.environmentScore + item.serviceScore) / 3).toFixed(1));
20
 
21
 
21
 
22
 
22
   const handleDetail = () => {
23
   const handleDetail = () => {
23
-    targetType == "shop_package" ? Taro.navigateTo({ url: `/pages/details/foodDetails/foodDetails?id=${item.shopId}` })
24
-      : targetType == "tourist" ? Taro.navigateTo({ url: `/pages/details/mjDetails/sceneryDetails?id=${item.targetId}` })
25
-        : Taro.navigateTo({ url: `/pages/details/foodDetails/foodDetails?id=${item.targetId}` })
24
+    switch (targetType) {
25
+      case "shop_package":
26
+        Taro.navigateTo({ url: `/pages/details/foodDetails/foodDetails?id=${item.shopId}` })
27
+        break;
28
+      case "shop":
29
+        Taro.navigateTo({ url: `/pages/details/foodDetails/foodDetails?id=${item.targetId}` })
30
+        break;
31
+      case "tourist":
32
+        Taro.navigateTo({ url: `/pages/details/mjDetails/sceneryDetails?id=${item.targetId}` })
33
+        break;
34
+      case "note":
35
+        Taro.navigateTo({ url: `/pages/details/NoteDetails/index?id=${item.targetId}` })
36
+        break;
37
+      default:
38
+        break;
39
+    }
40
+
41
+    // targetType == "shop_package" && Taro.navigateTo({ url: `/pages/details/foodDetails/foodDetails?id=${item.shopId}` })
42
+    // targetType == "shop" && Taro.navigateTo({ url: `/pages/details/foodDetails/foodDetails?id=${item.targetId}` })
43
+    // targetType == "tourist" && Taro.navigateTo({ url: `/pages/details/mjDetails/sceneryDetails?id=${item.targetId}` })
44
+    // targetType == "note" && Taro.navigateTo({ url: `/pages/details/NoteDetails/index?id=${item.targetId}` })
26
   }
45
   }
27
 
46
 
28
   const PayAction = <Action.Icon icon={SeeDetails} text='查看详情' onClick={handleDetail} />
47
   const PayAction = <Action.Icon icon={SeeDetails} text='查看详情' onClick={handleDetail} />
44
                   <View className='cpn-card-text'>
63
                   <View className='cpn-card-text'>
45
                     {(item.title).toString().length > 25 ? (item.title).substring(0, 25) + '...' : (item.title)}
64
                     {(item.title).toString().length > 25 ? (item.title).substring(0, 25) + '...' : (item.title)}
46
                   </View>
65
                   </View>
47
-                  <View className='cpn-card-text' style={{ lineHeight:'10px' }}>
66
+                  <View className='cpn-card-text' style={{ lineHeight: '10px' }}>
48
                     <Text className='cpn-card-text_mn'>¥{`${(item.actualPrice / 100)?.toFixed(2)}元`}</Text>
67
                     <Text className='cpn-card-text_mn'>¥{`${(item.actualPrice / 100)?.toFixed(2)}元`}</Text>
49
                     <Text className='cpn-card-text_rm'>{`门市价${(item.standardPrice / 100)?.toFixed(2)}元`}</Text>
68
                     <Text className='cpn-card-text_rm'>{`门市价${(item.standardPrice / 100)?.toFixed(2)}元`}</Text>
50
                   </View>
69
                   </View>
58
         )
77
         )
59
       }
78
       }
60
       {
79
       {
61
-        targetType !== "shop_package" && (
80
+        targetType === "shop" && (
62
           <View style={{ margin: '15px 5px' }}>
81
           <View style={{ margin: '15px 5px' }}>
63
             <CouponCard action={PayAction}>
82
             <CouponCard action={PayAction}>
64
               <CouponMedia>
83
               <CouponMedia>
70
                   <View className='cpn-card-text'>
89
                   <View className='cpn-card-text'>
71
                     {(item.title).toString().length > 25 ? (item.title).substring(0, 25) + '...' : (item.title)}
90
                     {(item.title).toString().length > 25 ? (item.title).substring(0, 25) + '...' : (item.title)}
72
                   </View>
91
                   </View>
73
-                  <View className='cpn-card-text' style={{ lineHeight:'10px' }}>
92
+                  <View className='cpn-card-text' style={{ lineHeight: '10px' }}>
74
                     <Text className='cpn-card-text_mn'>¥{`${formatPrice(item.averagePrice)}元`}</Text>
93
                     <Text className='cpn-card-text_mn'>¥{`${formatPrice(item.averagePrice)}元`}</Text>
75
                   </View>
94
                   </View>
76
                   <View className='cpn-md-act'>
95
                   <View className='cpn-md-act'>
86
           </View>
105
           </View>
87
         )
106
         )
88
       }
107
       }
108
+
109
+      {
110
+        targetType === "tourist" && (
111
+          <View style={{ margin: '15px 5px' }}>
112
+            <CouponCard action={PayAction}>
113
+              <CouponMedia>
114
+                <CouponMedia.Header
115
+                  image={compressImage(item.poster)}
116
+                  badge={targetType}
117
+                />
118
+                <CouponMedia.Body >
119
+                  <View className='cpn-card-text'>
120
+                    {(item.title).toString().length > 25 ? (item.title).substring(0, 25) + '...' : (item.title)}
121
+                  </View>
122
+                  <View className='cpn-card-text' style={{ lineHeight: '10px' }}>
123
+                    <Text className='cpn-card-text_mn'>¥{`${formatPrice(item.averagePrice)}元`}</Text>
124
+                  </View>
125
+                  <View className='cpn-md-act'>
126
+                    <Location {...item} />
127
+                    <view className='wdscbaozan'>
128
+                      <image className='title-on' src={baozan} />
129
+                      <text className='title-on-text'>爆赞 {item.likeNum}</text>
130
+                    </view>
131
+                  </View>
132
+                </CouponMedia.Body>
133
+              </CouponMedia>
134
+            </CouponCard>
135
+          </View>
136
+        )
137
+      }
138
+      {
139
+        targetType === 'note' && (
140
+          <View style={{ margin: '15px 5px' }}>
141
+            <CouponCard action={PayAction}>
142
+              <CouponMedia>
143
+                <CouponMedia.Header
144
+                  image={compressImage(item.poster)}
145
+                  badge={targetType}
146
+                />
147
+                <CouponMedia.Body >
148
+                  <View className='cpn-card-text'>
149
+                    {(item.title).toString().length > 25 ? (item.title).substring(0, 25) + '...' : (item.title)}
150
+                  </View>
151
+                  {/* <View className='cpn-card-text' style={{ lineHeight: '10px' }}>
152
+                  <Text className='cpn-card-text_mn'>¥{`${formatPrice(item.averagePrice)}元`}</Text>
153
+                </View> */}
154
+                  {/* <View className='cpn-md-act'>
155
+                  <Location {...item} />
156
+                  <view className='wdscbaozan'>
157
+                    <image className='title-on' src={baozan} />
158
+                    <text className='title-on-text'>爆赞 {item.likeNum}</text>
159
+                  </view>
160
+                </View> */}
161
+                </CouponMedia.Body>
162
+              </CouponMedia>
163
+            </CouponCard>
164
+          </View>
165
+        )
166
+      }
89
     </View>
167
     </View>
90
   )
168
   )
91
 }
169
 }

+ 4
- 0
src/pages/RandomItinerary/components/FiveSenses/index.jsx View File

13
 const mouth = 'https://yz-shigongli.oss-cn-shanghai.aliyuncs.com/images/RandomIIcon/mouth.png'
13
 const mouth = 'https://yz-shigongli.oss-cn-shanghai.aliyuncs.com/images/RandomIIcon/mouth.png'
14
 
14
 
15
 export default (props) => {
15
 export default (props) => {
16
+  const { ico, textNext, onSelected } = props
17
+
18
+
16
   const [netxIma, setNetxIma] = useState(false)
19
   const [netxIma, setNetxIma] = useState(false)
17
   const [oneImage, setOneImage] = useState([
20
   const [oneImage, setOneImage] = useState([
18
     {
21
     {
44
   ])
47
   ])
45
 
48
 
46
   const handleTextNext = (e) => {
49
   const handleTextNext = (e) => {
50
+    onSelected()
47
 
51
 
48
     const res = oneImage.map((item, inx) => {
52
     const res = oneImage.map((item, inx) => {
49
 
53
 

+ 4
- 1
src/pages/RandomItinerary/components/GirlFriend/index.jsx View File

9
 
9
 
10
 
10
 
11
 export default (props) => {
11
 export default (props) => {
12
-  const { ico, textNext } = props
12
+  const { ico, textNext, onSelected } = props
13
+
13
   const YES = 'https://yz-shigongli.oss-cn-shanghai.aliyuncs.com/images/RandomIIcon/YES.png'
14
   const YES = 'https://yz-shigongli.oss-cn-shanghai.aliyuncs.com/images/RandomIIcon/YES.png'
14
   const No = 'https://yz-shigongli.oss-cn-shanghai.aliyuncs.com/images/RandomIIcon/No.png'
15
   const No = 'https://yz-shigongli.oss-cn-shanghai.aliyuncs.com/images/RandomIIcon/No.png'
15
 
16
 
19
   const handleYES = () => {
20
   const handleYES = () => {
20
     setImageOne(true)
21
     setImageOne(true)
21
     setImageTow(false)
22
     setImageTow(false)
23
+    onSelected()
22
   }
24
   }
23
 
25
 
24
 
26
 
25
   const handleNo = () => {
27
   const handleNo = () => {
26
     setImageOne(false)
28
     setImageOne(false)
27
     setImageTow(true)
29
     setImageTow(true)
30
+    onSelected()//未选择不给到下一题
28
   }
31
   }
29
 
32
 
30
 
33
 

+ 3
- 1
src/pages/RandomItinerary/components/Hand/index.jsx View File

10
 
10
 
11
 
11
 
12
 export default (props) => {
12
 export default (props) => {
13
-  const { ico, textNext } = props
13
+  const { ico, onSelected } = props
14
   const LeftHand = 'https://yz-shigongli.oss-cn-shanghai.aliyuncs.com/images/RandomIIcon/LeftHand.png'
14
   const LeftHand = 'https://yz-shigongli.oss-cn-shanghai.aliyuncs.com/images/RandomIIcon/LeftHand.png'
15
   const RightHand = 'https://yz-shigongli.oss-cn-shanghai.aliyuncs.com/images/RandomIIcon/RightHand.png'
15
   const RightHand = 'https://yz-shigongli.oss-cn-shanghai.aliyuncs.com/images/RandomIIcon/RightHand.png'
16
 
16
 
20
   const handleLeftHand = () => {
20
   const handleLeftHand = () => {
21
     setImageOne(true)
21
     setImageOne(true)
22
     setImageTow(false)
22
     setImageTow(false)
23
+    onSelected()
23
   }
24
   }
24
 
25
 
25
 
26
 
26
   const handleRightHand = () => {
27
   const handleRightHand = () => {
27
     setImageOne(false)
28
     setImageOne(false)
28
     setImageTow(true)
29
     setImageTow(true)
30
+    onSelected()
29
   }
31
   }
30
 
32
 
31
 
33
 

+ 2
- 2
src/pages/RandomItinerary/components/UFO/index.jsx View File

11
 
11
 
12
 
12
 
13
 export default (props) => {
13
 export default (props) => {
14
-  const { ico, textNext } = props
14
+  const { ico, onSelected } = props
15
   const [netxIma, setNetxIma] = useState(false)
15
   const [netxIma, setNetxIma] = useState(false)
16
 
16
 
17
   const MaJiang = 'https://yz-shigongli.oss-cn-shanghai.aliyuncs.com/images/RandomIIcon/MaJiang.png'
17
   const MaJiang = 'https://yz-shigongli.oss-cn-shanghai.aliyuncs.com/images/RandomIIcon/MaJiang.png'
59
 
59
 
60
 
60
 
61
   const handleTexUfo = (e) => {
61
   const handleTexUfo = (e) => {
62
-
62
+    onSelected()
63
     const res = ufoImage.map((item, inx) => {
63
     const res = ufoImage.map((item, inx) => {
64
 
64
 
65
       if (item.title == e.title) {
65
       if (item.title == e.title) {

+ 9
- 4
src/pages/RandomItinerary/index.jsx View File

26
 
26
 
27
   const onSelected = () => {
27
   const onSelected = () => {
28
     setI(true)
28
     setI(true)
29
+    setTimeout(() => {
30
+      setI(false)
31
+
32
+    }, 800);
33
+
29
   }
34
   }
30
 
35
 
31
   const handleGoTo = () => {
36
   const handleGoTo = () => {
68
             show === 1 && <ConstellationCard ico={ChangeNext} textNext='换一批' onSelected={onSelected} />
73
             show === 1 && <ConstellationCard ico={ChangeNext} textNext='换一批' onSelected={onSelected} />
69
           }
74
           }
70
           {
75
           {
71
-            show === 2 && <GirlFriend />
76
+            show === 2 && <GirlFriend onSelected={onSelected} />
72
           }
77
           }
73
           {
78
           {
74
-            show === 3 && <Hand />
79
+            show === 3 && <Hand onSelected={onSelected} />
75
           }
80
           }
76
           {
81
           {
77
-            show === 4 && <FiveSenses />
82
+            show === 4 && <FiveSenses onSelected={onSelected} />
78
           }
83
           }
79
           {
84
           {
80
-            show === 5 && <UFO />
85
+            show === 5 && <UFO onSelected={onSelected} />
81
           }
86
           }
82
 
87
 
83
         </View>
88
         </View>