|
|
|
|
@ -7,11 +7,12 @@
|
|
|
|
|
:background="background"
|
|
|
|
|
:backIconName="fromShare ? 'home' : 'arrow-left'"
|
|
|
|
|
></u-navbar>
|
|
|
|
|
<!-- @touchstart="onTouchStart"
|
|
|
|
|
@touchmove="onTouchMove"
|
|
|
|
|
@touchend="onTouchEnd" -->
|
|
|
|
|
<view
|
|
|
|
|
class="scroll-container"
|
|
|
|
|
@touchstart="onTouchStart"
|
|
|
|
|
@touchmove="onTouchMove"
|
|
|
|
|
@touchend="onTouchEnd"
|
|
|
|
|
|
|
|
|
|
>
|
|
|
|
|
<view class="background-container"
|
|
|
|
|
style="width: 100%;overflow: hidden;"
|
|
|
|
|
@ -337,17 +338,25 @@ export default {
|
|
|
|
|
|
|
|
|
|
if (e.touches && e.touches.length > 0) {
|
|
|
|
|
this.moveY = e.touches[0].pageY;
|
|
|
|
|
const query = uni.createSelectorQuery().in(this);
|
|
|
|
|
query.select('.scroll-container').boundingClientRect(data => {
|
|
|
|
|
if (data) {
|
|
|
|
|
const scrollTop = data.scrollTop || 0;
|
|
|
|
|
if (scrollTop <= 0 && this.moveY > this.startY) {
|
|
|
|
|
const pullDistance = this.moveY - this.startY;
|
|
|
|
|
this.backgroundScale++;
|
|
|
|
|
this.mtScroll++;
|
|
|
|
|
const moveDistance = this.moveY - this.startY;
|
|
|
|
|
|
|
|
|
|
// 只有向下移动(moveDistance > 0)时才触发下拉效果
|
|
|
|
|
if (moveDistance > 0) {
|
|
|
|
|
const query = uni.createSelectorQuery().in(this);
|
|
|
|
|
query.select('.scroll-container').boundingClientRect(data => {
|
|
|
|
|
if (data) {
|
|
|
|
|
const scrollTop = data.scrollTop || 0;
|
|
|
|
|
// 只有在滚动到顶部且向下拉动时才执行缩放
|
|
|
|
|
if (scrollTop <= 0) {
|
|
|
|
|
// 根据移动距离计算缩放值,使效果更自然
|
|
|
|
|
// 可以调整 divisor(这里是80)来改变缩放的灵敏度
|
|
|
|
|
const scaleValue = Math.min(moveDistance / 40, 5); // 限制最大缩放值
|
|
|
|
|
this.backgroundScale = scaleValue;
|
|
|
|
|
this.mtScroll = scaleValue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}).exec();
|
|
|
|
|
}).exec();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|