初始化

This commit is contained in:
2025-12-11 09:50:45 +08:00
commit f52cfe714f
78 changed files with 11304 additions and 0 deletions

647
pages/test/test.js Normal file
View 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
View File

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

143
pages/test/test.wxml Normal file
View 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
View File

@@ -0,0 +1 @@
/* pages/test/test.wxss */