调整预约款式图片排列

This commit is contained in:
2026-10-29 14:36:54 +08:00
parent 8f8f89e3b7
commit f6b8f9b72a
4 changed files with 35 additions and 13 deletions
@@ -103,14 +103,16 @@
</view>
<view class="manual-style-images">
<view class="manual-style-image-heading"><text>款式图片</text><text class="manual-style-image-count">{{form.manualProductImages.length}} / 9</text></view>
<view class="manual-style-image-grid">
<view wx:for="{{form.manualProductImages}}" wx:key="fileId" class="manual-style-image-tile">
<image src="{{item.previewUrl || item.fileUrl}}" mode="aspectFill" data-index="{{index}}" binderror="onManualProductImageError"></image>
<text wx:if="{{index === 0}}" class="manual-style-image-cover">封面</text>
<button class="manual-style-image-remove" data-index="{{index}}" disabled="{{manualImageUploading}}" catchtap="removeManualProductImage" aria-label="移除图片">×</button>
<scroll-view class="manual-style-image-scroll" scroll-x="true" enhanced="true" show-scrollbar="false">
<view class="manual-style-image-grid">
<view wx:for="{{form.manualProductImages}}" wx:key="fileId" class="manual-style-image-tile">
<image src="{{item.previewUrl || item.fileUrl}}" mode="aspectFill" data-index="{{index}}" binderror="onManualProductImageError"></image>
<text wx:if="{{index === 0}}" class="manual-style-image-cover">封面</text>
<button class="manual-style-image-remove" data-index="{{index}}" disabled="{{manualImageUploading}}" catchtap="removeManualProductImage" aria-label="移除图片">×</button>
</view>
<button wx:if="{{form.manualProductImages.length < 9}}" class="manual-style-add-image" bindtap="chooseManualProductImage" loading="{{manualImageUploading}}" disabled="{{manualImageUploading}}"><text class="manual-style-add-icon">+</text><text>点击添加图片</text></button>
</view>
<button wx:if="{{form.manualProductImages.length < 9}}" class="manual-style-add-image" bindtap="chooseManualProductImage" loading="{{manualImageUploading}}" disabled="{{manualImageUploading}}"><text class="manual-style-add-icon">+</text><text>点击添加图片</text></button>
</view>
</scroll-view>
<text class="manual-style-image-tip">第一张图片会作为款式封面</text>
</view>
<view class="manual-style-description-field">
@@ -1186,20 +1186,30 @@ button.full{
font-weight: 700;
}
.manual-style-image-grid {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
.manual-style-image-scroll {
width: 100%;
height: 218rpx;
margin-top: 16rpx;
white-space: nowrap;
}
.manual-style-image-grid {
display: inline-flex;
align-items: flex-start;
flex-wrap: nowrap;
gap: 16rpx;
min-width: 100%;
height: 206rpx;
}
.manual-style-image-tile,
.manual-style-add-image {
position: relative;
box-sizing: border-box;
width: calc((100% - 24rpx) / 3);
flex: 0 0 206rpx;
width: 206rpx;
height: 206rpx;
margin: 0 0 12rpx;
margin: 0;
overflow: hidden;
border-radius: 20rpx;
}
@@ -132,6 +132,7 @@ page.confirmManualProduct()
assert.strictEqual(page.data.manualProductSheetVisible, false)
const wxml = require('fs').readFileSync(require('path').join(__dirname, 'index.wxml'), 'utf8')
const wxss = require('fs').readFileSync(require('path').join(__dirname, 'index.wxss'), 'utf8')
assert.ok(wxml.indexOf('美甲款式') < wxml.indexOf('预约信息'))
assert.ok(wxml.indexOf('预约信息') < wxml.indexOf('>客户</text>'))
assert.match(wxml, /class="appointment-hero"/)
@@ -158,11 +159,15 @@ assert.match(wxml, /bind:openmanual="openManualProductFromLibrary"/)
assert.match(wxml, /show-manual-action="\{\{true\}\}"/)
assert.match(wxml, /本次 \{\{form\.amount \|\| '待填'\}\} 元/)
assert.match(wxml, /wx:for="\{\{form\.manualProductImages\}\}"/)
assert.match(wxml, /<scroll-view class="manual-style-image-scroll" scroll-x="true"/)
assert.match(wxml, /src="\{\{item\.previewUrl \|\| item\.fileUrl\}\}"/)
assert.match(wxml, /form\.manualProductImages\[0\]\.previewUrl \|\| form\.manualProductImages\[0\]\.fileUrl/)
assert.match(wxml, /manualProductImages\.length < 9/)
assert.match(wxml, /data-index="\{\{index\}\}"[^>]*catchtap="removeManualProductImage"/)
assert.match(wxml, /manualProductImages\.length\}\} \/ 9/)
assert.match(wxss, /\.manual-style-image-scroll\s*\{[^}]*height:\s*218rpx/s)
assert.match(wxss, /\.manual-style-image-grid\s*\{[^}]*flex-wrap:\s*nowrap/s)
assert.match(wxss, /\.manual-style-image-tile,\s*\.manual-style-add-image\s*\{[^}]*width:\s*206rpx;[^}]*height:\s*206rpx/s)
async function testManualProductImages() {
selectedImagePaths = ['/tmp/style-1.jpg', '/tmp/style-2.jpg', '/tmp/style-3.jpg']