Explorar el Código

修改指挥讲解swiper

xiaoyue5430 hace 3 años
padre
commit
866b9981c3

+ 68 - 64
spring-cloud/server-page/src/main/resources/static/ipad/js/basic/index_sw.js

@@ -268,74 +268,78 @@ function initClick() {
 
     // 点击列表子子项目选中
     $(".swiper-wrapper").on("click", '.slide-item', function() {
+        //禁用轮播图
+        util.variable['swiper'].disable();
         switchSwiper($(this).attr('data-si'));
-    });
-
-    // 长按拖拽,将项目添加到
-    var tmerSw = null
-    var idenSw = 0
-    var swX = 0
-    var swY = 0
-    var initX = 0
-    $(".swiper-wrapper").on("touchstart", '.slide-item', function(e) {
-        // 获取长按点距离容器左右的距离
-        var that = this
-        tmerSw = setTimeout(function() {
-            //禁用轮播图
-            // util.variable['swiper'].disable();
-            initX = $(that)[0].offsetLeft + $(".back").clientWidth + $(that)[0].clientWidth / 2;
-            $(".cont").css({ "left": initX, "top": "90%" });
-            $(".cont").css("display", "block").empty();
-            // 将长按的元素复制到容器中
-            var copyEl = $.clone($(that)[0]);
-            $(".cont").append(copyEl);
-            // 获取容器的初始位置值
-            // 移动容器
-            that.addEventListener("touchmove", function(e1) {
-                swX = e1.changedTouches[0].clientX;
-                swY = e1.changedTouches[0].clientY;
-                $(".cont").css({ "left": swX, "top": swY });
-            })
-            idenSw = 1;
-        }, 500);
-
-        util.variable['swiper'].on("touchMove", function(swiper, e) {
-            that.removeEventListener("touchmove", function(e1) {
-                swX = e1.changedTouches[0].clientX;
-                swY = e1.changedTouches[0].clientY;
-                $(".cont").css({ "left": swX, "top": swY });
-            })
-            clearTimeout(tmerSw);
-        })
-    });
-    $(".swiper-wrapper").on("touchend", '.slide-item', function() {
-        // 判断是否长按
-        clearTimeout(tmerSw);
-        if (idenSw == 0) {
-            switchSwiper($(this).attr('data-si'));
-        } else {
-            // 获取当前画面的可放置区域
-            var curFrameWidth = $("iframe[id=mainIframe]")[0].clientWidth
-            var curFrameHeight = $("iframe[id=mainIframe]")[0].clientHeight + $(".header")[0].clientHeight + $(".cur_title")[0].clientHeight
-            var minX = 0
-            var maxX = curFrameWidth
-            var minY = 0
-            var maxY = curFrameHeight
-
-            if (minX < swX && minY < swY && maxX > swX && maxY > swY) {
-                switchSwiper($(this).attr('data-si'));
-            } else {
-                console.log("未拖动到当前页面,无法替换当前页面")
-            }
-            $(".cont").css({ "display": "none" })
-        }
         //启用轮播图
-        // util.variable['swiper'].enable();
-        idenSw = 0;
+        util.variable['swiper'].enable();
     });
 
-    var frameBh = 0
-        // 展示画面操作
+    // // 长按拖拽,将项目添加到
+    // var tmerSw = null
+    // var idenSw = 0
+    // var swX = 0
+    // var swY = 0
+    // var initX = 0
+    // $(".swiper-wrapper").on("touchstart", '.slide-item', function(e) {
+    //     // 获取长按点距离容器左右的距离
+    //     var that = this
+    //     tmerSw = setTimeout(function() {
+    //         //禁用轮播图
+    //         util.variable['swiper'].disable();
+    //         initX = $(that)[0].offsetLeft + $(".back").clientWidth + $(that)[0].clientWidth / 2;
+    //         $(".cont").css({ "left": initX, "top": "90%" });
+    //         $(".cont").css("display", "block").empty();
+    //         // 将长按的元素复制到容器中
+    //         var copyEl = $.clone($(that)[0]);
+    //         $(".cont").append(copyEl);
+    //         // 获取容器的初始位置值
+    //         // 移动容器
+    //         that.addEventListener("touchmove", function(e1) {
+    //             swX = e1.changedTouches[0].clientX;
+    //             swY = e1.changedTouches[0].clientY;
+    //             $(".cont").css({ "left": swX, "top": swY });
+    //         })
+    //         idenSw = 1;
+    //     }, 500);
+
+    //     // util.variable['swiper'].on("touchMove", function(swiper, e) {
+    //     //     that.removeEventListener("touchmove", function(e1) {
+    //     //         swX = e1.changedTouches[0].clientX;
+    //     //         swY = e1.changedTouches[0].clientY;
+    //     //         $(".cont").css({ "left": swX, "top": swY });
+    //     //     })
+    //     //     clearTimeout(tmerSw);
+    //     // })
+    // });
+    // $(".swiper-wrapper").on("touchend", '.slide-item', function() {
+    //     // 判断是否长按
+    //     clearTimeout(tmerSw);
+    //     if (idenSw == 0) {
+    //         switchSwiper($(this).attr('data-si'));
+    //     } else {
+    //         // 获取当前画面的可放置区域
+    //         var curFrameWidth = $("iframe[id=mainIframe]")[0].clientWidth
+    //         var curFrameHeight = $("iframe[id=mainIframe]")[0].clientHeight + $(".header")[0].clientHeight + $(".cur_title")[0].clientHeight
+    //         var minX = 0
+    //         var maxX = curFrameWidth
+    //         var minY = 0
+    //         var maxY = curFrameHeight
+
+    //         if (minX < swX && minY < swY && maxX > swX && maxY > swY) {
+    //             switchSwiper($(this).attr('data-si'));
+    //         } else {
+    //             console.log("未拖动到当前页面,无法替换当前页面")
+    //         }
+    //         $(".cont").css({ "display": "none" })
+    //     }
+    //     //启用轮播图
+    //     util.variable['swiper'].enable();
+    //     idenSw = 0;
+    // });
+
+    var frameBh = 0;
+    // 展示画面操作
     $(".frame_box>div>div").on("click", function(e) {
         // 获取标识
         var bs = $(this).attr("data-bs")