张延森 3 years ago
parent
commit
cf45c4161f

+ 4
- 2
src/components/CouponCard/Media/Body.jsx View File

6
 export default (props) => {
6
 export default (props) => {
7
   const { star } = props
7
   const { star } = props
8
 
8
 
9
+  const enableStar = star !== undefined && star !== null
10
+
9
   return (
11
   return (
10
     <View className='coupun-media_body'>
12
     <View className='coupun-media_body'>
11
-      {star?<Star score={(star).toFixed(1)} style={{ position: 'absolute', top: '26rpx', left: 0 }} />:''}      
12
-      <View>
13
+      {enableStar && <Star score={(star).toFixed(1)} style={{ marginTop: '26rpx' }} />}      
14
+      <View className='coupun-media_body_ctt'>
13
         {props.children}
15
         {props.children}
14
       </View>
16
       </View>
15
     </View>
17
     </View>

+ 3
- 1
src/components/CouponCard/Media/Header.jsx View File

7
 export default (props) => {
7
 export default (props) => {
8
   const { cashback, badge, image } = props
8
   const { cashback, badge, image } = props
9
 
9
 
10
+  const enableCashback = cashback !== undefined && cashback !== null
11
+
10
   return (
12
   return (
11
     <View className='coupun-media_header'>
13
     <View className='coupun-media_header'>
12
-      {cashback?<Cashback money={cashback} style={{ position: 'absolute', top: '10px', left: 0 }} />:''}
14
+      {enableCashback && <Cashback money={cashback} style={{ marginTop: '10px' }} />}
13
       <View className='coupun-media_thumb'>
15
       <View className='coupun-media_thumb'>
14
         <BadgeTag type={badge} />
16
         <BadgeTag type={badge} />
15
         <Image src={image} />
17
         <Image src={image} />

+ 8
- 2
src/components/CouponCard/Media/style.less View File

8
     width: 184px;
8
     width: 184px;
9
     position: relative;
9
     position: relative;
10
 
10
 
11
-    padding: 78px 20px 40px;
11
+    padding: 0 20px 40px 0;
12
   }
12
   }
13
 
13
 
14
   &_thumb {
14
   &_thumb {
15
+    margin-top: 20px;
16
+    margin-left: 20px;
15
     width: 144px;
17
     width: 144px;
16
     height: 144px;
18
     height: 144px;
17
     border-radius: 24px;
19
     border-radius: 24px;
28
   &_body {
30
   &_body {
29
     flex: auto;
31
     flex: auto;
30
     position: relative;
32
     position: relative;
31
-    padding: 78px 20px 40px 0;
33
+    padding: 0 20px 40px 0;
32
     box-sizing: border-box;
34
     box-sizing: border-box;
35
+
36
+    &_ctt {
37
+      margin-top: 20px;
38
+    }
33
   }
39
   }
34
 }
40
 }