zhaoxiaohai пре 3 година
родитељ
комит
d90be59cf3
2 измењених фајлова са 9 додато и 6 уклоњено
  1. 2 2
      pages/threadedTree/index.wxml
  2. 7 4
      pages/threadedTree/modules/FloatingButton/index.js

+ 2 - 2
pages/threadedTree/index.wxml

@@ -10,8 +10,8 @@
 </van-tabs>
 
 <!-- 浮动按钮 -->
-<FloatingButton wx:if="{{per.query(auth,'新增')}}">
-    <image style="width: 130rpx; height: 130rpx; transform: translate(-50%,-50%);" src='../../static/image/add.png' data-title="新建线索" bindtap="openSheet" />
+<FloatingButton wx:if="{{per.query(auth,'新增')}}" radius='32'>
+    <image style="width: 160rpx; height: 160rpx; transform: translate(-50%,-50%);" src='../../static/image/add.png' data-title="新建线索" bindtap="openSheet" />
 </FloatingButton>
 
 <My_listBox id='ListBox' bindgetlist="getList" height='{{scrollHeight}}'>

+ 7 - 4
pages/threadedTree/modules/FloatingButton/index.js

@@ -1,4 +1,7 @@
 Component({
+    properties: {
+        radius: Number //半径 单位px
+    },
     data: {
         top: "550px",
         left: "345px",
@@ -17,11 +20,11 @@ Component({
     methods: {
         viewTouchMove(e) {
             let left = e.touches[0].pageX;
-            if (left > 375) left = 375;
-            if (left < 0) left = 0;
+            if (left > (375 - this.data.radius)) left = 375 - (this.data.radius / 2);
+            if (left < 0 + this.data.radius) left = 0 + this.data.radius;
             let top = e.touches[0].pageY;
-            if (top < 0) top = 0;
-            if (top > this.data.viewHeight) top = this.data.viewHeight;
+            if (top < 0 + this.data.radius) top = 0 + this.data.radius;
+            if (top > this.data.viewHeight - this.data.radius) top = this.data.viewHeight - this.data.radius;
             this.setData({
                 left: left + 'px',
                 top: top + 'px'