sys 2 lat temu
rodzic
commit
04bed3f96d
2 zmienionych plików z 22 dodań i 8 usunięć
  1. 10 4
      components/dgex-tantan/dgex-tantan.vue
  2. 12 4
      service/tools.js

+ 10 - 4
components/dgex-tantan/dgex-tantan.vue

@@ -3,11 +3,12 @@
 		width: winWidth + 'px',
 		height: winHeigh + 'px',
 	}">
+<!--    @touchstart.capture="touchStart($event,currentIndex)"-->
+		<view
 
-		<view @touchstart.capture="touchStart($event,currentIndex)"
 			@touchmove.stop.capture="touchMove($event,currentIndex)"
 			@touchend.capture="touchEnd(currentIndex)"
-          @longpress="longPress"
+          @longpress="longPress($event,currentIndex)"
           class="tantan-slide-box">
 			<template v-for="(item, index) in list">
 				<view class="tantan-slide-box-item"
@@ -22,7 +23,7 @@
 					 <!-- 加载图片会闪屏 双if避免 -->
 					<template v-if="currentIndex + visible >= index && currentIndex <= index">
             <view  :animation="animationData" class="tantan-slide-img-box"   :style="{height: winHeigh + 'px'}">
-              <scroll-view class="tantan-slide-img-scroll-box" :scroll-y="!ifLongTap" :style="{height: winHeigh + 'px'}">
+              <scroll-view class="tantan-slide-img-scroll-box" :bindscroll="endScroll"  :scroll-y="!ifLongTap" :style="{height: winHeigh + 'px'}">
               <view class="img-list">
                 <image  class="tantan-slide-img" v-show="imgIndex===imgKey" v-for="(img,imgIndex) in item.images"   :style="{height: winHeigh + 'px'}"  mode="aspectFill" :src="img" ></image>
               </view>
@@ -227,9 +228,13 @@
 				}
 				return css
 			},
-      longPress(){
+      endScroll(){
+        console.log('滚动结束')
+      },
+      longPress(e, index){
         this.ifLongTap=true
         tools.vibrate()
+        this.touchStart(e, index)
       },
 			touchStart(e, index) {
 
@@ -254,6 +259,7 @@
         this.x.move = e.touches[0].pageX;
         this.y.move = e.touches[0].pageY;
         console.log('this.x.start:'+this.x.start+'this.x.move:'+this.x.move)
+        console.log('this.y.start:'+this.y.start+'this.y.move:'+this.y.move)
 
 
 

+ 12 - 4
service/tools.js

@@ -182,11 +182,19 @@ tools.platformType = function () {
 tools.vibrate=function (){
     console.log('vibrate')
     // #ifndef H5
-    uni.vibrateLong({
-        success: function () {
-            console.log('success');
+        let platform=uni.getSystemInfoSync().platform
+        // #ifdef APP-PLUS
+        if (platform === "ios") {
+            let UIImpactFeedbackGenerator = plus.ios.importClass('UIImpactFeedbackGenerator');
+            let impact = new UIImpactFeedbackGenerator();
+            impact.prepare();
+            impact.init(1);
+            impact.impactOccurred();
         }
-    });
+        if (platform === "android") {
+            uni.vibrateShort();
+        }
+        // #endif
     //#endif
 
 }