|
@@ -23,16 +23,20 @@ export function GoodsCard({ data, onPress }: GoodsCardProps) {
|
|
|
<ImageBackground
|
|
<ImageBackground
|
|
|
source={{ uri: Images.home.cellGoodsBg }}
|
|
source={{ uri: Images.home.cellGoodsBg }}
|
|
|
style={[styles.cell, { width: CARD_WIDTH }]}
|
|
style={[styles.cell, { width: CARD_WIDTH }]}
|
|
|
- resizeMode="cover"
|
|
|
|
|
|
|
+ resizeMode="stretch"
|
|
|
>
|
|
>
|
|
|
<View style={[styles.content, { width: CARD_WIDTH - 10 }]}>
|
|
<View style={[styles.content, { width: CARD_WIDTH - 10 }]}>
|
|
|
<View style={styles.imgBox}>
|
|
<View style={styles.imgBox}>
|
|
|
- <Image source={data.cover} style={styles.image} contentFit="contain" />
|
|
|
|
|
- {/* 图片边框装饰 */}
|
|
|
|
|
|
|
+ <Image
|
|
|
|
|
+ source={typeof data.cover === 'string' ? { uri: data.cover } : data.cover}
|
|
|
|
|
+ style={styles.image}
|
|
|
|
|
+ contentFit="contain"
|
|
|
|
|
+ />
|
|
|
|
|
+ {/* 图片边框装饰 - scaled to 70% to match Vue implementation */}
|
|
|
<ImageBackground
|
|
<ImageBackground
|
|
|
source={{ uri: Images.home.imgBoxBorder }}
|
|
source={{ uri: Images.home.imgBoxBorder }}
|
|
|
style={styles.imgBoxBorder}
|
|
style={styles.imgBoxBorder}
|
|
|
- resizeMode="center"
|
|
|
|
|
|
|
+ resizeMode="contain"
|
|
|
/>
|
|
/>
|
|
|
</View>
|
|
</View>
|
|
|
<View style={styles.textBox}>
|
|
<View style={styles.textBox}>
|
|
@@ -59,18 +63,24 @@ const styles = StyleSheet.create({
|
|
|
cell: {
|
|
cell: {
|
|
|
height: CARD_HEIGHT,
|
|
height: CARD_HEIGHT,
|
|
|
marginBottom: 12,
|
|
marginBottom: 12,
|
|
|
|
|
+ justifyContent: 'center',
|
|
|
|
|
+ alignItems: 'center',
|
|
|
},
|
|
},
|
|
|
content: {
|
|
content: {
|
|
|
overflow: 'hidden',
|
|
overflow: 'hidden',
|
|
|
borderRadius: 8,
|
|
borderRadius: 8,
|
|
|
|
|
+ alignItems: 'center',
|
|
|
|
|
+ // Width set inline to CARD_WIDTH - 10
|
|
|
},
|
|
},
|
|
|
imgBox: {
|
|
imgBox: {
|
|
|
- width: IMG_BOX_WIDTH,
|
|
|
|
|
|
|
+ width: IMG_BOX_WIDTH, // Vue uses fixed width 340rpx (170pt)
|
|
|
height: IMG_BOX_HEIGHT,
|
|
height: IMG_BOX_HEIGHT,
|
|
|
borderRadius: 7,
|
|
borderRadius: 7,
|
|
|
overflow: 'hidden',
|
|
overflow: 'hidden',
|
|
|
- paddingHorizontal: 6,
|
|
|
|
|
|
|
+ paddingHorizontal: 6, // Match Vue: padding: 0 12rpx
|
|
|
alignSelf: 'center',
|
|
alignSelf: 'center',
|
|
|
|
|
+ justifyContent: 'center', // Ensure content centers if padding affects it
|
|
|
|
|
+ alignItems: 'center',
|
|
|
},
|
|
},
|
|
|
image: {
|
|
image: {
|
|
|
width: '100%',
|
|
width: '100%',
|
|
@@ -78,10 +88,10 @@ const styles = StyleSheet.create({
|
|
|
},
|
|
},
|
|
|
imgBoxBorder: {
|
|
imgBoxBorder: {
|
|
|
position: 'absolute',
|
|
position: 'absolute',
|
|
|
- left: 0,
|
|
|
|
|
- top: 0,
|
|
|
|
|
- width: '100%',
|
|
|
|
|
- height: '100%',
|
|
|
|
|
|
|
+ width: '85%', // 70% background-size in Vue roughly maps to shrinking this, but let's try 85% first as 70% might be too small if cover is contain. Vue says bg-size 70%.
|
|
|
|
|
+ height: '85%',
|
|
|
|
|
+ alignSelf: 'center',
|
|
|
|
|
+ top: '7.5%', // Center it vertically
|
|
|
},
|
|
},
|
|
|
textBox: {
|
|
textBox: {
|
|
|
paddingHorizontal: 9,
|
|
paddingHorizontal: 9,
|