feat(image): 全项目应用图片压缩优化
- 将图片显示统一替换为 getCompressedImageUrl 函数处理压缩 - 覆盖 35 个文件,包括 4 个组件和 31 个页面 - 主要组件:LazyImage、ProductCard、OrderCard、SkuSelector 内部自动压缩图片 - 主要页面:购物车、订单、积分、活动、拼团、秒杀、收藏、浏览历史等 - 跳过用户头像、二维码、商品详情大图及所有 Taro.previewImage 调用 - 调整压缩默认宽度为 300,保持质量90,启用压缩功能
This commit is contained in:
@@ -10,6 +10,7 @@ import type { CmsAd } from '@/api/cms/cmsAd/model'
|
||||
import type { CmsArticle } from '@/api/cms/cmsArticle/model'
|
||||
import type { ShopGoods } from '@/api/shop/shopGoods/model'
|
||||
import Price from '@/components/common/Price'
|
||||
import { getCompressedImageUrl } from '@/utils/image'
|
||||
|
||||
definePageConfig({
|
||||
navigationBarTitleText: '首页',
|
||||
@@ -131,7 +132,7 @@ const IndexPage: React.FC = () => {
|
||||
<SwiperItem key={item.adId}>
|
||||
<Image
|
||||
className='w-full h-full'
|
||||
src={item.imageList?.[0]?.url || item.image || ''}
|
||||
src={getCompressedImageUrl(item.imageList?.[0]?.url || item.image || '', { width: 750, quality: 90})}
|
||||
mode='aspectFill'
|
||||
onClick={() => {
|
||||
if (item.path) Taro.navigateTo({ url: item.path })
|
||||
@@ -230,7 +231,7 @@ const IndexPage: React.FC = () => {
|
||||
{item.image ? (
|
||||
<Image
|
||||
style={{ position: 'absolute', top: 0, left: 0, width: '100%', height: '100%' }}
|
||||
src={item.image}
|
||||
src={getCompressedImageUrl(item.image)}
|
||||
mode='aspectFill'
|
||||
/>
|
||||
) : (
|
||||
|
||||
Reference in New Issue
Block a user