diff --git a/miniprogram/app.js b/miniprogram/app.js index ac74a45..aa944b6 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -2,19 +2,19 @@ App({ // 上海长阳-配置信息 APPID: 'wx08bf0d440e446e7c', APPSECRET: 'e0ef2bac28df376d8855d04ee8828d73', - tenantId : '12', // 地区 - parkId : '26', // 园区id - parkName : '长阳智会云控', // 园区名称 + tenantId: '12', // 地区 + parkId: '26', // 园区id + parkName: '长阳智会云控', // 园区名称 // 本地测试 - DOMAIN_NAME_PREFIX: 'http://192.168.0.30', - DOMAIN_NAME: 'http://192.168.0.30:9227', //接口域名 - IMG_NAME: 'http://192.168.0.30:9227', - socketUrl: 'wss://company.haxy.com.cn:4443/changyang-office/websocket-server', - // 生产 - // DOMAIN_NAME_PREFIX: 'https://www.chuangzhikj.com', - // DOMAIN_NAME: 'https://www.chuangzhikj.com/saas-ics', //接口域名 - // IMG_NAME: 'https://www.chuangzhikj.com/saas-ics', + // DOMAIN_NAME_PREFIX: ' http://wrqhey.natappfree.cc', + // DOMAIN_NAME: ' http://wrqhey.natappfree.cc', //接口域名 + // IMG_NAME: ' http://wrqhey.natappfree.cc', // socketUrl: 'wss://company.haxy.com.cn:4443/changyang-office/websocket-server', + // 生产 + DOMAIN_NAME_PREFIX: 'https://www.chuangzhikj.com', + DOMAIN_NAME: 'https://www.chuangzhikj.com/saas-ics', //接口域名 + IMG_NAME: 'https://www.chuangzhikj.com/saas-ics', + socketUrl: 'wss://company.haxy.com.cn:4443/changyang-office/websocket-server', globals: { refreshMyPages: false, homedata: {}, @@ -304,4 +304,50 @@ App({ } }) }, + + // 消息提示 + vantNotify(Notify, msg, type, top) { + let data = { + type, + message: msg, + } + if (!type) { + data.type = 'primary' + } + if (top) { + data.top = top + } + Notify(data); + }, + // 消息提示 + vantNotifySuccess(Notify, msg) { + this.vantNotify(Notify, msg, 'primary') + }, + // 消息提示 + vantNotifyErr(Notify, msg) { + this.vantNotify(Notify, msg, 'danger') + }, + // 消息提示 + vantNotifySuccessTop(Notify, msg) { + this.vantNotify(Notify, msg, 'primary', 90) + }, + // 消息提示 + vantNotifyErrTop(Notify, msg) { + this.vantNotify(Notify, msg, 'danger', 90) + }, + // 自定义后退 + selfBackPage(step) { + let currentPages = getCurrentPages(); + // 大于就后退,否则直接跳转首页 + if (currentPages.length > step) { + wx.navigateBack({ + delta: step + }) + } else { + // 跳转首页 + wx.reLaunch({ + url: '/pages/index/index', + }) + } + } }) \ No newline at end of file diff --git a/miniprogram/pages/smartDevice/room/room.js b/miniprogram/pages/smartDevice/room/room.js index 9bd2c5b..f8c4294 100644 --- a/miniprogram/pages/smartDevice/room/room.js +++ b/miniprogram/pages/smartDevice/room/room.js @@ -1,5 +1,8 @@ const app = getApp() +import Notify from '@vant/weapp/notify/notify'; + + import { getAllDeviceInfoByRoomIdRq, getAllPanelInfoByRoomIdRq, @@ -283,8 +286,15 @@ Page({ let _this = this let lockDoor = _this.data.lockDoor // 调用设备接口 - _this.callApiByDevice({ + callApiByDeviceIdRq({ "deviceId": lockDoor.id, + }).then(res => { + console.log('callApiByDeviceIdRq', res); + if(res.code == 0){ + app.vantNotifySuccess(Notify, res.msg) + }else{ + app.vantNotifyErr(Notify, res.msg) + } }) }, @@ -297,7 +307,6 @@ Page({ // 初始化socket initSocket() { - return let _this = this let socketTask = wx.connectSocket({ url: app.socketUrl, @@ -324,7 +333,7 @@ Page({ if (type == 'KONKE_ZIGBEE_CHOPIN_LIGHT_PROJECT') { // 灯控面板、雾化玻璃 let id = pushMsg.id let on = pushMsg.status.on // true 开 false 关 - let equipmentData = equipmentList.find(item => item.id == id) + let equipmentData = equipmentList.find(item => item.equipmentNum == id) if (equipmentData) { equipmentData.status = on } @@ -336,7 +345,7 @@ Page({ let whiteBri = pushMsg.status.whiteBri // 白光亮度 [1,100] let colourTemperature = pushMsg.status.colourTemperature // 色温[1,100] // - let equipmentData = equipmentList.find(item => item.id == id) + let equipmentData = equipmentList.find(item => item.equipmentNum == id) if (equipmentData) { equipmentData.status = on } @@ -344,13 +353,13 @@ Page({ } else if (type == 'KONKE_ZIGBEE_CHOPIN_CURTAIN_CUSTOM') { // 窗帘 let id = pushMsg.id let MotorStatus = pushMsg.status.MotorStatus // OPEN 开 、CLOSE 关、 STOP 暂停 - let equipmentData = equipmentList.find(item => item.id == id) + let equipmentData = equipmentList.find(item => item.equipmentNum == id) equipmentData.status = MotorStatus } else if (type == 'KONKE_ZIGBEE_CHOPIN_10A_SOCKET') { // 插座 let id = pushMsg.id let on = pushMsg.status.on // on 开关状态 true开 false关 - let equipmentData = equipmentList.find(item => item.id == id) + let equipmentData = equipmentList.find(item => item.equipmentNum == id) equipmentData.status = on } else if (type == 'KONKE_ZIGBEE_KIT_TEMPSENSOR') { // 温度 diff --git a/miniprogram/pages/smartDevice/room/room.json b/miniprogram/pages/smartDevice/room/room.json index 360ee08..587bf06 100644 --- a/miniprogram/pages/smartDevice/room/room.json +++ b/miniprogram/pages/smartDevice/room/room.json @@ -1,4 +1,6 @@ { - "usingComponents": {}, + "usingComponents": { + "van-notify": "@vant/weapp/notify/index" + }, "navigationBarTitleText": "房间" } \ No newline at end of file diff --git a/miniprogram/pages/smartDevice/room/room.wxml b/miniprogram/pages/smartDevice/room/room.wxml index c72f926..ab1b78a 100644 --- a/miniprogram/pages/smartDevice/room/room.wxml +++ b/miniprogram/pages/smartDevice/room/room.wxml @@ -78,4 +78,7 @@ - \ No newline at end of file + + + + diff --git a/project.private.config.json b/project.private.config.json index 1f6d844..36457dc 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -6,6 +6,13 @@ "condition": { "miniprogram": { "list": [ + { + "name": "pages/test/test", + "pathName": "pages/test/test", + "query": "", + "launchMode": "default", + "scene": null + }, { "name": "pages/test/test", "pathName": "pages/test/test",