初始化

This commit is contained in:
2025-12-11 09:50:02 +08:00
commit c25e282398
127 changed files with 63158 additions and 0 deletions

View File

@@ -0,0 +1 @@
{"containers":[],"config":{}}

14
.gitignore vendored Normal file
View File

@@ -0,0 +1,14 @@
# Windows
[Dd]esktop.ini
Thumbs.db
$RECYCLE.BIN/
# macOS
.DS_Store
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
# Node.js
node_modules/

1
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1 @@
{}

83
SQL/日志表.sql Normal file
View File

@@ -0,0 +1,83 @@
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD>AuthorityDB sql
if Exists(select top 1 * from sysObjects where Id=OBJECT_ID(N'MACLogs') and xtype='U')
drop table MACLogs
go
create table MACLogs(
Id int identity(1,1),
HostsId int not null,
MAC nvarchar(50) null,
userid int not null,
location nvarchar(100) null,
Ip nvarchar(50) null,
ActionId INT null,
[type] int default 0, -- 0 <20><><EFBFBD><EFBFBD> 1 <20><><EFBFBD> 2 <20><><EFBFBD>İ<EFBFBD>
CreateTime datetime default getdate()-- 0 <20><><EFBFBD><EFBFBD> 1 <20><><EFBFBD>
)
go
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD>AuthorityDB sql
if Exists(select top 1 * from sysObjects where Id=OBJECT_ID(N'ErrorInfo') and xtype='U')
drop table ErrorInfo
go
create table ErrorInfo(
Id int identity(1,1),
HostsId int not null,
MAC nvarchar(50) null,
userid int not null,
[type] int default 0, -- 0 <20><><EFBFBD><EFBFBD><E4B1BB> 1 MAC<41><43><EFBFBD><EFBFBD>
[status] int default 0,--<EFBFBD>Ƿ<EFBFBD><EFBFBD>Ѿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 δ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1 <EFBFBD>Ѿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
CreateTime datetime default getdate()-- ʱ<><CAB1>
)
go
select * from Hosts where id = 14939
SELECT * FROM MACLogs
if EXISTS(SELECT 1 FROM sys.views WHERE name='View_MAClog')
begin
drop view View_MAClog
end
go
create view View_MAClog
as
select m.*,u.[Uid] ,ht.Name,Hotelsid = ht.Id
from MACLogs m
left join Hotels ht on ht.id = m.HotelID
left join UserInfo u on u.id = m.userid
go
select *,CreateTime from MACLogs
SELECT * FROM View_MAClog
SELECT * FROM ErrorInfo --WHERE
SELECT * FROM UserInfo WHERE ID = 212
--<EFBFBD><EFBFBD> sql
select * from tb_Hosts where hotelid = 3
update tb_Hosts set MAC=MAC where MAC= '34-D0-B8-11-10-4D';update tb_Hosts set MAC='34-D0-B8-11-10-4D' where Id = 14810;
DECLARE @MAC int;
DECLARE @ID int;
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD> @MAC <EFBFBD>µ<EFBFBD>MAC @ID Ϊ<EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>mac<EFBFBD><EFBFBD>id
begin tran
DECLARE @HostsId int;
DECLARE @oldmac nvarchar(50);
DECLARE @HostsIdoldmac nvarchar(50);
SET @HostsId = -1;
SET @oldmac = '-1';
SET @HostsIdoldmac = '-1';
SELECT TOP 1 @HostsId = id, @oldmac= MAC FROM tb_Hosts where MAC = @MAC
SELECT TOP 1 @HostsIdoldmac = MAC FROM tb_Hosts where Id = @ID and mac is not null and mac!=''
PRINT convert(varchar,@HostsId) +'&'+ @oldmac+'&'+@HostsIdoldmac
update tb_Hosts set MAC='' where id = @HostsId
update tb_Hosts set MAC=@MAC where Id = @ID
if @@ERROR>0
begin
rollback tran
end
ELSE
BEGIN
COMMIT TRAN
END
;
go
select * from Hosts where Id = 14939

153
app copy.js Normal file
View File

@@ -0,0 +1,153 @@
//app.js
import {
LoginToken
} from '/lib/RequestingCenter.js'
import {
Toastsuccess,ToastError
} from '/lib/Toast.js'
let sum = 0;
App({
onLaunch: function() {
wx.removeStorage({
key: 'oldHotelinfo',
})
// 获取系统状态栏信息
wx.getSystemInfo({
success: e => {
this.globalData.StatusBar = e.statusBarHeight;
let capsule = wx.getMenuButtonBoundingClientRect();
if (capsule) {
this.globalData.Custom = capsule;
this.globalData.CustomBar = capsule.bottom + capsule.top - e.statusBarHeight;
} else {
this.globalData.CustomBar = e.statusBarHeight + 50;
}
}
})
// 登录
// this.userLogin();
},
globalData: {
ImgUrl : "https://auth.blv-oa.com/ImgServer/FileImage?url=ImgUrl&&ftp=11",
userinfo: null,
MapKey: '6JMBZ-BSAWP-D2NDJ-LFL4J-QJQQ3-3TBTV',
MapSk:'MHAGZ4S3aYeAD1pFoMTy6HAFL7nG18',
autho: null,
authotype:{
no:1,
ok:3
}
},
toast:function(type,title,success,time){
if(type==1){
Toastsuccess(title,success,time)
}
if(type==2){
ToastError(title,success,time)
}
// Toast(title,icon,success,time)
},
//TOKEN登录
userLogin:async function (back) {
let that = this;
// 读取本地信息尝试登录
const xiaoxi_token = wx.getStorageSync('xiaoxi_token') || null
if (xiaoxi_token != null && xiaoxi_token!="") {
await LoginToken({
token: xiaoxi_token
}).then(res => {
if(res.Status!=200){
that.toast(2,res.Message||"网络繁忙",function () {
wx.reLaunch({
url: "../login/login",
})
})
return;
}
res.Data.userinfo.error = res.Data.error
res.Data.userinfo.HeadImg = that.globalData.ImgUrl.replace("ImgUrl",res.Data.userinfo.HeadImg)
that.globalData.userinfo = res.Data.userinfo
that.globalData.autho = res.Data.autho
//由于这里是网络请求,可能会在 Page.onLoad 之后才返回
// 所以此处加入 callback 以防止这种情况
// if (that.checkLoginReadyCallback){
// that.checkLoginReadyCallback();
// }
wx.setStorageSync('xiaoxi_token', res.Data.token)
back();
},
err=>{
that.toast(2,'网络繁忙',function () {
wx.reLaunch({
url: "/pages/login/login",
})
})
}
).catch(
err => {
console.log(err)
that.toast(2,'网络繁忙', ()=> {
wx.reLaunch({
url: "/pages/login/login",
})
})
}
);
} else {
wx.reLaunch({
url: "/pages/login/login",
})
}
},
//检测授权信息
SQ: function (back) {
let that = this;
wx.getSetting({
success: (res) => {
// res.authSetting['scope.userLocation'] == undefined 表示 初始化进入该页面
// res.authSetting['scope.userLocation'] == false 表示 非初始化进入该页面,且未授权
// res.authSetting['scope.userLocation'] == true 表示 地理位置授权
if (res.authSetting['scope.userLocation'] != undefined && res.authSetting['scope.userLocation'] != true) {
//以前被拒绝授权指引用户授权
wx.showModal({
title: '请求授权当前位置',
content: '需要获取您的地理位置,请确认授权',
success: function (res) {
if (res.cancel) {
console.log('0')
back(false)
} else if (res.confirm) {
wx.openSetting({
success: function (dataAu) {
if (dataAu.authSetting["scope.userLocation"] == true) {
back(true);
} else {
back(false)
}
}
})
}
}
})
} else if (res.authSetting['scope.userLocation'] == undefined) {
back(false)
} else {
// 已经授权
back(true);
}
}
})
},
// 微信api获取经纬度
getLocation(back,err) {
wx.getLocation({
type: 'gcj02',
success: (params) =>{
back();
},
fail: (e) => {
err();
}
})
}
})

208
app.js Normal file
View File

@@ -0,0 +1,208 @@
//app.js
import {
LoginToken
} from '/lib/RequestingCenter.js'
import {
Toastsuccess,ToastError
} from '/lib/Toast.js'
let sum = 0;
App({
onLaunch: function() {
wx.removeStorage({
key: 'oldHotelinfo',
})
// 获取系统状态栏信息
wx.getSystemInfo({
success: e => {
this.globalData.StatusBar = e.statusBarHeight;
let capsule = wx.getMenuButtonBoundingClientRect();
if (capsule) {
this.globalData.Custom = capsule;
this.globalData.CustomBar = capsule.bottom + capsule.top - e.statusBarHeight;
} else {
this.globalData.CustomBar = e.statusBarHeight + 50;
}
}
})
// 登录
// this.userLogin();
},
globalData: {
ImgUrl : "https://auth.blv-oa.com/ImgServer/FileImage?url=ImgUrl&&ftp=11",
userinfo: null,
MapKey: '6JMBZ-BSAWP-D2NDJ-LFL4J-QJQQ3-3TBTV',
MapSk:'MHAGZ4S3aYeAD1pFoMTy6HAFL7nG18',
autho: null,
authotype:{
no:1,
ok:3
},
roontypeList:[],
roomIDName:[],
roomName:[],
HotelId:-1,
CreateTime:null,
HotelCode:null,
},
toast:function(type,title,success,time){
if(type==1){
Toastsuccess(title,success,time)
}
if(type==2){
ToastError(title,success,time)
}
// Toast(title,icon,success,time)
},
//TOKEN登录
userLogin:async function (back) {
let that = this;
// 读取本地信息尝试登录
const xiaoxi_token = wx.getStorageSync('xiaoxi_token') || null
if (xiaoxi_token != null && xiaoxi_token!="") {
await LoginToken({
token: xiaoxi_token
}).then(res => {
if(res.Status!=200){
that.toast(2,res.Message||"网络繁忙",function () {
wx.reLaunch({
url: "../login/login",
})
})
return;
}
res.Data.userinfo.error = res.Data.error
res.Data.userinfo.HeadImg = that.globalData.ImgUrl.replace("ImgUrl",res.Data.userinfo.HeadImg)
that.globalData.userinfo = res.Data.userinfo
that.globalData.autho = res.Data.autho
//由于这里是网络请求,可能会在 Page.onLoad 之后才返回
// 所以此处加入 callback 以防止这种情况
// if (that.checkLoginReadyCallback){
// that.checkLoginReadyCallback();
// }
wx.setStorageSync('xiaoxi_token', res.Data.token)
back();
},
err=>{
that.toast(2,'网络繁忙',function () {
wx.reLaunch({
url: "/pages/login/login",
})
})
}
).catch(
err => {
console.log(err)
that.toast(2,'网络繁忙', ()=> {
wx.reLaunch({
url: "/pages/login/login",
})
})
}
);
} else {
wx.reLaunch({
url: "/pages/login/login",
})
}
},
//检测授权信息
SQ: function (back) {
let that = this;
wx.getSetting({
success: (res) => {
// res.authSetting['scope.userLocation'] == undefined 表示 初始化进入该页面
// res.authSetting['scope.userLocation'] == false 表示 非初始化进入该页面,且未授权
// res.authSetting['scope.userLocation'] == true 表示 地理位置授权
if (res.authSetting['scope.userLocation'] != undefined && res.authSetting['scope.userLocation'] != true) {
//以前被拒绝授权指引用户授权
wx.showModal({
title: '请求授权当前位置',
content: '需要获取您的地理位置,请确认授权',
success: function (res) {
if (res.cancel) {
console.log('0')
back(false)
} else if (res.confirm) {
wx.openSetting({
success: function (dataAu) {
if (dataAu.authSetting["scope.userLocation"] == true) {
back(true);
} else {
back(false)
}
}
})
}
}
})
} else if (res.authSetting['scope.userLocation'] == undefined) {
back(false)
} else {
// 已经授权
back(true);
}
}
})
},
// 微信api获取经纬度
// wx.getFuzzyLocation
getFuzzyLocations(back,err) {
wx.getFuzzyLocation({
type: 'wgs84',
success: (params) =>{
back();
},
fail: (e) => {
err();
}
})
},
SetroontypeListindex: function (back){
this.globalData.roontypeList=back.Data
this.GetRoomIDNameArry()
// for (let index = 0; index < back.Data.length; index++) {
// //console.log( this.globalData.roontypeList.length)
// //console.log(back.Data[index].ROOM_TYPE_ID)
// //console.log( back.Data[index])
// this.globalData.roontypeList[back.Data[index].ROOM_TYPE_ID]=back.Data[index]
// // console.log(res.Data[index].ROOM_TYPE_ID)
// }
//console.log( this.globalData.roontypeList.length)
},
GetroontypeListindex: function (){
return this.globalData.roontypeList
},
GetRoomIDNameArry(){
var narr = []
var narr3 = []
let narr2 = []
narr2=this.globalData.roontypeList
//debugger
for (let index = 0; index < this.globalData.roontypeList.length; index++) {
//console.log( this.globalData.roontypeList.length)
//console.log(back.Data[index].ROOM_TYPE_ID)
//console.log( back.Data[index])
// narr[app.globalData.roontypeList[index].ROOM_TYPE_ID]=app.globalData.roontypeList[index]
// console.log(res.Data[index].ROOM_TYPE_ID)
// let rs = {
// id:narr2[index].ROOM_TYPE_ID,
// name:narr2[index].ROOM_TYPE_NAME
// }
let rs = narr2[index].ROOM_TYPE_OLD_ID + '|' + narr2[index].ROOM_TYPE_NAME
narr3.push(narr2[index].ROOM_TYPE_NAME)
narr.push(rs)
}
this.globalData.roomIDName=narr
this.globalData.roomName=narr3
//console.log(narr)
}
})

60
app.json Normal file
View File

@@ -0,0 +1,60 @@
{
"pages": [
"pages/autho/index",
"pages/login/login",
"pages/index/index",
"pages/mycenter/index",
"pages/logs/logs",
"pages/NewHome/NewHome",
"pages/basics/MakingRounds/MakingRounds",
"pages/basics/MakingRounds/process/process",
"pages/basics/MakingRoundsAbnormal/MakingRoundsAbnormal",
"pages/basics/HostUpgrade/HostUpgrade",
"pages/basics/HostUpgrade/EquipmentCaontrol/EquipmentCaontrol"
],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "ColorUI",
"navigationStyle": "custom",
"navigationBarTextStyle": "white"
},
"requiredPrivateInfos": [
"getFuzzyLocation"
],
"usingComponents": {
"cu-custom": "/colorui/components/cu-custom"
},
"useExtendedLib": {
"weui": true
},
"sitemapLocation": "sitemap.json",
"tabBar": {
"selectedColor": "#2bab99",
"list": [
{
"pagePath": "pages/index/index",
"text": "首页",
"iconPath": "/icon/home_.png",
"selectedIconPath": "/icon/home.png"
},
{
"pagePath": "pages/logs/logs",
"text": "操作日志",
"iconPath": "/icon/log_.png",
"selectedIconPath": "/icon/log.png"
},
{
"pagePath": "pages/mycenter/index",
"text": "我的",
"iconPath": "/icon/usercenter_.png",
"selectedIconPath": "/icon/usercenter.png"
}
]
},
"permission": {
"scope.userFuzzyLocation": {
"desc": "你的位置信息将用于记录用户信息~"
}
}
}

124
app.wxss Normal file
View File

@@ -0,0 +1,124 @@
@import "colorui/main.wxss";
@import "colorui/icon.wxss";
.scrollPage {
height: 60vh;
}
.nav-list {
display: flex;
flex-wrap: wrap;
padding: 0px 20rpx 0px;
justify-content: space-between;
}
.nav-list1 {
display: flex;
flex-wrap: wrap;
padding: 0px 10rpx 0px;
justify-content: flex-start;
}
.nav-li {
padding: 30rpx;
border-radius: 12rpx;
width: 47%;
margin: 0 1% 40rpx;
background-image: url(https://image.weilanwl.com/color2.0/cardBg.png);
background-size: cover;
background-position: center;
position: relative;
z-index: 1;
}
.nav-li4 {
padding: 30rpx;
border-radius: 12rpx;
width: 32%;
margin: 0 5rpx 5rpx;
background-image: url(https://image.weilanwl.com/color2.0/cardBg.png);
background-size: cover;
background-position: center;
position: relative;
z-index: 1;
}
.nav-li::after {
content: "";
position: absolute;
z-index: -1;
background-color: inherit;
width: 100%;
height: 100%;
left: 0;
bottom: -10%;
border-radius: 10rpx;
opacity: 0.2;
transform: scale(0.9, 0.9);
}
.nav-li.cur {
color: #fff;
background: rgb(94, 185, 94);
box-shadow: 4rpx 4rpx 6rpx rgba(94, 185, 94, 0.4);
}
.nav-title {
font-size: 27rpx;
font-weight: 150;
}
.nav-title::first-letter {
font-size: 40rpx;
margin-right: 4rpx;
}
.nav-name {
font-size: 28rpx;
text-transform: Capitalize;
margin-top: 20rpx;
position: relative;
}
.nav-name::before {
content: "";
position: absolute;
display: block;
width: 40rpx;
height: 6rpx;
background: #fff;
bottom: 0;
right: 0;
opacity: 0.5;
}
.nav-name::after {
content: "";
position: absolute;
display: block;
width: 100rpx;
height: 1px;
background: #fff;
bottom: 0;
right: 10rpx;
opacity: 0.3;
}
.nav-name::first-letter {
font-weight: bold;
font-size: 36rpx;
margin-right: 1px;
}
.nav-li text {
position: absolute;
right: 30rpx;
top: 30rpx;
font-size: 52rpx;
width: 60rpx;
height: 10rpx;
text-align: center;
line-height: 10rpx;
}
.text-light {
font-weight: 300;
}

184
colorui/animation.wxss Normal file
View File

@@ -0,0 +1,184 @@
/*
Animation 微动画
基于ColorUI组建库的动画模块 by 文晓港 2019年3月26日19:52:28
*/
/* css 滤镜 控制黑白底色gif的 */
.gif-black{
mix-blend-mode: screen;
}
.gif-white{
mix-blend-mode: multiply;
}
/* Animation css */
[class*=animation-] {
animation-duration: .5s;
animation-timing-function: ease-out;
animation-fill-mode: both
}
.animation-fade {
animation-name: fade;
animation-duration: .8s;
animation-timing-function: linear
}
.animation-scale-up {
animation-name: scale-up
}
.animation-scale-down {
animation-name: scale-down
}
.animation-slide-top {
animation-name: slide-top
}
.animation-slide-bottom {
animation-name: slide-bottom
}
.animation-slide-left {
animation-name: slide-left
}
.animation-slide-right {
animation-name: slide-right
}
.animation-shake {
animation-name: shake
}
.animation-reverse {
animation-direction: reverse
}
@keyframes fade {
0% {
opacity: 0
}
100% {
opacity: 1
}
}
@keyframes scale-up {
0% {
opacity: 0;
transform: scale(.2)
}
100% {
opacity: 1;
transform: scale(1)
}
}
@keyframes scale-down {
0% {
opacity: 0;
transform: scale(1.8)
}
100% {
opacity: 1;
transform: scale(1)
}
}
@keyframes slide-top {
0% {
opacity: 0;
transform: translateY(-100%)
}
100% {
opacity: 1;
transform: translateY(0)
}
}
@keyframes slide-bottom {
0% {
opacity: 0;
transform: translateY(100%)
}
100% {
opacity: 1;
transform: translateY(0)
}
}
@keyframes shake {
0%,
100% {
transform: translateX(0)
}
10% {
transform: translateX(-9px)
}
20% {
transform: translateX(8px)
}
30% {
transform: translateX(-7px)
}
40% {
transform: translateX(6px)
}
50% {
transform: translateX(-5px)
}
60% {
transform: translateX(4px)
}
70% {
transform: translateX(-3px)
}
80% {
transform: translateX(2px)
}
90% {
transform: translateX(-1px)
}
}
@keyframes slide-left {
0% {
opacity: 0;
transform: translateX(-100%)
}
100% {
opacity: 1;
transform: translateX(0)
}
}
@keyframes slide-right {
0% {
opacity: 0;
transform: translateX(100%)
}
100% {
opacity: 1;
transform: translateX(0)
}
}

View File

@@ -0,0 +1,54 @@
const app = getApp();
Component({
/**
* 组件的一些选项
*/
options: {
addGlobalClass: true,
multipleSlots: true
},
/**
* 组件的对外属性
*/
properties: {
bgColor: {
type: String,
default: ''
},
isCustom: {
type: [Boolean, String],
default: false
},
isBack: {
type: [Boolean, String],
default: false
},
bgImage: {
type: String,
default: ''
},
},
/**
* 组件的初始数据
*/
data: {
StatusBar: app.globalData.StatusBar,
CustomBar: app.globalData.CustomBar,
Custom: app.globalData.Custom
},
/**
* 组件的方法列表
*/
methods: {
BackPage() {
wx.navigateBack({
delta: 1
});
},
toHome(){
wx.reLaunch({
url: '/pages/index/index',
})
}
}
})

View File

@@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

View File

@@ -0,0 +1,16 @@
<view class="cu-custom" style="height:{{CustomBar}}px">
<view class="cu-bar fixed {{bgImage!=''?'none-bg text-white bg-img':''}} {{bgColor}}" style="height:{{CustomBar}}px;padding-top:{{StatusBar}}px;{{bgImage?'background-image:url(' + bgImage+')':''}}">
<view class="action" bindtap="BackPage" wx:if="{{isBack}}">
<text class="cuIcon-back"></text>
<slot name="backText"></slot>
</view>
<view class="action border-custom" wx:if="{{isCustom}}" style="width:{{Custom.width}}px;height:{{Custom.height}}px;margin-left:calc(750rpx - {{Custom.right}}px)">
<text class="cuIcon-back" bindtap="BackPage"></text>
<text class="cuIcon-homefill" bindtap="toHome"></text>
</view>
<view class="content" style="top:{{StatusBar}}px">
<slot name="content"></slot>
</view>
<slot name="right"></slot>
</view>
</view>

View File

@@ -0,0 +1 @@
/* colorui/components/cu-custom.wxss */

1226
colorui/icon.wxss Normal file

File diff suppressed because one or more lines are too long

4054
colorui/main.wxss Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,144 @@
// components/logscom.js
//导入日志信息请求发方法
import {
Logsinfo
} from '../../lib/RequestingCenter.js'
Component({
/**
* 组件的属性列表
*/
properties: {
hotelsid:{
type:String,
value:null
}
},
/**
* 组件的初始数据
*/
data: {
//正加载
status: 0,
page: 1,
logsdata: [],
sum: 0,
pagelength:10,
refresher: false
},
lifetimes: {
// 生命周期函数可以为函数或一个在methods段中定义的方法名
detached: function () { },
ready:function(){this.onLoad()}
},
/**
* 组件的方法列表
*/
methods: {
onLoad: function () {
let that = this;
setTimeout(function () {
try {
// 1.使用wx.createSelectorQuery()查询到需要滚动到的元素位置
that.createSelectorQuery().select('#scroll').boundingClientRect(res => {
console.log(res)
// 2.使用wx.getSysTemInfo()获取设备及页面高度windowHeightpx
wx.getSystemInfo({
success(ress) {
console.log(ress)
that.setData({
topheight: ress.windowHeight - res.top
})
}
})
}).exec(function (params) {
console.log(params)
})
} catch (error) {
console.log(error)
}
}, 500)
this.init()},
// 下拉刷新
toupper: function () {
if (this.data.refresher) {
return;
}
this.setData({
refresher: true,
})
var that = this;
that.setData({
page: 1,
})
that.init();
},
// 下拉加载
MoreData: function (params) {
if (this.data.status == 1 || this.data.status == 3) {
return;
}
this.setData({
status: 1,
page: this.data.page + 1
})
this.init();
},
//加载数据
init:async function () {
try {
if(this.data.page<1){
this.setData({
page:1
})
}
let that = this;
await Logsinfo({
page:that.data.page,
search:{ hotelsid:that.data.hotelsid,name:'',endtime:'',starttime:''},
length:that.data.pagelength
}).then(res => {
if (res.Status == 200) {
let newdata = res.Data.data
if(that.data.page>1){
newdata = that.data.logsdata.concat(newdata);
}
//判断是否有更多
let more = 0;
if((that.data.page * that.data.pagelength)>=res.Data.filtcount){
more = 3;
}
that.setData({
refresher: false,
logsdata: newdata,
status: more,
//过滤后总数
sum: res.Data.filtcount
})
} else {
that.setData({
status:2,
page:that.data.page-1
})
app.toast(2, res.Message || "网络繁忙")
}
}, err => {
that.setData({
status:2,
page:that.data.page-1
})
app.toast(2 ,"网络繁忙")
}).catch(err => {
that.setData({
status:2,
page:that.data.page-1
})
console.log(err)
app.toast(2 ,"网络繁忙")
});
} catch (error) {
console.log(error)
}
},
}
})

View File

@@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

View File

@@ -0,0 +1,30 @@
<!-- 过滤器 -->
<wxs module="filter" src="../../utils/filters.wxs"></wxs>
<view class="padding-sm bg-white radius shadow shadow-lg" style="padding-bottom:0;">
<view class="flex flex-wrap">
<view class="basis-xl">
操作日志共{{sum}}条
</view>
<!-- <view class="basis-sm">当前第{{page}}页</view> -->
</view>
<view class="bg-gray margin-xs" style="padding:2rpx" ></view>
<view id="scroll">
<scroll-view wx:if="{{topheight>0}}" style="height:{{topheight==null?'600rpx':topheight+'px'}} ;padding-bottom:10rpx" refresher-background="white" refresher-default-style="black" scroll-y refresher-enabled="{{true}}"
refresher-triggered="{{refresher}}" bindscrolltolower="MoreData" bindrefresherrefresh="toupper">
<view wx:for="{{logsdata}}" class="flex flex-wrap border-bottom">
<view class="basis-lg">{{item.Id}}<text class="margin-left-xs"></text>{{item.uid}}<text class="margin-left-xs"></text> {{filter.TimeFormat(item.createtime)}}</view>
<view class="basis-sm text-right">{{item.ActionId}}<text class='margin-left-xs text-{{item.type==0?"green":"red"}}'>{{item.AppType==0?"RCU":"人脸机"}}{{item.type==0?"绑定":"解绑"}}</text></view>
<!-- <view class="basis-df">行为:{{item.type==0?"绑定":"解绑"}}</view> -->
<view class="basis-xl">酒店:<text class='text-{{item.type==0?"green":"red"}}'>{{item.Name}}</text></view>
<view class="basis-sm">房间号:<text class='text-{{item.type==0?"green":"red"}}'>{{item.roomNumber}} - {{item.roomID}}</text></view>
<view class="basis-lg">{{item.AppType==0?"MAC":"SN"}}:<text class='text-{{item.type==0?"green":"red"}}'>{{item.MAC}}</text></view>
<view class="basis-xl">地点:{{item.location}}</view>
<view class="bg-gray margin-xs" style="padding:2rpx; width:100%" ></view>
</view>
<view class="cu-load bg-blue light loading" wx:if="{{status==1}}"></view>
<view class="cu-load bg-blue light over" wx:if="{{status==3}}"></view>
<view class="cu-load bg-red light erro " wx:if="{{status==2}}"></view>
</scroll-view>
</view>
</view>

View File

@@ -0,0 +1,2 @@
@import "../../colorui/main.wxss";
@import "../../colorui/icon.wxss";

View File

@@ -0,0 +1,45 @@
// pages/components/selector/selector.js
Component({
/**
* 组件的属性列表
*/
properties: {
listData: {
type: Array,
value: [],
}
},
/**
* 组件的初始数据
*/
data: {
selectShow: false,
index: 0
},
/**
* 组件的方法列表
*/
methods: {
// 点击下拉显示框
/**
* 切换选择框的显示状态
* 通过修改selectShow的值来控制选择框的显示/隐藏
*/
selectTap() {
this.setData({
selectShow: !this.data.selectShow
});
},
// 点击下拉列表
optionTap(e) {
let Index = e.currentTarget.dataset.index; //获取点击的下拉列表的下标
this.setData({
selectShow: !this.data.selectShow,
index: Index
});
this.triggerEvent('optionTap', this.data.listData[Index])
},
}
})

View File

@@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

View File

@@ -0,0 +1,11 @@
<view class='select_box'>
<view class='select' catchtap='selectTap'>
<text class='select_text'>{{listData[index]}}</text>
<text >{{selectShow ? '▲' : '▼'}} </text>
</view>
<view class='option_box' wx:if="{{selectShow}}"
style='height:{{selectShow?(listData.length>5?325:listData.length*50):0}}rpx;'>
<text class='option' wx:for='{{listData}}' wx:key='index' data-index='{{index}}'
catchtap='optionTap'>{{item}}</text>
</view>
</view>

View File

@@ -0,0 +1,63 @@
/* pages/components/selector/selector.wxss */
.select_box {
background: #fff;
width: 100%;
height: 100%;
border-radius: 14rpx;
position: relative;
border: 1px solid #ccc;
z-index: 10;
}
.select_box .select {
box-sizing: border-box;
width: 100%;
height: 100%;
border-radius: 8rpx;
display: flex;
align-items: center;
padding: 0 10rpx;
}
.select_box .select .select_text {
font-size: 26rpx;
color: #777777;
line-height: 28rpx;
flex: 1;
}
.select_box .select .select_img {
width: 30rpx;
height: 30rpx;
display: block;
transition: transform 0.3s;
}
.select_box .select .select_img_rotate {
transform: rotate(180deg);
}
.select_box .option_box {
position: absolute;
top: 50rpx;
left: 0;
width: 100%;
box-sizing: border-box;
height: 0;
overflow-y: auto;
background: #fff;
transition: height 0.3s;
border-left: 1px solid #efefef;
border-right: 1px solid #efefef;
}
.select_box .option_box .option {
display: block;
line-height: 30rpx;
font-size: 26rpx;
border-top: 1px solid #efefef;
border-bottom: 1px solid #efefef;
padding: 10rpx;
}

BIN
icon/home.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
icon/home_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
icon/log.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
icon/log_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
icon/usercenter.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

BIN
icon/usercenter_.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
icon/vacant.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

BIN
icon/住宿.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
icon/开门.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

BIN
icon/设备编号.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

BIN
icon/退房.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

BIN
icon/酒店.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
icon/重启.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

BIN
images/BasicsBg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

BIN
images/cjkz.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
images/componentBg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

BIN
images/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

BIN
images/share.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
images/tabbar/about.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
images/tabbar/about_cur.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
images/tabbar/basics.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

BIN
images/tabbar/component.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
images/tabbar/plugin.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
images/wave.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 956 KiB

BIN
images/zanCode.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
img/back.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
img/ble.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
img/ecble.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
img/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

BIN
img/s1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
img/s2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
img/s3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
img/s4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
img/s5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

260
lib/RequestingCenter.js Normal file
View File

@@ -0,0 +1,260 @@
import reqeust from 'request.js'
import reqeust1 from 'request1.js'
// 本地环境
// const Url = "http://192.168.0.104:81/ApiWx/";
// const Url = "http://localhost:56306/ApiWx/";
// 生产环境
const Url = "https://auth.blv-oa.com/ApiWx/";
const BoonliveUrl = "https://auth.blv-oa.com/Upgrade/";
// 测试环境
//const Url = "http://auth.blv-oa.com:996/ApiWx/";
const appid = 5;
var token = null
//获取token
function gettoken(){
if (token == null) {
token = wx.getStorageSync('xiaoxi_token') || ""
}
return token;
}
export function settoken(val) {
token = val;
}
//账号密码登录
export async function Login(params) {
token = null;
params.appid = appid
return await reqeust({
title: "登录中",
url: Url + 'Login',
data: params || {}
})
};
//token登录
export async function LoginToken(params) {
token = null;
params.appid = appid
return await reqeust({
title: "登录中",
url: Url + 'LoginToken',
data: params || {}
})
}
//获取酒店信息
export async function GetHostsInfo(params) {
params.appid = appid
params.token = gettoken();
return await reqeust({
title: "加载中...",
url: Url + 'HostsInfo',
data: params || {}
})
}
//绑定Mac地址
export async function GetMAC(params) {
params.token = gettoken();
return await reqeust({
title: params.MAC == "" ? "解绑中..." : "绑定中...",
url: Url + 'GetMAC',
data: params || {}
})
}
// 日志信息
export async function Logsinfo(params) {
params.token = gettoken();
return await reqeust({
title: "加载中...",
url: Url + 'Logsinfo',
data: params || {}
})
}
// 反馈错误
export async function ErrorInfo(params) {
params.token = gettoken();
return await reqeust({
title: "反馈中...",
url: Url + 'ErrorInfo',
data: params || {}
})
}
// 查询人脸机是否绑定
export async function CheckFaceSN(params) {
params.token = gettoken();
return await reqeust({
title:"查询中...",
url: Url + 'CheckFaceSN',
data: params || {}
})
}
// 绑定人脸机
export async function GetFaceSN(params) {
params.token = gettoken();
return await reqeust({
title: params.isjb ? "解绑中..." : "绑定中...",
url: Url + 'GetFaceSN',
data: params || {}
})
}
//开门测试
export async function OpenDoorTest(params){
params.token = gettoken();
console.log(params)
return await reqeust({
title: "下发开门命令中",
url: Url + 'OpenDoorTest',
data: params || {}
})
}
//重启测试
export async function RestartTheDevice(params){
params.token = gettoken();
console.log(params)
return await reqeust({
title: "下发重启命令中",
url: Url + 'RestartTheDevice',
data: params || {}
})
}
//获取设备信息测试
export async function GeteDeviceInfomation(params){
params.token = gettoken();
console.log(params)
return await reqeust({
title: "下发获取设备信息命令中",
url: Url + 'GeteDeviceInfomation',
data: params || {}
})
}
//删除所有住户人员信息
export async function DeletePeopleFromDeviceByGroup(params){
params.token = gettoken();
console.log(params)
return await reqeust({
title: "下发删除所有住户人员信息命令中",
url: Url + 'DeletePeopleFromDeviceByGroup',
data: params || {}
})
}
export async function GetThePeopleListOfDevice(params){
params.token = gettoken();
console.log(params)
return await reqeust({
title: "获取人员信息列表",
url: Url + 'GetThePeopleListOfDevice',
data: params || {}
})
}
//开房
export async function openRommCheckin(params){
params.token = gettoken();
console.log(params)
return await reqeust({
title: "下发开房命令",
url: Url + 'openRommCheckin',
data: params || {}
})
}
//退房
export async function roomCheckOut(params){
params.token = gettoken();
console.log(params)
return await reqeust({
title: "下发退房命令",
url: Url + 'roomCheckOut',
data: params || {}
})
}
//获取房型
export async function GetRoomType(params){
params.token = gettoken();
console.log(params)
return await reqeust({
title: "获取酒店房型信息",
url: Url + 'GetRoomTypeAndModalsList',
data: params || {}
})
}
//获取房型下的房间
export async function GetRoomTypeNode(params){
params.token = gettoken();
console.log(params)
return await reqeust1({
title: "获取酒店房间信息",
url: BoonliveUrl + 'GetDeviceInfo',
data: params || {}
})
}
export async function WebChatUpgrade(params){
params.token = gettoken();
console.log(params)
return await reqeust1({
title: "准备设备升级",
url: BoonliveUrl + 'WebChatUpgrade',
data: params || {}
})
}
export async function GetRoomTypeAndModalsListLog(params){
params.token = gettoken();
console.log(params)
return await reqeust1({
title: "获取房间配置回路信息",
url: BoonliveUrl + 'GetRoomTypeAndModalsListLog',
data: params || {}
})
}
export async function QueryUpdateHostStatus(params){
params.token = gettoken();
console.log(params)
return await reqeust1({
title: null,
url: BoonliveUrl + 'QueryUpdateHostStatus',
data: params || {}
})
}
export async function ForwardQueryUpdateHostProgressBar(params){
params.token = gettoken();
// console.log(params)
return await reqeust1({
title: null,
url: BoonliveUrl + 'ForwardQueryUpdateHostProgressBar',
data: params || {}
})
}
export async function SetRCULight(params){
params.token = gettoken();
console.log(params)
return await reqeust1({
title: null,
url: BoonliveUrl + 'SetRCULight',
data: params || {}
})
}
export async function SetRCUAir(params){
params.token = gettoken();
console.log(params)
return await reqeust1({
title: null,
url: BoonliveUrl + 'SetRCUAir',
data: params || {}
})
}
export async function SetRCUCurtain(params){
params.token = gettoken();
console.log(params)
return await reqeust1({
title: null,
url: BoonliveUrl + 'SetRCUCurtain',
data: params || {}
})
}
SetRCUCurtain

18
lib/Toast.js Normal file
View File

@@ -0,0 +1,18 @@
export function Toastsuccess(title,success,time) {
wx.showToast({
title:title || '成功',
icon:'success',
mask:true,
duration:time||1500,
success:success || null
})
}
export function ToastError(title,success,time) {
wx.showToast({
title:title,
icon:'none',
mask:true,
duration:time||1500,
success:success || null
})
}

61
lib/request.js Normal file
View File

@@ -0,0 +1,61 @@
//请求数量
let show = 0;
export default async function reqeust(params) {
show++;
return new Promise((resolve, reject) => {
wx.showLoading({
title: params.title,
mask:true
})
wx.request({
url: params.url,
method: params.method || 'post',
data: params.data || {},
success: res => {
resolve(res.data)
},
fail: err => {
reject(err)
},
complete:()=>{
show--;
if(show==0){
wx.hideLoading()
}
}
})
}).catch((error) => {
throw new Error(error);
})
}
// export default async function reqeust1(params) {
// show++;
// return new Promise((resolve, reject) => {
// wx.showLoading({
// title: params.title,
// mask:true
// })
// wx.request({
// header: {
// contentType: 'application/x-www-form-urlencoded', // 填入服务名称
// },
// url: params.url,
// method: params.method || 'post',
// data: params.data || {},
// success: res => {
// resolve(res.data)
// },
// fail: err => {
// reject(err)
// },
// complete:()=>{
// show--;
// if(show==0){
// wx.hideLoading()
// }
// }
// })
// }).catch((error) => {
// throw new Error(error);
// })
// }

65
lib/request1.js Normal file
View File

@@ -0,0 +1,65 @@
//请求数量
let show = 0;
export default async function reqeust(params) {
show++;
return new Promise((resolve, reject) => {
wx.showLoading({
title: params.title,
mask:true
})
wx.request({
header: {
contentType: 'application/x-www-form-urlencoded', // 填入服务名称
},
url: params.url,
method: params.method || 'post',
data: params.data || {},
success: res => {
resolve(res.data)
},
fail: err => {
reject(err)
},
complete:()=>{
show--;
if(show==0){
wx.hideLoading()
}
}
})
}).catch((error) => {
throw new Error(error);
})
}
// export default async function reqeust1(params) {
// show++;
// return new Promise((resolve, reject) => {
// wx.showLoading({
// title: params.title,
// mask:true
// })
// wx.request({
// header: {
// contentType: 'application/x-www-form-urlencoded', // 填入服务名称
// },
// url: params.url,
// method: params.method || 'post',
// data: params.data || {},
// success: res => {
// resolve(res.data)
// },
// fail: err => {
// reject(err)
// },
// complete:()=>{
// show--;
// if(show==0){
// wx.hideLoading()
// }
// }
// })
// }).catch((error) => {
// throw new Error(error);
// })
// }

147
pages/NewHome/NewHome.js Normal file
View File

@@ -0,0 +1,147 @@
const app = getApp()
// pages/NewHome.js
Page({
options: {
addGlobalClass: true,
},
/**
* 页面的初始数据
*/
data: {
elements: [{
title: '查房',
name: 'MakingRounds',
color: 'cyan',
icon: 'newsfill'
},
{
title: '查房异常记录',
name: 'MakingRoundsAbnormal',
color: 'blue',
icon: 'colorlens'
},
{
title: '主机升级',
name: 'HostUpgrade',
color: 'purple',
icon: 'font'
},
{
title: '主机绑定 ',
name: 'HostBinding',
color: 'mauve',
icon: 'icon'
},
{
title: '人脸机绑定',
name: 'FacialDeviceBinding',
color: 'pink',
icon: 'btn'
},
{
title: '红外转发码库下载',
name: 'InfraredLibraryDownload',
color: 'brown',
icon: 'tagfill'
},
{
title: '程序配置',
name: 'ProgramConfiguration',
color: 'red',
icon: 'myfill'
},
{
title: '日志查询',
name: 'progress',
color: 'orange',
icon: 'icloading'
},
],
//权限信息
autho: null,
//酒店信息
Hotelinfo: null,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: async function (options) {
if (!options.HotelId || app.globalData.autho == null) {
app.toast(2, "无酒店信息~")
return;
}
this.setData({
autho: app.globalData.autho
})
try {
this.data.autho.forEach((element, index) => {
element.Hotels.forEach((elements, indexs) => {
if (elements.HotelId == options.HotelId) {
this.setData({
Hotelinfo: elements
})
throw new Error();
}
})
});
} catch (error) {
console.log("已经找到,无需循环~")
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@@ -0,0 +1,5 @@
{
"usingComponents": {
}
}

View File

@@ -0,0 +1,21 @@
<cu-custom bgColor="bg-gradual-blue"
isBack="true">
<block bindtap="back" slot="backText" >返回</block>
<view slot="content">{{Hotelinfo.HotelName}}({{Hotelinfo.Code}})</view>
</cu-custom>
<scroll-view scroll-y >
<view class='nav-list' style="margin-top: 20rpx;">
<navigator open-type="navigate" hover-class="navigator-hover" url="/pages/basics/{{item.name}}/{{item.name}}?HotelId={{Hotelinfo.HotelId}}" class="nav-li bg-{{item.color}}" wx:for="{{elements}}" wx:key>
<view class="nav-title ">{{item.title}}</view>
<!-- <view class="nav-name">{{item.name}}</view> -->
<!-- <text class='cuIcon-{{item.icon}}'></text> -->
</navigator>
</view>
<view class='cu-tabbar-height'></view>
</scroll-view>

View File

@@ -0,0 +1,6 @@
.flex-center {
display: flex;
justify-content: center; /* 水平 */
align-items: center; /* 垂直 */
text-align: center; /* 多行时文字也居中 */
}

103
pages/autho/index.js Normal file
View File

@@ -0,0 +1,103 @@
// pages/autho/index.js
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
},
onLoad :function (params) {
wx.removeStorage({
key: 'oldHotelinfo',
success (res) {
console.log('清除历史酒店信息~')
}
})
this.SQ();
},
SQ:function(params) {
app.SQ(isok=>{
if(isok){
console.log(params)
app.userLogin(()=>{
//登录成功~
wx.reLaunch({
url: "../index/index",
})
});
}else{
app.getFuzzyLocations(function (params) {
console.log(params)
app.userLogin(()=>{
//登录成功~
wx.reLaunch({
url: "../index/index",
})
});
},
()=>{
wx.showToast({
title: '拒绝将无法进入~',
showCancel:false,
icon:"error"
})
})
};}
)
},
/**
* 生命周期函数--监听页面加载
*/
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

3
pages/autho/index.json Normal file
View File

@@ -0,0 +1,3 @@
{
"usingComponents": {}
}

7
pages/autho/index.wxml Normal file
View File

@@ -0,0 +1,7 @@
<cu-custom bgColor="bg-gradual-blue" >
<block bindtap="back" slot="backText" >返回</block>
<view slot="content">授权申请</view>
</cu-custom>
<view class="padding flex justify-center align-center bg-white">
<button class="cu-btn bg-green" bindtap="SQ">点击授权</button>
</view>

1
pages/autho/index.wxss Normal file
View File

@@ -0,0 +1 @@
/* pages/autho/index.wxss */

View File

@@ -0,0 +1,645 @@
// pages/basics/MakingRounds/MakingRounds.js
const app = getApp()
// const upgrade = require('../../../utils/upgrade.js')
import {
GetHostsInfo,
GetMAC,
GetFaceSN,
ErrorInfo,
CheckFaceSN,
OpenDoorTest,
GetRoomType,
GetRoomTypeAndModalsListLog,
WebChatUpgrade,
QueryUpdateHostStatus,
ForwardQueryUpdateHostProgressBar,
GetRoomTypeNode,
SetRCULight,
SetRCUAir,
SetRCUCurtain,
} from '../../../../lib/RequestingCenter.js'
import DeviceUpgrader from '../../../../utils/upgrade.js';
const upgrader = new DeviceUpgrader();
Page({
/**
* 页面的初始数据
*/
data: {
RoomNumber:"",
HotelName:"",
HotelId:"",
HotelCode:"",
roomtypeid:"",
devNode:null,
Gfilename:"",
Pfilename:"",
TabCur:1,
scrollHeight:0,
Completed:false, //是否处于升级状态
CurrentUpgradeDev:'', //当前升级设备
CurrentUpgradeDevStart:'',//当前升级设备状态
UpgradeCount:0, //已升级设备数量
UpgradeAllCount:1, //总升级设备数量
// 回路调试相关数据
roomtypeInfoNode:{},
roomtypeInfoNodeinfo:[],
VolumeLevel:30,
showinfo:0,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad:async function(options){
// 初始化升级器事件监听
upgrader.on('progress', p => {
console.log(p)
this.setData({ CurrentUpgradeDevStart: p }) // 实时刷新 UI
})
upgrader.on('error', e => {
wx.showToast({ title: '升级失败', icon: 'none' })
})
if (!options.RoomNumber || !options.HotelName ||!options.HotelId ||!options.roomtypeid ||!options.HotelCode||!options.createTime){
app.toast(2, "无酒店信息~")
return;
}
console.log(options.RoomNumber)
this.setData ({
RoomNumber:options.RoomNumber,
HotelName:options.HotelName,
HotelId:options.HotelId,
roomtypeid:options.roomtypeid,
HotelCode:options.HotelCode,
createTime:options.createTime
})
try {
// 调用 GetRoomTypeNode
const res = await GetRoomTypeNode({
hotelid:options.HotelId,
roomTypeID: options.roomtypeid
});
if (res.IsSuccess==true) {
let devlist = res.HostData
for (let nindex = 0; nindex < devlist.length; nindex++) {
if (devlist[nindex].RoomNumber==options.RoomNumber) {
devlist[nindex].Model =devlist[nindex].Model.trim().replace(/\0/g, "")
console.log(devlist[nindex].Model)
this.setData ({
devNode:devlist[nindex]
})
break
}
}
}
const Nres = await GetRoomType({
HotelID:options.HotelId,
})
let Gfilename=""
let Pfilename=""
if (Nres.Status==200) {
let Roomtypeinfo=Nres.Data
for (let index = 0; index < Roomtypeinfo.length; index++) {
const element = Roomtypeinfo[index];
if (element.ROOM_TYPE_OLD_ID == options.roomtypeid) {
if (element.App_Cfg_For_L2.length>0) {
Gfilename=element.App_Cfg_For_L2
}
if (element.App_Cfg_For_L4.length>0) {
Gfilename=element.App_Cfg_For_L4
}
if (element.APPTYPE=="App_Cfg") {
Pfilename=element.CONFIG_BIN
}else{
Pfilename=""
}
break
}
}
}
await GetRoomTypeAndModalsListLog({
code:options.HotelCode
}).then(res =>{
if (res.IsSuccess==true) {
for (let index = 0; index < res.Result.length; index++) {
const element = res.Result[index];
if (element.ID == options.roomtypeid) {
this.setData({
roomtypeInfo:res.Result,
roomtypeInfoNodeinfo:element.Modals
})
break
}
}
console.log(this.data.roomtypeInfoNodeinfo)
this.LoopDebugging(null)
}
})
this.setData({
Pfilename:Pfilename,
Gfilename:Gfilename,
});
} catch (err) {
console.log('GetRoomTypeNode error', err);
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
this.calcScrollHeight();
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
upgrader.cancelUpgrade()
upgrader._cleanup()
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
// 手动关闭升级进度显示
closeUpgradeProgress() {
this.setData({
Completed: false
})
},
onShareAppMessage() {
},
calcScrollHeight() {
// 1. 拿到屏幕可用高度px
const sys = wx.getSystemInfoSync();
const screenHeight = sys.windowHeight; // px
// 2. 拿到 scroll-view 的 toppx
wx.createSelectorQuery()
.in(this)
.select('#myScroll')
.boundingClientRect(rect => {
if (rect) {
const topPx = rect.top; // px
const bottomPx = 10 / 2; // 10rpx → 5px2倍屏
const heightPx = screenHeight - topPx - bottomPx;
// 3. 转 rpx 并写入
this.setData({
scrollHeight: heightPx * 2 // px→rpx
});
}
})
.exec();
},
tabSelect(e) {
this.setData({
TabCur: e.currentTarget.dataset.id,
})
},
async UpgradeTheEquipment(e) {
let se = e
let _this = this
let updataDev = e.currentTarget.dataset.id
let errstr = ""
if (updataDev == 1) {
errstr = "固件"
}
if (updataDev == 2) {
errstr = "配置"
}
wx.showModal({
title: "提示",
content: "是否进行" + errstr + "升级!",
async success(res) {
if (res.confirm) {
await _this.UpgradeTheEquipment2(se)
} else if (res.cancel) {
return
}
}
})
},
async UpgradeTheEquipment2(e) {
let updataDev = e.currentTarget.dataset.id
let errstr = ""
let UpgradeType = ""
let filename = ""
let _this = this
let RoomTypeID = this.data.roomtypeid
let HotelId = this.data.HotelId
let devNode = this.data.devNode
if (updataDev == 1) {
errstr = "升级固件失败"
UpgradeType = 'firmware'
filename = _this.data.Gfilename
filename = filename.replace('.hex', '.bin')
}
if (updataDev == 2) {
errstr = "升级配置失败"
UpgradeType = ''
filename = _this.data.Pfilename
}
if (filename.length == 0) {
_this.DisplayPrompt("未获取到升级文件!升级失败", 3000)
return
}
_this.setData({
UpgradeCount: 0, //升级计数
CurrentUpgradeDev: devNode.RoomNumber, //当前升级设备
CurrentUpgradeDevStart: '升级就绪',//当前升级设备状态
Completed: true,
UpgradeAllCount: 1,//升级总数
})
try {
await upgrader.startUpgrade(UpgradeType, {
roomTypeID: RoomTypeID,
hostidLists: '[' + devNode.ID + ']',
upgradefileName: filename,
hotelid: HotelId
})
.then(res => {
_this.setData({
UpgradeCount: _this.data.UpgradeCount + 1, //升级计数
})
console.log('升级完成', res)
})
.catch(err => {
console.log('升级失败', err)
});
_this.DisplayPrompt2("升级完成!", 1000)
} catch (error) {
_this.setData({
CurrentUpgradeDev: devNode.RoomNumber, //当前升级设备
CurrentUpgradeDevStart: errstr + ',服务器响应异常',//当前升级设备状态
})
// this.DisplayPrompt(errstr + ',服务器响应异常', 1000)
return
}
},
DisplayPrompt2(tipstr, showtime) {
wx.showToast({
title: tipstr,
icon: 'none',
duration: showtime
})
},
DisplayPrompt(tipstr, showtime) {
wx.showToast({
title: tipstr,
icon: 'none',
duration: showtime
})
},
LoopDebugging:async function (e)
{
//
let roomtypeInfoNodeinfo=this.data.roomtypeInfoNodeinfo
let addrtype
const myMap =[]
let li =[]
let addrtypelist =true
let message =this.data.message
for (let index = 0; index < roomtypeInfoNodeinfo.length; index++) {
const element = roomtypeInfoNodeinfo[index];
addrtype=this.GetloopType(element.ModalAddress)
if (addrtype.length==0) {
continue
}
addrtypelist=true
for (let index2 = 0; index2 < myMap.length; index2++) {
const element2 = myMap[index2];
if ( element2[0] == addrtype[0][0]) {
li= myMap[index2][1]
li.push([element.ModalAddress,element.Name,addrtype[0][1]])
myMap[index2][1]=li
addrtypelist=false
break
}
}
if (addrtypelist) {
li=[]
li.push([element.ModalAddress,element.Name,addrtype[0][1]])
myMap.push([addrtype[0][0],li])
}
}
roomtypeInfoNodeinfo=myMap.sort((a, b) => a[0] - b[0])
//获取房间在线状态 roomstart
console.log(roomtypeInfoNodeinfo)
this.setData({
roomtypeInfoNodeinfo:roomtypeInfoNodeinfo
})
console.log(this.data.roomtypeInfoNode)
},
GetloopType(loopaddr){
let astr =loopaddr[0]+loopaddr[1]+loopaddr[2]
let aint =parseInt(astr,10)
let bint =[]
switch (aint) {
case 1 :
// case 4 :
// case 54:
bint.push([1,[[1,'开关',0]]])//开关
break;
case 5: //开关停
bint.push([5,[[1,'开关',0]]])
break;
case 7: //开关停
bint.push([7,[[1,'开关',0],[2,'模式',1],[3,'风速',1],[4,'温度',25],[5,'阀开',0]]])
break;
case 23 :
case 24:
bint.push([23,[[1,'开关',10]]])
break;
case 52:
bint.push([52,[[1,'开关',0],[2,'亮度',10],[3,'色温',10]]])
break;
default:
break;
}
return bint
},
// 播放欢迎词
GetshowinfoClick() {
this.setData({
showinfo: this.data.showinfo + 1
})
},
// 调整音量
changeVolumeLevel(e) {
this.setData({
VolumeLevel: e.detail.value
})
},
// 设置设备开关状态
SetDeviceSwitchStatus(e) {
let devarr = e.target.dataset.index
let devval = parseInt(e.target.dataset.value)
let ID = parseInt(e.target.id)
let type = e.target.dataset.type
this.SetDevStartToHostMachine(ID, devarr, devval, type)
console.log(e)
},
// 设置设备调光亮度
SetDeviceSwitchStatusslider(e) {
let devarr = e.target.dataset.index
let devval = parseInt(e.detail.value)
let ID = parseInt(e.target.id)
this.SetDevStartToHostMachine(ID, devarr, devval, 0)
console.log(e)
},
// 设备控制主方法
SetDevStartToHostMachine: async function (id, devarr, Handletype, type) {
let roomtypeInfoNodeinfo = this.data.roomtypeInfoNodeinfo
let narry = []
for (let index = 0; index < roomtypeInfoNodeinfo.length; index++) {
const element = roomtypeInfoNodeinfo[index];
if (element[0] === id) {
for (let nindex = 0; nindex < element[1].length; nindex++) {
const nelement = element[1][nindex];
if (nelement[0] === devarr) {
narry = this.SetloopDataChange(id, nelement[2], Handletype, type)
let iset = await this.ControlStatusMainCircuit(id, narry, devarr)
if (iset) {
roomtypeInfoNodeinfo[index][1][nindex][2] = narry
this.setData({
roomtypeInfoNodeinfo: roomtypeInfoNodeinfo
})
}
return
}
}
return
}
}
},
// 回路数据变更
SetloopDataChange(id, dataarry, Handletype, type) {
let result = []
switch (id) {
case 1:
if (dataarry[0][2] == 1) {
dataarry[0][2] = 0
} else {
dataarry[0][2] = 1
}
result = dataarry
break;
case 23:
case 5:
dataarry[0][2] = Handletype
result = dataarry
break;
case 52:
let devval = parseInt(type)
if (devval == 1) {
if (dataarry[devval - 1][2] == 1) {
dataarry[devval - 1][2] = 0
result = dataarry
} else {
dataarry[devval - 1][2] = 1
result = dataarry
}
} else {
dataarry[devval - 1][2] = Handletype
result = dataarry
}
break;
case 7:
let bevval = parseInt(type)
switch (bevval) {
case 1:
if (dataarry[bevval - 1][2] == 1) {
dataarry[bevval - 1][2] = 0
result = dataarry
} else {
dataarry[bevval - 1][2] = 1
result = dataarry
}
break;
case 3:
case 2:
if (dataarry[bevval - 1][2] == 4) {
dataarry[bevval - 1][2] = 1
} else {
dataarry[bevval - 1][2] = dataarry[bevval - 1][2] + 1
}
break;
case 4: // -
if (dataarry[bevval - 1][2] == 16) {
break;
} else {
dataarry[bevval - 1][2] = dataarry[bevval - 1][2] - 1
}
break
case 5: // +
if (dataarry[bevval - 2][2] == 32) {
break;
} else {
dataarry[bevval - 2][2] = dataarry[bevval - 2][2] + 1
}
break;
default:
break;
}
result = dataarry
break;
default:
break;
}
return result
},
// 控制状态主回路
ControlStatusMainCircuit: async function (id, dataarry, addr) {
let RoomNumber = this.data.RoomNumber
let HotelId = this.data.HotelCode
let devNode = this.data.devNode
let res = []
let sw = dataarry[0][2]
// 解析.NET风格的日期格式 "/Date(1473004800000)/"
let dotNetDate = this.data.createTime
let timestamp, pageCreateTime
try {
timestamp = parseInt(dotNetDate.match(/\d+/)[0])
pageCreateTime = new Date(timestamp)
} catch (error) {
console.error('日期解析错误:', error)
// 如果解析失败,使用当前日期作为备选
pageCreateTime = new Date()
}
let year = pageCreateTime.getFullYear()
let month = (pageCreateTime.getMonth() + 1).toString().padStart(2, '0')
let day = pageCreateTime.getDate().toString().padStart(2, '0')
let CreateTime = `${year}-${month}-${day}`
switch (id) {
case 1:
sw = sw == 1 ? 1 : 2
res = await SetRCULight({
roomNumber: RoomNumber,
code: HotelId,
creatDate: CreateTime,
status: sw,
modalAddress: addr,
brightness: 0
})
break;
case 5:
res = await SetRCUCurtain({
roomNumber: RoomNumber,
code: HotelId,
creatDate: CreateTime,
modalAddress: addr,
status: sw
})
break
case 7:
res = await SetRCUAir({
roomNumber: RoomNumber,
code: HotelId,
creatDate: CreateTime,
modalAddress: addr,
onOff: sw,
temperature: dataarry[3][2],
fanSpeed: dataarry[2][2] == 4 ? 0 : dataarry[2][2],
mode: dataarry[1][2] == 4 ? 0 : dataarry[1][2],
valve: 1
})
break
case 23:
res = await SetRCULight({
roomNumber: RoomNumber,
code: HotelId,
creatDate: CreateTime,
status: sw == 0 ? 2 : 1,
modalAddress: addr,
brightness: sw
})
break;
default:
return false
break;
}
if (res.IsSuccess == true) {
return true
}
return false
},
})

View File

@@ -0,0 +1,3 @@
{
"usingComponents": {}
}

View File

@@ -0,0 +1,242 @@
<cu-custom bgColor="bg-gradual-blue"
isBack="true">
<block bindtap="back" slot="backText" >返回</block>
<view slot="content">({{HotelName}})_{{RoomNumber}}</view>
</cu-custom>
<view class=" bg-white padding-5" >
<view class="bg-white" >
<view class="cubarN bg-white " >
<view class="cubarN bg-white flex-9" data-id ="{{index}}" bindtap="HideOrOpen" style="background:white;">
<view class="flex-9" style="font-weight: bold;" >房号:{{RoomNumber}}</view>
<view class="flex-sub text-{{devNode.Status==true? 'green':'red'}}" >{{ devNode.Status==true? "在线":"离线"}}</view>
</view>
</view>
<view class="cubarN bg-white" > <!-- wx:if="{{devlist[index].show==0}}"> -->
<view class="flex-xis" >MAC:{{devNode.MAC}}</view>
<!-- <view class="flex-xis setborder line-grey text-cut" style="height: 50rpx;width: 520rpx; font-size:22rpx; line-height: 50rpx"></view> -->
<view class="flex-twice" style="font-size: 26rpx;">主机:{{devNode.Model}}</view>
<view class="flex-twice" style="font-size: 22rpx;">配置版本:{{devNode.ConfigVersion}} </view>
</view>
<view class="cubarN bg-white solid-bottom "> <!-- wx:if="{{devlist[index].show==0}}"> -->
<view class="flex-eight" style="font-size: 22rpx;" >固件版本:{{devNode.Version}}</view>
</view>
</view>
</view>
<view class="flex solids line-grey" style=" height:62% ;width:100%;">
<view class="flex-eight" style="height: 100%;margin: 3rpx 5rpx; " >
<view class="flex-xis setborder line-grey text-cut" style="height: 45%;font-size: 22rpx; line-height: 50rpx;min-width: 0;margin: 3rpx 0rpx; ">
{{Gfilename}}
</view>
<view class="flex-xis setborder line-grey text-cut" style="height: 45%;font-size: 22rpx; line-height: 50rpx;min-width: 0;margin: 3rpx 0rpx;">
{{Pfilename}}
</view>
</view>
<view class="flex-twice" style="height: 100%;margin: 3rpx 5rpx;" >
<button class=" "style=" margin: 3rpx 0rpx; font-size: 22rpx;height:45%;" data-id="1" bind:tap="UpgradeTheEquipment" disabled="{{Completed}}">固件升级</button>
<button class=""style=" margin: 3rpx 0rpx; font-size: 22rpx;height: 45%;" data-id="2" bind:tap="UpgradeTheEquipment" disabled="{{Completed}}">配置升级</button>
</view>
</view>
<view wx:if="{{Completed}}" class=" flex align-center " style="height: 70rpx;background: aquamarine;" >
<view class="flex-eight" >正在升级房号:{{CurrentUpgradeDev}}:{{CurrentUpgradeDevStart}}</view>
<view class="flex-sub">
<text bind:tap="closeUpgradeProgress" class="setborder padding-xs text-red " style="cursor: pointer;">关闭</text>
</view>
</view>
<scroll-view scroll-x class="bg-white nav text-center text-bold text-xl ">
<view class="flex text-center">
<view class="cu-item {{1==TabCur?'text-blue cur':''}}" bindtap="tabSelect" data-id="{{1}}">
主机控制
</view>
<view class="cu-item {{2==TabCur?'text-blue cur':''}}" bindtap="tabSelect" data-id="{{2}}">
控制日志
</view>
</view>
</scroll-view>
<scroll-view scroll-y scroll-into-view="{{toView}}" id="myScroll" style="height:{{scrollHeight}}rpx; " >
<view wx:if="{{TabCur===1}}" style="height:95%" class="bg-white" >
<view class="bg-white ">
<!-- <view style="text-align: left;font-weight: bold">播放测试:</view> -->
<!-- <view style="text-align: left;font-weight: bold">播放测试:</view> -->
<view class="Ncu-bar bg-white flex">
<button bindtap="GetshowinfoClick" class="cu-btn round1 ulg margin-5" style="font-weight: bold;">播放欢迎词</button>
<!-- <view style="text-align: left;font-weight: bold" class=" margin-xs radius ">音量:</view> -->
<slider style="width:50%;" min="30" max="100" step="1" value="{{VolumeLevel}}" bindchange="changeVolumeLevel" ></slider>
<view>{{VolumeLevel}}</view>
</view>
<view class="ControlLine"></view>
</view>
<view class="bg-white " wx:for="{{roomtypeInfoNodeinfo}}" wx:for-item="row" wx:for-index="rowIndex">
<view class=" bg-white " wx:if="{{row[0]===1}}" >
<!-- <view style="text-align: left;font-weight: bold">设置设备开关状态:</view> -->
<view class="Ncu-bar bg-white flex-sub" wx:for="{{row[1].length/4 }}" wx:for-index="colIndex" >
<view class="Ncu-bar bg-white" wx:if="{{colIndex*4<row[1].length}}">
<button id="1" class="cu-btn round1 margin-3 vlg" data-value="1" data-index="{{row[1][colIndex*4][0]}}" bindtap="SetDeviceSwitchStatus" wx:if="{{colIndex*4<row[1].length}}" style="background-color: {{row[1][colIndex*4][2][0][2]===0 ? '#E6E6E6 ':'#39b54a'}};" >{{row[1][colIndex*4][1] }}</button>
<button id="1" class="cu-btn round1 margin-3 vlg" data-value="1" data-index="{{row[1][colIndex*4+1][0]}}" bindtap="SetDeviceSwitchStatus" wx:if="{{colIndex*4+1<row[1].length}}" style="background-color: {{row[1][colIndex*4+1][2][0][2]===0 ? '#E6E6E6':'#39b54a'}};">{{row[1][colIndex*4+1][1] }}</button>
<button id="1" class="cu-btn round1 margin-3 vlg" data-value="1" data-index="{{row[1][colIndex*4+2][0]}}" bindtap="SetDeviceSwitchStatus" wx:if="{{colIndex*4+2<row[1].length}}" style="background-color: {{row[1][colIndex*4+2][2][0][2]===0 ? '#E6E6E6':'#39b54a'}};">{{row[1][colIndex*4+2][1] }}</button>
<button id="1" class="cu-btn round1 margin-3 vlg" data-value="1" data-index="{{row[1][colIndex*4+3][0]}}" bindtap="SetDeviceSwitchStatus" wx:if="{{colIndex*4+3<row[1].length}}" style="background-color: {{row[1][colIndex*4+3][2][0][2]===0 ? '#E6E6E6':'#39b54a'}};">{{row[1][colIndex*4+3][1] }}</button>
<!-- <button class="cu-btn round margin-3 nlg" data-index="{{row[1][colIndex*5+4][0]}}" bindtap="SetDeviceSwitchStatus" wx:if="{{colIndex*4+4<row[1].length}}">{{row[1][colIndex*4+4][1] }}</button> -->
<!-- <button class="cu-btn round margin-3 nlg" data-index="{{row[1][colIndex*6+5][0]}}" bindtap="SetDeviceSwitchStatus" wx:if="{{colIndex*6+5<row[1].length}}">{{row[1][colIndex*6+5][1] }}</button> -->
</view>
</view>
<view class="ControlLine"></view>
</view>
<view class="bg-white" wx:if="{{row[0]===23}}">
<!-- <view style="text-align: left;font-weight: bold">设置调光亮度:</view> -->
<view class="bg-white" wx:for="{{row[1].length}}" wx:for-index="DimIndex" >
<view class="Ncu-bar bg-white">
<view class="flex-twice">{{row[1][DimIndex][1]}}</view>
<slider id="23" data-index="{{row[1][DimIndex][0]}}" class="flex-eight" min="10" max="90" step="1" value="{{row[1][DimIndex][2][0][2]}}" bindchange="SetDeviceSwitchStatusslider" ></slider>
<view class="flex-sub">{{row[1][DimIndex][2][0][2]}}</view>
</view>
</view>
<view class="ControlLine"></view>
</view>
<view class="bg-white" wx:if="{{row[0]===52}}">
<!-- <view style="text-align: left;font-weight: bold">色温控制:</view> -->
<view class="Ncu-bar bg-white">
<view class="action margin-0 flex-twice text-green " >开关</view>
<view class="action margin-0 flex-xis text-green solid-left" >色温</view>
<view class="action margin-0 flex-xis text-green solid-left" >亮度</view>
</view>
<view class=" bg-white" wx:for="{{row[1].length}}" wx:for-index="coloIndex" >
<view class="Ncu-bar bg-white">
<view class=" flex-twice margin-3 " >
<button id="52" data-type="1" data-value="1" data-index="{{row[1][coloIndex][0]}}" class="cu-btn round1 Elg" bindtap="SetDeviceSwitchStatus" style="background-color: {{row[1][coloIndex][2][0][2]===0 ? '#E6E6E6 ':'#39b54a'}};" >{{row[1][coloIndex][1]}}</button>
</view>
<view class=" flex-xis Ncubar1 solid-left " >
<button id="52" data-type="2" data-value="20" data-index="{{row[1][coloIndex][0]}}" class="margin-3 cu-btn round1 EElg" bindtap="SetDeviceSwitchStatus" style="background-color: {{row[1][coloIndex][2][1][2]===20 ? '#39b54a':'#E6E6E6 '}};">20</button>
<button id="52" data-type="2" data-value="50" data-index="{{row[1][coloIndex][0]}}" class="margin-3 cu-btn round1 EElg" bindtap="SetDeviceSwitchStatus" style="background-color: {{row[1][coloIndex][2][1][2]===50 ? '#39b54a':'#E6E6E6 '}};">50</button>
<button id="52" data-type="2" data-value="80" data-index="{{row[1][coloIndex][0]}}" class="margin-3 cu-btn round1 EElg" bindtap="SetDeviceSwitchStatus" style="background-color: {{row[1][coloIndex][2][1][2]===80 ? '#39b54a':'#E6E6E6 '}};">80</button>
</view>
<view class="ControlLine_h"></view>
<view class=" flex-xis Ncubar1 " >
<button id="52" data-type="3" data-value="20" data-index="{{row[1][coloIndex][0]}}" class="margin-3 cu-btn round1 EElg" bindtap="SetDeviceSwitchStatus" style="background-color: {{row[1][coloIndex][2][2][2]===20 ? '#39b54a':'#E6E6E6 '}};">20</button>
<button id="52" data-type="3" data-value="50" data-index="{{row[1][coloIndex][0]}}" class="margin-3 cu-btn round1 EElg" bindtap="SetDeviceSwitchStatus" style="background-color: {{row[1][coloIndex][2][2][2]===50 ? '#39b54a':'#E6E6E6 '}};">50</button>
<button id="52" data-type="3" data-value="80" data-index="{{row[1][coloIndex][0]}}" class="margin-3 cu-btn round1 EElg" bindtap="SetDeviceSwitchStatus" style="background-color: {{row[1][coloIndex][2][2][2]===80 ? '#39b54a':'#E6E6E6 '}};">80</button>
</view>
</view>
<!-- <view class="Ncubar1 bg-white" style="text-align: left;">
<view class="flex-twice">
<view style="text-align: left;font-weight: bold">{{row[1][coloIndex][1]}}:</view>
</view>
<view class="flex-8">
<switch class="Green" data-index="{{item}}" bindchange="Loopswitch"></switch>
</view>
</view> -->
<!-- <view class="Ncu-bar bg-white flex-eight">
<button class="cu-btn round vlg">亮度20</button>
<button class="cu-btn round vlg">亮度80</button>
<button class="cu-btn round vlg">色温20</button>
<button class="cu-btn round vlg">色温80</button>
</view> -->
</view>
<view class="ControlLine"></view>
</view>
<view class="bg-white" wx:if="{{row[0]===5}}">
<!-- <view style="text-align: left;font-weight: bold">设置设备开停关状态:</view> -->
<view class="bg-white" wx:for="{{row[1].length}}" wx:for-index="coloIndex">
<view class="Ncu-bar bg-white">
<view class="flex-treble" style="font-weight: bold">{{row[1][coloIndex][1]}}</view>
<view class="Ncubar1 bg-white flex-eight">
<button id="5" data-value="1" class="margin-3 cu-btn round1 clg" style="background-color:{{row[1][coloIndex][2][0][2]===1 ? '#39b54a':'#E6E6E6'}};" data-index="{{row[1][coloIndex][0]}}" bindtap="SetDeviceSwitchStatus" >开</button>
<button id="5" data-value="2" class="margin-3 cu-btn round1 clg" style="background-color:{{row[1][coloIndex][2][0][2]===2 ? '#39b54a':'#E6E6E6'}};" data-index="{{row[1][coloIndex][0]}}" bindtap="SetDeviceSwitchStatus" >关</button>
<button id="5" data-value="6" class="margin-3 cu-btn round1 clg" style="background-color:{{row[1][coloIndex][2][0][2]===6 ? '#39b54a':'#E6E6E6'}};" data-index="{{row[1][coloIndex][0]}}" bindtap="SetDeviceSwitchStatus">停</button>
</view>
</view>
<view class="ControlLine"></view>
</view>
<view class="ControlLine"></view>
</view>
<view class="bg-white" wx:if="{{row[0]===7}}">
<!-- <view style="text-align: left;font-weight: bold">设置温控设备状态:</view> -->
<view class=" bg-white" wx:for="{{row[1].length}}" wx:for-index="coloIndex">
<view class="Ncu-bar bg-white">
<view class=" flex-twice margin-xs " >
<!-- <button class="cu-btn round1 Elg">{{row[1][coloIndex][1]}}</button> -->
<button id="7" data-type="1" data-value="1" data-index="{{row[1][coloIndex][0]}}" class="cu-btn round1 Elg" bindtap="SetDeviceSwitchStatus" style="background-color: {{row[1][coloIndex][2][0][2]===0 ? '#E6E6E6 ':'#39b54a'}};" >{{row[1][coloIndex][1]}}</button>
</view>
<view class=" flex-8 Ncubar1 solid-left " >
<button id="7" data-type="2" data-value="1" data-index="{{row[1][coloIndex][0]}}" class=" cu-btn round1 clg margin-3" bindtap="SetDeviceSwitchStatus" style="background-color: {{row[1][coloIndex][2][1][2]===4 ? '#E6E6E6 ':row[1][coloIndex][2][1][2]===3 ? '#1cbbb4':row[1][coloIndex][2][1][2]===2 ? '#e54d42':'#0081ff'}};" >{{row[1][coloIndex][2][1][2]===4 ? '自动':row[1][coloIndex][2][1][2]===3 ? '送风':row[1][coloIndex][2][1][2]===2 ? '制热':'制冷'}}</button>
<button id="7" data-type="3" data-value="1" data-index="{{row[1][coloIndex][0]}}" class=" cu-btn round1 clg margin-3" bindtap="SetDeviceSwitchStatus" >{{row[1][coloIndex][2][2][2]===4 ? '自动':row[1][coloIndex][2][2][2]===3 ? '高风速':row[1][coloIndex][2][2][2]===2 ? '中风速':'低风速'}}</button>
<button id="7" data-type="4" data-value="1" data-index="{{row[1][coloIndex][0]}}" bindtap="SetDeviceSwitchStatus" class=" cu-btn round1 vvlg margin-3">-</button>
<text class=" textvlg">{{row[1][coloIndex][2][3][2]}}</text>
<button id="7" data-type="5" data-value="1" data-index="{{row[1][coloIndex][0]}}" bindtap="SetDeviceSwitchStatus" class=" cu-btn round1 vvlg margin-3">+</button>
</view>
</view>
<!-- <view class="Ncubar1 bg-white" style="text-align: left;">
<view class="flex-twice">
<view style="text-align: left;font-weight: bold">{{row[1][coloIndex][1]}}:</view>
</view>
<view class="flex-8">
<switch class="Green" data-index="{{item}}" bindchange="Loopswitch"></switch>
</view>
</view>
<view class=" bg-white flex-eight">
<view class="Ncu-bar bg-white flex-eight">
<button class=" cu-btn round1 vlg margin-3">制冷</button>
<button class=" cu-btn round1 vlg margin-3">制热</button>
<button class=" cu-btn round1 vlg margin-3">20度</button>
<button class=" cu-btn round1 vlg margin-3">30度</button>
</view>
<view class="Ncu-bar bg-white flex-eight">
<button class="cu-btn round1 vlg margin-3">风速高</button>
<button class="cu-btn round1 vlg margin-3">风速中</button>
<button class="cu-btn round1 vlg margin-3">风速低</button>
<button class="cu-btn round1 vlg margin-3">自动</button>
</view>
</view> -->
<view class="ControlLine"></view>
</view>
<view class="ControlLine"></view>
</view>
</view>
</view>
<view wx:else>
</view>
</scroll-view>

View File

@@ -0,0 +1,25 @@
.cubarN {
display: flex;
position: relative;
align-items: center;
min-height: 50rpx ;
justify-content: space-between;
}
.setborder
{
border: 1rpx solid #999;
}
.Ncu-bar {
display: flex;
position: relative;
align-items: center;
min-height: 70rpx ;
justify-content: space-between;
}
.Ncu-bar1 {
display: flex;
position: relative;
align-items: center;
min-height: 70rpx ;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,9 @@
{
"usingComponents": {
"loscom": "/components/logscom/logscom",
"HostUpgrade":"/pages/HostUpgrade/HostUpgrade",
"Upgrade":"/pages/Upgrade/Upgrade"
}
}

View File

@@ -0,0 +1,668 @@
<!-- pages/Hosts/Hosts.wxml{{isback}} -->
<cu-custom bgColor="bg-gradual-blue"
isBack="true">
<block bindtap="back" slot="backText" >返回</block>
<view slot="content">{{Hotelinfo.HotelName}}({{Hotelinfo.Code}})</view>
</cu-custom>
<view class="padding-sm bg-white radius shadow shadow-lg" style="padding-bottom:0;">
<!-- 头部区域 -->
<view>
<!-- 酒店信息 {{Hotelinfo.HotelId}}-->
<!-- <view class="margin-xs basis-xl">{{Hotelinfo.Code}}<span class="padding-left-xs">{{Hotelinfo.HotelName}}</span></view> -->
<!-- <view class="flex justify-end basis-xs">
<view class="text-green" bindtap="HelpClick">{{Help?'关闭':'帮助'}}</view>
</view> -->
<!---->
<!-- 导航栏 -->
<view class="flex flex-wrap">
<!-- 分类显示 -->
<view class="basis-xxxl ">
<button style="margin-right: 2px;" data-index="0" bindtap="GetshowinfoClick" class="cu-btn bg-{{showinfo==0?'green':'grey'}} ">全部</button>
<button style="margin-right: 2px;" data-index="1" bindtap="GetshowinfoClick" class="cu-btn bg-{{showinfo==1?'green':'grey'}} ">主机绑定</button>
<button style="margin-right: 2px;" data-index="2" bindtap="GetshowinfoClick" class="cu-btn bg-{{showinfo==2?'green':'grey'}} ">人脸机</button>
<button style="margin-right: 2px;" data-index="4" bindtap="GetshowinfoClick" class="cu-btn bg-{{showinfo==4?'green':'grey'}} ">主机蓝牙升级</button>
<button style="margin-right: 2px;" data-index="5" bindtap="GetshowinfoClick" class="cu-btn bg-{{showinfo==5?'green':'grey'}} ">主机升级</button>
<button style="margin-right: 2px;" data-index="3" bindtap="GetshowinfoClick1" class="cu-btn bg-{{showinfo==3?'green':'grey'}} ">刷新</button>
</view>
<view>
<view class="text-green" bindtap="HelpClick">{{Help?'关闭':'帮助'}}</view>
</view>
<!-- 标识区域 -->
<!-- <view class="basis-lg">
<view class="flex flex-wrap margin-left-xs">
<view class="basis-df flex">
<view style="width:0rpx;height:0rpx;margin-top:12rpx;" class="padding-xs bg-green"></view>
<text class="text-black text-df margin-left-xs margin-right-xs">绑定成功<text class="margin-left-xs"></text>{{statusdata[0]}}</text>
</view>
<view class="basis-df flex">
<view style="width:0rpx;height:0rpx;margin-top:12rpx;" class="padding-xs bg-red"></view>
<text class="text-black text-df margin-left-xs margin-right-xs">绑定失败<text class="margin-left-xs"></text>{{statusdata[1]}}</text>
</view>
<view class="basis-df flex">
<view style="width:0rpx;height:0rpx;margin-top:12rpx;" class="padding-xs bg-yellow"></view>
<text class="text-black text-df margin-left-xs margin-right-xs">解除绑定<text class="margin-left-xs"></text>{{statusdata[2]}}</text>
</view>
<view class="basis-df flex">
<view style="width:0rpx;height:0rpx;margin-top:12rpx;" class="padding-xs bg-grey"></view>
<text class="text-black text-df margin-left-xs margin-right-xs">未操作<text class="margin-left-xs"></text>{{statusdata[3]}}</text>
</view>
</view>
</view> -->
<!-- 按钮区域 -->
<!-- <view class="basis-sm flex flex-wrap">
<view class="flex flex-wrap text-center ">
<view class="basis-df" bindtap="islogsClick">
<view class=" radius bg-red">
<text class=" text-df text-white" >{{islogs?'退出':'操作记录'}}<text class="text-lg"></text></text>
</view>
</view>
<view class="basis-df">
<view data-index="0" bindtap="GetClick" class=" margin-left-xs radius bg-{{sel==0?'green':'grey'}} ">
<text class=" text-df text-white">全部<text class="margin-left-xs text-lg">{{HostsData.length}}</text></text>
</view>
</view>
<view class="basis-df">
<view data-index="2" bindtap="GetClick" class="margin-top-xs radius bg-{{sel==2?'green':'grey'}} ">
<text class=" text-df text-white">未绑<text class="margin-left-xs text-lg">{{NMac}}</text></text>
</view>
</view>
<view class="basis-df ">
<view data-index="1" bindtap="GetClick" class=" margin-top-xs margin-left-xs radius bg-{{sel==1?'green':'grey'}} ">
<text class="text-df text-white">已绑<text class="margin-left-xs text-lg">{{YMac}}</text></text>
</view>
</view>
</view>
</view> -->
</view>
<view class="bg-gray margin-xs" style="padding:2rpx"></view>
</view>
<!-- 房间显示区域 -->
<scroll-view id="scroll" wx:if="{{!Help && !islogs && showinfo!=4&& showinfo!=5}}" style="height:{{top_height==null?'600rpx':top_height+'px'}} ;padding-bottom:10rpx" scroll-y="true">
<view class="grid col-4 text-center" wx:if="{{showinfo<4}}">
<view wx:for="{{HostsDataFilters}}">
<view class="padding-xs">
<view style="font:bold;white-space: nowrap;overflow: hidden;" class="text-df {{item.xg!=null?(item.xg==0?'bg-green':(item.xg==1?'bg-red':'bg-yellow')):'bg-grey'}}">
{{item.RoomNumber}}
</view>
<view class="light bg-grey " style="height:{{showinfo==0?'170rpx':showinfo==3?'170rpx':'85rpx'}}">
<!-- rcu主机 -->
<view wx:if="{{showinfo!=2}}" bindtouchstart="handleTouchStart"
bindtouchend="handleTouchEnd"
data-index="{{index}}" bindlongtap="GetMAC_long" bindtap="GetMAC">
<block wx:if="{{item.MAC.length==17}}">
<view class="text-sm">M:{{item.MAC[0]}}{{item.MAC[1]}}{{item.MAC[2]}}{{item.MAC[3]}}{{item.MAC[4]}}{{item.MAC[5]}}{{item.MAC[6]}}{{item.MAC[7]}}{{item.MAC[8]}}
</view>
<view class="text-df">{{item.MAC[9]}}{{item.MAC[10]}}{{item.MAC[11]}}{{item.MAC[12]}}{{item.MAC[13]}}{{item.MAC[14]}}{{item.MAC[15]}}{{item.MAC[16]}}
</view>
</block>
<block wx:if="{{item.MAC.length<17 || !item.MAC || item.MAC.length==0}}" >
<!-- 两个 view 是因为 mac 是两行 -->
<view class="text-sm light" >
<!-- xiaoxi --> RCU
</view> <!-- style="opacity:0" -->
<view class="text-sm light" style="color: #e7ebee;">
<!-- xiaoxi -->绑定
</view>
</block>
</view>
<view class=" bg-white" style="height: 2rpx;" wx:if="{{showinfo==0}}"></view>
<!-- 人脸机 -->
<view wx:if="{{showinfo!=1 }}" bindtouchstart="handleTouchStart"
bindtouchend="handleTouchEnd"
data-index="{{index}}" bindlongtap="GetFaceSN_long" bindtap="GetFaceSN">
<block wx:if="{{item.FaceStatus==true}}">
<block wx:if="{{item.FaceSN.length>0}}">
<view style="color: #17852d;" class="text-df">s:{{item.FaceSN[0]}}{{item.FaceSN[1]}}{{item.FaceSN[2]}}{{item.FaceSN[3]}}{{item.FaceSN[4]}}{{item.FaceSN[5]}}{{item.FaceSN[6]}}{{item.FaceSN[7]}}
</view>
<view style="color: #17852d;" class="text-df">{{item.FaceSN[8]}}{{item.FaceSN[9]}}{{item.FaceSN[10]}}{{item.FaceSN[11]}}{{item.FaceSN[12]}}{{item.FaceSN[13]}}{{item.FaceSN[14]}}{{item.FaceSN[15]}}
</view>
</block>
<!-- <block wx:if="{{item.FaceSN.length==0}}">
style="opacity:0"
<view class="text-sm light">
xiaoxi
</view>
class="text-df light" style="opacity:0"
<view class="text-sm light">
xiaoxi
</view>
</block> -->
</block>
<block wx:else="{{item.FaceStatus==false}}">
<block wx:if="{{item.FaceSN.length>0}}">
<view style="color: #d11515;" class="text-df">s:{{item.FaceSN[0]}}{{item.FaceSN[1]}}{{item.FaceSN[2]}}{{item.FaceSN[3]}}{{item.FaceSN[4]}}{{item.FaceSN[5]}}{{item.FaceSN[6]}}{{item.FaceSN[7]}}
</view>
<view style="color:#d11515;" class="text-df">{{item.FaceSN[8]}}{{item.FaceSN[9]}}{{item.FaceSN[10]}}{{item.FaceSN[11]}}{{item.FaceSN[12]}}{{item.FaceSN[13]}}{{item.FaceSN[14]}}{{item.FaceSN[15]}}
</view>
</block>
<block wx:if="{{item.FaceSN.length==0}}">
<!-- class="text-sm light" style="opacity:0" -->
<view class="text-sm light">
<!-- xiaoxi -->人脸机
</view>
<!-- class="text-df light" style="opacity:0" -->
<view class="text-sm light" style="color: #e7ebed;">
绑定
</view>
</block>
</block>
</view>
</view>
</view>
</view>
<view wx:if="{{HostsDataFilters.length<=0}}">
暂无数据~
</view>
</view>
</scroll-view>
<HostUpgrade wx:if="{{showinfo==4}}" paramA="{{showinfo}}" myProperty="{{roomtype}}" nheight="{{top_height==null?'600':top_height}}" style="height:{{top_height==null?'600rpx':top_height+'rpx'}} ;padding-bottom:10rpx"></HostUpgrade>
<Upgrade wx:if="{{showinfo==5}}" style="height:{{top_height==null?'600rpx':top_height+'px'}} ;padding-top:10rpx;"></Upgrade>
<!-- 帮助区域 -->
<view wx:if="{{Help}}" class="padding-xs">
<view class="cu-card article">
<view class="cu-item shadow " style="margin:0;padding-bottom:0;">
<view class="title" style="line-height:initial;"><view class="text-cut">颜色指示块</view></view>
<view class="content">
<view class="desc">
<view class="text-content text-df">
指示块,仅针对本次进入页面有效,不代表历史操作记录,刷新或者重新进入页面都会执行重置操作。
</view>
</view>
</view>
</view>
</view>
<view class="cu-card article">
<view class="cu-item shadow " style="margin:0;padding-bottom:0;">
<view class="title" style="line-height:initial;"><view class="text-cut">MAC绑定操作</view></view>
<view class="content">
<view class="desc">
<view class="text-content text-df" style="height: auto;">
<view class="text-df text-green">点击</view>
点击房间如果已经绑定MAC会弹出提示语句点击继续继续执行扫码绑定扫码后,会有普通的MAC矫正如果MAC已经被绑定会再次弹出提示语句
如果MAC绑定的酒店有权限就会有提示语句然后可以点击继续执行绑定这将解除原有绑定绑定当前MAC;如果MAC绑定的酒店没有权限就仅有提示语而没有继续绑定按钮。
<view class="text-df text-green">长按</view>
长按会执行手动输入MAC后续与点击扫码绑定一致~
</view>
</view>
</view>
</view>
</view>
</view>
<!-- 操作日志 -->
<view wx:if="{{islogs}}" >
<loscom hotelsid="{{Hotelinfo.HotelId}}"></loscom>
</view>
</view>
<!-- 房间已经绑定弹窗提示 -->
<view class="cu-modal {{modal==1?'show':''}}">
<view class="cu-Ndialog">
<view class="cu-bar bg-white ">
<view>
<view class="action " bindtap="GetReturnSet" wx:if="{{ISLoopDebugging>0}}">
<text class="cuIcon-back"></text>
</view>
</view>
<view>
<view class="content text-{{selHosts.Status == 1 ? 'green':'red'}}}" >{{selHosts.RoomNumber}}已经绑定MAC({{selHosts.Status == 1 ? '在线':'离线'}})</view>
</view>
<view class="justify-end">
<view class="action justify-end" bindtap="GetHide" >
<text class="cuIcon-close text-red"></text>
</view>
</view>
</view>
<view wx:if="{{ISLoopDebugging===0}}">
<view class="padding-lg flex flex-wrap " >
<view class="basis-sm text-right">酒店:</view><view class="text-left basis-lg">{{Hotelinfo.HotelName}}</view>
<view class="basis-sm text-right">房间:</view><view class="basis-lg text-left">{{message[1]}}</view>
<view class="basis-sm text-right">MAC地址</view><view class="basis-lg text-left">{{message[0]}}</view>
<view class="basis-sm text-right">当前固件:</view><view class="basis-lg text-left">{{roomGfilename}}</view>
<view class="basis-sm text-right">当前配置:</view><view class="basis-lg text-left">{{roomPfilename}}</view>
<view class=" text-left flex-sub text-sm text-gray">房间已经绑定MAC点击继续将执行扫描绑定点击取消将不会执行任何操作~</view>
</view>
<view class=" bg-white">
<view class="Ncu-bar bg-white">
<view class="action margin-0 flex-sub text-green " data-type="0" bindtap="ConfigurationUpgrade">固件升级</view>
<view class="action margin-0 flex-sub text-green solid-left" bindtap="FirmwareUpgrade" >配置升级</view>
<view class="action margin-0 flex-sub solid-left" bindtap="LoopDebugging" >回路调试</view>
</view>
<view class="Ncu-bar bg-white">
<view class="action margin-0 flex-sub text-green " data-type="0" bindtap="ErrorInfo">反馈错误</view>
<view class="action margin-0 flex-sub text-green solid-left" bindtap="GetHide" >取消</view>
<view class="action margin-0 flex-sub solid-left" bindtap="{{input == 0?'GetCode':'ShowInput'}}" >继续</view>
</view>
</view>
</view>
<view wx:if="{{ISLoopDebugging===1}}" style="height:95%" class="bg-white" >
<scroll-view style="height:90%" id="LoopDebugging" scroll-y="true" scroll-top="true">
<view class="bg-white ">
<!-- <view style="text-align: left;font-weight: bold">播放测试:</view> -->
<!-- <view style="text-align: left;font-weight: bold">播放测试:</view> -->
<view class="Ncu-bar bg-white">
<button bindtap="GetshowinfoClick" class="cu-btn round1 ulg margin-5" style="font-weight: bold;">播放欢迎词</button>
<!-- <view style="text-align: left;font-weight: bold" class=" margin-xs radius ">音量:</view> -->
<slider style="width:50%;" min="30" max="100" step="1" value="{{VolumeLevel}}" bindchange="changeVolumeLevel" ></slider>
<view>{{VolumeLevel}}</view>
</view>
<view class="ControlLine"></view>
</view>
<view class="bg-white " wx:for="{{roomtypeInfoNodeinfo}}" wx:for-item="row" wx:for-index="rowIndex">
<view class=" bg-white " wx:if="{{row[0]===1}}" >
<!-- <view style="text-align: left;font-weight: bold">设置设备开关状态:</view> -->
<view class="Ncu-bar bg-white flex-sub" wx:for="{{row[1].length/4 }}" wx:for-index="colIndex" >
<view class="Ncu-bar bg-white" wx:if="{{colIndex*4<row[1].length}}">
<button id="1" class="cu-btn round1 margin-3 vlg" data-value="1" data-index="{{row[1][colIndex*4][0]}}" bindtap="SetDeviceSwitchStatus" wx:if="{{colIndex*4<row[1].length}}" style="background-color: {{row[1][colIndex*4][2][0][2]===0 ? '#E6E6E6 ':'#39b54a'}};" >{{row[1][colIndex*4][1] }}</button>
<button id="1" class="cu-btn round1 margin-3 vlg" data-value="1" data-index="{{row[1][colIndex*4+1][0]}}" bindtap="SetDeviceSwitchStatus" wx:if="{{colIndex*4+1<row[1].length}}" style="background-color: {{row[1][colIndex*4+1][2][0][2]===0 ? '#E6E6E6':'#39b54a'}};">{{row[1][colIndex*4+1][1] }}</button>
<button id="1" class="cu-btn round1 margin-3 vlg" data-value="1" data-index="{{row[1][colIndex*4+2][0]}}" bindtap="SetDeviceSwitchStatus" wx:if="{{colIndex*4+2<row[1].length}}" style="background-color: {{row[1][colIndex*4+2][2][0][2]===0 ? '#E6E6E6':'#39b54a'}};">{{row[1][colIndex*4+2][1] }}</button>
<button id="1" class="cu-btn round1 margin-3 vlg" data-value="1" data-index="{{row[1][colIndex*4+3][0]}}" bindtap="SetDeviceSwitchStatus" wx:if="{{colIndex*4+3<row[1].length}}" style="background-color: {{row[1][colIndex*4+3][2][0][2]===0 ? '#E6E6E6':'#39b54a'}};">{{row[1][colIndex*4+3][1] }}</button>
<!-- <button class="cu-btn round margin-3 nlg" data-index="{{row[1][colIndex*5+4][0]}}" bindtap="SetDeviceSwitchStatus" wx:if="{{colIndex*4+4<row[1].length}}">{{row[1][colIndex*4+4][1] }}</button> -->
<!-- <button class="cu-btn round margin-3 nlg" data-index="{{row[1][colIndex*6+5][0]}}" bindtap="SetDeviceSwitchStatus" wx:if="{{colIndex*6+5<row[1].length}}">{{row[1][colIndex*6+5][1] }}</button> -->
</view>
</view>
<view class="ControlLine"></view>
</view>
<view class="bg-white" wx:if="{{row[0]===23}}">
<!-- <view style="text-align: left;font-weight: bold">设置调光亮度:</view> -->
<view class="bg-white" wx:for="{{row[1].length}}" wx:for-index="DimIndex" >
<view class="Ncu-bar bg-white">
<view class="flex-twice">{{row[1][DimIndex][1]}}</view>
<slider id="23" data-index="{{row[1][DimIndex][0]}}" class="flex-eight" min="10" max="90" step="1" value="{{row[1][DimIndex][2][0][2]}}" bindchange="SetDeviceSwitchStatusslider" ></slider>
<view class="flex-sub">{{row[1][DimIndex][2][0][2]}}</view>
</view>
</view>
<view class="ControlLine"></view>
</view>
<view class="bg-white" wx:if="{{row[0]===52}}">
<!-- <view style="text-align: left;font-weight: bold">色温控制:</view> -->
<view class="Ncu-bar bg-white">
<view class="action margin-0 flex-twice text-green " >开关</view>
<view class="action margin-0 flex-xis text-green solid-left" >色温</view>
<view class="action margin-0 flex-xis text-green solid-left" >亮度</view>
</view>
<view class=" bg-white" wx:for="{{row[1].length}}" wx:for-index="coloIndex" >
<view class="Ncu-bar bg-white">
<view class=" flex-twice margin-3 " >
<button id="52" data-type="1" data-value="1" data-index="{{row[1][coloIndex][0]}}" class="cu-btn round1 Elg" bindtap="SetDeviceSwitchStatus" style="background-color: {{row[1][coloIndex][2][0][2]===0 ? '#E6E6E6 ':'#39b54a'}};" >{{row[1][coloIndex][1]}}</button>
</view>
<view class=" flex-xis Ncubar1 solid-left " >
<button id="52" data-type="2" data-value="20" data-index="{{row[1][coloIndex][0]}}" class="margin-3 cu-btn round1 EElg" bindtap="SetDeviceSwitchStatus" style="background-color: {{row[1][coloIndex][2][1][2]===20 ? '#39b54a':'#E6E6E6 '}};">20</button>
<button id="52" data-type="2" data-value="50" data-index="{{row[1][coloIndex][0]}}" class="margin-3 cu-btn round1 EElg" bindtap="SetDeviceSwitchStatus" style="background-color: {{row[1][coloIndex][2][1][2]===50 ? '#39b54a':'#E6E6E6 '}};">50</button>
<button id="52" data-type="2" data-value="80" data-index="{{row[1][coloIndex][0]}}" class="margin-3 cu-btn round1 EElg" bindtap="SetDeviceSwitchStatus" style="background-color: {{row[1][coloIndex][2][1][2]===80 ? '#39b54a':'#E6E6E6 '}};">80</button>
</view>
<view class="ControlLine_h"></view>
<view class=" flex-xis Ncubar1 " >
<button id="52" data-type="3" data-value="20" data-index="{{row[1][coloIndex][0]}}" class="margin-3 cu-btn round1 EElg" bindtap="SetDeviceSwitchStatus" style="background-color: {{row[1][coloIndex][2][2][2]===20 ? '#39b54a':'#E6E6E6 '}};">20</button>
<button id="52" data-type="3" data-value="50" data-index="{{row[1][coloIndex][0]}}" class="margin-3 cu-btn round1 EElg" bindtap="SetDeviceSwitchStatus" style="background-color: {{row[1][coloIndex][2][2][2]===50 ? '#39b54a':'#E6E6E6 '}};">50</button>
<button id="52" data-type="3" data-value="80" data-index="{{row[1][coloIndex][0]}}" class="margin-3 cu-btn round1 EElg" bindtap="SetDeviceSwitchStatus" style="background-color: {{row[1][coloIndex][2][2][2]===80 ? '#39b54a':'#E6E6E6 '}};">80</button>
</view>
</view>
<!-- <view class="Ncubar1 bg-white" style="text-align: left;">
<view class="flex-twice">
<view style="text-align: left;font-weight: bold">{{row[1][coloIndex][1]}}:</view>
</view>
<view class="flex-8">
<switch class="Green" data-index="{{item}}" bindchange="Loopswitch"></switch>
</view>
</view> -->
<!-- <view class="Ncu-bar bg-white flex-eight">
<button class="cu-btn round vlg">亮度20</button>
<button class="cu-btn round vlg">亮度80</button>
<button class="cu-btn round vlg">色温20</button>
<button class="cu-btn round vlg">色温80</button>
</view> -->
</view>
<view class="ControlLine"></view>
</view>
<view class="bg-white" wx:if="{{row[0]===5}}">
<!-- <view style="text-align: left;font-weight: bold">设置设备开停关状态:</view> -->
<view class="bg-white" wx:for="{{row[1].length}}" wx:for-index="coloIndex">
<view class="Ncu-bar bg-white">
<view class="flex-treble" style="font-weight: bold">{{row[1][coloIndex][1]}}</view>
<view class="Ncubar1 bg-white flex-eight">
<button id="5" data-value="1" class="margin-3 cu-btn round1 clg" style="background-color:{{row[1][coloIndex][2][0][2]===1 ? '#39b54a':'#E6E6E6'}};" data-index="{{row[1][coloIndex][0]}}" bindtap="SetDeviceSwitchStatus" >开</button>
<button id="5" data-value="2" class="margin-3 cu-btn round1 clg" style="background-color:{{row[1][coloIndex][2][0][2]===2 ? '#39b54a':'#E6E6E6'}};" data-index="{{row[1][coloIndex][0]}}" bindtap="SetDeviceSwitchStatus" >关</button>
<button id="5" data-value="6" class="margin-3 cu-btn round1 clg" style="background-color:{{row[1][coloIndex][2][0][2]===6 ? '#39b54a':'#E6E6E6'}};" data-index="{{row[1][coloIndex][0]}}" bindtap="SetDeviceSwitchStatus">停</button>
</view>
</view>
<view class="ControlLine"></view>
</view>
<view class="ControlLine"></view>
</view>
<view class="bg-white" wx:if="{{row[0]===7}}">
<!-- <view style="text-align: left;font-weight: bold">设置温控设备状态:</view> -->
<view class=" bg-white" wx:for="{{row[1].length}}" wx:for-index="coloIndex">
<view class="Ncu-bar bg-white">
<view class=" flex-twice margin-xs " >
<!-- <button class="cu-btn round1 Elg">{{row[1][coloIndex][1]}}</button> -->
<button id="7" data-type="1" data-value="1" data-index="{{row[1][coloIndex][0]}}" class="cu-btn round1 Elg" bindtap="SetDeviceSwitchStatus" style="background-color: {{row[1][coloIndex][2][0][2]===0 ? '#E6E6E6 ':'#39b54a'}};" >{{row[1][coloIndex][1]}}</button>
</view>
<view class=" flex-8 Ncubar1 solid-left " >
<button id="7" data-type="2" data-value="1" data-index="{{row[1][coloIndex][0]}}" class=" cu-btn round1 clg margin-3" bindtap="SetDeviceSwitchStatus" style="background-color: {{row[1][coloIndex][2][1][2]===4 ? '#E6E6E6 ':row[1][coloIndex][2][1][2]===3 ? '#1cbbb4':row[1][coloIndex][2][1][2]===2 ? '#e54d42':'#0081ff'}};" >{{row[1][coloIndex][2][1][2]===4 ? '自动':row[1][coloIndex][2][1][2]===3 ? '送风':row[1][coloIndex][2][1][2]===2 ? '制热':'制冷'}}</button>
<button id="7" data-type="3" data-value="1" data-index="{{row[1][coloIndex][0]}}" class=" cu-btn round1 clg margin-3" bindtap="SetDeviceSwitchStatus" >{{row[1][coloIndex][2][2][2]===4 ? '自动':row[1][coloIndex][2][2][2]===3 ? '高风速':row[1][coloIndex][2][2][2]===2 ? '中风速':'低风速'}}</button>
<button id="7" data-type="4" data-value="1" data-index="{{row[1][coloIndex][0]}}" bindtap="SetDeviceSwitchStatus" class=" cu-btn round1 vvlg margin-3">-</button>
<text class=" textvlg">{{row[1][coloIndex][2][3][2]}}</text>
<button id="7" data-type="5" data-value="1" data-index="{{row[1][coloIndex][0]}}" bindtap="SetDeviceSwitchStatus" class=" cu-btn round1 vvlg margin-3">+</button>
</view>
</view>
<!-- <view class="Ncubar1 bg-white" style="text-align: left;">
<view class="flex-twice">
<view style="text-align: left;font-weight: bold">{{row[1][coloIndex][1]}}:</view>
</view>
<view class="flex-8">
<switch class="Green" data-index="{{item}}" bindchange="Loopswitch"></switch>
</view>
</view>
<view class=" bg-white flex-eight">
<view class="Ncu-bar bg-white flex-eight">
<button class=" cu-btn round1 vlg margin-3">制冷</button>
<button class=" cu-btn round1 vlg margin-3">制热</button>
<button class=" cu-btn round1 vlg margin-3">20度</button>
<button class=" cu-btn round1 vlg margin-3">30度</button>
</view>
<view class="Ncu-bar bg-white flex-eight">
<button class="cu-btn round1 vlg margin-3">风速高</button>
<button class="cu-btn round1 vlg margin-3">风速中</button>
<button class="cu-btn round1 vlg margin-3">风速低</button>
<button class="cu-btn round1 vlg margin-3">自动</button>
</view>
</view> -->
<view class="ControlLine"></view>
</view>
<view class="ControlLine"></view>
</view>
</view>
</scroll-view>
</view>
<view wx:if="{{ISLoopDebugging===2}}" class="bg-white" >
<view style="text-align: left;font-weight: bold">设备当前版本:</view>
<view>{{UpgradestIstrue == 0? Upgradenode.Gfilename:Upgradenode.Pfilename}}</view>
<view style="text-align: left;font-weight: bold">准备升级版本:</view>
<view>{{UpgradestIstrue == 0? Upgradenode.App_Cfg_For_L4:Upgradenode.CONFIG_BIN}}</view>
<view class="Ncubar1 bg-white">
<view class=" text-left " wx:if="{{Upgradestatus.length>0}}" >升级状态:</view>
<view class=" text-left " style="font-weight: bold;">{{Upgradestatus}}</view>
</view>
</view>
</view>
</view>
<!-- MAC已经被绑定弹窗提示 -->
<view class="cu-modal {{modal==3 || modal==4?'show':''}}">
<view class="cu-dialog">
<view class="cu-bar bg-white justify-end">
<view class="content">{{code}}已经被绑定</view>
<view class="action" bindtap="GetHide" >
<text class="cuIcon-close text-red"></text>
</view>
</view>
<view class="padding-xs flex flex-wrap justify-center " >
<view class="basis-xl text-sm" wx:for="{{bdHosts}}" >
<text class=" text-right ">酒店:</text><text class="text-left text-red">{{item.HotelName}}</text>
<text class="padding-left-xs text-right " >房间:</text><text class="text-left text-red">{{item.RoomNumber}}</text>
<button class="cu-btn margin-left-xs sm bg-red" wx:if="{{item.qx == 0}}" data-index="{{index}}" type="" bindtap="Jb" >解绑</button>
<button class="cu-btn margin-left-xs sm bg-red" wx:if="{{item.qx != 0}}" disabled >解绑</button>
</view>
<view class="basis-xl">MAC地址<text class="text-left">{{code}}</text></view>
<view class="basis-xl text-left text-sm text-gray">MAC已经被其他房间绑定点击继续将取消原有绑定执行新的绑定点击取消将不会执行任何操作~</view>
</view>
<view class="cu-bar bg-white">
<view class="action margin-0 flex-sub text-green " data-type="1" bindtap="ErrorInfo">反馈错误</view>
<view class="action margin-0 flex-sub text-green solid-left" bindtap="GetHide" >取消</view>
<view wx:if="{{bdHosts.length<=0}}" class="action margin-0 flex-sub solid-left" data-type="false" bindtap="GetMacOKend" >继续</view>
</view>
</view>
</view>
<!-- 手动输入mac地址 -->
<view class="cu-modal {{modal==1000?'show':''}}">
<view class="cu-dialog">
<view class="cu-bar bg-white justify-end">
<view class="content">为{{selHosts.RoomNumber}}绑定MAC</view>
<view class="action" bindtap="GetHide" >
<text class="cuIcon-close text-red"></text>
</view>
</view>
<view class="padding-lg flex flex-wrap " >
<view class="basis-sm text-right">房间:</view><view class="basis-lg text-left">{{selHosts.RoomNumber}}</view>
<view class="basis-sm text-right">MAC地址</view>
<view class="basis-lg text-left">
<input placeholder="手动输入MAC" model:value="{{code}}" name="input"></input>
</view>
</view>
<view class="cu-bar bg-white">
<view class="action margin-0 flex-sub text-green solid-left" bindtap="GetHide" >取消</view>
<view class="action margin-0 flex-sub solid-left" bindtap="GetMACOK" >确认</view>
</view>
</view>
</view>
<!-- 确定绑定 -->
<view class="cu-modal {{modal==521?'show':''}}">
<view class="cu-dialog">
<view class="cu-bar bg-white justify-end">
<view class="content">绑定确认</view>
<view class="action" bindtap="GetHide" >
<text class="cuIcon-close text-red"></text>
</view>
</view>
<view class="padding-lg flex flex-wrap " >
<view class="basis-sm text-right">酒店:</view><view class="text-left basis-lg">{{Hotelinfo.HotelName}}</view>
<view class="basis-sm text-right">房间:</view><view class="basis-lg text-left">{{selHosts.RoomNumber}}</view>
<view class="basis-sm text-right">MAC地址</view><view class="basis-lg text-left">{{code}}</view>
<view class=" text-left flex-sub text-sm text-gray">确定为房间绑定MAC点击继续将执行扫描绑定点击取消将不会执行任何操作~</view>
</view>
<view class="cu-bar bg-white">
<view class="action margin-0 flex-sub text-green solid-left" bindtap="GetHide" >取消</view>
<view class="action margin-0 flex-sub solid-left" data-type="true" bindtap="GetMacOKend" >继续</view>
</view>
</view>
</view>
<!-- 无效条形码 -->
<view class="cu-modal {{modal==520?'show':''}}">
<view class="cu-dialog">
<view class="cu-bar bg-white justify-end">
<view class="content">无效条码</view>
<view class="action" bindtap="GetHide" >
<text class="cuIcon-close text-red"></text>
</view>
</view>
<view class="padding-lg flex flex-wrap " >
<view class="basis-sm text-right">无效条码:</view><view class="basis-lg text-left">{{code}}</view>
<view class=" text-left flex-sub text-sm text-gray">扫描的条码为无效条码~</view>
</view>
<view class="cu-bar bg-white">
<view class="action margin-0 flex-sub text-green solid-left" bindtap="GetHide" >确定</view>
</view>
</view>
</view>
<!-- 确定绑定 -->
<view class="cu-modal {{modal==-521?'show':''}}">
<view class="cu-dialog">
<view class="cu-bar bg-white justify-end">
<view class="content">绑定确认</view>
<view class="action" bindtap="GetHide" >
<text class="cuIcon-close text-red"></text>
</view>
</view>
<view class="padding-lg flex flex-wrap " >
<view class="basis-sm text-right">酒店:</view><view class="text-left basis-lg">{{Hotelinfo.HotelName}}</view>
<view class="basis-sm text-right">房间:</view><view class="basis-lg text-left">{{selHosts.RoomNumber}}</view>
<view class="basis-sm text-right">人脸机SN</view><view class="basis-lg text-left">{{code}}</view>
<view class=" text-left flex-sub text-sm text-gray">确定为房间绑定SN点击继续将执行扫描绑定点击取消将不会执行任何操作~</view>
</view>
<view class="cu-bar bg-white">
<view class="action margin-0 flex-sub text-green solid-left" bindtap="GetHide" >取消</view>
<view class="action margin-0 flex-sub solid-left" data-type="true" bindtap="GetFaceSNend" >继续</view>
</view>
</view>
</view>
<!-- 房间已经绑定人脸机弹窗提示 -->
<view class="cu-modal {{modal==-1?'show':''}}">
<view class="cu-dialog">
<view class="cu-bar bg-white justify-end">
<view class="content">{{selHosts.RoomNumber}}已经绑定人脸机</view>
<view class="action" bindtap="GetHide" >
<text class="cuIcon-close text-red"></text>
</view>
</view>
<view class="padding-lg flex flex-wrap " >
<view class="basis-sm text-right">酒店:</view><view class="text-left basis-lg">{{Hotelinfo.HotelName}}</view>
<view class="basis-sm text-right">房间:</view><view class="basis-lg text-left">{{message[1]}}</view>
<view class="basis-sm text-right">人脸机SN</view><view class="basis-lg text-left">{{message[0]}}</view>
<view class=" text-left flex-sub text-sm text-gray">房间已经绑定人脸机,点击继续将执行扫描绑定;点击取消,将不会执行任何操作~</view>
</view>
<view class="cu-bar bg-white">
<!-- <view class="action margin-0 flex-sub " data-type="0" bindtap="ErrorInfo">反馈错误</view>text-red -->
<view id="{{Hotelinfo.HotelName}}_{{message[1]}}_{{message[0]}}_{{Hotelinfo.Code}}_{{Hotelinfo.HotelId}}" class="action margin-0 flex-sub text-green solid-left" style="font-weight: 600;" bindtap="testinfo" >设置</view>
<view id="{{Hotelinfo.HotelName}}_{{message[1]}}_{{message[0]}}_{{Hotelinfo.Code}}" class="action margin-0 flex-sub text-green solid-left" style="font-weight: 600;" bindtap="OpenDoor" >开门</view>
<!-- <view class="action margin-0 flex-sub {{selHosts.FaceSN!=''?'show':''}} text-red solid-left" bindtap="JbSn" >解绑</view> -->
<!-- <view class="action margin-0 flex-sub solid-left" bindtap="GetHide" >取消</view> -->
<!-- <view class="action margin-0 flex-sub text-green solid-left" bindtap="{{FaceSNinput == 0?'GetFaceCode':'ShowInputsn'}}" >继续</view> -->
</view>
</view>
</view>
<!-- SN已经被绑定弹窗提示 -->
<view class="cu-modal {{modal==-200?'show':''}}">
<view class="cu-dialog">
<view class="cu-bar bg-white justify-end">
<view class="content">{{code}}已经被绑定
</view>
<view class="action" bindtap="GetHide" >
<text class="cuIcon-close text-red"></text>
</view>
</view>
<view class="padding-xs flex flex-wrap justify-center " >
<view class="basis-xl text-sm" wx:for="{{bdHosts}}" >
<text class=" text-right ">酒店:</text><text class="text-left text-red">{{item.HotelName}}</text>
<text class="padding-left-xs text-right " >房间:</text><text class="text-left text-red">{{item.RoomNumber}}</text>
<button class="cu-btn margin-left-xs sm bg-red" wx:if="{{item.qx == 0}}" data-index="{{index}}" type="" bindtap="JbSn" >解绑</button>
<button class="cu-btn margin-left-xs sm bg-red" wx:if="{{item.qx != 0}}" disabled >解绑</button>
</view>
<view class="basis-xl">SN<text class="text-left">{{code}}</text></view>
<view class="basis-xl text-left text-sm text-gray">SN已经被其他房间绑定点击继续将取消原有绑定执行新的绑定点击取消将不会执行任何操作~</view>
</view>
<view class="cu-bar bg-white">
<view class="action margin-0 flex-sub text-green solid-left" bindtap="GetHide" >取消</view>
<view wx:if="{{bdHosts.length<=0}}" class="action margin-0 flex-sub solid-left" data-type="false" bindtap="GetFaceSNend" >继续</view>
</view>
</view>
</view>
<!-- 手动输入SN地址 -->
<view class="cu-modal {{modal==-1000?'show':''}}">
<view class="cu-dialog">
<view class="cu-bar bg-white justify-end">
<view class="content">为{{selHosts.RoomNumber}}绑定人脸机SN</view>
<view class="action" bindtap="GetHide" >
<text class="cuIcon-close text-red"></text>
</view>
</view>
<view class="padding-lg flex flex-wrap " >
<view class="basis-sm text-right">房间:</view><view class="basis-lg text-left">{{selHosts.RoomNumber}}</view>
<view class="basis-sm text-right">人脸机SN</view>
<view class="basis-lg text-left">
<input placeholder="手动输入SN" model:value="{{code}}" name="input"></input>
</view>
</view>
<view class="cu-bar bg-white">
<view class="action margin-0 flex-sub text-green solid-left" bindtap="GetHide" >取消</view>
<view class="action margin-0 flex-sub solid-left" bindtap="GetFaceSNOK" >确认</view>
</view>
</view>
</view>

View File

@@ -0,0 +1,42 @@
.Ncu-bar {
display: flex;
position: relative;
align-items: center;
min-height: 70rpx ;
justify-content: space-between;
}
.Ncu-bar1 {
display: flex;
position: relative;
align-items: center;
min-height: 70rpx ;
}
.Ncubar1 {
display: flex;
position: relative;
align-items:flex-start;
min-height: 70rpx ;
}
.ControlLine{
background-color: gray;
height: 1rpx;
width: 100%;
}
.ControlLine_h{
background-color: lightgray;
height: 80rpx;
width: 1rpx;
}
.textvlg {
display: inline-flex;
align-items: center;
justify-content: center;
text-align:center;
padding: 0 5rpx;
font-size:28rpx;
height: 80rpx;
width: 70rpx;
text-decoration: none;
}

View File

@@ -0,0 +1,948 @@
// pages/basics/MakingRounds/MakingRounds.js
const app = getApp()
//const upgrade = require('../../../utils/upgrade.js')
import {
GetHostsInfo,
GetMAC,
GetFaceSN,
ErrorInfo,
CheckFaceSN,
OpenDoorTest,
GetRoomType,
GetRoomTypeAndModalsListLog,
WebChatUpgrade,
QueryUpdateHostStatus,
ForwardQueryUpdateHostProgressBar,
GetRoomTypeNode,
SetRCULight,
SetRCUAir,
SetRCUCurtain,
} from '../../../lib/RequestingCenter.js'
import DeviceUpgrader from '../../../utils/upgrade.js';
// const DeviceUpgrader = require('../../../utils/upgrade.js');
const upgrader = new DeviceUpgrader();
Page({
/**
* 页面的初始数据
*/
data: {
TabCur:1,
RoomIndex:0,
//权限信息
autho: null,
//酒店信息
Hotelinfo: null,
HostsData:null,
HostsDataFilters:[],
isback:null,
HotelId:null,
statusdata:null,
onlineNumber:0,
inputValue:"",
toView:"",
scrollHeight: 0,
RoomtypeNamearray: [],
Completed:false, //是否处于升级状态
RoomtypeName: "",
devlist:[],
Roomtypeinfo:[],
Pfilename:"",
Gfilename:"",
Upgradenode:[],
myArray:[],
CurrentUpgradeDev:'', //当前升级设备
CurrentUpgradeDevStart:'',//当前升级设备状态
UpgradeAllCount:0,
//MAC绑定相关
selHosts: null,
code: null,
modal: 0,
input: 0,
bdHosts: [],
address: "",
},
/**
* 生命周期函数--监听页面加载
*/
onLoad:async function(options) {
if (!options.HotelId ) {
app.toast(2, "无酒店信息~")
return;
}
this.setData({
autho: app.globalData.autho
})
try {
this.data.autho.forEach((element, index) => {
element.Hotels.forEach((elements, indexs) => {
if (elements.HotelId == options.HotelId) {
this.setData({
Hotelinfo: elements
})
throw new Error();
}
})
});
} catch (error) {
console.log("已经找到,无需循环~")
}
let that = this
await GetHostsInfo({
HotelID: this.data.Hotelinfo.HotelId
}).then(res => {
if (res.Status == 200) {
let onlineNumber=0
for (let index = 0; index < res.Data.length; index++) {
const element = res.Data[index];
if (element.Status===1) {
onlineNumber=onlineNumber+1
}
}
that.setData({
onlineNumber:onlineNumber,
HostsData: res.Data,
HostsDataFilters: res.Data,
isback: (app.globalData.autho.length > 1 || app.globalData.autho[0].Hotels.length > 1),
HotelId: options.HotelId,
statusdata: [0, 0, 0, res.Data.length]
})
console.log(this.data.HostsDataFilters)
} else {
app.toast(2, res.Message || "网络繁忙")
}
}, err => {
console.log(err)
app.toast(2, "网络繁忙")
}).catch(err => {
console.log(err)
app.toast(2, "网络繁忙")
});
app.globalData.HotelId=options.HotelId
await GetRoomType({
HotelID: options.HotelId
}).then(res => {
app.SetroontypeListindex(res)
this.setData({
myArray:app.globalData.roomIDName ,
RoomtypeNamearray:app.globalData.roomName
})
}, err => {
console.log('GetRoomType error')
}).catch(err => {
});
upgrader.on('progress', p => {
console.log(p)
this.setData({ CurrentUpgradeDevStart: p }) // 实时刷新 UI
})
upgrader.on('error', e => {
wx.showToast({ title: '升级失败', icon: 'none' })
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
this.calcScrollHeight();
},
calcScrollHeight() {
// 1. 拿到屏幕可用高度px
const sys = wx.getSystemInfoSync();
const screenHeight = sys.windowHeight; // px
// 2. 拿到 scroll-view 的 toppx
wx.createSelectorQuery()
.in(this)
.select('#myScroll')
.boundingClientRect(rect => {
if (rect) {
const topPx = rect.top; // px
const bottomPx = 10 / 2; // 10rpx → 5px2倍屏
const heightPx = screenHeight - topPx - bottomPx;
// 3. 转 rpx 并写入
this.setData({
scrollHeight: heightPx * 2 // px→rpx
});
}
})
.exec();
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
upgrader.cancelUpgrade()
upgrader._cleanup()
},
//MAC绑定相关方法
//检查MAC地址合法性
CheckMAC: function (vlues) {
return (vlues.indexOf("34D0B8") == 0 && vlues.length == 12 && vlues.indexOf(" ") < 0);
},
//扫码获取MAC地址
GetCode: async function () {
var that = this;
setTimeout(function () {
that.GetHide()
}, 100);
wx.scanCode({
onlyFromCamera: true,
success(res) {
that.setData({
code: res.result
})
that.GetMACOK();
},
fail(err) {
app.toast(2, "未识别到有效条形码")
}
})
},
//隐藏弹窗
GetHide() {
this.setData({
modal: 0,
input: 0,
})
},
//房间点击事件 - 扫码绑定
/**
* 获取主机MAC地址
* @async
* @function GetMAC
* @param {Object} e - 事件对象
* @param {number} e.currentTarget.dataset.index - 当前选中主机的索引
* @description 根据选中主机的索引获取MAC地址如果MAC地址不存在则调用GetCode方法
* @returns {Promise<void>}
*/
GetMAC: async function (e) {
let index = e.currentTarget.dataset['index'];
let selHosts = this.data.HostsDataFilters[index];
selHosts.index = index;
this.setData({
selHosts: selHosts,
input: 0
})
if (this.data.HostsDataFilters[index].MAC != "" && this.data.HostsDataFilters[index].MAC != null) {
this.setData({
modal: 1,
message: [this.data.HostsDataFilters[index].MAC, selHosts.RoomNumber]
})
} else {
this.GetCode()
}
},
//长按房间事件 - 手动输入MAC
GetMAC_long: function (e) {
let indexstr = e.currentTarget.id.replace("msg-","")
let index= Number(indexstr)
let selHosts = this.data.HostsDataFilters[index];
selHosts.index = index;
this.setData({
selHosts: selHosts,
input: 100
})
if (this.data.HostsDataFilters[index].MAC != "" && this.data.HostsDataFilters[index].MAC != null) {
this.setData({
modal: 1,
message: [selHosts.RoomNumber, this.data.HostsDataFilters[index].MAC]
})
} else {
this.ShowInput();
}
},
//显示手动输入MAC弹窗
ShowInput: function (params) {
this.setData({
modal: 1000,
code: ""
})
},
//验证手动输入的MAC地址
GetMACOK: function () {
let that = this;
if (!this.CheckMAC(that.data.code)) {
this.setData({
modal: 520
})
return;
}
this.setData({
modal: 521
})
},
//解绑MAC地址
Jb: async function(params) {
let index = params.currentTarget.dataset['index'];
let jbjd = this.data.bdHosts[index];
let that = this;
await GetMAC({
roomNumber: jbjd.RoomNumber,
roomID: jbjd.Id,
HotelID: jbjd.HotelID,
MAC: "",
NoCheck: false,
loc: that.data.address
}).then(
res => {
if (res.Status == 1000) {
app.toast(2, "无权限")
}
if (res.Status == 200) {
app.toast(1, "解绑成功")
var databdHosts = that.data.bdHosts;
databdHosts.splice(index, 1);
that.setData({
bdHosts: databdHosts
})
if (jbjd.HotelID != that.data.HotelId) {
return;
}
let data = that.data.HostsData;
let OLD = -1;
try {
data.forEach(
(x, INDEX) => {
if (x.RoomNumber === jbjd.RoomNumber) {
OLD = INDEX;
throw new Error();
}
}
)
} catch (error) {
}
if (OLD >= 0) {
data[OLD].MAC = "";
}
let res = that.GetFilters(that.data.sel, data);
that.setData({
HostsData: data,
HostsDataFilters: res[0],
statusdata: res[1]
})
} else {
app.toast(2, "解绑失败")
}
},
err => {
app.toast(2, "网络繁忙")
}
).catch(err => {
app.toast(2, "网络繁忙")
});
},
//最终绑定MAC地址
GetMacOKend: async function (type) {
let that = this;
if (type != true && type != false) {
type = type.currentTarget.dataset['type']
}
this.GetHide();
let xg = null;
await GetMAC({
roomNumber: that.data.selHosts.RoomNumber,
HotelID: that.data.selHosts.HotelID,
MAC: that.data.code,
NoCheck: type,
loc: that.data.address
}).then(
res => {
if (res.Status == 1000) {
xg = 100;
app.toast(2, "无权限")
}
if (res.Status == 200) {
xg = 0;
app.toast(1, "绑定成功")
//更新本地数据
let data = that.data.HostsData;
let OLD = -1;
try {
data.forEach(
(x, INDEX) => {
if (x.RoomNumber === that.data.selHosts.RoomNumber) {
OLD = INDEX;
throw new Error();
}
}
)
} catch (error) {
}
if (OLD >= 0) {
data[OLD].MAC = that.data.code;
}
that.setData({
HostsData: data,
HostsDataFilters: data
})
} else {
if (!type) {
xg = 1;
app.toast(2, "绑定失败")
} else {
try {
if (res.Status == 100) {
xg = 100;
let modal = 3;
let mesg = [that.data.code];
let bdHosts = res.Data.Hosts;
try {
that.data.autho.forEach((element, index) => {
element.Hotels.forEach((elements, indexs) => {
for (let index = 0; index < res.Data.Hosts.length; index++) {
if (elements.HotelId == res.Data.Hosts[index].HotelID) {
elements.Auth.forEach(Auth => {
if (Auth.AuthorityId == 16 && Auth.AuthotypeId == 3) {
bdHosts[index].qx = 0;
}
})
}
}
})
});
} catch (error) {
console.log(error)
}
that.setData({
modal: modal,
bdHosts: bdHosts,
message: mesg
})
} else {
if (res.Status == 150) {
xg = 1;
app.toast(2, "绑定失败")
} else {
xg = 100;
app.toast(2, "网络繁忙")
}
}
} catch (error) {
xg = 100;
console.log(error)
}
}
}
},
err => {
xg = 100;
app.toast(2, "网络繁忙")
}
).catch(err => {
xg = 100;
app.toast(2, "网络繁忙")
});
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
},
inputSearchForHotels(e){
this.setData({
inputValue: e.detail.value
})
},
async UpgradeTheEquipment(e){
let se=e
let _this =this
let updataDev = e.currentTarget.dataset.id
let errstr =""
if (updataDev == 1) {
errstr="固件"
}
if (updataDev == 2) {
errstr="配置"
}
wx.showModal({
title: "提示",
content: "是否进行"+errstr+"升级!",
async success (res) {
if (res.confirm) {
await _this.UpgradeTheEquipment2(se)
} else if (res.cancel) {
return
}
}
})
},
async UpgradeTheEquipment2(e){
let updataDev = e.currentTarget.dataset.id
let errstr =""
let devlist =this.data.devlist
let UpgradeType =""
let filename = ""
let RoomtypeName =this.data.RoomtypeName
let _this =this
let RoomTypeID=""
let HotelId= app.globalData.HotelId
let UpgradeCount=0
if (updataDev == 1) {
errstr="升级固件失败"
UpgradeType='firmware'
filename=_this.data.Gfilename
filename=filename.replace('.hex','.bin')
}
if (updataDev == 2) {
errstr="升级配置失败"
UpgradeType=''
filename=_this.data.Pfilename
}
if (filename.length ==0) {
_this.DisplayPrompt("未获取到升级文件!升级失败",3000)
return
}
RoomTypeID=this.GetRoomTypeId(RoomtypeName)
let newdevlist =[]
for (let i = 0; i < this.data.devlist.length; i++) {
devlist[i].UpgradeStatus = 0
if (devlist[i].checkbox) { //勾选
if (devlist[i].Status) { //离在线
newdevlist.push(devlist[i])
}
}
}
if (newdevlist.length>0) {
_this.setData({
UpgradeCount:0, //升级计数
CurrentUpgradeDev:"", //当前升级设备
CurrentUpgradeDevStart:"",//当前升级设备状态
Completed:true,
UpgradeAllCount:newdevlist.length,//升级总数
devlist:devlist
})
}else
{
this.DisplayPrompt2("未选中升级设备", 1000)
return
}
for (let Nvindex = 0; Nvindex < newdevlist.length; Nvindex++) {
const element = newdevlist[Nvindex];
_this.setData({
//升级计数
CurrentUpgradeDev:element.RoomNumber, //当前升级设备
CurrentUpgradeDevStart:'升级就绪',//当前升级设备状态
})
try {
await upgrader.startUpgrade(UpgradeType, {
roomTypeID: RoomTypeID,
hostidLists:'['+element.ID+']',
upgradefileName: filename,
hotelid:HotelId
})
.then(res => {
_this.setData({
UpgradeCount:_this.data.UpgradeCount+1, //升级计数
})
console.log('升级完成', res)
})
.catch(err =>{
console.log('升级失败', err)
});
}catch (error) {
_this.setData({
//升级计数
CurrentUpgradeDev:element.RoomNumber, //当前升级设备
CurrentUpgradeDevStart:errstr+',服务器响应异常',//当前升级设备状态
Completed:false
})
//this.DisplayPrompt(errstr+',服务器响应异常',1000)
return
}
}
this.DisplayPrompt2("升级完成!", 1000)
},
DisplayPrompt2(tipstr, showtime)
{
wx.showToast({
title: tipstr,
icon: 'none'
})
setTimeout(function () {
wx.hideToast()
}, showtime)
},
ALLcheckboxSub(e){
let devlist =this.data.devlist
let ALLcheckbox =this.data.Allcheckbox
let values = !ALLcheckbox
for (let index = 0; index < devlist.length; index++) {
devlist[index].checkbox=values
}
this.setData({
devlist:devlist,
Allcheckbox:values
});
},
checkboxSub(e){
let devlist =this.data.devlist
let ALLcheckbox =this.data.Allcheckbox
let index = e.currentTarget.dataset.id
let values =!devlist[index].checkbox
devlist[index].checkbox=values
let checksun =0
for (let nindex = 0; nindex < devlist.length; nindex++) {
if (values) {
if ( devlist[nindex].checkbox!=values) {
values=devlist[nindex].checkbox
}
}
if (devlist[nindex].checkbox) {
checksun=checksun+1
}
}
this.setData({
devlist:devlist,
Allcheckbox:values,
checksun:checksun
});
},
SearchForHotels(e){
//debugger
let myarry =this.data.HostsDataFilters
let inputValue =this.data.inputValue.trim()
const CNaelement =this.sortHotelsByFuzzyMatch(myarry,inputValue)
this.setData({
HostsDataFilters:CNaelement
})
},
goProcess(e) {
let indexstr = e.currentTarget.id.replace("msg-","")
let index= Number(indexstr)
const { room, hotel, status,roomtypeid,hotelcode,createTime} = e.currentTarget.dataset;
let HostsDataFilters =this.data.HostsDataFilters
let timestr = HostsDataFilters[0].CreateTime
if (status !== 1) {
if (!HostsDataFilters[index].MAC||HostsDataFilters[index].MAC.length==0) {
//长按事件
if (this.endTime - this.startTime > 350) {
return;
}
this.setData({
selHosts: HostsDataFilters[index]
})
this.GetCode()
}
} else{ // 不为1时不跳转
wx.navigateTo({
url: `/pages/basics/HostUpgrade/EquipmentCaontrol/EquipmentCaontrol?RoomNumber=${room}&HotelName=${hotel}&HotelId=${this.data.Hotelinfo.HotelId }&roomtypeid=${roomtypeid }&HotelCode=${hotelcode}&createTime=${timestr}`
});
}
},
RefreshTheRoom:async function(e){
let that = this
await GetHostsInfo({
HotelID: this.data.Hotelinfo.HotelId
}).then(res => {
if (res.Status == 200) {
let onlineNumber=0
for (let index = 0; index < res.Data.length; index++) {
const element = res.Data[index];
if (element.Status===1) {
onlineNumber=onlineNumber+1
}
}
that.setData({
onlineNumber:onlineNumber,
HostsData: res.Data,
HostsDataFilters: res.Data,
isback: (app.globalData.autho.length > 1 || app.globalData.autho[0].Hotels.length > 1),
statusdata: [0, 0, 0, res.Data.length]
})
console.log(this.data.HostsDataFilters)
} else {
app.toast(2, res.Message || "网络繁忙")
}
}, err => {
console.log(err)
app.toast(2, "网络繁忙")
}).catch(err => {
console.log(err)
app.toast(2, "网络繁忙")
});
},
//touch start 开始触摸房间区域
handleTouchStart: function (e) {
this.startTime = e.timeStamp;
//console.log(" startTime = " + e.timeStamp);
},
//touch end结束触摸房间区域
handleTouchEnd: function (e) {
this.endTime = e.timeStamp;
//console.log(" endTime = " + e.timeStamp);
},
sortHotelsByFuzzyMatch:function(hotels, keyword) {
// 1. 参数验证
if (!Array.isArray(hotels)) {
console.warn('第一个参数必须是数组');
return [];
}
if (typeof keyword !== 'string') {
console.warn('第二个参数必须是字符串');
return hotels.slice();
}
// 2. 处理空数组或空关键字的情况
const trimmedKeyword = keyword.trim();
if (hotels.length === 0 || trimmedKeyword === '') {
return hotels.slice();
}
const lowerKeyword = trimmedKeyword.toLowerCase();
// 3. 分离匹配和不匹配的酒店
const matchedHotels = [];
const unmatchedHotels = [];
hotels.forEach(hotel => {
// 检查是否为有效酒店对象
if (!hotel || typeof hotel !== 'object' || !hotel.RoomNumber) {
unmatchedHotels.push(hotel);
return;
}
const hotelName = String(hotel.RoomNumber).toLowerCase();
const isMatch = hotelName.includes(lowerKeyword);
if (isMatch) {
matchedHotels.push(hotel);
} else {
unmatchedHotels.push(hotel);
}
});
// 4. 合并数组并返回
return [...matchedHotels, ...unmatchedHotels];
},
RefreshTheRoomType(e){
e.detail=this.data.RoomtypeName
this.bindPickerChange(e)
},
GetRoomTypeId(roomTypeName){
if (roomTypeName.length>0) {
let myArray =this.data.myArray
for (let index = 0; index < myArray.length; index++) {
let strbuf = myArray[index].split('|') ;
if (strbuf[1]==roomTypeName) {
return strbuf[0]
}
}
}else{
return ""
}
},
DisplayPrompt(tipstr, showtime)
{
// wx.showModal({
// title: '提示',
// content: '确认执行此操作吗?',
// success(res) {
// if (res.confirm) { /* 用户点击确定 */ }
// }
// });
wx.showLoading({
title: tipstr,
})
setTimeout(function () {
wx.hideLoading()
}, showtime)
},
async bindPickerChange(e) {
let Completed =this.data.Completed
let _this =this
if (Completed) {
this.DisplayPrompt("正在升级中!",1000)
return
}
let devlist=[]
let Roomtypeinfo=[]
let roomid = this.GetRoomTypeId(e.detail)
if (roomid.length==0) {
return
}
let Pfilename =""
let Gfilename =""
let Upgradenode =[]
try {
// 调用 GetRoomTypeNode
const res = await GetRoomTypeNode({
hotelid: app.globalData.HotelId,
roomTypeID: roomid,
});
if (res.IsSuccess==true) {
devlist = res.HostData
for (let nindex = 0; nindex < devlist.length; nindex++) {
devlist[nindex].show=1
devlist[nindex].checkbox=0
devlist[nindex].UpgradeStatus=0
devlist[nindex].Model =_this.removeNullCharsAndInvisibleChars(devlist[nindex].Model)
}
}
const Nres = await GetRoomType({
HotelID:app.globalData.HotelId
})
if (Nres.Status==200) {
Roomtypeinfo=Nres.Data
for (let index = 0; index < Roomtypeinfo.length; index++) {
const element = Roomtypeinfo[index];
if (element.ROOM_TYPE_OLD_ID == roomid) {
Upgradenode=element
if (element.App_Cfg_For_L2.length>0) {
Gfilename=element.App_Cfg_For_L2
}
if (element.App_Cfg_For_L4.length>0) {
Gfilename=element.App_Cfg_For_L4
}
if (element.APPTYPE=="App_Cfg") {
Pfilename=element.CONFIG_BIN
}else{
Pfilename=""
}
break
}
}
}
this.setData({
RoomtypeName: e.detail,
devlist:devlist,
Roomtypeinfo:Roomtypeinfo,
Pfilename:Pfilename,
Gfilename:Gfilename,
Upgradenode:Upgradenode
});
console.log(devlist)
} catch (err) {
console.log('GetRoomTypeNode error', err);
}
},
removeNullCharsAndInvisibleChars(str) {
try {
return str.replace(/[\u0000-\u001F\u007F-\u009F\u200B-\u200F\u202A-\u202E\u2060-\u206F\uFEFF]/g, '');
} catch (error) {
return "NULL"
}
},
tabSelect(e) {
this.setData({
TabCur: e.currentTarget.dataset.id,
})
},
})

View File

@@ -0,0 +1,5 @@
{
"usingComponents": {
"wanselect": "/components/wanselect/wanselect"
}
}

View File

@@ -0,0 +1,238 @@
<cu-custom bgColor="bg-gradual-blue"
isBack="true">
<block bindtap="back" slot="backText" >返回</block>
<view slot="content">{{Hotelinfo.HotelName}}({{Hotelinfo.Code}})</view>
</cu-custom>
<scroll-view scroll-x class="bg-white nav text-center text-bold text-xl ">
<view class="flex text-center">
<view class="cu-item {{1==TabCur?'text-blue cur':''}}" bindtap="tabSelect" data-id="{{1}}">
单房间升级
</view>
<view class="cu-item {{2==TabCur?'text-blue cur':''}}" bindtap="tabSelect" data-id="{{2}}">
批量升级
</view>
</view>
</scroll-view>
<view wx:if="{{1==TabCur}}">
<view class=" solids bg-white" style="margin-top: 10rpx;height:70px ;width: 100%;font-weight: bold; ">
<view class="flex text-xl" style=" height:45% ;width: 100%;">
<!-- <view class="solids" wx:if="{{RoomIndex>=0}}" style="height:100% ;width: 50%;">
<text class="text-black">房号:{{HostsDataFilters[RoomIndex].RoomNumber}}</text>
</view> -->
<view class="solids" wx:if="{{RoomIndex>=0}}" style="height:100% ;width: 60%;">
<text class="text-black">房间在线:</text>
<text class="text-blue">{{onlineNumber}}/</text>
<text class="text-black">{{HostsDataFilters.length}} </text>
</view>
<view class="solids" wx:if="{{RoomIndex>=0}}" style="height:100% ;width: 40%;">
<button class="cu-btn1 line-green margin-left " style="width: 100%; margin:5rpx;" bindtap="RefreshTheRoom">刷新</button>
</view>
</view>
<view class="cu-bar1 bg-white " style="height:50% ;width: 100%;" >
<view class="solids" style="width: 60%;">
<input class="solids cu-btn1" focus="true" bindinput="inputSearchForHotels" confirm-type="search" style="width: 100%;"/>
</view>
<view class="flex"style="width: 40%;">
<button class="cu-btn1 line-green margin-left " style="width: 100%; margin:5rpx;" bindtap="SearchForHotels">搜索</button>
</view>
</view>
</view>
<scroll-view scroll-y scroll-into-view="{{toView}}" id="myScroll" style="height:{{scrollHeight}}rpx;" >
<view class='nav-list1 bg-white' bindtouchstart="handleTouchStart"
bindtouchend="handleTouchEnd" style="margin-top: 20rpx;">
<view bindtap="goProcess" bindlongtap="GetMAC_long" data-room="{{item.RoomNumber}}" data-hotel="{{Hotelinfo.HotelName}}"
data-status="{{item.Status}}" data-HotelCode="{{Hotelinfo.Code}}" data-roomtypeid="{{item.RoomTypeID}}" hover-class="navigator-hover" class="nav-li4 bg-{{item.Status===1? 'cyan':'gray'}}" wx:for="{{HostsDataFilters}}" id="msg-{{index}}" wx:key>
<view style="font-size: 32rpx;justify-content:start" >{{item.RoomNumber}}</view>
<view style="font-size: 20rpx;justify-content:start" >{{item.MAC}}</view>
</view>
</view>
</scroll-view>
</view>
<view wx:if="{{2==TabCur}}">
<view class=" solids bg-white" style="margin-top: 10rpx;height:100px ;width: 100%;font-weight: bold; ">
<view class="flex text-xl" style=" height:35% ;width: 100%;">
<view class="solids" style="height:100% ;width: 70%;">
<!-- 房型 -->
<view style="height:100% ;width: 100%; display: flex;justify-content:center; align-items:center; " >
<view style="height:100% ;width: 20%;">
<text >房型:</text>
</view>
<view style="height:100% ;width: 75%;">
<wanselect style="justify-content:center; align-items:center;" listData="{{RoomtypeNamearray}}" bind:optionTap='bindPickerChange'></wanselect>
</view>
</view>
</view>
<view class="solids" wx:if="{{RoomIndex>=0}}" style="height:100% ;width: 30%;">
<button class="cu-btn1 line-green margin-left " style="width: 100%; margin:5rpx;" bindtap="RefreshTheRoomType">刷新</button>
</view>
</view>
<view class="flex solids line-grey" style=" height:62% ;width:100%;">
<view class="flex-eight" style="height: 100%;margin: 3rpx 5rpx; " >
<view class="flex-xis setborder line-grey text-cut" style="height: 45%;font-size: 22rpx; line-height: 50rpx;min-width: 0;margin: 3rpx 0rpx; ">
{{Gfilename}}
</view>
<view class="flex-xis setborder line-grey text-cut" style="height: 45%;font-size: 22rpx; line-height: 50rpx;min-width: 0;margin: 3rpx 0rpx;">
{{Pfilename}}
</view>
</view>
<view class="flex-twice" style="height: 100%;margin: 3rpx 5rpx;" >
<button class=" "style=" margin: 3rpx 0rpx; font-size: 22rpx;height:45%;" data-id="1" bind:tap="UpgradeTheEquipment">固件升级</button>
<button class=""style=" margin: 3rpx 0rpx; font-size: 22rpx;height: 45%;" data-id="2" bind:tap="UpgradeTheEquipment" >配置升级</button>
</view>
</view>
</view>
<view class=" flex align-center " style="height: 70rpx;background: aquamarine;" >
<view class="flex-treble margin-xs" style="height: 50rpx;" bindtap="ALLcheckboxSub" >
<checkbox checked="{{Allcheckbox}}" ></checkbox>
<text >全选</text>
</view>
<view class="flex-eight" >正在升级房号:{{CurrentUpgradeDev}}:{{CurrentUpgradeDevStart}}</view>
<view class="flex-treble " style="justify-content: flex-end">已升级设备: {{UpgradeCount}} </view>
</view>
<scroll-view id="myScroll" scroll-into-view="{{toView}}" scroll-y="true" style="height:{{scrollHeight-100}}rpx;" >
<view wx:for="{{devlist.length}}" wx:key="index" class=" bg-white padding-5" >
<view class="bg-white" >
<view class="cubarN bg-white " >
<view class="flex-xsub margin-xs" data-id ="{{index}}" bindtap="checkboxSub" >
<checkbox style="top:25%;" checked="{{devlist[index].checkbox}}" ></checkbox>
</view>
<view class="cubarN bg-white flex-9" data-id ="{{index}}" bindtap="HideOrOpen" style="background:{{devlist[index].UpgradeStatus ==0? 'white':devlist[index].UpgradeStatus ==1? 'green':'red' }} ;">
<view class="flex-9" style="font-weight: bold;" >房号:{{devlist[index].RoomNumber}}</view>
<view class="flex-sub text-{{devlist[index].Status==true? 'green':'red'}}" >{{devlist[index].Status==true? "在线":"离线"}}</view>
</view>
</view>
<view class="cubarN bg-white" > <!-- wx:if="{{devlist[index].show==0}}"> -->
<view class="flex-xis" >MAC:{{devlist[index].MAC}}</view>
<!-- <view class="flex-xis setborder line-grey text-cut" style="height: 50rpx;width: 520rpx; font-size:22rpx; line-height: 50rpx"></view> -->
<view class="flex-twice" style="font-size: 22rpx;">主机:{{devlist[index].Model}}</view>
<view class="flex-twice" style="font-size: 22rpx;">配置版本:{{devlist[index].ConfigVersion}} </view>
</view>
<view class="cubarN bg-white solid-bottom "> <!-- wx:if="{{devlist[index].show==0}}"> -->
<view class="flex-eight" style="font-size: 22rpx;" >固件版本:{{devlist[index].Version}}</view>
</view>
</view>
</view>
</scroll-view>
</view>
<!-- MAC已经被绑定弹窗提示 -->
<view class="cu-modal {{modal==3 || modal==4?'show':''}}">
<view class="cu-dialog">
<view class="cu-bar bg-white justify-end">
<view class="content">{{code}}已经被绑定</view>
<view class="action" bindtap="GetHide" >
<text class="cuIcon-close text-red"></text>
</view>
</view>
<view class="padding-xs flex flex-wrap justify-center " >
<view class="basis-xl text-sm" wx:for="{{bdHosts}}" >
<text class=" text-right ">酒店:</text><text class="text-left text-red">{{item.HotelName}}</text>
<text class="padding-left-xs text-right " >房间:</text><text class="text-left text-red">{{item.RoomNumber}}</text>
<button class="cu-btn margin-left-xs sm bg-red" wx:if="{{item.qx == 0}}" data-index="{{index}}" type="" bindtap="Jb" >解绑</button>
<button class="cu-btn margin-left-xs sm bg-red" wx:if="{{item.qx != 0}}" disabled >解绑</button>
</view>
<view class="basis-xl">MAC地址<text class="text-left">{{code}}</text></view>
<view class="basis-xl text-left text-sm text-gray">MAC已经被其他房间绑定点击继续将取消原有绑定执行新的绑定点击取消将不会执行任何操作~</view>
</view>
<view class="cu-bar bg-white">
<view class="action margin-0 flex-sub text-green " data-type="1" bindtap="ErrorInfo">反馈错误</view>
<view class="action margin-0 flex-sub text-green solid-left" bindtap="GetHide" >取消</view>
<view wx:if="{{bdHosts.length<=0}}" class="action margin-0 flex-sub solid-left" data-type="false" bindtap="GetMacOKend" >继续</view>
</view>
</view>
</view>
<!-- 手动输入mac地址 -->
<view class="cu-modal {{modal==1000?'show':''}}">
<view class="cu-dialog">
<view class="cu-bar bg-white justify-end">
<view class="content">为{{selHosts.RoomNumber}}绑定MAC</view>
<view class="action" bindtap="GetHide" >
<text class="cuIcon-close text-red"></text>
</view>
</view>
<view class="padding-lg flex flex-wrap " >
<view class="basis-sm text-right">房间:</view>
<view class="basis-lg text-left">{{selHosts.RoomNumber}}</view>
<view class="basis-sm text-right">MAC地址</view>
<view class="basis-lg text-left">
<input placeholder="手动输入MAC" model:value="{{code}}" name="input"></input>
</view>
</view>
<view class="cu-bar bg-white">
<view class="action margin-0 flex-sub text-green solid-left" bindtap="GetHide" >取消</view>
<view class="action margin-0 flex-sub solid-left" bindtap="GetMACOK" >确认</view>
</view>
</view>
</view>
<!-- 确定绑定 -->
<view class="cu-modal {{modal==521?'show':''}}">
<view class="cu-dialog">
<view class="cu-bar bg-white justify-end">
<view class="content">绑定确认</view>
<view class="action" bindtap="GetHide" >
<text class="cuIcon-close text-red"></text>
</view>
</view>
<view class="padding-lg flex flex-wrap " >
<view class="basis-sm text-right">酒店:</view><view class="text-left basis-lg">{{Hotelinfo.HotelName}}</view>
<view class="basis-sm text-right">房间:</view><view class="basis-lg text-left">{{selHosts.RoomNumber}}</view>
<view class="basis-sm text-right">MAC地址</view><view class="basis-lg text-left">{{code}}</view>
<view class=" text-left flex-sub text-sm text-gray">确定为房间绑定MAC点击继续将执行扫描绑定点击取消将不会执行任何操作~</view>
</view>
<view class="cu-bar bg-white">
<view class="action margin-0 flex-sub text-green solid-left" bindtap="GetHide" >取消</view>
<view class="action margin-0 flex-sub solid-left" data-type="true" bindtap="GetMacOKend" >继续</view>
</view>
</view>
</view>
<!-- 无效条形码 -->
<view class="cu-modal {{modal==520?'show':''}}">
<view class="cu-dialog">
<view class="cu-bar bg-white justify-end">
<view class="content">无效条码</view>
<view class="action" bindtap="GetHide" >
<text class="cuIcon-close text-red"></text>
</view>
</view>
<view class="padding-lg flex flex-wrap " >
<view class="basis-sm text-right">无效条码:</view><view class="basis-lg text-left">{{code}}</view>
<view class=" text-left flex-sub text-sm text-gray">扫描的条码为无效条码~</view>
</view>
<view class="cu-bar bg-white">
<view class="action margin-0 flex-sub text-green solid-left" bindtap="GetHide" >确定</view>
</view>
</view>
</view>

View File

@@ -0,0 +1,112 @@
.aside{
width:8rem;
border-right: 1px solid #ddd;
font-size: .85rem;
}
.type-nav{
width:8rem;
position: relative;
padding:.7rem .3rem;
text-align: center;
border-bottom: 1px solid #ddd;
z-index: 10;
}
.flex-wrap{
display: flex;
}
.type-nav.selected{
margin-right: -1px;
padding-left:0,-1px;
color: #333;
background-color: #fff;
}
/* .content{
background-color: #fff;
} */
.dish{
margin-left: 1rem;
padding: 1rem;
border-bottom: 1px solid #ddd;
}
.dish .title{
display: block;
font-size: 1rem;
}
.dish p{
color: orange;
font-size: .75rem;
}
.dish .add-btn{
width: 8rem;
text-align: right;
}
.cu-bar1 {
display: flex;
align-items: center;
justify-content: space-between;
}
.cart{
display: block;
position: fixed;
left: 0;
right: 0;
bottom: 0;
padding: 1rem;
background: #ddd;
}
.container {
height: 50%;
box-sizing: border-box;
background-color: #f4f4f4;
}
.cu1-btn {
position: relative;
border: 0rpx;
display: inline-flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
padding: 5rpx 5rpx;
font-size: 26rpx;
height: 70rpx;
line-height: 1;
text-align: center;
text-decoration: none;
overflow: visible;
margin-left: initial;
transform: translate(0rpx, 0rpx);
margin-right: initial;
}
.cu-btn1 {
position: relative;
border: 0rpx;
display: inline-flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
padding: 0 5rpx;
font-size: 26rpx;
height: 64rpx;
line-height: 1;
text-align: center;
text-decoration: none;
overflow: visible;
margin-left: initial;
transform: translate(0rpx, 0rpx);
margin-right: initial;
}
.setborder
{
border: 1rpx solid currentColor;
}
.cubarN {
display: flex;
position: relative;
align-items: center;
min-height: 50rpx ;
justify-content: space-between;
}

View File

@@ -0,0 +1,286 @@
// pages/basics/MakingRounds/MakingRounds.js
const app = getApp()
import {
GetHostsInfo,
GetMAC,
GetFaceSN,
ErrorInfo,
CheckFaceSN,
OpenDoorTest,
GetRoomType,
GetRoomTypeAndModalsListLog,
WebChatUpgrade,
QueryUpdateHostStatus,
ForwardQueryUpdateHostProgressBar,
GetRoomTypeNode,
SetRCULight,
SetRCUAir,
SetRCUCurtain,
} from '../../../lib/RequestingCenter.js'
Page({
/**
* 页面的初始数据
*/
data: {
RoomIndex:0,
//权限信息
autho: null,
//酒店信息
Hotelinfo: null,
HostsData:null,
HostsDataFilters:[],
isback:null,
HotelId:null,
statusdata:null,
onlineNumber:0,
inputValue:"",
toView:"",
scrollHeight: 0
},
/**
* 生命周期函数--监听页面加载
*/
onLoad:async function(options) {
if (!options.HotelId || app.globalData.autho == null) {
app.toast(2, "无酒店信息~")
return;
}
this.setData({
autho: app.globalData.autho
})
try {
this.data.autho.forEach((element, index) => {
element.Hotels.forEach((elements, indexs) => {
if (elements.HotelId == options.HotelId) {
this.setData({
Hotelinfo: elements
})
throw new Error();
}
})
});
} catch (error) {
console.log("已经找到,无需循环~")
}
let that = this
await GetHostsInfo({
HotelID: this.data.Hotelinfo.HotelId
}).then(res => {
if (res.Status == 200) {
let onlineNumber=0
for (let index = 0; index < res.Data.length; index++) {
const element = res.Data[index];
if (element.Status===1) {
onlineNumber=onlineNumber+1
}
}
that.setData({
onlineNumber:onlineNumber,
HostsData: res.Data,
HostsDataFilters: res.Data,
isback: (app.globalData.autho.length > 1 || app.globalData.autho[0].Hotels.length > 1),
HotelId: options.HotelId,
statusdata: [0, 0, 0, res.Data.length]
})
console.log(this.data.HostsDataFilters)
} else {
app.toast(2, res.Message || "网络繁忙")
}
}, err => {
console.log(err)
app.toast(2, "网络繁忙")
}).catch(err => {
console.log(err)
app.toast(2, "网络繁忙")
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
this.calcScrollHeight();
},
calcScrollHeight() {
// 1. 拿到屏幕可用高度px
const sys = wx.getSystemInfoSync();
const screenHeight = sys.windowHeight; // px
// 2. 拿到 scroll-view 的 toppx
wx.createSelectorQuery()
.in(this)
.select('#myScroll')
.boundingClientRect(rect => {
if (rect) {
const topPx = rect.top; // px
const bottomPx = 10 / 2; // 10rpx → 5px2倍屏
const heightPx = screenHeight - topPx - bottomPx;
// 3. 转 rpx 并写入
this.setData({
scrollHeight: heightPx * 2 // px→rpx
});
}
})
.exec();
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
},
inputSearchForHotels(e){
this.setData({
inputValue: e.detail.value
})
},
SearchForHotels(e){
//debugger
let myarry =this.data.HostsDataFilters
let inputValue =this.data.inputValue.trim()
const CNaelement =this.sortHotelsByFuzzyMatch(myarry,inputValue)
this.setData({
HostsDataFilters:CNaelement
})
},
goProcess(e) {
const { room, hotel, status } = e.currentTarget.dataset;
if (status !== 1) return; // 不为1时不跳转
wx.navigateTo({
url: `/pages/basics/MakingRounds/process/process?RoomNumber=${room}&HotelName=${hotel}&HotelId=${this.data.Hotelinfo.HotelId }`
});
},
RefreshTheRoom:async function(e){
let that = this
await GetHostsInfo({
HotelID: this.data.Hotelinfo.HotelId
}).then(res => {
if (res.Status == 200) {
let onlineNumber=0
for (let index = 0; index < res.Data.length; index++) {
const element = res.Data[index];
if (element.Status===1) {
onlineNumber=onlineNumber+1
}
}
that.setData({
onlineNumber:onlineNumber,
HostsData: res.Data,
HostsDataFilters: res.Data,
isback: (app.globalData.autho.length > 1 || app.globalData.autho[0].Hotels.length > 1),
statusdata: [0, 0, 0, res.Data.length]
})
console.log(this.data.HostsDataFilters)
} else {
app.toast(2, res.Message || "网络繁忙")
}
}, err => {
console.log(err)
app.toast(2, "网络繁忙")
}).catch(err => {
console.log(err)
app.toast(2, "网络繁忙")
});
},
sortHotelsByFuzzyMatch:function(hotels, keyword) {
// 1. 参数验证
if (!Array.isArray(hotels)) {
console.warn('第一个参数必须是数组');
return [];
}
if (typeof keyword !== 'string') {
console.warn('第二个参数必须是字符串');
return hotels.slice();
}
// 2. 处理空数组或空关键字的情况
const trimmedKeyword = keyword.trim();
if (hotels.length === 0 || trimmedKeyword === '') {
return hotels.slice();
}
const lowerKeyword = trimmedKeyword.toLowerCase();
// 3. 分离匹配和不匹配的酒店
const matchedHotels = [];
const unmatchedHotels = [];
hotels.forEach(hotel => {
// 检查是否为有效酒店对象
if (!hotel || typeof hotel !== 'object' || !hotel.RoomNumber) {
unmatchedHotels.push(hotel);
return;
}
const hotelName = String(hotel.RoomNumber).toLowerCase();
const isMatch = hotelName.includes(lowerKeyword);
if (isMatch) {
matchedHotels.push(hotel);
} else {
unmatchedHotels.push(hotel);
}
});
// 4. 合并数组并返回
return [...matchedHotels, ...unmatchedHotels];
},
})

View File

@@ -0,0 +1,3 @@
{
"usingComponents": {}
}

View File

@@ -0,0 +1,46 @@
<cu-custom bgColor="bg-gradual-blue"
isBack="true">
<block bindtap="back" slot="backText" >返回</block>
<view slot="content">{{Hotelinfo.HotelName}}({{Hotelinfo.Code}})</view>
</cu-custom>
<view class=" solids bg-white" style="height:70px ;width: 100%;font-weight: bold; ">
<view class="flex text-xl" style=" height:45% ;width: 100%;">
<view class="solids" wx:if="{{RoomIndex>=0}}" style="height:100% ;width: 50%;">
<text class="text-black">房号:{{HostsDataFilters[RoomIndex].RoomNumber}}</text>
</view>
<view class="solids" wx:if="{{RoomIndex>=0}}" style="height:100% ;width: 50%;">
<text class="text-black">房间在线:</text>
<text class="text-blue">{{onlineNumber}}/</text>
<text class="text-black">{{HostsDataFilters.length}} </text>
</view>
</view>
<view class="cu-bar1 bg-white " style="height:50% ;width: 100%;" >
<view class="solids" style="width: 60%;">
<input class="solids cu-btn1" focus="true" bindinput="inputSearchForHotels" confirm-type="search" style="width: 100%;"/>
</view>
<view class="flex"style="width: 40%;">
<button class="cu-btn1 line-green margin-left " style="width: 100%; margin:5rpx;" bindtap="SearchForHotels">搜索</button>
<button class="cu-btn1 line-green margin-left " style="width: 100%; margin:5rpx;" bindtap="RefreshTheRoom">刷新</button>
</view>
</view>
</view>
<scroll-view scroll-y scroll-into-view="{{toView}}" id="myScroll" style="height:{{scrollHeight}}rpx;" >
<view class='nav-list1 bg-white' style="margin-top: 20rpx;">
<view bindtap="goProcess" data-room="{{item.RoomNumber}}" data-hotel="{{Hotelinfo.HotelName}}"
data-status="{{item.Status}}" hover-class="navigator-hover" class="nav-li4 bg-{{item.Status===1? 'cyan':'gray'}}" wx:for="{{HostsDataFilters}}" id="msg-{{index}}" wx:key>
<view style="font-size: 32rpx;justify-content:start" >{{item.RoomNumber}}</view>
<view style="font-size: 20rpx;justify-content:start" >{{item.MAC}}</view>
</view>
</view>
</scroll-view>

View File

@@ -0,0 +1,101 @@
.aside{
width:8rem;
border-right: 1px solid #ddd;
font-size: .85rem;
}
.type-nav{
width:8rem;
position: relative;
padding:.7rem .3rem;
text-align: center;
border-bottom: 1px solid #ddd;
z-index: 10;
}
.flex-wrap{
display: flex;
}
.type-nav.selected{
margin-right: -1px;
padding-left:0,-1px;
color: #333;
background-color: #fff;
}
/* .content{
background-color: #fff;
} */
.dish{
margin-left: 1rem;
padding: 1rem;
border-bottom: 1px solid #ddd;
}
.dish .title{
display: block;
font-size: 1rem;
}
.dish p{
color: orange;
font-size: .75rem;
}
.dish .add-btn{
width: 8rem;
text-align: right;
}
.cu-bar1 {
display: flex;
align-items: center;
justify-content: space-between;
}
.cart{
display: block;
position: fixed;
left: 0;
right: 0;
bottom: 0;
padding: 1rem;
background: #ddd;
}
.container {
height: 50%;
box-sizing: border-box;
background-color: #f4f4f4;
}
.cu1-btn {
position: relative;
border: 0rpx;
display: inline-flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
padding: 5rpx 5rpx;
font-size: 26rpx;
height: 70rpx;
line-height: 1;
text-align: center;
text-decoration: none;
overflow: visible;
margin-left: initial;
transform: translate(0rpx, 0rpx);
margin-right: initial;
}
.cu-btn1 {
position: relative;
border: 0rpx;
display: inline-flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
padding: 0 5rpx;
font-size: 26rpx;
height: 64rpx;
line-height: 1;
text-align: center;
text-decoration: none;
overflow: visible;
margin-left: initial;
transform: translate(0rpx, 0rpx);
margin-right: initial;
}

View File

@@ -0,0 +1,182 @@
// pages/basics/MakingRounds/process/process.js
Page({
/**
* 页面的初始数据
*/
data: {
RoomNumber:"",
HotelName:"",
deviceList:[
{id:1, name:'取电面板通讯', status:'在线',note:'在线',isnote:"0"},
{id:2, name:'温控面板通讯', status:'在线',note:'在线',isnote:0},
{id:3, name:'红外转发通讯', status:'离线',note:'在线',isnote:0},
{id:4, name:'485窗帘电机通讯',status:'在线',note:'在线',isnote:0},
{id:5, name:'门口传感器测试', status:'显示',note:'在线',isnote:0},
{id:6, name:'卫生间传感器测试',status:'显示',note:'在线',isnote:0},
{id:7, name:'淋浴间传感器测试',status:'不显示',note:'在线',isnote:0},
{id:8, name:'床尾传感器测试', status:'不显示',note:'在线',isnote:0},
{id:9, name:'镜前传感器测试', status:'不显示',note:'在线',isnote:0},
{id:10,name:'休闲区传感器测试',status:'不显示',note:'在线',isnote:0},
{id:11,name:'客厅传感器测试', status:'不显示',note:'在线',isnote:0},
{id:12,name:'厅卫传感器测试', status:'不显示',note:'在线',isnote:0},
{id:13,name:'浴缸传感器测试', status:'不显示',note:'在线',isnote:0},
{id:14,name:'门磁测试', status:'不显示',note:'在线',isnote:0},
{id:15,name:'干接点窗帘测试', status:'正常',note:'在线',isnote:0} // 最后一条你自行改状态
],
deviceListindex:0,
inputValue:"",
toView:"",
scrollHeight: 0 ,
modalName: "",
note:"",
noteok:"",
errorsNumber:0,
HotelId:""
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
if (!options.RoomNumber || !options.HotelName ||!options.HotelId) {
app.toast(2, "无酒店信息~")
return;
}
console.log(options.RoomNumber)
this.setData ({
RoomNumber:options.RoomNumber,
HotelName:options.HotelName,
HotelId:options.HotelId
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
this.calcScrollHeight();
},
calcScrollHeight() {
// 1. 拿到屏幕可用高度px
const sys = wx.getSystemInfoSync();
const screenHeight = sys.windowHeight; // px
// 2. 拿到 scroll-view 的 toppx
wx.createSelectorQuery()
.in(this)
.select('#myScroll')
.boundingClientRect(rect => {
if (rect) {
const topPx = rect.top; // px
const bottomPx = 10 / 2; // 10rpx → 5px2倍屏
const heightPx = screenHeight - topPx - bottomPx;
// 3. 转 rpx 并写入
this.setData({
scrollHeight: heightPx * 2 // px→rpx
});
}
})
.exec();
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
},
showModal(e) {
this.setData({
modalName: e.currentTarget.dataset.target,
deviceListindex:e.currentTarget.dataset.id-1
})
},
DialogModal1(e){
let deviceList = this.data.deviceList
let deviceListindex=this.data.deviceListindex
deviceList[deviceListindex].equipmentstatus=e.currentTarget.dataset.id
this.setData({
modalName: null,
deviceList:deviceList
})
console.log(this.data.deviceList)
},
DialogModal2(e){
let deviceList = this.data.deviceList
let deviceListindex=this.data.deviceListindex
if (e.currentTarget.dataset.id==="hideModal_1") {
deviceList[deviceListindex].isnote=1
}else{
deviceList[deviceListindex].isnote=0
}
this.setData({
deviceList:deviceList
})
console.log(this.data.deviceList)
},
inputSearchForHotels(e){
this.setData({
note: e.detail.value
})
console.log(this.data.note)
},
checkWardRoundRecords(e){
wx.navigateTo({
url: `/pages/basics/MakingRoundsAbnormal/MakingRoundsAbnormal?HotelId=${this.data.HotelId}&RoomNumber=${this.data.RoomNumber}`
});
},
saveTheText(e){
let deviceList = this.data.deviceList
let deviceListindex=this.data.deviceListindex
let note=this.data.note
let noteok=e.currentTarget.dataset.id
deviceList[deviceListindex].isnote= 0
if (noteok==="ok") {
deviceList[deviceListindex].note= note
}
this.setData({
deviceList:deviceList
})
},
})

View File

@@ -0,0 +1,3 @@
{
"usingComponents": {}
}

View File

@@ -0,0 +1,84 @@
<cu-custom bgColor="bg-gradual-blue"
isBack="true">
<block bindtap="back" slot="backText" >返回</block>
<view slot="content">({{HotelName}})_{{RoomNumber}}</view>
</cu-custom>
<view class="flex solid-bottom justify-between ">
<view class=" padding-xs margin-sm radius">
<text class="text-black">异常数量:</text>
<text class="text-red">1</text>
<text class="text-black">/{{deviceList.length}}</text>
</view>
<view class="bg-grey padding-xs margin-sm radius" hover-class="navigator-hover" bindtap="checkWardRoundRecords" >查看查房记录</view>
<view class="bg-grey padding-xs margin-sm radius" hover-class="navigator-hover">上传查房状态</view>
</view>
<!-- 设备状态表格 -->
<view class="th">
<text class="th-item">设备名称</text>
<text class="th-item">状态</text>
<text class="th-item">设备检测</text>
</view>
<scroll-view scroll-y scroll-into-view="{{toView}}" id="myScroll" style="height:{{scrollHeight}}rpx;">
<view class="device-table">
<block wx:for="{{deviceList}}" wx:key="id">
<view class="tr">
<!-- 名称 -->
<text class="th-item {{item.equipmentstatus==='hideModal_1'? 'bg-green':item.equipmentstatus==='hideModal_0'? 'bg-red':'textbcolor'}} ">{{item.name}}</text>
<!-- 状态 -->
<view class="td status">
<text class="status-text {{item.status==='在线'||item.status==='显示'?'on':'off'}}">
{{item.status}}
</text>
</view>
<!-- 按钮 -->
<view class="td btn-group">
<button class="btn green" data-id="{{item.id}}" data-st="正常" data-target="DialogModal1" bindtap="showModal">设备检测</button>
</view>
</view>
</block>
</view>
</scroll-view>
<view class="cu-modal {{modalName=='DialogModal1'?'show':''}}">
<view class="cu-dialog">
<view class="cu-bar bg-white justify-end">
<view class="content">{{deviceList[deviceListindex].name}}</view>
</view>
<view >
<view class=" text-left" > 检测流程:</view>
<textarea auto-height maxlength="-1" class="solids " disabled="true" confirm-type="return" style="width: 95%;font-size: 32rpx;text-align: left;white-space: pre-wrap; word-break: break-all; line-height: 1.5;" value=" {{deviceList[deviceListindex].note}}"/>
</view>
<view class="cu-bar bg-white justify-end">
<view class="action">
<button class="cu-btn bg-gray text-xl text-blue" data-id="hideModal_1" bindtap="DialogModal2">修改检测流程</button>
<button class="cu-btn bg-red text-xl text-black margin-left" data-id="hideModal_0" bindtap="DialogModal1">异常</button>
<button class="cu-btn bg-green text-xl text-black margin-left" data-id="hideModal_1" bindtap="DialogModal1">正常</button>
</view>
</view>
<view wx:if="{{deviceList[deviceListindex].isnote === 1 }}" >
<view class=" text-left" > 检测流程:</view>
<textarea auto-height maxlength="-1" class="solids " focus="true" bindinput="inputSearchForHotels" confirm-type="return" style="width: 100%;font-size: 32rpx;text-align: left;white-space: pre-wrap; word-break: break-all; line-height: 1.5;" value=" {{deviceList[deviceListindex].note}}"/>
<view class="cu-bar bg-white justify-end">
<view class="action">
<button class="cu-btn bg-red text-xl text-black margin-left" data-id="cancel" bindtap="saveTheText">取消</button>
<button class="cu-btn bg-green text-xl text-black margin-left" data-id="ok" bindtap="saveTheText">保存</button>
</view>
</view>
</view>
</view>
</view>

View File

@@ -0,0 +1,18 @@
/* 新增scroll-view样式 */
.scroll-container {
height: calc(100vh - 240rpx); /* 精确计算上方固定内容的高度 */
}
.textbcolor{ background-color: #f0f0f0;}
.device-table{ margin: 20rpx; font-size: 28rpx; }
.th{ display: flex; border-bottom: 2rpx solid #e0e0e0; padding: 15rpx 0; }
.th-item{ flex: 1; text-align: center; font-weight: bold; }
.tr{ display: flex; align-items: center; padding: 15rpx 0; border-bottom: 1rpx solid #f0f0f0; }
.td{ flex: 1; text-align: center; }
.name{ text-align: left; padding-left: 10rpx; }
.status-text{ padding: 4rpx 12rpx; border-radius: 6rpx; color: #fff; font-size: 24rpx; }
.on{ background: #07c160; }
.off{ background: #e54d42; }
.btn-group{ display: flex; justify-content: space-around; }
.btn{ width: 160rpx; height: 50rpx; line-height: 50rpx; font-size: 32rpx; color: #fff; padding: 0; border: none; border-radius: 8rpx; }
.green{ background: #07c160; }
.red{ background: #e54d42; }

View File

@@ -0,0 +1,129 @@
const app = getApp()
import {
GetHostsInfo,
GetMAC,
GetFaceSN,
ErrorInfo,
CheckFaceSN,
OpenDoorTest,
GetRoomType,
GetRoomTypeAndModalsListLog,
WebChatUpgrade,
QueryUpdateHostStatus,
ForwardQueryUpdateHostProgressBar,
GetRoomTypeNode,
SetRCULight,
SetRCUAir,
SetRCUCurtain,
} from '../../../lib/RequestingCenter.js'
Page({
/**
* 页面的初始数据
*/
data: {
RoomIndex:0,
//权限信息
autho: null,
//酒店信息
HostsDataFilters:[],
toView:"",
RoomNumber:"",
HotelId:"",
},
/**
* 生命周期函数--监听页面加载
*/
onLoad:async function(options) {
if (!options.HotelId || app.globalData.autho == null) {
app.toast(2, "无酒店信息~")
return;
}
if (!options.RoomNumber) {
this.setData({
autho: app.globalData.autho,
HotelId: options.HotelId
})
}else{
this.setData({
autho: app.globalData.autho,
HotelId: options.HotelId,
RoomNumber:options.RoomNumber
})
}
try {
this.data.autho.forEach((element, index) => {
element.Hotels.forEach((elements, indexs) => {
if (elements.HotelId == options.HotelId) {
this.setData({
Hotelinfo: elements
})
throw new Error();
}
})
});
} catch (error) {
console.log("已经找到,无需循环~")
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
inputSearchForHotels(e){
this.setData({
RoomNumber: e.detail.value
})
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@@ -0,0 +1,5 @@
{
"usingComponents": {
}
}

View File

@@ -0,0 +1,53 @@
<cu-custom bgColor="bg-gradual-blue"
isBack="true">
<block bindtap="back" slot="backText" >返回</block>
<view slot="content">{{Hotelinfo.HotelName}}({{Hotelinfo.Code}})</view>
</cu-custom>
<view class=" solids bg-white" style="height:70px ;width: 100%;font-weight: bold; ">
<view class="flex text-xl " style=" height:45% ;width: 100%;">
<view class="flex solids " wx:if="{{RoomIndex>=0}}" style="height:100% ;width: 60%;">
<view class="text-black ">房间号:{{}}</view>
</view>
<view class="solids " wx:if="{{RoomIndex>=0}}" style="height:100% ;width: 40%;">
<text class="text-black">异常记录:</text>
<!-- <text class="text-blue">{{onlineNumber}}/</text> -->
<text class="text-black">{{HostsDataFilters.length}} </text>
</view>
</view>
<view class="cu-bar1 bg-white " style="height:50% ;width: 100%;" >
<view class="solids" style="width: 60%;">
<input class="solids cu-btn1" focus="true" bindinput="inputSearchForHotels" confirm-type="search" style="width: 100%;" value="{{RoomNumber}}"/>
</view>
<view class="flex"style="width: 40%;">
<button class="cu-btn1 line-green margin-left " style="width: 100%; margin:5rpx;" bindtap="inputSearchForHotels">搜索</button>
<button class="cu-btn1 line-green margin-left " style="width: 100%; margin:5rpx;" bindtap="RefreshTheRoom">维修记录</button>
</view>
</view>
</view>
<scroll-view scroll-y scroll-into-view="{{toView}}" >
<view class="cu-list menu margin-top-xs margin-bottom-sm shadow-lg" >
<view class="cu-itemz " wx:for="{{20}}" wx:key="index">
<view class="flex" style="width: 80%">
<view class="flex text-black"style="width: 50%">
<view>房号:</view>
<view class="nav-name">{{"床卫生间传"}}</view>
</view>
<view class=" nav-name " style="width: 50%;left: 30rpx;">
<view >床卫生间传感器测试</view>
</view>
</view>
<view class="flex"style="width: 18%;">
<button class="cu-btn1 line-green margin-left " style="width: 100%; margin:5rpx;white-space: pre-line;" bindtap="RefreshTheRoom">确认维\n修完成</button>
</view>
</view>
</view>
</scroll-view>

View File

@@ -0,0 +1,101 @@
.aside{
width:8rem;
border-right: 1px solid #ddd;
font-size: .85rem;
}
.type-nav{
width:8rem;
position: relative;
padding:.7rem .3rem;
text-align: center;
border-bottom: 1px solid #ddd;
z-index: 10;
}
.flex-wrap{
display: flex;
}
.type-nav.selected{
margin-right: -1px;
padding-left:0,-1px;
color: #333;
background-color: #fff;
}
/* .content{
background-color: #fff;
} */
.dish{
margin-left: 1rem;
padding: 1rem;
border-bottom: 1px solid #ddd;
}
.dish .title{
display: block;
font-size: 1rem;
}
.dish p{
color: orange;
font-size: .75rem;
}
.dish .add-btn{
width: 8rem;
text-align: right;
}
.cu-bar1 {
display: flex;
align-items: center;
justify-content: space-between;
}
.cart{
display: block;
position: fixed;
left: 0;
right: 0;
bottom: 0;
padding: 1rem;
background: #ddd;
}
.container {
height: 50%;
box-sizing: border-box;
background-color: #f4f4f4;
}
.cu1-btn {
position: relative;
border: 0rpx;
display: inline-flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
padding: 5rpx 5rpx;
font-size: 26rpx;
height: 70rpx;
line-height: 1;
text-align: center;
text-decoration: none;
overflow: visible;
margin-left: initial;
transform: translate(0rpx, 0rpx);
margin-right: initial;
}
.cu-btn1 {
position: relative;
border: 0rpx;
display: inline-flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
padding: 0 5rpx;
font-size: 26rpx;
height: 64rpx;
line-height: 1;
text-align: center;
text-decoration: none;
overflow: visible;
margin-left: initial;
transform: translate(0rpx, 0rpx);
margin-right: initial;
}

149
pages/device/device.js Normal file
View File

@@ -0,0 +1,149 @@
// pages/device.js
const ecUI = require('../../utils/ecUI.js')
const ecBLE = require('../../utils/ecBLE.js')
let ctx
let isCheckScroll = true
let isCheckRevHex = false
let isCheckSendHex = false
let sendData = ''
Page({
/**
* 页面的初始数据
*/
data: {
textRevData: '',
scrollIntoView: 'scroll-view-bottom',
},
/**
* 生命周期函数--监听页面加载
*/
onLoad() {
ctx = this
isCheckScroll = true
isCheckRevHex = false
isCheckSendHex = false
sendData = ''
ecBLE.setChineseType(ecBLE.ECBLEChineseTypeGBK)
//on disconnect
ecBLE.onBLEConnectionStateChange(() => {
ecUI.showModal('提示', '设备断开连接')
})
//receive data
ecBLE.onBLECharacteristicValueChange((str, strHex) => {
let data =
ctx.data.textRevData +
ctx.dateFormat('[hh:mm:ss,S]:', new Date()) +
(isCheckRevHex ? strHex.replace(/[0-9a-fA-F]{2}/g, ' $&') : str) +
'\r\n'
// console.log(data)
ctx.setData({ textRevData: data })
if (isCheckScroll) {
if (ctx.data.scrollIntoView === "scroll-view-bottom") {
ctx.setData({ scrollIntoView: "scroll-view-bottom2" })
} else {
ctx.setData({ scrollIntoView: "scroll-view-bottom" })
}
}
})
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
ecBLE.onBLEConnectionStateChange(() => { })
ecBLE.onBLECharacteristicValueChange(() => { })
ecBLE.closeBLEConnection()
},
checkScroll(e) {
if (e.detail.value.length) isCheckScroll = true
else isCheckScroll = false
},
checkRevHex(e) {
if (e.detail.value.length) isCheckRevHex = true
else isCheckRevHex = false
},
checkSendHex(e) {
if (e.detail.value.length) isCheckSendHex = true
else isCheckSendHex = false
},
inputSendData(e) {
sendData = e.detail.value
},
btClearTap() {
this.setData({ textRevData: '' })
},
btSendTap() {
if (isCheckSendHex) {
let data = sendData
.replace(/\s*/g, '')
.replace(/\n/g, '')
.replace(/\r/g, '')
if (data.length === 0) {
ecUI.showModal('提示', '请输入要发送的数据')
return
}
if (data.length % 2 != 0) {
ecUI.showModal('提示', '数据长度只能是双数')
return
}
if (data.length > 488) {
ecUI.showModal('提示', '最多只能发送244字节')
return
}
if (!new RegExp('^[0-9a-fA-F]*$').test(data)) {
ecUI.showModal('提示', '数据格式错误只能是0-9,a-f,A-F')
return
}
ecBLE.writeBLECharacteristicValue(data, true)
} else {
if (sendData.length === 0) {
ecUI.showModal('提示', '请输入要发送的数据')
return
}
let tempSendData = sendData.replace(/\n/g, '\r\n')
if (tempSendData.length > 244) {
ecUI.showModal('提示', '最多只能发送244字节')
return
}
ecBLE.writeBLECharacteristicValue(tempSendData, false)
}
},
dateFormat(fmt, date) {
let o = {
'M+': date.getMonth() + 1, //月份
'd+': date.getDate(), //日
'h+': date.getHours(), //小时
'm+': date.getMinutes(), //分
's+': date.getSeconds(), //秒
'q+': Math.floor((date.getMonth() + 3) / 3), //季度
S: date.getMilliseconds(), //毫秒
}
if (/(y+)/.test(fmt))
fmt = fmt.replace(
RegExp.$1,
(date.getFullYear() + '').substr(4 - RegExp.$1.length)
)
for (var k in o)
if (new RegExp('(' + k + ')').test(fmt)) {
// console.log(RegExp.$1.length)
// console.log(o[k])
fmt = fmt.replace(
RegExp.$1,
RegExp.$1.length == 1
? (o[k] + '').padStart(3, '0')
: ('00' + o[k]).substr(('' + o[k]).length)
)
}
return fmt
},
checkChinese(e){
if(e.detail.value==='gbk'){
ecBLE.setChineseType(ecBLE.ECBLEChineseTypeGBK)
}else{
ecBLE.setChineseType(ecBLE.ECBLEChineseTypeUTF8)
}
}
})

5
pages/device/device.json Normal file
View File

@@ -0,0 +1,5 @@
{
"usingComponents": {},
"enablePullDownRefresh": false,
"disableScroll": true
}

47
pages/device/device.wxml Normal file
View File

@@ -0,0 +1,47 @@
<!--pages/device.wxml-->
<view class="device-container">
<view class="control-rev">
<text class="title-rev">数据接收 : </text>
<button class="bt-clear" type="primary" bindtap="btClearTap" hover-start-time="0">清空</button>
<checkbox-group bindchange="checkScroll" class="checkbox-scroll">
<checkbox checked="true"></checkbox>
<text>滚动</text>
</checkbox-group>
<checkbox-group bindchange="checkRevHex" class="checkbox-rev-hex">
<checkbox></checkbox>
<text>Hex</text>
</checkbox-group>
</view>
<view class="scroll-view-container">
<scroll-view class="scroll-view-rev" scroll-y="true" scroll-into-view="{{scrollIntoView}}">
<view class="view-rev-gap"></view>
<text class="text-rev" user-select="true" selectable="true">{{textRevData}}</text>
<view class="view-rev-gap"></view>
<view id="scroll-view-bottom"></view>
<view id="scroll-view-bottom2"></view>
</scroll-view>
</view>
<view class="control-send">
<text class="title-send">数据发送 : </text>
<checkbox-group bindchange="checkSendHex" class="checkbox-send-hex">
<checkbox></checkbox>
<text>Hex</text>
</checkbox-group>
</view>
<view class="view-input-send">
<textarea class="input-send" maxlength="-1" bindblur="inputSendData" bindinput="inputSendData" />
</view>
<view class="view-bt-send">
<button class="bt-send" type="primary" bindtap="btSendTap" hover-start-time="0">发送</button>
</view>
<view class="control-chinese">
<text class="title-chinese">中文字符集 : </text>
<radio-group bindchange="checkChinese" class="checkbox-chinese">
<radio value="utf8" />
<text class="checkbox-chinese-first-item">UTF-8</text>
<radio value="gbk" checked="true"/>
<text>GBK</text>
</radio-group>
</view>
<view><text class="text-support">技术支持https://eciot.com</text></view>
</view>

130
pages/device/device.wxss Normal file
View File

@@ -0,0 +1,130 @@
/* pages/device.wxss */
.device-container {
height: 100vh;
}
.control-rev{
height: 45px;
display: flex;
align-items: center;
padding: 0 20px;
}
.title-rev {
font-size: 17px;
flex:1;
}
.bt-clear {
width: 55px !important;
height: 29px;
font-size: 14px;
display: flex;
justify-content: center;
align-items: center;
padding: 0;
margin-right: 15px !important;
}
.checkbox-scroll {
font-size: 15px;
display: flex;
align-items: center;
margin-right: 10px;
}
.checkbox-rev-hex {
font-size: 15px;
display: flex;
align-items: center;
}
.scroll-view-container {
margin: 0 20px;
padding: 0 3px 0 5px;
background-color: #F5F5F5;
}
.scroll-view-rev {
height: 150px;
}
.view-rev-gap{
height: 5px;
}
.text-rev {
font-size: 14px;
word-break: break-all;
font-family: Monospace;
}
.control-send{
height: 45px;
display: flex;
align-items: center;
padding: 0 20px;
margin-top: 5px;
}
.title-send {
font-size: 17px;
flex:1;
}
.checkbox-send-hex {
font-size: 15px;
display: flex;
align-items: center;
}
.view-input-send {
margin: 0 20px;
padding: 2px 3px;
background-color: #F5F5F5;
}
.input-send {
height: 84px;
width: 100%;
word-break: break-all;
}
.view-bt-send {
margin: 15px 20px 0px 20px;
display: flex;
}
.bt-send {
flex: 1;
height: 45px;
display: flex;
justify-content: center;
align-items: center;
}
.control-chinese{
height: 45px;
display: flex;
align-items: center;
padding: 0 20px;
margin-top: 5px;
}
.title-chinese{
font-size: 17px;
flex:1;
}
.checkbox-chinese{
font-size: 15px;
display: flex;
align-items: center;
}
.checkbox-chinese-first-item{
margin-right: 10px;
}
.text-support{
font-size: 14px;
color: #909399;
margin-left: 20px;
}

Some files were not shown because too many files have changed in this diff Show More