描述: 智能设备

This commit is contained in:
SelfRidicule 2024-08-23 09:39:30 +08:00
parent a4681d407b
commit fc232f8e8a
5 changed files with 86 additions and 19 deletions

View File

@ -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',
})
}
}
})

View File

@ -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') { // 温度

View File

@ -1,4 +1,6 @@
{
"usingComponents": {},
"usingComponents": {
"van-notify": "@vant/weapp/notify/index"
},
"navigationBarTitleText": "房间"
}

View File

@ -79,3 +79,6 @@
</view>
</view>
</view>
<!-- 消息提示 -->
<van-notify id="van-notify" />

View File

@ -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",