siteManage.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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" :key="index"
  21. @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" v-if="type==1" @tap="goAlarmingList">
  24. <view class="text-grey site-tit">{{item.siteName}}</view>
  25. </view>
  26. <view class="content" v-else @tap="goDeviceType">
  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"></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. };
  61. },
  62. onLoad: function (option) {
  63. console.log(option.type); //打印出上个页面传递的参数。
  64. this.type=option.type;
  65. // this.getData()
  66. },
  67. methods: {
  68. // getData(){
  69. // uni.request({
  70. // url: '../../data/json.js', //仅为示例,并非真实接口地址。
  71. // data: {
  72. // text: 'uni.request'
  73. // },
  74. // header: {
  75. // 'custom-header': 'hello' //自定义请求头信息
  76. // },
  77. // success: (res) => {
  78. // console.log(res);
  79. // // this.text = 'request success';
  80. // }
  81. // });
  82. // },
  83. // 页面跳转
  84. goAddPage() {
  85. uni.navigateTo({
  86. url: '/pages/add/add',
  87. success: res => {},
  88. fail: () => {},
  89. complete: () => {}
  90. });
  91. },
  92. goAlarmingList() {
  93. uni.navigateTo({
  94. url: '/pages/alarmingList/alarmingList',
  95. success: res => {},
  96. fail: () => {},
  97. complete: () => {}
  98. });
  99. },
  100. goDeviceType() {
  101. uni.navigateTo({
  102. url: '/pages/deviceType/deviceType',
  103. success: res => {},
  104. fail: () => {},
  105. complete: () => {}
  106. });
  107. },
  108. InputFocus(e) {
  109. this.InputBottom = e.detail.height
  110. },
  111. InputBlur(e) {
  112. this.InputBottom = 0
  113. },
  114. // ListTouch触摸开始
  115. ListTouchStart(e) {
  116. this.listTouchStart = e.touches[0].pageX
  117. },
  118. // ListTouch计算方向
  119. ListTouchMove(e) {
  120. this.listTouchDirection = e.touches[0].pageX - this.listTouchStart > 0 ? 'right' : 'left'
  121. },
  122. // ListTouch计算滚动
  123. ListTouchEnd(e) {
  124. if (this.listTouchDirection == 'left') {
  125. this.modalName = e.currentTarget.dataset.target
  126. } else {
  127. this.modalName = null
  128. }
  129. this.listTouchDirection = null
  130. }
  131. }
  132. }
  133. </script>
  134. <style>
  135. </style>