siteManage.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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" @tap="goDeviceManage" v-if="type==1">
  24. <view class="text-grey site-tit">{{item.siteName}}</view>
  25. </view>
  26. <view class="content" v-else>
  27. <view class="text-grey site-tit">{{item.siteName}}</view>
  28. </view>
  29. <view class="nav-right num">
  30. <view class="text-grey text-xs">
  31. <image src="../../static/nav-icon.png" style="width:25rpx;height:25rpx;margin-right:26rpx"></image>
  32. </view>
  33. </view>
  34. <view class="move">
  35. <view class="bg-grey">编辑</view>
  36. <view class="bg-red">删除</view>
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. <!-- 列表end
  42. <!-- 新增按钮start -->
  43. <view class="plus">
  44. <image src="../../static/plus.png" style="width:125rpx;height:125rpx" @tap="goAddPage(type)"></image>
  45. </view>
  46. <!-- 新增按钮end -->
  47. </view>
  48. </template>
  49. <script>
  50. import json from '../../data/json.js';
  51. export default {
  52. data() {
  53. return {
  54. type: '0',
  55. siteListData: json.siteListData,
  56. modalName: null,
  57. listTouchStart: 0,
  58. listTouchDirection: null,
  59. CustomBar: this.CustomBar,
  60. csListArrl: [],
  61. //左滑默认宽度
  62. delBtnWidth: 160,
  63. };
  64. },
  65. onLoad: function(option) {
  66. console.log(option.type); //打印出上个页面传递的参数。
  67. this.type = option.type;
  68. if (option.type == 1) {
  69. uni.setNavigationBarTitle({
  70. title: '站点管理'
  71. });
  72. } else if (option.type == 2) {
  73. uni.setNavigationBarTitle({
  74. title: '设备管理'
  75. });
  76. }else{
  77. uni.setNavigationBarTitle({
  78. title: '权限管理'
  79. });
  80. }
  81. },
  82. methods: {
  83. // 页面跳转
  84. goAddPage(type) {
  85. uni.navigateTo({
  86. url: '/pages/add/add?type='+this.type,
  87. success: res => {},
  88. fail: () => {},
  89. complete: () => {}
  90. });
  91. },
  92. goDeviceManage() {
  93. uni.navigateTo({
  94. url: '/pages/siteManage/siteManage?type=2',
  95. success: res => {},
  96. fail: () => {},
  97. complete: () => {}
  98. });
  99. },
  100. InputFocus(e) {
  101. this.InputBottom = e.detail.height
  102. },
  103. InputBlur(e) {
  104. this.InputBottom = 0
  105. },
  106. // ListTouch触摸开始
  107. ListTouchStart(e) {
  108. this.listTouchStart = e.touches[0].pageX
  109. },
  110. // ListTouch计算方向
  111. ListTouchMove(e) {
  112. this.listTouchDirection = e.touches[0].pageX - this.listTouchStart < -80 ? 'left' : 'right'
  113. },
  114. // ListTouch计算滚动
  115. ListTouchEnd(e) {
  116. if (this.listTouchDirection == 'left') {
  117. this.modalName = e.currentTarget.dataset.target
  118. } else {
  119. this.modalName = null
  120. }
  121. this.listTouchDirection = null
  122. }
  123. }
  124. }
  125. </script>
  126. <style>
  127. </style>