修复:预约作品弹层滚动穿透
This commit is contained in:
@@ -454,6 +454,9 @@ Page({
|
|||||||
stopTap() {
|
stopTap() {
|
||||||
},
|
},
|
||||||
|
|
||||||
|
stopTouchMove() {
|
||||||
|
},
|
||||||
|
|
||||||
onProductSearch(event) {
|
onProductSearch(event) {
|
||||||
this.setData({ productKeyword: event.detail.value })
|
this.setData({ productKeyword: event.detail.value })
|
||||||
this.refreshProductCards()
|
this.refreshProductCards()
|
||||||
|
|||||||
@@ -79,7 +79,7 @@
|
|||||||
<text class="tip-text">{{conflictTip}}</text>
|
<text class="tip-text">{{conflictTip}}</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view wx:if="{{productModalVisible}}" class="modal-mask" bindtap="closeProductModal">
|
<view wx:if="{{productModalVisible}}" class="modal-mask" bindtap="closeProductModal" catchtouchmove="stopTouchMove">
|
||||||
<view class="product-modal" catchtap="stopTap">
|
<view class="product-modal" catchtap="stopTap">
|
||||||
<view class="modal-head">
|
<view class="modal-head">
|
||||||
<view>
|
<view>
|
||||||
@@ -88,7 +88,8 @@
|
|||||||
<view class="modal-close" bindtap="closeProductModal">×</view>
|
<view class="modal-close" bindtap="closeProductModal">×</view>
|
||||||
</view>
|
</view>
|
||||||
<input class="product-search" value="{{productKeyword}}" bindinput="onProductSearch" placeholder="搜索作品、标签、美甲师" />
|
<input class="product-search" value="{{productKeyword}}" bindinput="onProductSearch" placeholder="搜索作品、标签、美甲师" />
|
||||||
<scroll-view class="product-list" scroll-y>
|
<scroll-view class="product-modal-scroll" scroll-y enhanced show-scrollbar="{{false}}">
|
||||||
|
<view class="product-list">
|
||||||
<view wx:if="{{productError}}" class="product-empty">{{productError}}</view>
|
<view wx:if="{{productError}}" class="product-empty">{{productError}}</view>
|
||||||
<view wx:for="{{filteredProducts}}" wx:key="id" class="product-option {{form.productId == item.id ? 'active' : ''}}" data-id="{{item.id}}" bindtap="selectProduct">
|
<view wx:for="{{filteredProducts}}" wx:key="id" class="product-option {{form.productId == item.id ? 'active' : ''}}" data-id="{{item.id}}" bindtap="selectProduct">
|
||||||
<image wx:if="{{item.coverImage}}" class="product-cover" src="{{item.coverImage}}" mode="aspectFill"></image>
|
<image wx:if="{{item.coverImage}}" class="product-cover" src="{{item.coverImage}}" mode="aspectFill"></image>
|
||||||
@@ -105,7 +106,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view wx:if="{{!productError && filteredProducts.length === 0}}" class="product-empty">暂无匹配作品</view>
|
<view wx:if="{{!productError && filteredProducts.length === 0}}" class="product-empty">暂无匹配作品</view>
|
||||||
</scroll-view>
|
</view>
|
||||||
<view class="manual-panel">
|
<view class="manual-panel">
|
||||||
<text class="manual-title required-label">手动新增预约作品</text>
|
<text class="manual-title required-label">手动新增预约作品</text>
|
||||||
<view class="manual-grid">
|
<view class="manual-grid">
|
||||||
@@ -126,6 +127,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<button class="secondary-btn manual-btn" bindtap="useManualProduct">使用手动预约作品</button>
|
<button class="secondary-btn manual-btn" bindtap="useManualProduct">使用手动预约作品</button>
|
||||||
</view>
|
</view>
|
||||||
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|||||||
@@ -208,8 +208,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.product-modal {
|
.product-modal {
|
||||||
|
display: flex;
|
||||||
|
box-sizing: border-box;
|
||||||
|
height: 88vh;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-height: 88vh;
|
max-height: 88vh;
|
||||||
|
flex-direction: column;
|
||||||
|
overflow: hidden;
|
||||||
padding: 28rpx 28rpx calc(28rpx + env(safe-area-inset-bottom));
|
padding: 28rpx 28rpx calc(28rpx + env(safe-area-inset-bottom));
|
||||||
border-radius: 28rpx 28rpx 0 0;
|
border-radius: 28rpx 28rpx 0 0;
|
||||||
background: #fffaf4;
|
background: #fffaf4;
|
||||||
@@ -293,9 +298,16 @@
|
|||||||
font-size: 26rpx;
|
font-size: 26rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.product-list {
|
.product-modal-scroll {
|
||||||
max-height: 440rpx;
|
flex: 1;
|
||||||
|
height: 0;
|
||||||
|
min-height: 0;
|
||||||
margin-top: 20rpx;
|
margin-top: 20rpx;
|
||||||
|
padding-right: 2rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-list {
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.product-option {
|
.product-option {
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
const assert = require('assert')
|
||||||
|
const fs = require('fs')
|
||||||
|
const path = require('path')
|
||||||
|
|
||||||
|
const wxml = fs.readFileSync(path.join(__dirname, 'index.wxml'), 'utf8')
|
||||||
|
const wxss = fs.readFileSync(path.join(__dirname, 'index.wxss'), 'utf8')
|
||||||
|
const pageScript = fs.readFileSync(path.join(__dirname, 'index.js'), 'utf8')
|
||||||
|
|
||||||
|
assert.match(wxml, /class="modal-mask" bindtap="closeProductModal" catchtouchmove="stopTouchMove"/)
|
||||||
|
assert.match(wxml, /<scroll-view class="product-modal-scroll" scroll-y/)
|
||||||
|
assert.match(wxml, /<view class="product-list">/)
|
||||||
|
assert.match(wxss, /\.product-modal\s*\{[^}]*height:\s*88vh;[^}]*flex-direction:\s*column;[^}]*overflow:\s*hidden;/s)
|
||||||
|
assert.match(wxss, /\.product-modal-scroll\s*\{[^}]*flex:\s*1;[^}]*height:\s*0;[^}]*min-height:\s*0;/s)
|
||||||
|
assert.match(pageScript, /stopTouchMove\(\)\s*\{\s*\}/)
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
# 预约作品弹层滚动修复设计
|
||||||
|
|
||||||
|
## 问题
|
||||||
|
|
||||||
|
预约作品弹层只有最大高度,内部作品列表没有确定的可滚动高度;遮罩层也未拦截纵向触摸,导致滑动作品弹层时底层预约页面滚动。
|
||||||
|
|
||||||
|
## 方案
|
||||||
|
|
||||||
|
- 将作品弹层设置为固定视口高度的纵向弹性布局,并隐藏弹层自身溢出。
|
||||||
|
- 标题和搜索框保持固定,将作品列表及手动新增区域放入同一个纵向 `scroll-view`。
|
||||||
|
- 遮罩层拦截 `touchmove`,阻止手势穿透到底层页面。
|
||||||
|
- 保留点击遮罩关闭、作品选择、搜索和手动新增的原有业务行为。
|
||||||
|
|
||||||
|
## 验证
|
||||||
|
|
||||||
|
增加弹层结构测试,检查滚动容器、固定高度布局和触摸拦截;运行全部小程序测试。当前会话未提供 GitNexus `impact` 与 `detect_changes` 工具,因此使用静态引用检查、结构测试和 Git 差异检查替代。
|
||||||
Reference in New Issue
Block a user