Commit c4da84f3 by xiexiaoqin

fix:swipe when scroll

parent 46d5f471
...@@ -151,4 +151,10 @@ ...@@ -151,4 +151,10 @@
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
}
.scroll-lock {
height: 100%;
overflow-y: hidden;
position: fixed;
} }
\ No newline at end of file
<import src="../../template/affairBlank/index.axml"/> <import src="../../template/affairBlank/index.axml"/>
<scroll-view a:if="{{dynamicList.length !== 0}}" scroll-y="{{true}}" class="dynamicBox" onScrollToLower="onScrollToLower"> <view class="{{isStopBodyScroll ? 'scroll-lock' : ''}}" onTap="closeSwipe" onTouchStart="closeSwipe">
<view class="dynamicList"> <view a:if="{{dynamicList.length !== 0}}" scroll-y="{{true}}" class="dynamicBox" onScrollToLower="onScrollToLower">
<swipe rightWidth="{{ 78 }}" leftWidth="{{ 0 }}" a:for="{{dynamicList}}" class="dynamicContent"> <view class="dynamicList">
<view class="dynamicDetails"> <swipe onSetBodyDisableScroll="setBodyDisableScroll" rightWidth="{{ 78 }}" leftWidth="{{ 0 }}" a:for="{{dynamicList}}" class="dynamicContent">
<view class="meetingtitle"> <view class="dynamicDetails">
<view> <view class="meetingtitle">
<view>
{{item.title}} {{item.title}}
</view>
<view>
<text a:if="{{item.traceTime !== '1970-03-01 00:00:00'}}" class="iconfont iconicon_top1"></text>
</view>
</view>
<block a:for="{{item.meetingLogDataList.slice(0,2)}}" a:for-item="dynamicItem">
<view class="userDynamic">
<view class="dynamicTime">
<text>{{dynamicItem.creatorInfo.username}}更新了{{dynamicItem.category == 2 ? '文件' : '任务'}}</text>
<text>{{createTime}}</text>
</view> </view>
<file-list a:if="{{dynamicItem.category === '2'}}" fileView="{{dynamicItem.meetingLogResource}}" isCanEdit="{{false}}"/> <view>
<view class="dynamicFile" a:if="{{dynamicItem.category === '3'}}"> <text a:if="{{item.traceTime !== '1970-03-01 00:00:00'}}" class="iconfont iconicon_top1"></text>
<task-list onChangeTaskStatusOnList="onChangeTaskStatusOnList" taskList="{{[dynamicItem.meetingLogResource]}}" isCanEdit="{{false}}"/>
</view> </view>
</view> </view>
</block> <block a:for="{{item.meetingLogDataList.slice(0,2)}}" a:for-item="dynamicItem">
</view> <view class="userDynamic">
<view slot="right" class="placedTop" onTap="changeCollection" data-scheduleid="{{item.scheduleId}}" data-index="{{index}}" data-collection="{{item.traceTime === '1970-03-01 00:00:00' ? 'Y':'N'}}"> <view class="dynamicTime">
<text class="iconfont iconicon_top1 {{item.traceTime === '1970-03-01 00:00:00' ? '': 'isTopIcon'}}"></text> <text>{{dynamicItem.creatorInfo.username}}更新了{{dynamicItem.category == 2 ? '文件' : '任务'}}</text>
</view> <text>{{createTime}}</text>
</swipe> </view>
<file-list a:if="{{dynamicItem.category === '2'}}" fileView="{{dynamicItem.meetingLogResource}}" isCanEdit="{{false}}"/>
<view class="dynamicFile" a:if="{{dynamicItem.category === '3'}}">
<task-list onChangeTaskStatusOnList="onChangeTaskStatusOnList" taskList="{{[dynamicItem.meetingLogResource]}}" isCanEdit="{{false}}"/>
</view>
</view>
</block>
</view>
<view slot="right" class="placedTop" onTap="changeCollection" data-scheduleid="{{item.scheduleId}}" data-index="{{index}}" data-collection="{{item.traceTime === '1970-03-01 00:00:00' ? 'Y':'N'}}">
<text class="iconfont iconicon_top1 {{item.traceTime === '1970-03-01 00:00:00' ? '': 'isTopIcon'}}"></text>
</view>
</swipe>
</view>
</view>
<view class="noDate" a:else>
<template is="affair-placeholder" data="{{title: '展示安排的所有动态', tip: '实时同步所有事件的最新动态,便于随时处理工作内容'}}"/>
</view> </view>
</scroll-view>
<view class="noDate" a:else>
<template is="affair-placeholder" data="{{title: '展示安排的所有动态', tip: '实时同步所有事件的最新动态,便于随时处理工作内容'}}"/>
</view> </view>
\ No newline at end of file
...@@ -4,9 +4,12 @@ import { ...@@ -4,9 +4,12 @@ import {
updateMeetingTask updateMeetingTask
} from "../../api/request"; } from "../../api/request";
import { dealFileTime, uniqueObject } from "../../utils/utils"; import { dealFileTime, uniqueObject } from "../../utils/utils";
Component({ import create from 'dd-store';
create.Component({
mixins: [], mixins: [],
data: { data: {
isStopBodyScroll: false,
isTop: false, isTop: false,
isTouchMove: false, isTouchMove: false,
touchMoveId: "", touchMoveId: "",
...@@ -24,6 +27,15 @@ Component({ ...@@ -24,6 +27,15 @@ Component({
didUpdate() { }, didUpdate() { },
didUnmount() { }, didUnmount() { },
methods: { methods: {
setBodyDisableScroll(isStopBodyScroll) {
this.setData({
isStopBodyScroll
})
},
//点击页面关闭侧滑模块
closeSwipe() {
this.$store.closeActiveSwipe()
},
getPages(current) { getPages(current) {
let that = this; let that = this;
let data = { let data = {
......
{ {
"component": true, "component": true,
"disableScroll": true,
"usingComponents": { "usingComponents": {
"task-list": "../../components/taskList/taskList", "task-list": "../../components/taskList/taskList",
"file-list": "../../components/fileList/fileList", "file-list": "../../components/fileList/fileList",
......
<view disable-scroll="{{true}}" class="swipe-cell" data-key="cell" catchTap="onClick" catchTouchStart="startDrag" catchTouchMove="onDrag" catchTouchEnd="endDrag" catchTouchCancel="endDrag"> <view class="swipe-cell" data-key="cell" catchTap="onClick" catchTouchStart="startDrag" catchTouchMove="onDrag" catchTouchEnd="endDrag" catchTouchCancel="endDrag">
<view style="{{ wrapperStyle }}"> <view style="{{ wrapperStyle }}">
<view a:if="{{ leftWidth }}" class="swipe-cell__left" data-key="left" catchTap="onClick"> <view a:if="{{ leftWidth }}" class="swipe-cell__left" data-key="left" catchTap="onClick">
<slot name="left" /> <slot name="left" />
......
import create from 'dd-store';
var MIN_DISTANCE = 10; var MIN_DISTANCE = 10;
var THRESHOLD = 0.3; var THRESHOLD = 0.3;
function getDirection(x, y) { function getDirection(x, y) {
...@@ -19,7 +20,7 @@ let ARRAY = []; ...@@ -19,7 +20,7 @@ let ARRAY = [];
function range(num, min, max) { function range(num, min, max) {
return Math.min(Math.max(num, min), max); return Math.min(Math.max(num, min), max);
} }
Component({ create.Component({
mixins: [], mixins: [],
offset: 0, offset: 0,
data: { data: {
...@@ -73,8 +74,11 @@ Component({ ...@@ -73,8 +74,11 @@ Component({
if (this.direction !== 'horizontal') { if (this.direction !== 'horizontal') {
return; return;
} }
//设置页面禁止竖向滚动
this.props.onSetBodyDisableScroll(true);
//滑动的时候不要过度时间,否则不跟手势的感觉 //滑动的时候不要过度时间,否则不跟手势的感觉
this.dragging = true; this.dragging = true;
// 其他组件归位 // 其他组件归位
ARRAY.filter((item) => { return item !== this }).forEach(function (item) { return item.close(); }); ARRAY.filter((item) => { return item !== this }).forEach(function (item) { return item.close(); });
this.swipeMove(this.startOffset + this.deltaX); this.swipeMove(this.startOffset + this.deltaX);
...@@ -109,11 +113,19 @@ Component({ ...@@ -109,11 +113,19 @@ Component({
else { else {
this.swipeMove(0); this.swipeMove(0);
} }
//恢复页面竖向滚动
this.props.onSetBodyDisableScroll(false);
}, },
open: function (position) { open: function (position) {
const { leftWidth, rightWidth } = this.props; const { leftWidth, rightWidth } = this.props;
var offset = position === 'left' ? leftWidth : -rightWidth; var offset = position === 'left' ? leftWidth : -rightWidth;
this.swipeMove(offset); this.swipeMove(offset);
//向父组件暴露关闭方法
this.$store.closeActiveSwipe = () => {
this.close();
}
this.update();
}, },
}, },
}); });
版本175 <view style="position:absolute">
{{tabBarIndex}} 版本175
</view>
<view a:if="{{tabBarIndex === '0'}}"> <view a:if="{{tabBarIndex === '0'}}">
<my-dynamic> <my-dynamic>
</my-dynamic> </my-dynamic>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment