feat(store): add store sortOrder and swipeable package gallery
Enable HQ-controlled store list ordering and horizontal multi-image browsing on package detail. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import { useCallback, useState } from 'react';
|
||||
import { View, Text, Image } from '@tarojs/components';
|
||||
import { View, Text } from '@tarojs/components';
|
||||
import Taro, { useLoad, useRouter } from '@tarojs/taro';
|
||||
import { normalizeStorePackageImageUrls } from '@dukang/shared-types';
|
||||
import PageShell from '../../components/PageShell';
|
||||
import PageNavBar from '../../components/PageNavBar';
|
||||
import ProductCarousel from '../../components/ProductCarousel';
|
||||
import { request, toast } from '../../lib/api';
|
||||
|
||||
type StorePackage = {
|
||||
@@ -99,10 +100,6 @@ export default function StorePackageDetailPage() {
|
||||
}
|
||||
}
|
||||
|
||||
function previewImage(urls: string[], current: string) {
|
||||
Taro.previewImage({ urls, current }).catch(() => toast('无法预览图片'));
|
||||
}
|
||||
|
||||
if (loading) {
|
||||
return (
|
||||
<PageShell variant="scroll" className="store-package-detail-page">
|
||||
@@ -139,19 +136,16 @@ export default function StorePackageDetailPage() {
|
||||
) : null}
|
||||
</View>
|
||||
|
||||
{imageUrls.map((url) => (
|
||||
<View
|
||||
key={url}
|
||||
className="store-package-detail-photo"
|
||||
onClick={() => previewImage(imageUrls, url)}
|
||||
>
|
||||
<Image
|
||||
className="store-package-detail-photo-image"
|
||||
src={url}
|
||||
mode="widthFix"
|
||||
{imageUrls.length > 0 ? (
|
||||
<View className="store-package-detail-gallery">
|
||||
<ProductCarousel
|
||||
images={imageUrls}
|
||||
alt={pkg.name}
|
||||
variant="detail"
|
||||
previewable
|
||||
/>
|
||||
</View>
|
||||
))}
|
||||
) : null}
|
||||
|
||||
<View className="store-package-detail-content">
|
||||
<View className="store-detail-package-field">
|
||||
|
||||
@@ -352,7 +352,7 @@
|
||||
padding-left: 4px;
|
||||
}
|
||||
|
||||
.store-package-detail-photo {
|
||||
.store-package-detail-gallery {
|
||||
margin: 14px 0 0;
|
||||
border-radius: var(--radius-lg);
|
||||
overflow: hidden;
|
||||
@@ -360,10 +360,8 @@
|
||||
box-shadow: var(--shadow-card);
|
||||
}
|
||||
|
||||
.store-package-detail-photo-image {
|
||||
width: 100%;
|
||||
display: block;
|
||||
vertical-align: top;
|
||||
.store-package-detail-gallery .detail-carousel-wrap {
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.store-package-detail-content {
|
||||
|
||||
Reference in New Issue
Block a user