Browse Source

no message

BF-202210271038\Administrator 2 years ago
parent
commit
9a5f907845
1 changed files with 36 additions and 11 deletions
  1. 36 11
      components/dgex-tantan/dgex-tantan.vue

+ 36 - 11
components/dgex-tantan/dgex-tantan.vue

@@ -6,7 +6,9 @@
 
 		<view @touchstart.capture="touchStart($event,currentIndex)"
 			@touchmove.stop.capture="touchMove($event,currentIndex)"
-			@touchend.capture="touchEnd(currentIndex)" class="tantan-slide-box">
+			@touchend.capture="touchEnd(currentIndex)"
+          @longpress="longPress"
+          class="tantan-slide-box">
 			<template v-for="(item, index) in list">
 				<view class="tantan-slide-box-item"
 					:key="index"
@@ -20,6 +22,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'}">
               <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>
@@ -57,12 +60,12 @@
                 </view>
               </view>
               <view class="user-content">
-
+                <user-content></user-content>
               </view>
+              </scroll-view>
             </view>
 
 
-
 						<view v-if="index === currentIndex">
 							<view class="tantan-slide-box-icon tantan-slide-box-dislike"
 								:style="{
@@ -87,10 +90,12 @@
 
 <script>
 	import tools from "@/service/tools";
+  import UserContent from "@/pages/index/model/user-content";
 
   export default {
 		name: "slide",
-		props: {
+    components: {UserContent},
+    props: {
 			list: {
 				type: Array,
 				default: () => []
@@ -123,7 +128,8 @@
 
         imgKey:0,
         overturnType:0,
-        animationData:{}
+        animationData:{},
+        ifLongTap: false,
       }
 		},
     watch:{
@@ -221,7 +227,12 @@
 				}
 				return css
 			},
+      longPress(){
+        this.ifLongTap=true
+        tools.vibrate()
+      },
 			touchStart(e, index) {
+
 				if (this.slideing) return;
 				if (typeof this.list[index].x === 'undefined' && typeof this.list[index].y === 'undefined') {
 					this.$set(this.list[index], 'y', 0)
@@ -232,13 +243,19 @@
 				this.y.start = e.touches[0].pageY;
 			},
 			touchMove(e, index) {
+        if(!this.ifLongTap){
+          return;
+        }
 				if (this.slideing) return
 				// 滑动状态/最后一个就不滑动
 				if (this.list.length == index + 1) {
 					return;
 				}
-				this.x.move = e.touches[0].pageX;
-				this.y.move = e.touches[0].pageY;
+        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)
+
+
 
 				this.list[index].x = this.x.move - this.x.start
 				this.list[index].y = this.y.move - this.y.start
@@ -249,6 +266,9 @@
 				}
 			},
 			touchEnd(index) {
+        if(this.ifLongTap){
+          this.ifLongTap=false
+        }
 				if (this.slideing) return
 				this.swipering = false;
 				if (this.list.length == index + 1) {
@@ -383,10 +403,15 @@
     width: 100%;
     height: 100%;
     border-radius: 40rpx;
-    background-repeat: no-repeat;//不平铺
-    background-position: center center;//居中
-    background-size: cover;//随容器大小
-    overflow-y: scroll;
+    //background-repeat: no-repeat;//不平铺
+    //background-position: center center;//居中
+    //background-size: cover;//随容器大小
+    //overflow-y: scroll;
+    .tantan-slide-img-scroll-box{
+      border-radius: 40rpx;
+      width: 100%;
+      height: 100%;
+    }
     .tantan-slide-img{
       z-index: 10;
       border-radius: 40rpx;