|
|
- // index.js
- const WXAPI = require('../../utils/request')
- // 获取应用实例
- const app = getApp()
- Page({
- data: {
- show: false,
- signKey: '',
- commonKey: '',
- list: [],
- searchValue: '',
- userInfo: {},
- pageNum: 1,
- pageSize: 20,
- stoppull: false,
- zNodes: [],
- index: 0,
- array: [],
- index1: 0,
- array1: [],
- ces: 0,
- ces1: '',
- ces2: '',
- dataList: [],
- selectKey: '', //选中的节点id
- selectRoomName: '选择房间',
- pid:'',
- treeList:[]
- },
- onLoad() {
- wx.getStorage({
- key: "deviceinfoList",
- success: (res) => {
- this.setData({
- list:res.data,
- deviceList:res.data
- })
- },
- fail: (res) => {
- wx.redirectTo({
- url: "/pages/login/login"
- })
- }
- })
- },
- onChange(event) {
- this.setData({
- searchValue: event.detail
- })
- },
- changePassword(){
- wx.navigateTo({
- url: '/pages/updateWord/updateWord?role=2',
- })
- },
- // 退出登录
- loginOut(){
- console.log(1111)
- wx.showModal({
- cancelColor: '退出',
- title:"是否退出",
- success:function(res){
- console.log(res)
- wx.removeStorage({
- key:"signature"
- })
- wx.redirectTo({
- url:"/pages/login/login"
- })
- }
- })
- },
- godetail(e) {
- var IMEI = e.currentTarget.dataset.item
- if (IMEI.imei) {
- wx.setStorage({
- key: "deviceinfo",
- data: IMEI
- })
- wx.navigateTo({
- url: "/pages/userbluetoothUnlock/userbluetoothUnlock"
- })
- } else {
- wx.showToast({
- title: "还未绑定门锁",
- duration: 2000,
- icon: 'none'
- })
- }
- // } else if (this.data.userInfo.type == 3) {
- // wx.setStorage({
- // key: "deviceinfo",
- // data: this.data.list[0]
- // })
- // wx.navigateTo({
- // url: "/pages/roomDetail/roomDetail"
- // })
- // }
- },
- // 搜索
- onClick(e) {
- var arr=[]
- console.log(1111)
- if(this.data.searchValue==""){
- this.setData({
- list:this.data.deviceList
- })
- }else{
- this.data.deviceList.map(li=>{
- var result=li.roomName.indexOf(this.data.searchValue)
- if(result){
- arr.push(li)
- }else{
- arr=[]
- }
- })
- console.log(arr)
- this.setData({
- list:arr
- })
- }
- },
- onShow: function () {
- },
- getUserProfile(e) {},
- onShareAppMessage() {}
- })
|