You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

126 lines
2.5 KiB

1 year ago
  1. // index.js
  2. const WXAPI = require('../../utils/request')
  3. // 获取应用实例
  4. const app = getApp()
  5. Page({
  6. data: {
  7. show: false,
  8. signKey: '',
  9. commonKey: '',
  10. list: [],
  11. searchValue: '',
  12. userInfo: {},
  13. pageNum: 1,
  14. pageSize: 20,
  15. stoppull: false,
  16. zNodes: [],
  17. index: 0,
  18. array: [],
  19. index1: 0,
  20. array1: [],
  21. ces: 0,
  22. ces1: '',
  23. ces2: '',
  24. dataList: [],
  25. selectKey: '', //选中的节点id
  26. selectRoomName: '选择房间',
  27. pid:'',
  28. treeList:[]
  29. },
  30. onLoad() {
  31. wx.getStorage({
  32. key: "deviceinfoList",
  33. success: (res) => {
  34. this.setData({
  35. list:res.data,
  36. deviceList:res.data
  37. })
  38. },
  39. fail: (res) => {
  40. wx.redirectTo({
  41. url: "/pages/login/login"
  42. })
  43. }
  44. })
  45. },
  46. onChange(event) {
  47. this.setData({
  48. searchValue: event.detail
  49. })
  50. },
  51. changePassword(){
  52. wx.navigateTo({
  53. url: '/pages/updateWord/updateWord?role=2',
  54. })
  55. },
  56. // 退出登录
  57. loginOut(){
  58. console.log(1111)
  59. wx.showModal({
  60. cancelColor: '退出',
  61. title:"是否退出",
  62. success:function(res){
  63. console.log(res)
  64. wx.removeStorage({
  65. key:"signature"
  66. })
  67. wx.redirectTo({
  68. url:"/pages/login/login"
  69. })
  70. }
  71. })
  72. },
  73. godetail(e) {
  74. var IMEI = e.currentTarget.dataset.item
  75. if (IMEI.imei) {
  76. wx.setStorage({
  77. key: "deviceinfo",
  78. data: IMEI
  79. })
  80. wx.navigateTo({
  81. url: "/pages/userbluetoothUnlock/userbluetoothUnlock"
  82. })
  83. } else {
  84. wx.showToast({
  85. title: "还未绑定门锁",
  86. duration: 2000,
  87. icon: 'none'
  88. })
  89. }
  90. // } else if (this.data.userInfo.type == 3) {
  91. // wx.setStorage({
  92. // key: "deviceinfo",
  93. // data: this.data.list[0]
  94. // })
  95. // wx.navigateTo({
  96. // url: "/pages/roomDetail/roomDetail"
  97. // })
  98. // }
  99. },
  100. // 搜索
  101. onClick(e) {
  102. var arr=[]
  103. console.log(1111)
  104. if(this.data.searchValue==""){
  105. this.setData({
  106. list:this.data.deviceList
  107. })
  108. }else{
  109. this.data.deviceList.map(li=>{
  110. var result=li.roomName.indexOf(this.data.searchValue)
  111. if(result){
  112. arr.push(li)
  113. }else{
  114. arr=[]
  115. }
  116. })
  117. console.log(arr)
  118. this.setData({
  119. list:arr
  120. })
  121. }
  122. },
  123. onShow: function () {
  124. },
  125. getUserProfile(e) {},
  126. onShareAppMessage() {}
  127. })