初始化
1
.cloudbase/container/debug.json
Normal file
@@ -0,0 +1 @@
|
||||
{"containers":[],"config":{}}
|
||||
14
.gitignore
vendored
Normal 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/
|
||||
83
SQL/日志表.sql
Normal 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
@@ -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();
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
206
app.js
Normal file
@@ -0,0 +1,206 @@
|
||||
//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:[],
|
||||
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 = []
|
||||
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
|
||||
|
||||
narr.push(rs)
|
||||
}
|
||||
|
||||
this.globalData.roomIDName=narr
|
||||
|
||||
//console.log(narr)
|
||||
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
58
app.json
Normal file
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"pages": [
|
||||
"pages/autho/index",
|
||||
"pages/login/login",
|
||||
"pages/index/index",
|
||||
"pages/mycenter/index",
|
||||
"pages/logs/logs",
|
||||
"pages/test/test",
|
||||
"pages/Hosts/Hosts",
|
||||
"pages/HostUpgrade/HostUpgrade",
|
||||
"pages/Upgrade/Upgrade"
|
||||
],
|
||||
"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": "你的位置信息将用于记录用户信息~"
|
||||
}
|
||||
}
|
||||
}
|
||||
2
app.wxss
Normal file
@@ -0,0 +1,2 @@
|
||||
@import "colorui/main.wxss";
|
||||
@import "colorui/icon.wxss";
|
||||
184
colorui/animation.wxss
Normal 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)
|
||||
}
|
||||
}
|
||||
54
colorui/components/cu-custom.js
Normal 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',
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
4
colorui/components/cu-custom.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
16
colorui/components/cu-custom.wxml
Normal 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>
|
||||
1
colorui/components/cu-custom.wxss
Normal file
@@ -0,0 +1 @@
|
||||
/* colorui/components/cu-custom.wxss */
|
||||
1226
colorui/icon.wxss
Normal file
3967
colorui/main.wxss
Normal file
144
components/logscom/logscom.js
Normal 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()获取设备及页面高度windowHeight(px)
|
||||
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)
|
||||
}
|
||||
},
|
||||
}
|
||||
})
|
||||
4
components/logscom/logscom.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
30
components/logscom/logscom.wxml
Normal 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>
|
||||
|
||||
2
components/logscom/logscom.wxss
Normal file
@@ -0,0 +1,2 @@
|
||||
@import "../../colorui/main.wxss";
|
||||
@import "../../colorui/icon.wxss";
|
||||
BIN
icon/home.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
icon/home_.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
icon/log.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
icon/log_.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
icon/usercenter.png
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
BIN
icon/usercenter_.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
icon/vacant.png
Normal file
|
After Width: | Height: | Size: 7.1 KiB |
BIN
icon/住宿.png
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
icon/开门.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
icon/设备编号.png
Normal file
|
After Width: | Height: | Size: 6.5 KiB |
BIN
icon/退房.png
Normal file
|
After Width: | Height: | Size: 6.5 KiB |
BIN
icon/酒店.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
icon/重启.png
Normal file
|
After Width: | Height: | Size: 7.8 KiB |
232
lib/RequestingCenter.js
Normal file
@@ -0,0 +1,232 @@
|
||||
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 SetRCULight(params){
|
||||
params.token = gettoken();
|
||||
console.log(params)
|
||||
return await reqeust1({
|
||||
title: null,
|
||||
url: BoonliveUrl + 'SetRCULight',
|
||||
data: params || {}
|
||||
})
|
||||
}
|
||||
18
lib/Toast.js
Normal 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
@@ -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
@@ -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);
|
||||
// })
|
||||
// }
|
||||
420
pages/HostUpgrade/HostUpgrade.js
Normal file
@@ -0,0 +1,420 @@
|
||||
|
||||
|
||||
const app = getApp()
|
||||
function inArray(arr, key, val) {
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
if (arr[i][key] === val) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// ArrayBuffer转16进度字符串示例
|
||||
function ab2hex(buffer) {
|
||||
var hexArr = Array.prototype.map.call(
|
||||
new Uint8Array(buffer),
|
||||
function (bit) {
|
||||
return ('00' + bit.toString(16)).slice(-2)
|
||||
}
|
||||
)
|
||||
return hexArr.join('');
|
||||
}
|
||||
|
||||
|
||||
|
||||
Component({
|
||||
properties: {
|
||||
paramA: Number,
|
||||
paramB: String,
|
||||
// 定义属性,属性值可以是任意类型
|
||||
myProperty: {
|
||||
type: Array,
|
||||
value: {}
|
||||
}
|
||||
},
|
||||
data: {
|
||||
devices: [],
|
||||
connected: false,
|
||||
chs: [],
|
||||
TimerNumber:0,
|
||||
myArray: [],
|
||||
index: null,
|
||||
firmwareName:"这里显示文件名称",
|
||||
devicedisplay:0,
|
||||
dat_filename:"",
|
||||
dat_filePath:"",
|
||||
hex_filename:"",
|
||||
hex_filePath:"",
|
||||
},
|
||||
|
||||
methods: {
|
||||
onLoad: function() {
|
||||
this.data.paramA // 页面参数 paramA 的值
|
||||
this.data.paramB // 页面参数 paramB 的值
|
||||
|
||||
},
|
||||
bindPickerChange: function(e) {
|
||||
console.log('picker发送选择改变,携带值为', e.detail.value)
|
||||
this.setData({
|
||||
index: e.detail.value
|
||||
})
|
||||
},
|
||||
// 初始化蓝牙
|
||||
openBluetoothAdapter() {
|
||||
wx.openBluetoothAdapter({
|
||||
success: (res) => {
|
||||
console.log('openBluetoothAdapter success', res)
|
||||
this.startBluetoothDevicesDiscovery()
|
||||
},
|
||||
fail: (res) => {
|
||||
if (res.errCode === 10001) {
|
||||
wx.onBluetoothAdapterStateChange(function (res) {
|
||||
console.log('onBluetoothAdapterStateChange', res)
|
||||
if (res.available) {
|
||||
this.startBluetoothDevicesDiscovery()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
var _this =this;
|
||||
let num =setTimeout(function(){
|
||||
_this.stopBluetoothDevicesDiscovery()
|
||||
},20000)
|
||||
// console.log('setTimeout'+num)
|
||||
this.setData({
|
||||
TimerNumber: num,
|
||||
})
|
||||
// console.log('setTimeout'+this.data.TimerNumber)
|
||||
},
|
||||
|
||||
|
||||
startBluetoothDevicesDiscovery() {
|
||||
console.log('startBluetoothDevicesDiscovery ')
|
||||
if (this._discoveryStarted) {
|
||||
return
|
||||
}
|
||||
this._discoveryStarted = true
|
||||
wx.startBluetoothDevicesDiscovery({
|
||||
allowDuplicatesKey: true,
|
||||
success: (res) => {
|
||||
console.log('startBluetoothDevicesDiscovery success', res)
|
||||
this.onBluetoothDeviceFound()
|
||||
},
|
||||
fail(res) {
|
||||
console.error('startBluetoothDevicesDiscovery', res)
|
||||
}
|
||||
})
|
||||
},
|
||||
closeBLEConnection() {
|
||||
wx.closeBLEConnection({
|
||||
deviceId: this.data.deviceId
|
||||
})
|
||||
this.setData({
|
||||
connected: false,
|
||||
chs: [],
|
||||
canWrite: false,
|
||||
devicedisplay:-1
|
||||
})
|
||||
},
|
||||
onBluetoothDeviceFound() {
|
||||
// console.log('onBluetoothDeviceFound ')
|
||||
wx.onBluetoothDeviceFound((res) => {
|
||||
// console.log('onBluetoothDeviceFound ',res)
|
||||
res.devices.forEach(device => {
|
||||
if (!device.name && !device.localName) {
|
||||
return
|
||||
}
|
||||
const foundDevices = this.data.devices
|
||||
const idx = inArray(foundDevices, 'deviceId', device.deviceId)
|
||||
const data = {}
|
||||
if (idx === -1) {
|
||||
data[`devices[${foundDevices.length}]`] = device
|
||||
} else {
|
||||
data[`devices[${idx}]`] = device
|
||||
}
|
||||
this.setData(data)
|
||||
})
|
||||
})
|
||||
},
|
||||
getBluetoothAdapterState() {
|
||||
wx.getBluetoothAdapterState({
|
||||
success: (res) => {
|
||||
console.log('getBluetoothAdapterState', res)
|
||||
if (res.discovering) {
|
||||
this.onBluetoothDeviceFound()
|
||||
} else if (res.available) {
|
||||
this.startBluetoothDevicesDiscovery()
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
startBluetoothDevicesDiscovery() {
|
||||
console.log('startBluetoothDevicesDiscovery ')
|
||||
if (this._discoveryStarted) {
|
||||
return
|
||||
}
|
||||
this._discoveryStarted = true
|
||||
wx.startBluetoothDevicesDiscovery({
|
||||
allowDuplicatesKey: true,
|
||||
success: (res) => {
|
||||
console.log('startBluetoothDevicesDiscovery success', res)
|
||||
this.onBluetoothDeviceFound()
|
||||
},
|
||||
fail(res) {
|
||||
console.error('startBluetoothDevicesDiscovery', res)
|
||||
}
|
||||
})
|
||||
},
|
||||
stopBluetoothDevicesDiscovery() {
|
||||
// console.log('setTimeout'+this.data.TimerNumber)
|
||||
|
||||
wx.stopBluetoothDevicesDiscovery()
|
||||
if (this.data.TimerNumber!=0){
|
||||
// console.log('timeoutID'+ this.data.TimerNumber)
|
||||
clearTimeout(this.data.TimerNumber)
|
||||
}
|
||||
|
||||
},
|
||||
createBLEConnection(e) {
|
||||
|
||||
const ds = e.currentTarget.dataset
|
||||
const deviceId = ds.deviceId
|
||||
const name = ds.name
|
||||
|
||||
console.log('createBLEConnection:'+deviceId)
|
||||
wx.createBLEConnection({
|
||||
deviceId,
|
||||
success: (res) => {
|
||||
this.setData({
|
||||
connected: true,
|
||||
name,
|
||||
deviceId,
|
||||
devicedisplay:deviceId,
|
||||
})
|
||||
console.log('kkkkk:'+this.devicedisplay)
|
||||
this.getBLEDeviceServices(deviceId)
|
||||
},
|
||||
fail: (res) => {
|
||||
console.error('createBLEConnection', res.errMsg)
|
||||
}
|
||||
}
|
||||
)
|
||||
this.stopBluetoothDevicesDiscovery()
|
||||
},
|
||||
|
||||
getBLEDeviceServices(deviceId) {
|
||||
wx.getBLEDeviceServices({
|
||||
deviceId,
|
||||
success: (res) => {
|
||||
console.log('getBLEDeviceServices', res.characteristics)
|
||||
for (let i = 0; i < res.services.length; i++) {
|
||||
if (res.services[i].isPrimary) {
|
||||
this.getBLEDeviceCharacteristics(deviceId, res.services[i].uuid)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
getBLEDeviceCharacteristics(deviceId, serviceId) {
|
||||
wx.getBLEDeviceCharacteristics({
|
||||
deviceId,
|
||||
serviceId,
|
||||
success: (res) => {
|
||||
console.log('getBLEDeviceCharacteristics success', res.characteristics)
|
||||
for (let i = 0; i < res.characteristics.length; i++) {
|
||||
let item = res.characteristics[i]
|
||||
|
||||
if (item.properties.read) {
|
||||
console.log('read characteristicId:'+item.uuid, res.errMsg)
|
||||
wx.readBLECharacteristicValue({
|
||||
deviceId,
|
||||
serviceId,
|
||||
characteristicId: item.uuid,
|
||||
})
|
||||
}
|
||||
if (item.properties.write && item.properties.notify) {
|
||||
this.setData({
|
||||
canWrite: true
|
||||
})
|
||||
this._deviceId = deviceId
|
||||
this._serviceId = serviceId
|
||||
this._characteristicId = item.uuid
|
||||
console.log('Write _characteristicId:'+item.uuid, res.errMsg)
|
||||
|
||||
// this.writeBLECharacteristicValue('11223344AABBCC')
|
||||
}
|
||||
if (item.properties.notify || item.properties.indicate) {
|
||||
console.log('notify OR indicate characteristicId:'+item.uuid, res.errMsg)
|
||||
wx.notifyBLECharacteristicValueChange({
|
||||
deviceId,
|
||||
serviceId,
|
||||
characteristicId: item.uuid,
|
||||
state: true,
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
fail(res) {
|
||||
console.error('getBLEDeviceCharacteristics', res)
|
||||
}
|
||||
})
|
||||
// 操作之前先监听,保证第一时间获取数据
|
||||
wx.onBLECharacteristicValueChange((characteristic) => {
|
||||
const idx = inArray(this.data.chs, 'uuid', characteristic.characteristicId)
|
||||
const data = {}
|
||||
if (idx === -1) {
|
||||
data[`chs[${this.data.chs.length}]`] = {
|
||||
uuid: characteristic.characteristicId,
|
||||
value: ab2hex(characteristic.value)
|
||||
}
|
||||
} else {
|
||||
data[`chs[${idx}]`] = {
|
||||
uuid: characteristic.characteristicId,
|
||||
value: ab2hex(characteristic.value)
|
||||
}
|
||||
}
|
||||
// data[`chs[${this.data.chs.length}]`] = {
|
||||
// uuid: characteristic.characteristicId,
|
||||
// value: ab2hex(characteristic.value)
|
||||
// }
|
||||
this.setData(data)
|
||||
})
|
||||
},
|
||||
|
||||
stringToBytes : function(strtxt) {
|
||||
return new TextEncoder().encode(strtxt)
|
||||
},
|
||||
stringToByteArray:function (str) {
|
||||
console.log('str'+str)
|
||||
var array = new Uint8Array(str.length);
|
||||
for (var i = 0; i < str.length; i++) {
|
||||
array[i] = str.charCodeAt(i);
|
||||
console.log('array[i]'+array[i])
|
||||
}
|
||||
return array;
|
||||
} ,
|
||||
chooseMessageFile(e){
|
||||
const ds = e.currentTarget.dataset;
|
||||
const name = ds.name;
|
||||
const _this =this
|
||||
let array = [name]
|
||||
|
||||
|
||||
console.log(_this.properties.paramA)
|
||||
console.log(app.globalData.roomIDName.length)
|
||||
console.log(_this.data.myArray.length)
|
||||
console.log(_this.properties.myProperty.length)
|
||||
|
||||
|
||||
wx.chooseMessageFile({
|
||||
count: 1,
|
||||
type:'file',
|
||||
extension:array,
|
||||
success(res){
|
||||
console.log(res)
|
||||
if (name === '.hex')
|
||||
{
|
||||
console.log('chooseMessageFile True HEX:'+res.tempFiles[0].path)
|
||||
_this.setData({
|
||||
hex_filename:res.tempFiles[0].name,
|
||||
hex_filePath:res.tempFiles[0].path,
|
||||
|
||||
})
|
||||
}
|
||||
else if (name === '.dat') {
|
||||
console.log('chooseMessageFile True DAT:'+res.tempFiles[0].path)
|
||||
_this.setData({
|
||||
dat_filename:res.tempFiles[0].name,
|
||||
dat_filePath:res.tempFiles[0].path,
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
},
|
||||
fail (res) {
|
||||
console.log('Failed to get file', res.errMsg)
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
writeBLECharacteristicValue(sendstr) {
|
||||
// 向蓝牙设备发送一个0x00的16进制数据
|
||||
|
||||
console.log(sendstr)
|
||||
let datebuffer =this.stringToByteArray(sendstr);
|
||||
// console.log('buffer Size:'+buffer.length)
|
||||
|
||||
let buffer = datebuffer.buffer
|
||||
console.log('datebuffer'+datebuffer)
|
||||
// let dataView = new Uint8Array(buffer)
|
||||
// dataView.a
|
||||
console.log('buffer.leng'+buffer.byteLength)
|
||||
console.log('buffer.leng'+buffer)
|
||||
// dataView.setUint8(1,11)
|
||||
// dataView.setUint8(2,16)
|
||||
// dataView.setUint8(3,13)
|
||||
// dataView.setUint8(4,18)
|
||||
// dataView.setUint8(5,12)
|
||||
// dataView.setUint8(6,24)
|
||||
// dataView.setUint8(7,54)
|
||||
// dataView.setUint8(8,34)
|
||||
|
||||
console.log('UUID :'+this._characteristicId)
|
||||
|
||||
wx.writeBLECharacteristicValue({
|
||||
deviceId: this._deviceId,
|
||||
serviceId: this._serviceId,
|
||||
characteristicId: this._characteristicId,
|
||||
value: buffer,
|
||||
success (res) {
|
||||
console.log('writeBLECharacteristicValue success', res.errMsg)
|
||||
},
|
||||
fail (res) {
|
||||
console.log('writeBLECharacteristicValue fail', res.errMsg)
|
||||
}
|
||||
})
|
||||
},
|
||||
writeBLECharacteristicValue1(){
|
||||
this.writeBLECharacteristicValue('1233456789a')
|
||||
},
|
||||
|
||||
closeBluetoothAdapter() {
|
||||
wx.closeBluetoothAdapter()
|
||||
this._discoveryStarted = false
|
||||
},
|
||||
|
||||
|
||||
|
||||
},
|
||||
|
||||
|
||||
|
||||
ready: function () {
|
||||
|
||||
console.log(app.globalData.roomIDName)
|
||||
this.setData({
|
||||
myArray:app.globalData.roomIDName
|
||||
})
|
||||
console.log( this.data.myArray)
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 蓝牙操作
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
})
|
||||
3
pages/HostUpgrade/HostUpgrade.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
||||
117
pages/HostUpgrade/HostUpgrade.wxml
Normal file
@@ -0,0 +1,117 @@
|
||||
<view class="cu-item">
|
||||
<view class="flex align-center bg-gray">
|
||||
|
||||
<view class="flex-sub ">
|
||||
<text >房型:</text>
|
||||
</view>
|
||||
|
||||
<view class="flex-eight " style=" justify-content: center; align-items: center;padding: 5rpx 20rpx;"> <!--padding: 5rpx 30rpx;-->
|
||||
<picker bindchange="bindPickerChange" class="" mode="selector" range="{{myArray}}" >
|
||||
<view class="cu-tag line-cyan basis-xl " style="width: 100%;" >
|
||||
<view class="basis-xxl" style=" text-align: center; ">{{myArray[index]}}</view>
|
||||
<text class=" cuIcon-triangledownfill"style="padding: 5rpx 30rpx;" ></text>
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
|
||||
<view>
|
||||
<button style=" font-size: 28rpx;" data-index="0" bindtap="openBluetoothAdapter" class=" flex-sub cu-btn bg-{{showinfo==0?'green':'grey'}} ">搜索蓝牙</button>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
<view class="flex solid-bottom align-center "style="padding: 8rpx 8rpx;">
|
||||
|
||||
<view class="flex-nine " style="padding: 2rpx 0rpx;display: inline-block;">
|
||||
<view class="flex newcu-tag line-olive" style="padding: 5rpx 5rpx;width: 100%;">
|
||||
<view class=" flex-sub newcu-tag line-olive">
|
||||
<text >固件:</text>
|
||||
</view>
|
||||
<view class=" flex-five newcu-tag line-olive" style="width: 65%;">
|
||||
<text>{{hex_filename}}</text>
|
||||
</view>
|
||||
<view class=" flex-sub newcu-tag line-olive">
|
||||
<view class="newcu-tag line-olive"style="padding: 5rpx 5rpx;">
|
||||
<button class="cu-btn" data-name=".hex" style=" font-size: 24rpx; "bindtap="chooseMessageFile" >···</button>
|
||||
</view>
|
||||
<view class="newcu-tag line-olive" style="padding: 5rpx 5rpx;">
|
||||
<button class="cu-btn"style=" font-size: 24rpx;" >下发</button>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex newcu-tag line-blue" style="padding: 5rpx 5rpx;width: 100%;">
|
||||
<view class=" flex-sub newcu-tag line-blue">
|
||||
<text >配置:</text>
|
||||
</view>
|
||||
<view class=" flex-five newcu-tag line-blue" style="width: 65%;">
|
||||
<text>{{dat_filename}}</text>
|
||||
</view>
|
||||
<view class=" flex-sub newcu-tag line-blue">
|
||||
<view class="newcu-tag line-blue"style="padding: 5rpx 5rpx;">
|
||||
<button class="cu-btn" data-name=".dat" style=" font-size: 24rpx; "bindtap="chooseMessageFile" >···</button>
|
||||
</view>
|
||||
<view class="newcu-tag line-blue" style="padding: 5rpx 5rpx;">
|
||||
<button class="cu-btn"style=" font-size: 24rpx;" >下发</button>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
<view hover-class="device_item_hover" class="flex-twice align-center bg-grey " style="padding: 2rpx 0rpx;display: inline-block;">
|
||||
<view class="flex newcu-tag "style="padding: 5rpx 5rpx;width: 100%;" >获取</view>
|
||||
<view class="flex newcu-tag " style="padding: 5rpx 5rpx;width: 100%;">文件</view>
|
||||
<!-- <button class="bg-grey padding-5 margin-5 " style=" font-size: 38rpx; " data-index="0" bindtap="GetshowinfoClick" >获取\r文件</button> -->
|
||||
</view>
|
||||
</view>
|
||||
<view class=" bg-white">
|
||||
<view class="flex ">
|
||||
<view class="cu-progress round">
|
||||
<view class="bg-green" style="width:{{loading?'80%':''}};"></view>
|
||||
</view>
|
||||
<text class="margin-left">80%</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<view class="flex align-center ">
|
||||
<view class="devices_summary">已发现 {{devices.length}} 个外围设备:</view>
|
||||
<button style=" font-size: 28rpx;" data-index="0" bindtap="openBluetoothAdapter" class=" flex-sub cu-btn bg-{{showinfo==0?'green':'grey'}} ">设置</button>
|
||||
<button style=" font-size: 28rpx;" data-index="0" bindtap="openBluetoothAdapter" class=" flex-sub cu-btn bg-{{showinfo==0?'green':'grey'}} ">通信日志</button>
|
||||
</view>
|
||||
|
||||
<scroll-view class="device_list" scroll-y scroll-with-animation>
|
||||
<view wx:for="{{devices}}" wx:key="index"
|
||||
|
||||
class="device_item cf padding-sm">
|
||||
<view data-device-id="{{item.deviceId}}" data-name="{{item.name || item.localName}}" class="fl flex-eight bg-{{devicedisplay==item.deviceId?'green':'white'}}" bindtap="createBLEConnection" hover-class="device_item_hover" >
|
||||
<view style="font-size: 16px; color: #333;"> {{item.name}}</view>
|
||||
<view style="font-size: 10px">信号强度: {{item.RSSI}}dBm ({{utils.max(0, item.RSSI + 100)}}%)</view>
|
||||
<view style="font-size: 10px">UUID: {{item.deviceId}}</view>
|
||||
<view style="font-size: 10px">Service数量: {{utils.len(item.advertisServiceUUIDs)}}</view>
|
||||
<!-- <view class="bg-gray margin-xs" style="padding:2rpx;"></view> -->
|
||||
</view>
|
||||
<view class="fr flex-twice">
|
||||
<button class="bg-red padding-lg margin-xs radius " style="font-size: 26rpx; " data-index="0" bindtap="closeBLEConnection" wx:if="{{devicedisplay==item.deviceId}}">断开连接</button>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<!-- <view class="connected_info" wx:if="{{connected}}">
|
||||
<view>
|
||||
<text>已连接到 {{name}}</text>
|
||||
<view class="operation">
|
||||
<button wx:if="{{canWrite}}" size="mini" bindtap="writeBLECharacteristicValue1">写数据</button>
|
||||
<button size="mini" bindtap="closeBLEConnection">断开连接</button>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:for="{{chs}}" wx:key="index" style="font-size: 12px; margin-top: 10px;">
|
||||
<view>特性UUID: {{item.uuid}}</view>
|
||||
<view>特性值: {{item.value}}</view>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
|
||||
</view>
|
||||
80
pages/HostUpgrade/HostUpgrade.wxss
Normal file
@@ -0,0 +1,80 @@
|
||||
/* pages/HostUpgrade/HostUpgrade.wxss */@import "../../colorui/main.wxss";
|
||||
@import "../../colorui/icon.wxss";
|
||||
|
||||
.flex-nine
|
||||
{
|
||||
flex: 8;
|
||||
}
|
||||
.flex-five
|
||||
{
|
||||
flex: 5;
|
||||
}
|
||||
|
||||
.newcu-tag{
|
||||
font-size: 32rpx;
|
||||
vertical-align: middle;
|
||||
position: relative;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-sizing: border-box;
|
||||
padding: 0rpx 0rpx;
|
||||
height: 70rpx;
|
||||
font-family: Helvetica Neue, Helvetica, sans-serif;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.newcu-tag[class*="line-"]::after {
|
||||
content: " ";
|
||||
width: 200%;
|
||||
height: 200%;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
border: 1rpx solid currentColor;
|
||||
transform: scale(0.5);
|
||||
transform-origin: 0 0;
|
||||
box-sizing: border-box;
|
||||
border-radius: inherit;
|
||||
z-index: 1;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.devices_summary {
|
||||
margin-top: 2px;
|
||||
padding: 6px;
|
||||
font-size: 16px;
|
||||
}
|
||||
.device_list {
|
||||
height: 500px;
|
||||
margin: 50px 5px;
|
||||
margin-top: 0;
|
||||
border: 1px solid #EEE;
|
||||
border-radius: 5px;
|
||||
width: auto;
|
||||
}
|
||||
.device_item {
|
||||
border-bottom: 1px solid #EEE;
|
||||
padding: 10px;
|
||||
color: #666;
|
||||
}
|
||||
.device_item_hover {
|
||||
background-color: rgba(0, 0, 0, .1);
|
||||
}
|
||||
.connected_info {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
background-color: #F0F0F0;
|
||||
padding: 10px;
|
||||
padding-bottom: 20px;
|
||||
margin-bottom: env(safe-area-inset-bottom);
|
||||
font-size: 14px;
|
||||
min-height: 100px;
|
||||
box-shadow: 0px 0px 3px 0px;
|
||||
}
|
||||
.connected_info .operation {
|
||||
position: absolute;
|
||||
display: inline-block;
|
||||
right: 30px;
|
||||
}
|
||||
|
||||
1477
pages/Hosts/Hosts.js
Normal file
9
pages/Hosts/Hosts.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"loscom": "/components/logscom/logscom",
|
||||
"HostUpgrade":"/pages/HostUpgrade/HostUpgrade",
|
||||
"Upgrade":"/pages/Upgrade/Upgrade"
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
475
pages/Hosts/Hosts.wxml
Normal file
@@ -0,0 +1,475 @@
|
||||
<!-- 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}}" style="height:{{top_height==null?'600rpx':top_height+'px'}} ;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-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="text-left basis-lg">{{Hotelinfo.HotelName}}</view>
|
||||
<view class="basis-sm text-right">房间:</view><view class="basis-lg text-left">{{message[0]}}</view>
|
||||
<view class="basis-sm text-right">MAC地址:</view><view class="basis-lg text-left">{{message[1]}}</view>
|
||||
<view class=" text-left flex-sub text-sm text-gray">房间已经绑定MAC,点击继续将执行扫描绑定;点击取消,将不会执行任何操作~</view>
|
||||
</view>
|
||||
<view class=" bg-white">
|
||||
<view class=" text-left " wx:if="{{Upgradestatus.length>0}}" >升级状态:{{Upgradestatus}}</view>
|
||||
<view class="cu-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="{{input == 0?'GetCode':'ShowInput'}}" >回路调试</view>
|
||||
</view>
|
||||
<view class="cu-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>
|
||||
<!-- 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>
|
||||
0
pages/Hosts/Hosts.wxss
Normal file
118
pages/Upgrade/Upgrade.js
Normal file
@@ -0,0 +1,118 @@
|
||||
import {
|
||||
GetRoomTypeNode
|
||||
} from '../../lib/RequestingCenter.js'
|
||||
|
||||
const app = getApp()
|
||||
|
||||
Component({
|
||||
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
cWidth: { // 属性名
|
||||
type: Number,
|
||||
value: 100,
|
||||
},
|
||||
cheight: { // 属性名
|
||||
type: Number,
|
||||
value: 100,
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
myArray: [],
|
||||
index: -1,
|
||||
dat_filename:"固件文件.dat",
|
||||
hex_filename:"固件文件.Hex",
|
||||
devlist:[],
|
||||
RoomNomber:[],
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
async bindPickerChange(e) {
|
||||
console.log('picker发送选择改变,携带值为', e.detail.value);
|
||||
|
||||
// 更新数据
|
||||
this.setData({
|
||||
index: e.detail.value,
|
||||
});
|
||||
let strbuf= this.data. myArray[e.detail.value].split('|')
|
||||
|
||||
|
||||
|
||||
try {
|
||||
// 调用 GetRoomTypeNode
|
||||
const res = await GetRoomTypeNode({
|
||||
hotelid: app.globalData.HotelId,
|
||||
roomTypeID: strbuf[0],
|
||||
});
|
||||
|
||||
// 调用全局方法
|
||||
// await app.SetroontypeListindex(res);
|
||||
|
||||
// // 更新数据
|
||||
// this.setData({
|
||||
// roomtype: app.globalData.roomIDName,
|
||||
// });
|
||||
|
||||
console.log(res);
|
||||
} catch (err) {
|
||||
console.log('GetRoomTypeNode error', err);
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
// 组件生命周期
|
||||
pageLifetimes: {
|
||||
show: function() {
|
||||
console.log('页面被展示')
|
||||
},
|
||||
hide: function() {
|
||||
console.log('页面被隐藏')
|
||||
},
|
||||
resize: function(size) {
|
||||
console.log('页面尺寸变化')
|
||||
},
|
||||
|
||||
},
|
||||
lifetimes:{
|
||||
show: function() {
|
||||
debugger
|
||||
console.log('picker发送选择改变,携带值为')
|
||||
},
|
||||
ready: function () {
|
||||
debugger
|
||||
console.log(app.globalData.roomIDName)
|
||||
this.setData({
|
||||
myArray:app.globalData.roomIDName
|
||||
})
|
||||
|
||||
console.log( this.data.myArray)
|
||||
},
|
||||
attached: function() {
|
||||
// // 在组件实例进入页面节点树时执行
|
||||
// debugger
|
||||
// console.log(app.globalData.roomIDName)
|
||||
// this.setData({
|
||||
// myArray:app.globalData.roomIDName
|
||||
// })
|
||||
// console.log( this.data.myArray)\
|
||||
|
||||
|
||||
|
||||
},
|
||||
detached: function() {
|
||||
// 在组件实例被从页面节点树移除时执行
|
||||
console.log('在组件实例被从页面节点树移除时执行')
|
||||
}
|
||||
},
|
||||
|
||||
})
|
||||
3
pages/Upgrade/Upgrade.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
||||
72
pages/Upgrade/Upgrade.wxml
Normal file
@@ -0,0 +1,72 @@
|
||||
<view style="height:100%;Width:100%;background: aquamarine;" >
|
||||
<!-- 房型 -->
|
||||
<view class="flex align-center bg-gray">
|
||||
<view class=" ">
|
||||
<text >房型:</text>
|
||||
</view>
|
||||
<view class="flex-eight " style=" justify-content: center; align-items: center;padding: 5rpx 20rpx;">
|
||||
<picker class="" mode="selector" range="{{myArray}}" bindchange="bindPickerChange">
|
||||
<view class="cu-tag line-cyan basis-xl " style="width: 100%;" >
|
||||
<view class="basis-xxl" style=" text-align: center; ">{{myArray[index]}}</view>
|
||||
<text class="cuIcon-triangledownfill"style="padding: 5rpx 30rpx;" ></text>
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 房型下的信息 -->
|
||||
<view class="flex align-start bg-gray setborder line-grey">
|
||||
<view class="flex-sub " style="height: 100rpx;" >
|
||||
<checkbox style="top:25%;left: 12%;"></checkbox>
|
||||
</view>
|
||||
<view class="flex-sub " style="height: 100rpx" >
|
||||
<view class="flex-sub title setborder line-grey" style="height: 50rpx">固件</view>
|
||||
<view class="flex-sub title setborder line-grey" style="height: 50rpx">配置</view>
|
||||
</view>
|
||||
<view class="flex-xis" style="height: 100rpx" >
|
||||
<view class="flex-xis title setborder line-grey" style="height: 50rpx">
|
||||
<text>{{dat_filename}}</text>
|
||||
</view>
|
||||
<view class="flex-xis title setborder line-grey" style="height: 50rpx">
|
||||
<text>{{hex_filename}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-subN " style="height: 100rpx" >
|
||||
<button class="cu-btn setborder line-blue"style=" font-size: 25rpx;height: 50rpx" >升级</button>
|
||||
<button class="cu-btn setborder line-blue"style=" font-size: 25rpx;height: 50rpx" >升级</button>
|
||||
</view>
|
||||
<view class="flex-subN " style="height: 100rpx" >
|
||||
<button class="cu-btn setborder line-grey"style=" font-size: 25rpx;height: 100rpx" >设置</button>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 房型下的各个房号信息 -->
|
||||
<view>
|
||||
<view class="flex align-center " style="height: 50rpx;">
|
||||
<view class="devices_summary">已升级设备{{devlist.length}}:</view>
|
||||
<button style=" font-size: 18rpx;" data-index="0" bindtap="openBluetoothAdapter" class=" flex-sub newcu-btn bg-{{showinfo==0?'green':'grey'}} ">设置</button>
|
||||
<button style=" font-size: 18rpx;" data-index="0" bindtap="openBluetoothAdapter" class=" flex-sub newcu-btn bg-{{showinfo==0?'green':'grey'}} ">通信日志</button>
|
||||
</view>
|
||||
|
||||
<scroll-view class="device_list" scroll-y scroll-with-animation>
|
||||
<view wx:for="{{devices}}" wx:key="index"
|
||||
|
||||
class="device_item cf padding-sm">
|
||||
<view data-device-id="{{item.deviceId}}" data-name="{{item.name || item.localName}}" class="fl flex-eight bg-{{devicedisplay==item.deviceId?'green':'white'}}" bindtap="createBLEConnection" hover-class="device_item_hover" >
|
||||
<view style="font-size: 16px; color: #333;"> {{item.name}}</view>
|
||||
<view style="font-size: 10px">信号强度: {{item.RSSI}}dBm ({{utils.max(0, item.RSSI + 100)}}%)</view>
|
||||
<view style="font-size: 10px">UUID: {{item.deviceId}}</view>
|
||||
<view style="font-size: 10px">Service数量: {{utils.len(item.advertisServiceUUIDs)}}</view>
|
||||
<!-- <view class="bg-gray margin-xs" style="padding:2rpx;"></view> -->
|
||||
</view>
|
||||
<view class="fr flex-twice">
|
||||
<button class="bg-red padding-lg margin-xs radius " style="font-size: 26rpx; " data-index="0" bindtap="closeBLEConnection" wx:if="{{devicedisplay==item.deviceId}}">断开连接</button>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
</view>
|
||||
24
pages/Upgrade/Upgrade.wxss
Normal file
@@ -0,0 +1,24 @@
|
||||
@import "../../colorui/main.wxss";
|
||||
@import "../../colorui/icon.wxss";
|
||||
.setborder
|
||||
{
|
||||
border: 1rpx solid currentColor;
|
||||
}
|
||||
.newcu-btn {
|
||||
position: relative;
|
||||
border: 0rpx;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-sizing: border-box;
|
||||
padding: 0 20rpx;
|
||||
font-size: 20rpx;
|
||||
height: 50rpx;
|
||||
line-height: 1;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
overflow: visible;
|
||||
margin-left: initial;
|
||||
transform: translate(0rpx, 0rpx);
|
||||
margin-right: initial;
|
||||
}
|
||||
103
pages/autho/index.js
Normal 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
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
||||
7
pages/autho/index.wxml
Normal 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
@@ -0,0 +1 @@
|
||||
/* pages/autho/index.wxss */
|
||||
99
pages/index/index.js
Normal file
@@ -0,0 +1,99 @@
|
||||
// index.js
|
||||
// 获取应用实例
|
||||
const app = getApp()
|
||||
Page({
|
||||
data: {
|
||||
userInfo: null,
|
||||
autho: null,
|
||||
selectGroupIndex: -1,
|
||||
ishotel: false,
|
||||
hotelIndex: -1,
|
||||
issel:false
|
||||
},
|
||||
///选择酒店
|
||||
SelHotel: function (e) {
|
||||
let index = e.currentTarget.dataset['index'];
|
||||
this.setData({
|
||||
hotelIndex: index
|
||||
})
|
||||
wx.setStorageSync(this.data.userInfo.Id + '_xiaoxi_hotelId', this.data.autho[this.data.selectGroupIndex].Hotels[this.data.hotelIndex].HotelId)
|
||||
},
|
||||
//确定选择酒店
|
||||
ShowSelHotel: function (e) {
|
||||
let id = e.currentTarget.dataset['id'];
|
||||
if(id==-1){
|
||||
id = this.data.autho[this.data.selectGroupIndex].Hotels[this.data.hotelIndex].HotelId;
|
||||
}
|
||||
if(this.data.hotelIndex>=0){
|
||||
wx.navigateTo({
|
||||
url: '/pages/Hosts/Hosts?HotelId=' + id
|
||||
})
|
||||
}else{
|
||||
app.toast(2,'未选择酒店')
|
||||
}
|
||||
},
|
||||
//选择酒店组
|
||||
bindgroup: function (e) {
|
||||
let index = e.currentTarget.dataset['index']
|
||||
this.setData({
|
||||
selectGroupIndex: index,
|
||||
hotelIndex: 0,
|
||||
ishotel: true
|
||||
})
|
||||
wx.setStorageSync(this.data.userInfo.Id + '_xiaoxi_hotelId', this.data.autho[this.data.selectGroupIndex].Hotels[this.data.hotelIndex].HotelId)
|
||||
wx.setStorageSync(this.data.userInfo.Id + '_xiaoxi_selectGroupId', this.data.autho[this.data.selectGroupIndex].HotelGroupsId)
|
||||
},
|
||||
//登录
|
||||
onLoad: async function (option) {
|
||||
this.setData({
|
||||
userInfo: app.globalData.userinfo,
|
||||
autho: app.globalData.autho
|
||||
})
|
||||
if (this.data.userInfo == null) {
|
||||
app.checkLoginReadyCallback = res => {
|
||||
this.setData({
|
||||
userInfo: app.globalData.userinfo,
|
||||
autho: app.globalData.autho
|
||||
})
|
||||
this.ReaSel()
|
||||
};
|
||||
} else {
|
||||
this.ReaSel()
|
||||
}
|
||||
|
||||
},
|
||||
//读取历史选择酒店
|
||||
ReaSel: function () {
|
||||
let _xiaoxi_hotelId = wx.getStorageSync(this.data.userInfo.Id + '_xiaoxi_hotelId')
|
||||
let _xiaoxi_selectGroupId = wx.getStorageSync(this.data.userInfo.Id + '_xiaoxi_selectGroupId')
|
||||
let _xiaoxi_selectGroupIndex = -1;
|
||||
let _xiaoxi_hotelIndex = -1;
|
||||
this.data.autho.forEach((element, index) => {
|
||||
if (element.HotelGroupsId == _xiaoxi_selectGroupId) {
|
||||
_xiaoxi_selectGroupIndex = index;
|
||||
element.Hotels.forEach((elements, indexs) => {
|
||||
if (elements.HotelId == _xiaoxi_hotelId) {
|
||||
_xiaoxi_hotelIndex = indexs;
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
this.setData({
|
||||
selectGroupIndex: _xiaoxi_selectGroupIndex,
|
||||
hotelIndex: _xiaoxi_hotelIndex
|
||||
})
|
||||
//非选择 读取上次进行跳转
|
||||
if(!this.data.issel && this.data.hotelIndex>-1){
|
||||
wx.navigateTo({
|
||||
url: '/pages/Hosts/Hosts?HotelId='+this.data.autho[this.data.selectGroupIndex].Hotels[this.data.hotelIndex].HotelId
|
||||
})
|
||||
}
|
||||
// console.log(this.data.autho.length==1 && this.data.autho[0].Hotels.length==1 && option.issel!=0)
|
||||
//非选择 如果只有一个酒店就直接进行跳转
|
||||
if(this.data.autho.length==1 && this.data.autho[0].Hotels.length==1 && !this.data.issel){
|
||||
wx.navigateTo({
|
||||
url: '/pages/Hosts/Hosts?HotelId='+this.data.autho[0].Hotels[0].HotelId
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
3
pages/index/index.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
||||
38
pages/index/index.wxml
Normal file
@@ -0,0 +1,38 @@
|
||||
<cu-custom bgColor="bg-gradual-blue" >
|
||||
<block bindtap="" slot="backText" >返回</block>
|
||||
<view slot="content">BLV</view>
|
||||
</cu-custom>
|
||||
<view class="padding-sm bg-white radius shadow shadow-lg">
|
||||
<view id="groups">
|
||||
<view class="text-xl" wx:if="{{hotelIndex>=0}}">
|
||||
<!-- {{autho[selectGroupIndex].HotelGroupsName}} {{autho[selectGroupIndex].Hotels[hotelIndex].HotelId}}- -->
|
||||
<text class="text-green">{{autho[selectGroupIndex].Hotels[hotelIndex].Code}}:{{autho[selectGroupIndex].Hotels[hotelIndex].HotelName}}</text>
|
||||
<button wx:if="{{hotelIndex>=0}}" data-id="-1" class="cu-btn line-green margin-left" bindtap="ShowSelHotel">确定</button>
|
||||
<button wx:if="{{issel != false}}" data-id="{{issel}}" class="cu-btn line-green margin-left" bindtap="ShowSelHotel">返回</button>
|
||||
</view>
|
||||
<view wx:if="{{hotelIndex<0}}" >
|
||||
<button class="cu-btn bg-green margin-xs">请选择酒店</button>
|
||||
</view>
|
||||
<view class="text-black text-lg margin-left-xs" wx:if="{{autho.length>0}}">
|
||||
酒店组信息
|
||||
</view>
|
||||
<view class="grid col-3" wx:if="{{autho.length>0}}">
|
||||
<view class="padding-xs" bindtap="bindgroup" data-index="{{idx}}" wx:for="{{autho}}" wx:for-index="idx" wx:for-item="item" >
|
||||
<button style="width:100%;" class="cu-btn bg-{{selectGroupIndex==idx?'green':'grey'}}">{{item.HotelGroupsName}}({{item.Hotels.length}})</button>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{autho.length==0}}" class="text-red margin-left-xs" >
|
||||
暂无相关酒店信息
|
||||
</view>
|
||||
</view>
|
||||
<view id="hotels" wx:if="{{selectGroupIndex>-1}}" class="margin-top">
|
||||
<view class="text-black text-xl">
|
||||
<!-- 选择酒店 -->
|
||||
<view class="grid col-4 text-center ">
|
||||
<view bindtap="SelHotel" data-index="{{idx}}" wx:for="{{autho[selectGroupIndex].Hotels}}" wx:for-index="idx" wx:for-item="item" >
|
||||
<view style="font:bold;white-space: nowrap;overflow: hidden;" class="{{hotelIndex == idx?'text-green':''}} text-df bg-gray padding-xs margin-xs" >{{item.HotelName}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
0
pages/index/index.wxss
Normal file
115
pages/login/login.js
Normal file
@@ -0,0 +1,115 @@
|
||||
// pages/login.js
|
||||
// app.js
|
||||
const app = getApp()
|
||||
import {
|
||||
settoken,
|
||||
Login
|
||||
} from '../../lib/RequestingCenter.js'
|
||||
Page({
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
login:false,
|
||||
islong:false,
|
||||
Uid:null,
|
||||
Pwd:null
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
},
|
||||
getwxlogin:function(){
|
||||
app.toast(2,"暂未开放!");
|
||||
},
|
||||
//验证
|
||||
submitForm(e) {
|
||||
let that = this;
|
||||
let type = e.currentTarget.dataset['type']
|
||||
if(type=="1"){
|
||||
that.setData({
|
||||
islong:true
|
||||
})
|
||||
}
|
||||
if(this.data.Uid == null || this.data.Uid=="" || this.data.Pwd == ""|| this.data.Pwd == null){
|
||||
app.toast(2,"数据不完整")
|
||||
}else {
|
||||
Login({Pwd:that.data.Pwd,islong:that.data.islong,Uid:that.data.Uid}).then(res=>{
|
||||
if(res.Status==200){
|
||||
settoken(res.Data.token)
|
||||
console.log("------------------------------------------")
|
||||
// console.log(res)
|
||||
if(that.data.islong){
|
||||
wx.setStorageSync('xiaoxi_token', res.Data.token)
|
||||
}
|
||||
res.Data.userinfo.HeadImg = app.globalData.ImgUrl.replace("ImgUrl",res.Data.userinfo.HeadImg)
|
||||
app.globalData.userinfo = res.Data.userinfo,
|
||||
// console.log(res.Data.userinfo)
|
||||
app.globalData.autho = res.Data.autho
|
||||
// console.log(res.Data.autho)
|
||||
// console.log("------------------------------------------")
|
||||
app.toast(1,"登录成功",wx.reLaunch({
|
||||
url: "/pages/index/index",
|
||||
}))
|
||||
}else{
|
||||
app.toast(2,res.Message||"网络繁忙")
|
||||
}
|
||||
},err=>{
|
||||
app.toast(2,"网络繁忙")
|
||||
}
|
||||
).catch(
|
||||
err => {
|
||||
console.log(err)
|
||||
app.toast("异常",'error')
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
//登录
|
||||
getlogin:function(){
|
||||
this.setData({
|
||||
login:true
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
},
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
},
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
}
|
||||
})
|
||||
2
pages/login/login.json
Normal file
@@ -0,0 +1,2 @@
|
||||
{
|
||||
}
|
||||
48
pages/login/login.wxml
Normal file
@@ -0,0 +1,48 @@
|
||||
<cu-custom bgColor="bg-cyan">
|
||||
<view slot="content">BLV</view>
|
||||
</cu-custom>
|
||||
<!-- 选择按钮 -->
|
||||
<view wx:if="{{!login}}" class="padding " >
|
||||
<view class="flex justify-center">
|
||||
<!-- 辅助布局 -->
|
||||
<view class="flex-sub padding-sm margin-xs radius"></view>
|
||||
<!-- 辅助布局 -->
|
||||
<view class="flex-treble bg-cyan padding-sm margin-xs radius text-center" bindtap="getlogin">账号密码登录</view>
|
||||
<!-- 辅助布局 -->
|
||||
<view class="flex-sub padding-sm margin-xs radius"></view>
|
||||
<!-- 辅助布局 -->
|
||||
</view>
|
||||
<view class="flex">
|
||||
<!-- 辅助布局 -->
|
||||
<view class="flex-sub padding-sm margin-xs radius"></view>
|
||||
<!-- 辅助布局 -->
|
||||
<view class="flex-treble bg-green padding-sm margin-xs radius text-center" bindtap="getwxlogin">微信登录</view>
|
||||
<!-- 辅助布局 -->
|
||||
<view class="flex-sub padding-sm margin-xs radius"></view>
|
||||
<!-- 辅助布局 -->
|
||||
</view>
|
||||
</view>
|
||||
<!-- 密码账号登录 -->
|
||||
<view wx:if="{{login}}" class="padding " >
|
||||
<view class="flex justify-center text-center">
|
||||
<view class="flex-treble padding-sm margin-xs ">
|
||||
<form>
|
||||
<view class="cu-form-group margin-top">
|
||||
<view class="title">账号</view>
|
||||
<input placeholder="请输入账号" model:value="{{Uid}}" ></input>
|
||||
</view>
|
||||
<view class="cu-form-group">
|
||||
<view class="title">密码</view>
|
||||
<input type="password" placeholder="请输入密码" model:value="{{Pwd}}" ></input>
|
||||
</view>
|
||||
</form>
|
||||
<view>
|
||||
<button class="cu-btn bg-cyan margin lg" data-type="0" bindtap="submitForm">临时登录</button>
|
||||
<button class="cu-btn bg-cyan margin-top lg" data-type="1" bindtap="submitForm">长期登录</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
<mp-toptips msg="{{error}}" type="error" show="{{error}}"></mp-toptips>
|
||||
0
pages/login/login.wxss
Normal file
314
pages/logs/logs.js
Normal file
@@ -0,0 +1,314 @@
|
||||
const app = getApp()
|
||||
//导入日志信息请求发方法
|
||||
import {
|
||||
Logsinfo
|
||||
} from '../../lib/RequestingCenter.js'
|
||||
var util = require('../../utils/util.js')
|
||||
// pages/logs/logs.js
|
||||
Page({
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
// 查询类型
|
||||
apptype:-1,
|
||||
// 时间范围 4 今日
|
||||
seltime:4,
|
||||
// 起始时间
|
||||
starttime:"",
|
||||
// 结束时间
|
||||
endtime:"",
|
||||
//正加载
|
||||
status:0,
|
||||
page:1,
|
||||
logsdata:[],
|
||||
//总数
|
||||
sum:0,
|
||||
//过滤后
|
||||
filtcount:0,
|
||||
//每次加载数量
|
||||
pagelength:10,
|
||||
//swview高度
|
||||
topheight: 0,
|
||||
//是否下拉
|
||||
refresher:false,
|
||||
// 酒店
|
||||
Hotels:[],
|
||||
// 下拉框的酒店
|
||||
Hotelslist:[],
|
||||
// 下拉框的索引
|
||||
index:0,
|
||||
//名字搜素
|
||||
name:''
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad:async function (options) {
|
||||
//测试无需登录
|
||||
if(app.globalData.userinfo==null){
|
||||
wx.reLaunch({
|
||||
url: "../autho/index",
|
||||
})
|
||||
return;
|
||||
}
|
||||
let that = this;
|
||||
//酒店信息
|
||||
let Hotels =[];
|
||||
let Hotelslist =[]
|
||||
Hotelslist.push("全部酒店");
|
||||
let autho = app.globalData.autho
|
||||
autho.forEach((x)=>{
|
||||
x.Hotels.forEach(z=>{
|
||||
Hotels.push(z);
|
||||
Hotelslist.push(z.HotelName);
|
||||
})
|
||||
})
|
||||
that.setData({
|
||||
Hotels :Hotels,
|
||||
Hotelslist:Hotelslist
|
||||
})
|
||||
setTimeout(function () {
|
||||
try {
|
||||
// 1.使用wx.createSelectorQuery()查询到需要滚动到的元素位置
|
||||
wx.createSelectorQuery().select('#scroll').boundingClientRect(res => {
|
||||
// 2.使用wx.getSysTemInfo()获取设备及页面高度windowHeight(px)
|
||||
wx.getSystemInfo({
|
||||
success(ress) {
|
||||
that.setData({
|
||||
topheight: ress.windowHeight - res.top
|
||||
})
|
||||
}
|
||||
})
|
||||
}).exec(function (params) {
|
||||
console.log(params)
|
||||
})
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
}, 100)
|
||||
that.init();
|
||||
},
|
||||
sreach:function(params) {
|
||||
this.setData({
|
||||
page:1
|
||||
})
|
||||
this.init();
|
||||
},
|
||||
/**
|
||||
* 下拉选择酒店
|
||||
*/
|
||||
bindPickerChange:function (e) {
|
||||
this.setData({
|
||||
index: e.detail.value,
|
||||
page:1
|
||||
})
|
||||
this.init();
|
||||
},
|
||||
bindTimeChange:function (e) {
|
||||
if(e.target.dataset.type==1){
|
||||
this.setData({
|
||||
seltime:5,
|
||||
starttime: e.detail.value,
|
||||
page:1
|
||||
})
|
||||
}else{
|
||||
this.setData({
|
||||
seltime:5,
|
||||
endtime: e.detail.value,
|
||||
page:1
|
||||
})
|
||||
}
|
||||
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;
|
||||
}
|
||||
let s = this.data.page+1;
|
||||
this.setData({
|
||||
status:1,
|
||||
page:s
|
||||
})
|
||||
this.init();
|
||||
},
|
||||
//加载数据
|
||||
init:async function () {
|
||||
try {
|
||||
if(this.data.page<1){
|
||||
this.setData({
|
||||
page:1
|
||||
})
|
||||
}
|
||||
let that = this;
|
||||
let search = {name:that.data.name,endtime:that.data.endtime,starttime:that.data.starttime,hotelsid:''};
|
||||
let index = this.data.index -1;
|
||||
if(index>=0){
|
||||
search.hotelsid= that.data.Hotels[index].HotelId
|
||||
}
|
||||
await Logsinfo({
|
||||
page:that.data.page,
|
||||
search:search,
|
||||
length:that.data.pagelength,
|
||||
AppType:that.data.apptype
|
||||
}).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;
|
||||
}
|
||||
if(res.Data.filtcount<=0){
|
||||
newdata = [];
|
||||
}
|
||||
that.setData({
|
||||
refresher: false,
|
||||
logsdata: newdata,
|
||||
status: more,
|
||||
filtcount:res.Data.filtcount,
|
||||
sum: res.Data.sum
|
||||
})
|
||||
} 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)
|
||||
}
|
||||
},
|
||||
selapptype:function (e) {
|
||||
let sel =Number(e.target.dataset.val) ;
|
||||
this.setData({
|
||||
apptype: sel,
|
||||
page:1
|
||||
})
|
||||
this.init();
|
||||
},
|
||||
// 时间选择
|
||||
seltime:function (e) {
|
||||
let sel =Number(e.target.dataset.val) ;
|
||||
let starttime = util.formatTime(new Date()).split(' ')[0];
|
||||
let endtime = util.formatTime(new Date()).split(' ')[0];
|
||||
switch (sel) {
|
||||
case 2:
|
||||
let time = this.getThisWeekData();
|
||||
|
||||
starttime = time.start_day;//显示周一
|
||||
endtime = time.end_day;//显示周日
|
||||
break;
|
||||
case 3:
|
||||
starttime = util.getCurrentMonthFirst(new Date())
|
||||
endtime = util.getCurrentMonthLast(new Date())
|
||||
break;
|
||||
case 4:
|
||||
starttime = ""
|
||||
endtime = ""
|
||||
break;
|
||||
}
|
||||
this.setData({
|
||||
seltime: sel,
|
||||
starttime:starttime,
|
||||
endtime:endtime,
|
||||
page:1
|
||||
})
|
||||
this.init();
|
||||
|
||||
},
|
||||
getThisWeekData:function () {//获得本周周一~周日的年月日
|
||||
var thisweek = {};
|
||||
var date = new Date();
|
||||
// 本周一的日期
|
||||
date.setDate(date.getDate() - date.getDay() + 1);
|
||||
thisweek.start_day = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate() ;
|
||||
|
||||
// 本周日的日期
|
||||
date.setDate(date.getDate() + 6);
|
||||
thisweek.end_day = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate();
|
||||
return thisweek;
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
// this.init();
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
||||
3
pages/logs/logs.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
||||
79
pages/logs/logs.wxml
Normal file
@@ -0,0 +1,79 @@
|
||||
<!-- 过滤器 -->
|
||||
<wxs module="filter" src="../../utils/filters.wxs"></wxs>
|
||||
<cu-custom bgColor="bg-gradual-blue" >
|
||||
<block bindtap="" slot="backText" >返回</block>
|
||||
<view slot="content">操作日志</view>
|
||||
</cu-custom>
|
||||
<view class="padding-sm bg-white radius shadow shadow-lg" style="padding-bottom:0;">
|
||||
<view class="flex flex-wrap">
|
||||
<view class="basis-xl text-df padding-top-xs ">
|
||||
操作日志共{{sum}}条
|
||||
<text class="padding-right"></text>过滤后{{filtcount}}条
|
||||
</view>
|
||||
|
||||
<view style="flex-basis:100% " class="flex padding-top-xs">
|
||||
<view class="margin-right-xs text-df">酒店:</view>
|
||||
<picker class="text-df" mode="selector" value="{{index}}" bindchange="bindPickerChange" range="{{Hotelslist}}">
|
||||
<view class="picker text-green" >
|
||||
{{Hotelslist[index]}}
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
|
||||
<!-- 人脸机筛选 -->
|
||||
<view style="flex-basis:100% " class="flex padding-top-xs">
|
||||
<view bindtap="selapptype" data-val="-1" class="padding-right padding-left {{apptype==-1?'bg-green':''}} margin-right-xs text-df">全部</view>
|
||||
<view bindtap="selapptype" data-val="0" class="padding-right padding-left {{apptype==0?'bg-green':''}} margin-right-xs text-df">RCU主机绑定信息</view>
|
||||
<view bindtap="selapptype" data-val="1" class="padding-right padding-left {{apptype==1?'bg-green':''}} margin-right-xs text-df">人脸机绑定信息</view>
|
||||
</view>
|
||||
|
||||
<!-- 时间筛选 -->
|
||||
<view style="flex-basis:100% " class="flex padding-top-xs">
|
||||
<view bindtap="seltime" data-val="4" class="padding-right padding-left {{seltime==4?'bg-green':''}} margin-right-xs text-df">全部</view>
|
||||
<view bindtap="seltime" data-val="1" class="padding-right padding-left {{seltime==1?'bg-green':''}} margin-right-xs text-df">今日</view>
|
||||
<view bindtap="seltime" data-val="2" class="padding-right padding-left {{seltime==2?'bg-green':''}} margin-right-xs text-df">本周</view>
|
||||
<view bindtap="seltime" data-val="3" class="padding-right padding-left {{seltime==3?'bg-green':''}} margin-right-xs text-df">本月</view>
|
||||
<view bindtap="seltime" data-val="5" class="padding-right padding-left {{seltime==5?'bg-green':''}} margin-right-xs text-df">指定时间</view>
|
||||
</view>
|
||||
|
||||
<view style="flex-basis:100% " class="flex padding-top-xs">
|
||||
<view class="margin-right-xs text-df">起始时间:</view>
|
||||
<picker mode="date" class="text-df" data-type = "1" bindchange="bindTimeChange" :value="starttime" >
|
||||
<view class="picker text-green">
|
||||
{{starttime==""?"请选择":starttime}}
|
||||
</view>
|
||||
</picker>
|
||||
<view class="margin-left-sm margin-right-xs text-df">截止时间:</view>
|
||||
<picker start="{{starttime}}" mode="date" class="text-df" bindchange="bindTimeChange" data-type="2" :value="endtime" >
|
||||
<view class="picker text-green">
|
||||
{{endtime==""?"请选择":endtime}}
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
<view style="flex-basis:100% " class="flex padding-top-xs align-center">
|
||||
<view class="margin-right-xs text-df">用户名:</view>
|
||||
<input style="border-bottom: 2rpx solid #ccc !important;" class="text-df padding-right padding-left margin-right-xs" placeholder="搜索用户" name="input" model:value="{{name}}"></input>
|
||||
<view bindtap="sreach" class="padding-right padding-left bg-green text-df">搜素</view>
|
||||
</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>
|
||||
1
pages/logs/logs.wxss
Normal file
@@ -0,0 +1 @@
|
||||
/* pages/logs/logs.wxss */
|
||||
81
pages/mycenter/index.js
Normal file
@@ -0,0 +1,81 @@
|
||||
// pages/mycenter/index.js
|
||||
const app = getApp()
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
userInfo: null,
|
||||
},
|
||||
//退出登录
|
||||
LoginOut(){
|
||||
wx.removeStorage({
|
||||
key: 'xiaoxi_token',
|
||||
success (res) {
|
||||
wx.reLaunch({
|
||||
url: "../login/login",
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
this.setData({
|
||||
userInfo: app.globalData.userinfo,
|
||||
autho: app.globalData.autho
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
||||
3
pages/mycenter/index.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
||||
33
pages/mycenter/index.wxml
Normal file
@@ -0,0 +1,33 @@
|
||||
<!--pages/mycenter/index.wxml-->
|
||||
<cu-custom bgColor="bg-gradual-blue">
|
||||
<view slot="content">个人中心</view>
|
||||
</cu-custom>
|
||||
<view class="padding-sm bg-white radius shadow shadow-lg" >
|
||||
<!-- 用户头像系列 -->
|
||||
<view class="flex padding flex-wrap" style="width:100%">
|
||||
<view class="flex align-center justify-center text-center" style="width:100%">
|
||||
<view class="cu-avatar round xl" style="background-image:url({{userInfo.HeadImg}})"></view>
|
||||
</view>
|
||||
<view class="text-lg text-center padding-sm text-green" style="width:100%">{{userInfo.Uid}}</view>
|
||||
</view>
|
||||
<!-- 功能区域 -->
|
||||
<view class="padding-xl">
|
||||
<form>
|
||||
<view class="cu-form-group ">
|
||||
<view class="flex justify-between" style="width:100%">
|
||||
<view class="text-df">我的反馈</view>
|
||||
<view class="cu-capsule round">
|
||||
<view class='cu-tag bg-red light'>{{userInfo.error.length || 0}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cu-form-group ">
|
||||
<view class="flex justify-between" bindtap="LoginOut" style="width:100%">
|
||||
<view class="text-df">退出登录</view>
|
||||
</view>
|
||||
</view>
|
||||
</form>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
0
pages/mycenter/index.wxss
Normal file
647
pages/test/test.js
Normal file
@@ -0,0 +1,647 @@
|
||||
const app = getApp()
|
||||
//导入测试请求发方法
|
||||
import {
|
||||
OpenDoorTest,
|
||||
RestartTheDevice,
|
||||
GeteDeviceInfomation,
|
||||
DeletePeopleFromDeviceByGroup,
|
||||
GetThePeopleListOfDevice,
|
||||
openRommCheckin,
|
||||
roomCheckOut,GetFaceSN
|
||||
} from '../../lib/RequestingCenter.js'
|
||||
// pages/test/test.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
imgList:[],
|
||||
cout:1,
|
||||
isbut:false,
|
||||
isbuts:false,
|
||||
count:1,
|
||||
//测试信息
|
||||
sn:"",
|
||||
hid:"",
|
||||
HotelId:"",
|
||||
HotelName:"",
|
||||
Roomid:"",
|
||||
openUserName:"李四",
|
||||
openUserID:"123456789456123456",
|
||||
openUserSex:"1",
|
||||
outUserName:"",
|
||||
outUserID:"",
|
||||
imgurl:"",
|
||||
openUserTel:"15915641569",
|
||||
RoomNO:"",
|
||||
faceadd:""
|
||||
},
|
||||
isCard(e) {
|
||||
|
||||
if(this.data.isCardds==this.data.isCard){
|
||||
this.setData({
|
||||
isCard: e.detail.value,
|
||||
isCardds:!e.detail.value
|
||||
})
|
||||
}else{
|
||||
this.setData({
|
||||
isCard: e.detail.value,
|
||||
isCardds:""
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// this.setData({
|
||||
// isCard: e.detail.value
|
||||
// })
|
||||
},
|
||||
|
||||
isCardds(e){
|
||||
if(this.data.isCardds==this.data.isCard){
|
||||
this.setData({
|
||||
isCard: !e.detail.value,
|
||||
isCardds:e.detail.value
|
||||
})
|
||||
}else{
|
||||
this.setData({
|
||||
isCard: "",
|
||||
isCardds:e.detail.value
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//开房测试
|
||||
OpenRoom:function(params){
|
||||
|
||||
this.setData({
|
||||
islogs: false,
|
||||
openrom: !this.data.openrom
|
||||
})
|
||||
//调用打开摄像头代码
|
||||
|
||||
// wx.chooseMedia({
|
||||
// count: 1, // 可以选择的图片数量
|
||||
// sizeType: ['compressed'], // 可以指定是原图还是压缩图
|
||||
// sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机
|
||||
// success: function (res) {
|
||||
// // 将拍照后的照片保存在本地文件夹中
|
||||
// var tempFilePaths = res.tempFiles[0].tempFilePath
|
||||
// console.log(res.tempFiles[0].tempFilePath)
|
||||
// wx.uploadFile({
|
||||
// url: 'http://localhost:56306/ImgServer/Update',//开发者放服务地址
|
||||
// filePath: tempFilePaths,
|
||||
// name: 'file',
|
||||
// success: function (res) {
|
||||
// var data = res.data;
|
||||
// console.log(data);
|
||||
// },
|
||||
// fail: function (res) {
|
||||
// console.log(res);
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
// })
|
||||
//授权获取用户摄像头权限
|
||||
|
||||
},
|
||||
ViewImage(e) {
|
||||
wx.previewImage({
|
||||
urls: this.data.imgList,
|
||||
current: e.currentTarget.dataset.url
|
||||
});
|
||||
},
|
||||
ChooseImage() {
|
||||
console.log(111111111111)
|
||||
var that =this;
|
||||
wx.chooseImage({
|
||||
count: 1, //默认9
|
||||
sizeType: ['original'], //可以指定是原图还是压缩图,默认二者都有,'compressed'
|
||||
sourceType: ['camera'], //从相册选择camera,album
|
||||
camera: 'front',
|
||||
success: (res) => {
|
||||
console.log(res.tempFilePaths)
|
||||
if (that.data.imgList.length != 0) {
|
||||
that.setData({
|
||||
imgList: that.data.imgList.concat(res.tempFilePaths)
|
||||
})
|
||||
|
||||
} else {
|
||||
that.setData({
|
||||
imgList: res.tempFilePaths
|
||||
})
|
||||
}
|
||||
console.log(that.data.imgList)
|
||||
// https://auth.blv-oa.com/Wx/Update
|
||||
// http://auth.blv-oa.com/Wx/Update
|
||||
wx.uploadFile({
|
||||
url: 'https://auth.blv-oa.com/Wx/Update',//开发者放服务地址
|
||||
filePath: that.data.imgList[0],
|
||||
name: 'file',
|
||||
success: function (res) {
|
||||
var data = res.data;
|
||||
console.log(res)
|
||||
data=JSON.parse(data)
|
||||
console.log(data.data.src)
|
||||
that.setData({
|
||||
imgurl:data.data.src
|
||||
})
|
||||
|
||||
},
|
||||
fail: function (res) {
|
||||
console.log(res);
|
||||
}
|
||||
})
|
||||
},
|
||||
fail:(res)=>{
|
||||
console.log(res)
|
||||
}
|
||||
});
|
||||
// wx.authorize({
|
||||
// scope: 'scope.camera',
|
||||
// success: function () {
|
||||
// console.log("授权成功");
|
||||
|
||||
// // wx.chooseMedia({
|
||||
// // count: 1,
|
||||
// // mediaType: ['image'],
|
||||
// // sourceType: ['album'],
|
||||
// // maxDuration: 30,
|
||||
// // camera: 'front',
|
||||
// // success(res) {
|
||||
// // console.log(res.tempFiles)
|
||||
// // // console.log(res.tempFiles[0].tempFilePath)
|
||||
// // // console.log(res.tempFiles[0].size)
|
||||
// // if (that.data.imgList.length != 0) {
|
||||
// // that.setData({
|
||||
// // imgList: that.data.imgList.concat(res.tempFiles[0].tempFilePath)
|
||||
// // })
|
||||
|
||||
// // } else {
|
||||
// // that.setData({
|
||||
// // imgList: res.tempFiles[0].tempFilePath
|
||||
// // })
|
||||
// // }
|
||||
// // console.log(that.data.imgList)
|
||||
// // // wx.uploadFile({
|
||||
// // // url: 'https://auth.blv-oa.com/Wx/Update',//开发者放服务地址
|
||||
// // // filePath: that.data.imgList[0],
|
||||
// // // name: 'file',
|
||||
// // // success: function (res) {
|
||||
// // // var data = res.data;
|
||||
// // // console.log(res)
|
||||
// // // data=JSON.parse(data)
|
||||
// // // console.log(data.data.src)
|
||||
// // // that.setData({
|
||||
// // // imgurl:data.data.src
|
||||
// // // })
|
||||
|
||||
// // // },
|
||||
// // // fail: function (res) {
|
||||
// // // console.log(res);
|
||||
// // // }
|
||||
// // // })
|
||||
// // }
|
||||
// // })
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// },
|
||||
// fail: function (err) {
|
||||
// console.log(err);
|
||||
// }
|
||||
// })
|
||||
},
|
||||
DelImg(e) {
|
||||
wx.showModal({
|
||||
title: '',
|
||||
content: '确定要删除这张照片吗?',
|
||||
cancelText: '再看看',
|
||||
confirmText: '再见',
|
||||
success: res => {
|
||||
if (res.confirm) {
|
||||
this.data.imgList.splice(e.currentTarget.dataset.index, 1);
|
||||
this.setData({
|
||||
imgList: this.data.imgList
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
radioChang:function(e){
|
||||
console.log("radio发生change事件,携带value值为", e.detail.value)
|
||||
this.setData({
|
||||
openUserSex:e.detail.value
|
||||
})
|
||||
},
|
||||
|
||||
/// <summary>
|
||||
/// pms开房测试
|
||||
/// </summary>
|
||||
/// <param name="idNumber"></param>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="sex"></param>
|
||||
/// <param name="picture"></param>
|
||||
/// <param name="phone"></param>
|
||||
/// <param name="hotel"></param>
|
||||
/// <param name="room">房间编号</param>
|
||||
/// <param name="checkin">开房时间</param>
|
||||
/// <param name="shi">开房时间长度</param>
|
||||
/// <returns></returns>
|
||||
//开房按钮
|
||||
Checkin:function(){
|
||||
console.log("姓名:"+this.data.openUserName+"证件类型:"+this.data.openUserID+"性别:"+this.data.openUserSex+"照片路径:"+this.data.imgurl)
|
||||
var that=this;
|
||||
console.log("房间id:"+that.data.Roomid+"人脸机编号:"+that.data.sn+"酒店编号:"+that.data.hid)
|
||||
openRommCheckin({
|
||||
idNumber:that.data.openUserID,
|
||||
name:that.data.openUserName,
|
||||
sex:that.data.openUserSex,
|
||||
picture:that.data.imgurl,
|
||||
phone:that.data.openUserTel,
|
||||
room:that.data.Roomid,
|
||||
faceSN:that.data.sn,
|
||||
hotelCode:that.data.hid,
|
||||
}).then(
|
||||
res => {
|
||||
console.log(res)
|
||||
if (res.Status == 200) {
|
||||
app.toast(2, res.Message)
|
||||
}
|
||||
else{
|
||||
app.toast(2, res.Message)
|
||||
}
|
||||
},
|
||||
err => {
|
||||
app.toast(2, "网络繁忙")
|
||||
}
|
||||
).catch(err => {
|
||||
app.toast(2, "网络繁忙")
|
||||
});
|
||||
},
|
||||
|
||||
//解绑
|
||||
JbSn:function(params) {
|
||||
var that=this;
|
||||
wx.showModal({
|
||||
title: '提示',
|
||||
content: '确定要解绑吗?',
|
||||
success (res) {
|
||||
if (res.confirm) {
|
||||
|
||||
GetFaceSN({
|
||||
faceSN:that.data.sn,
|
||||
roomID:that.data.RoomNO,
|
||||
roomNumber:that.data.Roomid,
|
||||
faceAddress:that.data.address,
|
||||
HotelID:that.data.hid,
|
||||
isjb:true
|
||||
}).then(
|
||||
res => {
|
||||
if (res.Status == 200) {
|
||||
switch (res.Data) {
|
||||
case 0:
|
||||
app.toast(1, "解绑成功~");
|
||||
|
||||
wx.navigateTo({
|
||||
url: '/pages/Hosts/Hosts?HotelId='+that.data.hid
|
||||
})
|
||||
break;
|
||||
case 1:
|
||||
app.toast(2, "SN已经绑定酒店~")
|
||||
break;
|
||||
case 2:
|
||||
app.toast(2, "SN绑定酒店失败~")
|
||||
break;
|
||||
case 3:
|
||||
app.toast(2, "SN注册绑定酒店失败~")
|
||||
break;
|
||||
case 4:
|
||||
app.toast(2, "未知错误~")
|
||||
break;
|
||||
case 5:
|
||||
app.toast(2, "数据不符合~")
|
||||
break;
|
||||
case 6:
|
||||
app.toast(2, "解绑失败~")
|
||||
break;
|
||||
default:
|
||||
app.toast(2, "其他错误~")
|
||||
break;
|
||||
}
|
||||
/// 0 成功
|
||||
/// 1 已经注册已经绑定酒店
|
||||
/// 2 已经注册更新失败
|
||||
/// 3 未注册为分配酒店 添加注册 添加酒店是啊比
|
||||
/// 4 未能预计的结果--
|
||||
/// 5 数据不符合
|
||||
/// 6 解绑失败
|
||||
console.log(0)
|
||||
|
||||
}
|
||||
else{
|
||||
app.toast(2, "网络繁忙")
|
||||
}
|
||||
},
|
||||
err => {
|
||||
app.toast(2, "网络繁忙")
|
||||
}
|
||||
).catch(err => {
|
||||
app.toast(2, "网络繁忙")
|
||||
});
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消')
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// if (confirm("你确定要继续吗?")) {
|
||||
|
||||
// } else {
|
||||
// // 用户点击了取消
|
||||
// }
|
||||
|
||||
},
|
||||
|
||||
//退房测试
|
||||
checkOut:function(params){
|
||||
var that=this;
|
||||
|
||||
wx.showModal({
|
||||
title: '提示',
|
||||
content: '确定退房吗?',
|
||||
success (res) {
|
||||
if (res.confirm) {
|
||||
roomCheckOut({
|
||||
room:that.data.Roomid,
|
||||
faceSN:that.data.sn,
|
||||
hotelCode:that.data.hid,
|
||||
}).then(
|
||||
res => {
|
||||
if (res.Status == 200){
|
||||
app.toast(2,"退房命令下发成功")
|
||||
}
|
||||
else{
|
||||
app.toast(2, "退房命令下发成功")
|
||||
}
|
||||
},
|
||||
err => {
|
||||
app.toast(2, "退房命令下发失败")
|
||||
}
|
||||
).catch(err => {
|
||||
app.toast(2, "退房命令下发失败")
|
||||
});
|
||||
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消')
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 帮助
|
||||
HelpClick: function (params) {
|
||||
this.setData({
|
||||
islogs: false,
|
||||
Help: !this.data.Help,
|
||||
openrom: false
|
||||
})
|
||||
},
|
||||
|
||||
//功能测试
|
||||
// featurutist:function(){
|
||||
|
||||
|
||||
// },
|
||||
//测试
|
||||
// featurutistlist:function(e){
|
||||
|
||||
// },
|
||||
|
||||
|
||||
|
||||
|
||||
//开门测试
|
||||
OpenDoor:function(){
|
||||
var that=this;
|
||||
OpenDoorTest({faceSN:that.data.sn,isjb:true}).then(
|
||||
res => {
|
||||
if (res.Status == 200) {
|
||||
app.toast(2, res.Message)
|
||||
}
|
||||
else{
|
||||
app.toast(2, res.Message)
|
||||
}
|
||||
},
|
||||
err => {
|
||||
app.toast(2, "网络繁忙")
|
||||
}
|
||||
).catch(err => {
|
||||
app.toast(2, "网络繁忙")
|
||||
});
|
||||
},
|
||||
|
||||
//版本号码查询
|
||||
Getversionnumber:function(){
|
||||
console.log(2);
|
||||
var that=this;
|
||||
GeteDeviceInfomation({faceSN:that.data.sn,hotelCode:that.data.HotelId, isjb:true}).then(
|
||||
res => {
|
||||
if (res.Status == 200) {
|
||||
app.toast(2, res.Message)
|
||||
}
|
||||
else{
|
||||
app.toast(2, res.Message)
|
||||
}
|
||||
},
|
||||
err => {
|
||||
app.toast(2, "网络繁忙")
|
||||
}
|
||||
).catch(err => {
|
||||
app.toast(2, "网络繁忙")
|
||||
});
|
||||
},
|
||||
//人数查询
|
||||
Getpeopleobjained:function(){
|
||||
console.log(3)
|
||||
var that=this;
|
||||
GetThePeopleListOfDevice({faceSN:that.data.sn,hotelCode:that.data.HotelId, isjb:true}).then(
|
||||
res => {
|
||||
if (res.Status == 200) {
|
||||
app.toast(2, res.Message)
|
||||
}
|
||||
else{
|
||||
app.toast(2, res.Message)
|
||||
}
|
||||
},
|
||||
err => {
|
||||
app.toast(2, "网络繁忙")
|
||||
}
|
||||
).catch(err => {
|
||||
app.toast(2, "网络繁忙")
|
||||
});
|
||||
|
||||
},
|
||||
//删除所有人
|
||||
Deletepeople:function(){
|
||||
console.log(4)
|
||||
var that=this;
|
||||
wx.showModal({
|
||||
title: '提示',
|
||||
content: '确定删除设备中用户组为1的所有人信息吗?',
|
||||
success (res) {
|
||||
if (res.confirm) {
|
||||
DeletePeopleFromDeviceByGroup({faceSN:that.data.sn,hotelCode:that.data.HotelId, isjb:true}).then(
|
||||
res => {
|
||||
if (res.Status == 200) {
|
||||
app.toast(2, res.Message)
|
||||
}
|
||||
else{
|
||||
app.toast(2, res.Message)
|
||||
}
|
||||
},
|
||||
err => {
|
||||
app.toast(2, "网络繁忙")
|
||||
}
|
||||
).catch(err => {
|
||||
app.toast(2, "网络繁忙")
|
||||
});
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消')
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
//设备重新启动
|
||||
RestartDevice:function(){
|
||||
console.log(5)
|
||||
var that=this;
|
||||
wx.showModal({
|
||||
title: '提示',
|
||||
content: '确定让设备重新启动吗?',
|
||||
success (res) {
|
||||
if (res.confirm) {
|
||||
RestartTheDevice({faceSN:that.data.sn,isjb:true}).then(
|
||||
res => {
|
||||
if (res.Status == 200) {
|
||||
app.toast(2, res.Message)
|
||||
}
|
||||
else{
|
||||
app.toast(2, res.Message)
|
||||
}
|
||||
},
|
||||
err => {
|
||||
app.toast(2, "网络繁忙")
|
||||
}
|
||||
).catch(err => {
|
||||
app.toast(2, "网络繁忙")
|
||||
});
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消')
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
console.log(options)
|
||||
var splitArray = options.Hotelinfo.split("_");
|
||||
console.log(splitArray)
|
||||
var that=this;
|
||||
that.setData({
|
||||
sn:splitArray[2],
|
||||
HotelId:splitArray[3],
|
||||
Roomid:splitArray[1],
|
||||
HotelName:splitArray[0],
|
||||
hid:splitArray[4],
|
||||
RoomNO:options.RoomID,
|
||||
faceadd:options.faceadd
|
||||
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
3
pages/test/test.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
||||
143
pages/test/test.wxml
Normal file
@@ -0,0 +1,143 @@
|
||||
<cu-custom bgColor="bg-gradual-blue" isBack="true">
|
||||
<block bindtap="back" slot="backText" >返回</block>
|
||||
<view slot="content">{{HotelId}}-{{HotelName}}</view>
|
||||
</cu-custom>
|
||||
<view class="cu-card">
|
||||
<view class="cu-item">
|
||||
<view style="float: left; width: 70%;">
|
||||
<view style="text-align: left;">编号:{{HotelId}}</view>
|
||||
<view> 酒店:{{HotelName}} </view>
|
||||
<view> 房间:{{Roomid}} </view>
|
||||
<view> SN:{{sn}} </view>
|
||||
</view>
|
||||
<view style="float: left; width: 30%;">
|
||||
<view class="text-green" style="text-align: right;" bindtap="HelpClick">{{Help?'关闭':'帮助'}}</view>
|
||||
<view style="text-align: center;" >
|
||||
<button class="text-red cu-btn " bindtap="JbSn" >解绑</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 操作区域 -->
|
||||
<view class="cu-list menu" wx:if="{{!Help && !islogs}}" >
|
||||
<view class="cu-bar bg-white solid-bottom">
|
||||
<view class='action'>
|
||||
<text class='cuIcon-titles text-orange '></text> 开房测试
|
||||
</view>
|
||||
<view class='action'>
|
||||
<switch class='sm' checked='{{isCard}}' bindchange='isCard'></switch>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cu-card case {{isCard?'no-card':''}}" wx:if="{{isCard}}">
|
||||
<view class="cu-item shadow">
|
||||
|
||||
<view class="padding-xs">
|
||||
<button class="cu-btn round margin-top margin-left bg-red lg" bindtap="checkOut">退房</button>
|
||||
<form>
|
||||
<view class="cu-form-group margin-top">
|
||||
<view class="title">姓 名:</view>
|
||||
<input placeholder="请输入姓名" model:value="{{openUserName}}"></input>
|
||||
</view>
|
||||
<view class="cu-form-group">
|
||||
<view class="title">证件号:</view>
|
||||
<input placeholder="请输入证件号" model:value="{{openUserID}}"></input>
|
||||
</view>
|
||||
<view class="cu-form-group">
|
||||
<view class="title">电话号码:</view>
|
||||
<input placeholder="请输入电话号码" model:value="{{openUserTel}}"></input>
|
||||
</view>
|
||||
<radio-group class="cu-form-group" bindchange="radioChang" data-id="{{openUserSex}}">
|
||||
<view class="title">性 别:</view>
|
||||
<view>
|
||||
<radio class="red margin-left-lg" value="0"></radio>男
|
||||
<radio class="red margin-left-lg" value="1"></radio>女
|
||||
</view>
|
||||
</radio-group>
|
||||
<view class="cu-bar bg-white margin-top">
|
||||
<view class="action">
|
||||
图片上传
|
||||
</view>
|
||||
</view>
|
||||
<view class="cu-form-group">
|
||||
<view class="grid col-4 grid-square flex-sub">
|
||||
<view class="bg-img" wx:for="{{imgList}}" wx:key="{{index}}" bindtap="ViewImage" data-url="{{imgList[index]}}">
|
||||
<image src='{{imgList[index]}}' mode='aspectFill'></image>
|
||||
<view class="cu-tag bg-red" catchtap="DelImg" data-index="{{index}}">
|
||||
<text class="cuIcon-close"></text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="solids" bindtap="ChooseImage" wx:if="{{imgList.length<1}}">
|
||||
<text class="cuIcon-cameraadd"></text>
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
</view>
|
||||
<view class="padding flex flex-direction" bindtap="Checkin">
|
||||
<button class="cu-btn bg-grey lg" >开房</button>
|
||||
</view>
|
||||
</form>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="cu-bar bg-white solid-bottom {{isCard?'margin-top':''}}">
|
||||
<view class='action'>
|
||||
<text class='cuIcon-titles text-orange '></text> 功能测试
|
||||
</view>
|
||||
<view class='action'>
|
||||
<switch class='sm' checked='{{isCardds}}' bindchange='isCardds'></switch>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cu-card dynamic {{isCardds?'no-card':''}}" wx:if="{{isCardds}}">
|
||||
<view class="cu-item shadow">
|
||||
<button style="margin:5px ;" class="cu-btn round margin-xl bg-green" bindtap="OpenDoor" >开门</button>
|
||||
<button class="cu-btn round margin-xl" bindtap="Getversionnumber">版本号</button>
|
||||
<button style="margin:5px ;" class="cu-btn bg-red margin-xl round" bindtap="Deletepeople">删除</button>
|
||||
<button class="cu-btn bg-red margin-xl round" bindtap="RestartDevice">重启</button>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 帮助区域 -->
|
||||
<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">功能测试区域所有按钮含义</view></view>
|
||||
<view class="content">
|
||||
<view class="desc">
|
||||
<view class="text-content text-df" style="height: auto;">
|
||||
<view class="text-df text-green">开门</view>
|
||||
点击开门按钮是下发开门命令给设备,如果成功会听见继电器闭合声音或弹框开门成功。否则弹出开门失败或没有听见继电器闭合声音。
|
||||
<view class="text-df text-green">版本号</view>
|
||||
点击版本号是下发获取设备信息命令给设备,如果成功会弹出设备的版本号。否则弹出无法获取设备的版本信息。
|
||||
<!-- <view class="text-df text-green">人数</view>
|
||||
点击人数是下发获取入住人员数量命令给设备,如果成功会弹出入住人员数量,否则弹出入住人数是0。 -->
|
||||
<view class="text-df text-green">删除</view>
|
||||
点击删除是下发删除所有入住人员命令给设备,如果成功弹出删除成功,否则弹出删除失败。
|
||||
<view class="text-df text-green">重启</view>
|
||||
点击删除是下发重启命令给设备,如果成功下发成功设备将重新启动,否则弹出下发失败,设备不会重新启动。
|
||||
<view class="text-df text-green">开房</view>
|
||||
开房所有信息默认值,性别默认是:女,姓名默认:李四,电话默认:15915641569,证件号码默认:123456789456123456,直接点击图片上传,上传照片后,点击开房即可发送信息给人脸机。(注意图片上传成功会显示在页面上)
|
||||
<view class="text-df text-green">退房</view>
|
||||
直接点击退房,会直接下发退房命令给人脸机。
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
1
pages/test/test.wxss
Normal file
@@ -0,0 +1 @@
|
||||
/* pages/test/test.wxss */
|
||||
70
project.config.json
Normal file
@@ -0,0 +1,70 @@
|
||||
{
|
||||
"description": "项目配置文件,详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
|
||||
"setting": {
|
||||
"urlCheck": false,
|
||||
"es6": true,
|
||||
"enhance": true,
|
||||
"postcss": true,
|
||||
"preloadBackgroundData": false,
|
||||
"minified": true,
|
||||
"newFeature": true,
|
||||
"coverView": true,
|
||||
"nodeModules": false,
|
||||
"autoAudits": false,
|
||||
"showShadowRootInWxmlPanel": true,
|
||||
"scopeDataCheck": false,
|
||||
"uglifyFileName": true,
|
||||
"checkInvalidKey": true,
|
||||
"checkSiteMap": true,
|
||||
"uploadWithSourceMap": true,
|
||||
"compileHotReLoad": false,
|
||||
"lazyloadPlaceholderEnable": false,
|
||||
"useMultiFrameRuntime": true,
|
||||
"babelSetting": {
|
||||
"ignore": [],
|
||||
"disablePlugins": [],
|
||||
"outputPath": ""
|
||||
},
|
||||
"enableEngineNative": false,
|
||||
"useIsolateContext": true,
|
||||
"userConfirmedBundleSwitch": false,
|
||||
"packNpmManually": false,
|
||||
"packNpmRelationList": [],
|
||||
"minifyWXSS": true,
|
||||
"disableUseStrict": false,
|
||||
"minifyWXML": true,
|
||||
"showES6CompileOption": false,
|
||||
"useCompilerPlugins": false,
|
||||
"useStaticServer": true,
|
||||
"condition": false,
|
||||
"skylineRenderEnable": false,
|
||||
"ignoreUploadUnusedFiles": true
|
||||
},
|
||||
"compileType": "miniprogram",
|
||||
"simulatorType": "wechat",
|
||||
"simulatorPluginLibVersion": {},
|
||||
"condition": {
|
||||
"search": {
|
||||
"list": []
|
||||
},
|
||||
"conversation": {
|
||||
"list": []
|
||||
},
|
||||
"game": {
|
||||
"currentL": -1,
|
||||
"list": []
|
||||
},
|
||||
"miniprogram": {
|
||||
"list": []
|
||||
}
|
||||
},
|
||||
"editorSetting": {
|
||||
"tabIndent": "insertSpaces",
|
||||
"tabSize": 2
|
||||
},
|
||||
"packOptions": {
|
||||
"ignore": [],
|
||||
"include": []
|
||||
},
|
||||
"appid": "wx2278e1d160883eb0"
|
||||
}
|
||||
45
project.private.config.json
Normal file
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"setting": {
|
||||
"compileHotReLoad": true,
|
||||
"urlCheck": true
|
||||
},
|
||||
"condition": {
|
||||
"miniprogram": {
|
||||
"list": [
|
||||
{
|
||||
"name": "pages/index/index",
|
||||
"pathName": "pages/index/index",
|
||||
"query": "issel=0",
|
||||
"scene": null
|
||||
},
|
||||
{
|
||||
"name": "pages/logs/logs",
|
||||
"pathName": "pages/logs/logs",
|
||||
"query": "",
|
||||
"scene": null
|
||||
},
|
||||
{
|
||||
"name": "pages/mycenter/index",
|
||||
"pathName": "pages/mycenter/index",
|
||||
"query": "",
|
||||
"scene": null
|
||||
},
|
||||
{
|
||||
"name": "pages/Hosts/Hosts",
|
||||
"pathName": "pages/Hosts/Hosts",
|
||||
"query": "HotelId=1",
|
||||
"scene": null
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"pathName": "pages/logs/logs",
|
||||
"query": "",
|
||||
"scene": null
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"projectname": "App",
|
||||
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
|
||||
"libVersion": "2.29.2"
|
||||
}
|
||||
7
sitemap.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
|
||||
"rules": [{
|
||||
"action": "allow",
|
||||
"page": "*"
|
||||
}]
|
||||
}
|
||||
30
utils/filters.wxs
Normal file
@@ -0,0 +1,30 @@
|
||||
function formatTime(date) {
|
||||
var year = date.getFullYear()
|
||||
var month = date.getMonth() + 1
|
||||
var day = date.getDate()
|
||||
var hour = date.getHours()
|
||||
var minute = date.getMinutes()
|
||||
var second = date.getSeconds()
|
||||
return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
|
||||
}
|
||||
|
||||
function formatNumber(n) {
|
||||
n = n.toString()
|
||||
return n[1] ? n : '0' + n
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
/**
|
||||
* 日期格式化
|
||||
* @param formatTime
|
||||
* @returns {string}
|
||||
*/
|
||||
TimeFormat: function(formatTimestr) {
|
||||
var str = parseFloat(formatTimestr.replace("/Date(", "").replace(")/", ""));
|
||||
//转化为时间类型
|
||||
var obj = (getDate(str));
|
||||
console.log(obj)
|
||||
// return obj;
|
||||
return formatTime(obj);
|
||||
}
|
||||
}
|
||||
2
utils/md5.min.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
!function(n){"use strict";function t(n,t){var r=(65535&n)+(65535&t);return(n>>16)+(t>>16)+(r>>16)<<16|65535&r}function r(n,t){return n<<t|n>>>32-t}function e(n,e,o,u,c,f){return t(r(t(t(e,n),t(u,f)),c),o)}function o(n,t,r,o,u,c,f){return e(t&r|~t&o,n,t,u,c,f)}function u(n,t,r,o,u,c,f){return e(t&o|r&~o,n,t,u,c,f)}function c(n,t,r,o,u,c,f){return e(t^r^o,n,t,u,c,f)}function f(n,t,r,o,u,c,f){return e(r^(t|~o),n,t,u,c,f)}function i(n,r){n[r>>5]|=128<<r%32,n[14+(r+64>>>9<<4)]=r;var e,i,a,d,h,l=1732584193,g=-271733879,v=-1732584194,m=271733878;for(e=0;e<n.length;e+=16)i=l,a=g,d=v,h=m,g=f(g=f(g=f(g=f(g=c(g=c(g=c(g=c(g=u(g=u(g=u(g=u(g=o(g=o(g=o(g=o(g,v=o(v,m=o(m,l=o(l,g,v,m,n[e],7,-680876936),g,v,n[e+1],12,-389564586),l,g,n[e+2],17,606105819),m,l,n[e+3],22,-1044525330),v=o(v,m=o(m,l=o(l,g,v,m,n[e+4],7,-176418897),g,v,n[e+5],12,1200080426),l,g,n[e+6],17,-1473231341),m,l,n[e+7],22,-45705983),v=o(v,m=o(m,l=o(l,g,v,m,n[e+8],7,1770035416),g,v,n[e+9],12,-1958414417),l,g,n[e+10],17,-42063),m,l,n[e+11],22,-1990404162),v=o(v,m=o(m,l=o(l,g,v,m,n[e+12],7,1804603682),g,v,n[e+13],12,-40341101),l,g,n[e+14],17,-1502002290),m,l,n[e+15],22,1236535329),v=u(v,m=u(m,l=u(l,g,v,m,n[e+1],5,-165796510),g,v,n[e+6],9,-1069501632),l,g,n[e+11],14,643717713),m,l,n[e],20,-373897302),v=u(v,m=u(m,l=u(l,g,v,m,n[e+5],5,-701558691),g,v,n[e+10],9,38016083),l,g,n[e+15],14,-660478335),m,l,n[e+4],20,-405537848),v=u(v,m=u(m,l=u(l,g,v,m,n[e+9],5,568446438),g,v,n[e+14],9,-1019803690),l,g,n[e+3],14,-187363961),m,l,n[e+8],20,1163531501),v=u(v,m=u(m,l=u(l,g,v,m,n[e+13],5,-1444681467),g,v,n[e+2],9,-51403784),l,g,n[e+7],14,1735328473),m,l,n[e+12],20,-1926607734),v=c(v,m=c(m,l=c(l,g,v,m,n[e+5],4,-378558),g,v,n[e+8],11,-2022574463),l,g,n[e+11],16,1839030562),m,l,n[e+14],23,-35309556),v=c(v,m=c(m,l=c(l,g,v,m,n[e+1],4,-1530992060),g,v,n[e+4],11,1272893353),l,g,n[e+7],16,-155497632),m,l,n[e+10],23,-1094730640),v=c(v,m=c(m,l=c(l,g,v,m,n[e+13],4,681279174),g,v,n[e],11,-358537222),l,g,n[e+3],16,-722521979),m,l,n[e+6],23,76029189),v=c(v,m=c(m,l=c(l,g,v,m,n[e+9],4,-640364487),g,v,n[e+12],11,-421815835),l,g,n[e+15],16,530742520),m,l,n[e+2],23,-995338651),v=f(v,m=f(m,l=f(l,g,v,m,n[e],6,-198630844),g,v,n[e+7],10,1126891415),l,g,n[e+14],15,-1416354905),m,l,n[e+5],21,-57434055),v=f(v,m=f(m,l=f(l,g,v,m,n[e+12],6,1700485571),g,v,n[e+3],10,-1894986606),l,g,n[e+10],15,-1051523),m,l,n[e+1],21,-2054922799),v=f(v,m=f(m,l=f(l,g,v,m,n[e+8],6,1873313359),g,v,n[e+15],10,-30611744),l,g,n[e+6],15,-1560198380),m,l,n[e+13],21,1309151649),v=f(v,m=f(m,l=f(l,g,v,m,n[e+4],6,-145523070),g,v,n[e+11],10,-1120210379),l,g,n[e+2],15,718787259),m,l,n[e+9],21,-343485551),l=t(l,i),g=t(g,a),v=t(v,d),m=t(m,h);return[l,g,v,m]}function a(n){var t,r="",e=32*n.length;for(t=0;t<e;t+=8)r+=String.fromCharCode(n[t>>5]>>>t%32&255);return r}function d(n){var t,r=[];for(r[(n.length>>2)-1]=void 0,t=0;t<r.length;t+=1)r[t]=0;var e=8*n.length;for(t=0;t<e;t+=8)r[t>>5]|=(255&n.charCodeAt(t/8))<<t%32;return r}function h(n){return a(i(d(n),8*n.length))}function l(n,t){var r,e,o=d(n),u=[],c=[];for(u[15]=c[15]=void 0,o.length>16&&(o=i(o,8*n.length)),r=0;r<16;r+=1)u[r]=909522486^o[r],c[r]=1549556828^o[r];return e=i(u.concat(d(t)),512+8*t.length),a(i(c.concat(e),640))}function g(n){var t,r,e="";for(r=0;r<n.length;r+=1)t=n.charCodeAt(r),e+="0123456789abcdef".charAt(t>>>4&15)+"0123456789abcdef".charAt(15&t);return e}function v(n){return unescape(encodeURIComponent(n))}function m(n){return h(v(n))}function p(n){return g(m(n))}function s(n,t){return l(v(n),v(t))}function C(n,t){return g(s(n,t))}function A(n,t,r){return t?r?s(t,n):C(t,n):r?m(n):p(n)}"function"==typeof define&&define.amd?define(function(){return A}):"object"==typeof module&&module.exports?module.exports=A:n.md5=A}(this);
|
||||
//# sourceMappingURL=md5.min.js.map
|
||||
59
utils/util.js
Normal file
@@ -0,0 +1,59 @@
|
||||
const formatTime = date => {
|
||||
const year = date.getFullYear()
|
||||
const month = date.getMonth() + 1
|
||||
const day = date.getDate()
|
||||
const hour = date.getHours()
|
||||
const minute = date.getMinutes()
|
||||
const second = date.getSeconds()
|
||||
|
||||
return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
|
||||
}
|
||||
|
||||
const formatNumber = n => {
|
||||
n = n.toString()
|
||||
return n[1] ? n : '0' + n
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const getCurrentMonthFirst = date =>{
|
||||
date.setDate(1);
|
||||
let month = parseInt(date.getMonth()+1);
|
||||
let day = date.getDate();
|
||||
if (month < 10) {
|
||||
month = '0' + month
|
||||
}
|
||||
if (day < 10) {
|
||||
day = '0' + day
|
||||
}
|
||||
return date.getFullYear() + '-' + month + '-' + day;
|
||||
}
|
||||
|
||||
|
||||
const getCurrentMonthLast = function (date = null){
|
||||
if(date==null) {
|
||||
date = new Date();
|
||||
}
|
||||
let currentMonth=date.getMonth();
|
||||
let nextMonth=++currentMonth;
|
||||
let nextMonthFirstDay=new Date(date.getFullYear(),nextMonth,1);
|
||||
let oneDay=1000*60*60*24;
|
||||
let lastTime = new Date(nextMonthFirstDay-oneDay);
|
||||
let month = parseInt(lastTime.getMonth()+1);
|
||||
let day = lastTime.getDate();
|
||||
if (month < 10) {
|
||||
month = '0' + month
|
||||
}
|
||||
if (day < 10) {
|
||||
day = '0' + day
|
||||
}
|
||||
console.log(date.getFullYear() + '-' + month + '-' + day)
|
||||
return date.getFullYear() + '-' + month + '-' + day;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
formatTime: formatTime,
|
||||
getCurrentMonthFirst:getCurrentMonthFirst,
|
||||
getCurrentMonthLast:getCurrentMonthLast
|
||||
}
|
||||
41
utils/watch.js
Normal file
@@ -0,0 +1,41 @@
|
||||
// watch.js
|
||||
|
||||
const observe = (obj, key, watchFun, deep, page) => {
|
||||
let oldVal = obj[key]
|
||||
// 如果监听对象是object类型并且指定deep(深度监听)
|
||||
if (oldVal !== null && typeof oldVal === 'object' && deep) {
|
||||
// 递归子集,依次执行observe()
|
||||
Object.keys(oldVal).forEach(item => {
|
||||
observe(oldVal, item, watchFun, deep, page)
|
||||
})
|
||||
}
|
||||
// 使用Object.defineProperty()劫持数据的写操作,在监听对象改变后执行传入的watchFun
|
||||
Object.defineProperty(obj, key, {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
set(value) {
|
||||
if (value === oldVal) return
|
||||
watchFun.call(page, value, oldVal)
|
||||
oldVal = value
|
||||
},
|
||||
get() {
|
||||
return oldVal
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export const setWatcher = (page) => {
|
||||
// 页面里的data字段
|
||||
const data = page.data
|
||||
// 页面里的watch字段
|
||||
const watch = page.watch
|
||||
// 对watch里列举的每一个字段(需要监听的字段)执行observe()
|
||||
Object.keys(watch).forEach(key => {
|
||||
let targetData = data
|
||||
const targetKey = key
|
||||
// 支持deep深度监听,使用deep时需要配合handler使用,否则直接编写函数
|
||||
const watchFun = watch[key].handler || watch[key]
|
||||
const deep = watch[key].deep
|
||||
observe(targetData, targetKey, watchFun, deep, page)
|
||||
})
|
||||
}
|
||||