feat(image): 全项目应用图片压缩优化

- 将图片显示统一替换为 getCompressedImageUrl 函数处理压缩
- 覆盖 35 个文件,包括 4 个组件和 31 个页面
- 主要组件:LazyImage、ProductCard、OrderCard、SkuSelector 内部自动压缩图片
- 主要页面:购物车、订单、积分、活动、拼团、秒杀、收藏、浏览历史等
- 跳过用户头像、二维码、商品详情大图及所有 Taro.previewImage 调用
- 调整压缩默认宽度为 300,保持质量90,启用压缩功能
This commit is contained in:
2026-07-06 12:21:39 +08:00
parent c3dd04fa03
commit 082646a613
41 changed files with 95 additions and 50 deletions

View File

@@ -5,6 +5,7 @@ import { getBenefitPackageDetail, exchangeBenefitPackage } from '@/api/shop/shop
import { getDefaultAddress } from '@/api/shop/shopUserAddress';
import { getUserBalance } from '@/api/system/user/balance';
import './index.scss';
import { getCompressedImageUrl } from '@/utils/image';
definePageConfig({
navigationBarTitleText: '确认兑换',
@@ -113,7 +114,7 @@ export default function BenefitExchangeConfirmPage() {
{/* 权益包信息 */}
<View className="pkg-info-card">
{pkg.coverImage && (
<Image className="pkg-img" src={pkg.coverImage} mode="aspectFill" />
<Image className="pkg-img" src={getCompressedImageUrl(pkg.coverImage)} mode="aspectFill" />
)}
<View className="pkg-detail">
<Text className="pkg-name">{pkg.name}</Text>

View File

@@ -4,6 +4,7 @@ import { useState, useEffect } from 'react';
import { getBenefitPackageList } from '@/api/shop/shopMemberBenefit';
import EmptyState from '@/components/common/EmptyState';
import './index.scss';
import { getCompressedImageUrl } from '@/utils/image';
definePageConfig({
navigationBarTitleText: '会员权益包',
@@ -54,7 +55,7 @@ export default function BenefitPackagesPage() {
{list.map((pkg) => (
<View key={pkg.id} className="pkg-card">
{pkg.coverImage && (
<Image className="pkg-cover" src={pkg.coverImage} mode="aspectFill" />
<Image className="pkg-cover" src={getCompressedImageUrl(pkg.coverImage)} mode="aspectFill" />
)}
<View className="pkg-body">
<View className="pkg-header">

View File

@@ -5,6 +5,7 @@ import { listShopGoodsFavorite } from '@/api/shop/shopGoodsFavorite'
import type { ShopGoodsFavorite } from '@/api/shop/shopGoodsFavorite/model'
import EmptyState from '@/components/common/EmptyState'
import LoadMore from '@/components/common/LoadMore'
import { getCompressedImageUrl } from '@/utils/image'
definePageConfig({
navigationBarTitleText: '我的收藏',
@@ -69,7 +70,7 @@ const FavoriteListPage: React.FC = () => {
<Image
className='w-full'
style={{ height: '160px' }}
src={item.goodsImage}
src={getCompressedImageUrl(item.goodsImage)}
mode='aspectFill'
/>
<View className='p-2'>

View File

@@ -3,6 +3,7 @@ import { View, Text, Image, ScrollView } from '@tarojs/components'
import Taro from '@tarojs/taro'
import EmptyState from '@/components/common/EmptyState'
import LoadMore from '@/components/common/LoadMore'
import { getCompressedImageUrl } from '@/utils/image'
definePageConfig({
navigationBarTitleText: '浏览历史',
@@ -82,7 +83,7 @@ const BrowseHistoryPage: React.FC = () => {
<Image
className='w-full'
style={{ height: '160px' }}
src={item.image}
src={getCompressedImageUrl(item.image)}
mode='aspectFill'
/>
<View className='p-2'>