siteManage.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <template>
  2. <view class="site-wrapper">
  3. <!-- 筛选框start -->
  4. <view class="ding">
  5. <view class="cu-bar search bg-gray filter-section">
  6. <view class="search-form round bg-white">
  7. <text class="cuIcon-search"></text>
  8. <input class="" @focus="InputFocus" @blur="InputBlur" :adjust-position="false" type="text" placeholder="请输入站点名称"
  9. confirm-type="search"></input>
  10. </view>
  11. <view class="action">
  12. <button class="cu-btn bg-blue round">查询</button>
  13. </view>
  14. </view>
  15. </view>
  16. <!-- 筛选框end -->
  17. <!-- 站点列表start -->
  18. <view class="site-items">
  19. <view class="cu-list menu-avatar">
  20. <view class="cu-item" :class="modalName=='move-box-'+ index?'move-cur':''" v-for="(item,index) in siteListData"
  21. :key="index" @touchstart="ListTouchStart" @touchmove="ListTouchMove" @touchend="ListTouchEnd" :data-target="'move-box-' + index">
  22. <view class="cu-avatar round lg" style="background-image: url(../../static/site-icon.png);"></view>
  23. <view class="content">
  24. <view class="text-grey site-tit">{{item.siteName}}</view>
  25. </view>
  26. <view class="nav-right num">
  27. <view class="text-grey text-xs">
  28. <image src="../../static/nav-icon.png" style="width:25rpx;height:25rpx;margin-right:26rpx"></image>
  29. </view>
  30. </view>
  31. <view class="move">
  32. <view class="bg-grey">编辑</view>
  33. <view class="bg-red">删除</view>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. <!-- 站点列表end
  39. <!-- 新增按钮start -->
  40. <view class="plus">
  41. <image src="../../static/plus.png" style="width:125rpx;height:125rpx" @tap="goAddPage(type)"></image>
  42. </view>
  43. <!-- 新增按钮end -->
  44. </view>
  45. </template>
  46. <script>
  47. import json from '../../data/json.js';
  48. export default {
  49. data() {
  50. return {
  51. type: '0',
  52. siteListData: json.siteListData,
  53. modalName: null,
  54. listTouchStart: 0,
  55. listTouchDirection: null,
  56. CustomBar: this.CustomBar,
  57. csListArrl: [],
  58. //左滑默认宽度
  59. delBtnWidth: 160,
  60. };
  61. },
  62. onLoad: function(option) {
  63. console.log(option.type); //打印出上个页面传递的参数。
  64. this.type = option.type;
  65. if (option.type == 1) {
  66. uni.setNavigationBarTitle({
  67. title: '站点管理'
  68. });
  69. } else {
  70. uni.setNavigationBarTitle({
  71. title: '设备管理'
  72. });
  73. }
  74. },
  75. methods: {
  76. // 页面跳转
  77. goAddPage(type) {
  78. uni.navigateTo({
  79. url: '/pages/add/add?type='+this.type,
  80. success: res => {},
  81. fail: () => {},
  82. complete: () => {}
  83. });
  84. },
  85. InputFocus(e) {
  86. this.InputBottom = e.detail.height
  87. },
  88. InputBlur(e) {
  89. this.InputBottom = 0
  90. },
  91. // ListTouch触摸开始
  92. ListTouchStart(e) {
  93. this.listTouchStart = e.touches[0].pageX
  94. },
  95. // ListTouch计算方向
  96. ListTouchMove(e) {
  97. this.listTouchDirection = e.touches[0].pageX - this.listTouchStart < -80 ? 'left' : 'right'
  98. },
  99. // ListTouch计算滚动
  100. ListTouchEnd(e) {
  101. if (this.listTouchDirection == 'left') {
  102. this.modalName = e.currentTarget.dataset.target
  103. } else {
  104. this.modalName = null
  105. }
  106. this.listTouchDirection = null
  107. }
  108. }
  109. }
  110. </script>
  111. <style>
  112. </style>