
对讲排序备份
发布日期:2021-05-08 00:22:57
浏览次数:23
分类:精选文章
本文共 5051 字,大约阅读时间需要 16 分钟。
之前用的是通过css控制位置,然后支持拖动,
现在使用flex布局,拖动排序即可
//添加排序对讲窗口 SortVideoTable(sortIntercomBoxDatas) { this.intercomBoxDatas.push(sortIntercomBoxDatas); /*初始化jquery*/ /* $(document).ready(() => { /!*lua中的一个函数,math.ceil(x)返回大于等于参数x的最小整数,即对浮点数向上取整.*!/ for (var i = 1; i <= this.intercomBoxDatas.length; i++) { if (window.screen.width == 1366) { var css = { left: (Math.ceil((i) % 5.1) - 1) * 18 + 4 + '%', top: (Math.ceil((i + 1) / 6.1) - 1) * 150 + 10, }; } else if (window.screen.width == 1920 && window.screen.height == 1280) { var css = { left: (Math.ceil((i) % 6.1) - 1) * 1 + 1 + '%', // left: (Math.ceil((i) % 6.1) -1) * 1 + 1 + 'px', top: (Math.ceil((i + 1) / 7.1) - 1) * 20 + 20, }; } else { /!*var css = { left: (Math.ceil((i) % 5.1) - 1) * 16.5 + 4 + '%', top: (Math.ceil((i + 1) / 6.1) - 1) * 210 + 10, };*!/ var css = { left: (Math.ceil((i) % 6.1) - 1) * 1 + 1 + '%', // left: (Math.ceil((i) % 6.1) -1) * 1 + 1 + 'px', top: (Math.ceil((i + 1) / 7.1) - 1) * 20 + 20, }; } var a = '#intercomBox' + i; var b = '#intercomBox-up' + i; // $(a).Tdrag({ // scope: '.intercomBoxContainer', // handle: b,//手柄, // pos: true, // dragChange: true, // changeMode: 'sort', // }, // ); $(a).css(css); } });*/ const tbody = document.querySelector('.intercomBox'); /* Sortable.create(tbody, { onEnd({ newIndex, oldIndex }) { console.log(newIndex); const currRow = _this.intercomBoxDatas.splice(oldIndex, 1)[0] _this.intercomBoxDatas.splice(newIndex, 0, currRow) } })*/ /*this.sortable = Sortable.create(tbody, { animation: 180, delay: 0, onEnd: evt => { const oldItem = this.intercomBoxDatas[evt.oldIndex] this.intercomBoxDatas.splice(evt.oldIndex, 1) this.intercomBoxDatas.splice(evt.newIndex, 0, oldItem) console.log(evt.oldIndex,evt.newIndex); } })*/ var that = this; setTimeout(()=> { var el = document.getElementById('intercomBoxSortID'); this.sortable = Sortable.create(el, { onEnd: (evt)=> { let itemEl = evt.item; let oldIndex = evt.oldIndex; let newIndex = evt.newIndex; let temp = this.intercomBoxDatas[oldIndex]; if (oldIndex < newIndex) { for (var i = oldIndex; i < newIndex; i++) { this.intercomBoxDatas[i] = this.intercomBoxDatas[i + 1]; } } else if (oldIndex > newIndex) { for (var i = oldIndex; i > newIndex; i--) { this.intercomBoxDatas[i] = this.intercomBoxDatas[i - 1]; } } this.intercomBoxDatas[newIndex] = temp; }, }); }, 100); } , //默认排序对讲窗口 SortVideoTableNomal() { /*初始化jquery*/ /* $(document).ready(() => { /!*lua中的一个函数,math.ceil(x)返回大于等于参数x的最小整数,即对浮点数向上取整.*!/ for (var i = 1; i <= this.intercomBoxDatas.length; i++) { /!* var css = { left: (Math.ceil((i) % 5.1) - 1) * 19 + 4 + '%', top: (Math.ceil((i + 1) / 6.1) - 1) * 100 + 10, };*!/ if (window.screen.width == 1366) { var css = { left: (Math.ceil((i) % 5.1) - 1) * 18 + 4 + '%', top: (Math.ceil((i + 1) / 6.1) - 1) * 150 + 10, }; } else if (window.screen.width == 1920 && window.screen.height == 1280) { var css = { left: (Math.ceil((i) % 6.1) - 1) * 1 + 1 + '%', top: (Math.ceil((i + 1) / 7.1) - 1) * 20 + 20, }; } else { /!*var css = { left: (Math.ceil((i) % 5.1) - 1) * 16.5 + 4 + '%', top: (Math.ceil((i + 1) / 6.1) - 1) * 210 + 10, };*!/ var css = { left: (Math.ceil((i) % 6.1) - 1) * 1 + 1 + '%', top: (Math.ceil((i + 1) / 7.1) - 1) * 20 + 20, }; } var a = '#intercomBox' + i; var b = '#intercomBox-up' + i; // $(a).Tdrag({ // scope: '.intercomBoxContainer', // handle: b,//手柄, // pos: true, // dragChange: true, // changeMode: 'sort', // }, // ); $(a).css(css); } });*/ } ,
发表评论
最新留言
留言是一种美德,欢迎回访!
[***.207.175.100]2025年04月06日 13时13分43秒
关于作者

喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
Python存储系统(Redis)
2019-03-06
C语言指针收藏
2019-03-06
C#搞个跨平台的桌面NES游戏模拟器
2019-03-06
手把手教你安装Eclipse最新版本的详细教程 (非常详细,非常实用)
2019-03-06
《带你装B,带你飞》pytest成魔之路4 - fixture 之大解剖
2019-03-06
互联网App应用程序测试流程及测试总结
2019-03-06
根据轨迹分析出用户家在哪
2019-03-06
PostgreSQL查询表名称及表结构
2019-03-06
linux中使用awk命令
2019-03-06
如何使用google搜索?
2019-03-06
Redis分布式锁的正确实现方式
2019-03-06
设计模式-抽象工厂模式
2019-03-06
IntelliJ IDEA 中,项目文件右键菜单没有svn选项解决办法
2019-03-06
IDEA 调试Java代码的两个技巧
2019-03-06
Vue 数组和对象更新,但视图未更新,背后的故事
2019-03-06
剑指Offer面试题:9.二进制中1的个数
2019-03-06
《你是在做牛做马还是在做主管》- 读书笔记
2019-03-06
重新温习软件设计之路(4)
2019-03-06
MySQL数据库与python交互
2019-03-06