张延森 преди 3 години
родител
ревизия
12079ee08b
променени са 3 файла, в които са добавени 6 реда и са изтрити 4 реда
  1. 1
    1
      src/components/BossCard/index.jsx
  2. 1
    1
      src/components/CouponCard/Media/Header.jsx
  3. 4
    2
      src/utils/index.js

+ 1
- 1
src/components/BossCard/index.jsx Целия файл

@@ -33,7 +33,7 @@ export default (props) => {
33 33
       <CouponMedia onClick={goFood}>
34 34
         <CouponMedia.Header
35 35
           cashback={item.cashback}
36
-          image={compressImage(item.poster)}
36
+          image={compressImage(item.poster, 'thumb')}
37 37
           badge='food'
38 38
         />
39 39
         <CouponMedia.Body star={st}>

+ 1
- 1
src/components/CouponCard/Media/Header.jsx Целия файл

@@ -14,7 +14,7 @@ export default (props) => {
14 14
       {enableCashback && <Cashback money={cashback} style={{ marginTop: '-10px' }} />}
15 15
       <View className='coupun-media_thumb'>
16 16
         <BadgeTag type={badge} />
17
-        <Image src={image} />
17
+        <Image src={image} webp />
18 18
       </View>
19 19
     </View>
20 20
   )

+ 4
- 2
src/utils/index.js Целия файл

@@ -61,15 +61,17 @@ export function random(prefix) {
61 61
  * @param {*} url 
62 62
  * @returns 
63 63
  */
64
-export function compressImage(url) {
64
+export function compressImage(url, typ) {
65 65
   if (!url) return url;
66 66
 
67 67
   // GIF 不压缩
68 68
   if (url.indexOf('.gif') > -1) return url;
69 69
 
70
+  const style = typ || 'cmp80'
71
+
70 72
   // eslint-disable-next-line no-undef
71 73
   if (url.indexOf(OSS) > -1) {
72
-    return `${url}?x-oss-process=style/cmp80`
74
+    return `${url}?x-oss-process=style/${style}`.replace('http://', 'https://')
73 75
   }
74 76
 
75 77
   return url;