feat(image): 全项目应用图片压缩优化
- 将图片显示统一替换为 getCompressedImageUrl 函数处理压缩 - 覆盖 35 个文件,包括 4 个组件和 31 个页面 - 主要组件:LazyImage、ProductCard、OrderCard、SkuSelector 内部自动压缩图片 - 主要页面:购物车、订单、积分、活动、拼团、秒杀、收藏、浏览历史等 - 跳过用户头像、二维码、商品详情大图及所有 Taro.previewImage 调用 - 调整压缩默认宽度为 300,保持质量90,启用压缩功能
This commit is contained in:
@@ -3,6 +3,7 @@ import { View, Text, ScrollView, Image } from '@tarojs/components'
|
||||
import Taro from '@tarojs/taro'
|
||||
import { getShopEvent, getRegistrationStatus, getEventStatusLabel } from '@/api/shop/shopEvent'
|
||||
import type { ShopEvent, RegistrationStatus, EventFormField } from '@/api/shop/shopEvent'
|
||||
import { getCompressedImageUrl } from '@/utils/image'
|
||||
|
||||
definePageConfig({ navigationBarTitleText: '赛事详情' })
|
||||
|
||||
@@ -85,7 +86,7 @@ const EventDetailPage: React.FC = () => {
|
||||
<ScrollView scrollY className='flex-1'>
|
||||
{/* 封面 */}
|
||||
{event.image ? (
|
||||
<Image src={event.image} className='w-full' style={{ height: '200px' }} mode='aspectFill' />
|
||||
<Image src={getCompressedImageUrl(event.image)} className='w-full' style={{ height: '200px' }} mode='aspectFill' />
|
||||
) : (
|
||||
<View className='w-full flex items-center justify-center' style={{ height: '200px', background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)' }}>
|
||||
<Text className='text-6xl'>🏆</Text>
|
||||
|
||||
@@ -5,6 +5,7 @@ import { pageShopEvent, getEventStatusLabel } from '@/api/shop/shopEvent'
|
||||
import type { ShopEvent } from '@/api/shop/shopEvent'
|
||||
import EmptyState from '@/components/common/EmptyState'
|
||||
import LoadMore from '@/components/common/LoadMore'
|
||||
import { getCompressedImageUrl } from '@/utils/image'
|
||||
|
||||
definePageConfig({ navigationBarTitleText: '赛事报名' })
|
||||
|
||||
@@ -84,7 +85,7 @@ const EventListPage: React.FC = () => {
|
||||
>
|
||||
{/* 封面 */}
|
||||
{event.image ? (
|
||||
<Image src={event.image} className='w-full' style={{ height: '160px' }} mode='aspectFill' />
|
||||
<Image src={getCompressedImageUrl(event.image)} className='w-full' style={{ height: '160px' }} mode='aspectFill' />
|
||||
) : (
|
||||
<View className='w-full flex items-center justify-center' style={{ height: '140px', background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)' }}>
|
||||
<Text className='text-5xl'>🏆</Text>
|
||||
|
||||
Reference in New Issue
Block a user