|
@@ -1,4 +1,5 @@
|
1
|
|
-import React from 'react'
|
|
1
|
+import React, { useEffect, useState } from 'react'
|
|
2
|
+import Taro from '@tarojs/taro'
|
2
|
3
|
import { View, Image } from '@tarojs/components'
|
3
|
4
|
import BadgeTag from '@/components/BadgeTag'
|
4
|
5
|
import Cashback from '../Cashback'
|
|
@@ -9,12 +10,39 @@ export default (props) => {
|
9
|
10
|
|
10
|
11
|
const enableCashback = cashback !== undefined && cashback !== null
|
11
|
12
|
|
|
13
|
+ // // 为了解决苹果手机上图片不显示问题
|
|
14
|
+ // const [imgUrl, setImgUrl] = useState()
|
|
15
|
+ // useEffect(() => {
|
|
16
|
+ // if (image) {
|
|
17
|
+ // Taro.downloadFile({
|
|
18
|
+ // url: image,
|
|
19
|
+ // success: res => setImgUrl(res.tempFilePath),
|
|
20
|
+ // fail: err => {
|
|
21
|
+ // console.error(err)
|
|
22
|
+ // setImgUrl(image)
|
|
23
|
+ // }
|
|
24
|
+ // })
|
|
25
|
+ // } else {
|
|
26
|
+ // setImgUrl()
|
|
27
|
+ // }
|
|
28
|
+ // }, [image])
|
|
29
|
+ // const handleError = (e) => {
|
|
30
|
+ // console.error('-------image----->', image)
|
|
31
|
+ // console.error(e)
|
|
32
|
+ // }
|
|
33
|
+
|
|
34
|
+ const backImage = {
|
|
35
|
+ background: `url('${image}') no-repeat`,
|
|
36
|
+ backgroundSize: '100%',
|
|
37
|
+ }
|
|
38
|
+
|
12
|
39
|
return (
|
13
|
40
|
<View className='coupun-media_header'>
|
14
|
41
|
{enableCashback && <Cashback money={cashback} style={{ marginTop: '-10px' }} />}
|
15
|
42
|
<View className='coupun-media_thumb'>
|
16
|
43
|
<BadgeTag type={badge} />
|
17
|
|
- <Image src={image} webp />
|
|
44
|
+ {/* <Image src={image} webp mode='widthFix'onError={handleError} /> */}
|
|
45
|
+ <View className='image' style={backImage}></View>
|
18
|
46
|
</View>
|
19
|
47
|
</View>
|
20
|
48
|
)
|