初始化

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

273
pages/index/index.js Normal file
View File

@@ -0,0 +1,273 @@
// pages/basics/MakingRounds/MakingRounds.js
const app = getApp()
import {
GetHostsInfo,
GetMAC,
GetFaceSN,
ErrorInfo,
CheckFaceSN,
OpenDoorTest,
GetRoomType,
GetRoomTypeAndModalsListLog,
WebChatUpgrade,
QueryUpdateHostStatus,
ForwardQueryUpdateHostProgressBar,
GetRoomTypeNode,
SetRCULight,
SetRCUAir,
SetRCUCurtain,
} from '../../lib/RequestingCenter.js'
Page({
data: {
userInfo: null,
autho: null,
selectGroupIndex:-1,
ishotel: false,
hotelIndex: 0,
issel:false ,
curNav:1,
curIndex:0,
top_height:0,
inputValue:""
},
selectNav (event) {
let id = event.target.dataset.id,
index = parseInt(event.target.dataset.index);
self = this;
this.setData({
curNav:id,
curIndex:index
})
},
///选择酒店
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: async 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){
app.globalData.HotelId=id
wx.navigateTo({
url: '/pages/NewHome/NewHome?HotelId=' + id
})
}else{
app.toast(2,'未选择酒店')
}
},
//选择酒店组
bindgroup: function (e) {
let index
try {
index = e.currentTarget.dataset['index']
} catch (error) {
index=0
}
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)
},
codebindgroup: function (GroupIndex,hotelIndex) {
this.setData({
selectGroupIndex: GroupIndex,
hotelIndex:hotelIndex,
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) {
let that=this
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()
}
setTimeout(function () {
// 1.使用wx.createSelectorQuery()查询到需要滚动到的元素位置
wx.createSelectorQuery().select('#Headcustom').boundingClientRect(res => {
// 2.使用wx.getSysTemInfo()获取设备及页面高度windowHeightpx
wx.getSystemInfo({
success(ress) {
that.setData({
top_height: ress.windowHeight - res.bottom,
})
}
})
}).exec(function (params) {
console.log(params)
})
}, 100)
let e=[]
this.bindgroup(e)
console.log(this.data.top_height)
},
inputSearchForHotels(e){
this.setData({
inputValue: e.detail.value
})
},
SearchForHotels(e) {
//debugger //hotelIndex
let inputValue =this.data.inputValue.trim()
if (inputValue.length==0) {
wx.showModal({
title: "提示",
content: "无效搜索",
showCancel:false
})
return
}
let autho = this.data.autho
let selectGroupIndex = this.data.selectGroupIndex
const Naelement = autho[selectGroupIndex]
const CNaelement =this.sortHotelsByFuzzyMatch(Naelement.Hotels,inputValue)
autho[selectGroupIndex].Hotels=CNaelement
this.setData({
autho:autho
})
for (let aindex = 0; aindex < autho.length; aindex++) {
const aelement = autho[aindex];
for (let bindex = 0; bindex < aelement.Hotels.length; bindex++) {
const belement = aelement.Hotels[bindex];
if (belement.Code==inputValue) {
this.codebindgroup(aindex,bindex)
return
}
if (belement.HotelName==inputValue) {
this.codebindgroup(aindex,bindex)
return
}
}
}
wx.showModal({
title: "提示",
content: "未找到该酒店!",
showCancel:false
})
} ,
//读取历史选择酒店
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/NewHome/NewHome?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/NewHome/NewHome?HotelId='+this.data.autho[0].Hotels[0].HotelId
})
}
} ,
sortHotelsByFuzzyMatch:function(hotels, keyword) {
// 1. 参数验证
if (!Array.isArray(hotels)) {
console.warn('第一个参数必须是数组');
return [];
}
if (typeof keyword !== 'string') {
console.warn('第二个参数必须是字符串');
return hotels.slice();
}
// 2. 处理空数组或空关键字的情况
const trimmedKeyword = keyword.trim();
if (hotels.length === 0 || trimmedKeyword === '') {
return hotels.slice();
}
const lowerKeyword = trimmedKeyword.toLowerCase();
// 3. 分离匹配和不匹配的酒店
const matchedHotels = [];
const unmatchedHotels = [];
hotels.forEach(hotel => {
// 检查是否为有效酒店对象
if (!hotel || typeof hotel !== 'object' || !hotel.HotelName) {
unmatchedHotels.push(hotel);
return;
}
const hotelName = String(hotel.HotelName).toLowerCase();
const isMatch = hotelName.includes(lowerKeyword);
if (isMatch) {
matchedHotels.push(hotel);
} else {
unmatchedHotels.push(hotel);
}
});
// 4. 合并数组并返回
return [...matchedHotels, ...unmatchedHotels];
}
})

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

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

89
pages/index/index.wxml Normal file
View File

@@ -0,0 +1,89 @@
<cu-custom bgColor="bg-gradual-blue" id="Headcustom" >
<block bindtap="" slot="backText" >返回</block>
<view slot="content">{{selectGroupIndex==-1? "BLV":autho[selectGroupIndex].Hotels[hotelIndex].HotelName}}</view>
</cu-custom>
<!-- <view class="padding-sm bg-white radius shadow shadow-lg">
<view id="groups">
<view class="text-xl" wx:if="{{hotelIndex>=0}}">
<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> -->
<view style="height:{{top_height==0?'600rpx':top_height+'px'}} " >
<view class=" solids bg-white" style="height:13% ;width: 100%;">
<view class="text-xl" wx:if="{{hotelIndex>=0}}" style="height:100% ;width: 100%;">
<view class="solids" style="height:50% ;width: 100%;">
<text class="text-green">{{autho[selectGroupIndex].Hotels[hotelIndex].Code}}:{{autho[selectGroupIndex].Hotels[hotelIndex].HotelName}}</text>
</view>
<view class="cu-bar1 bg-white " style="height:50% ;width: 100%;" >
<view class="solids flex-6 " style="width: 100%;">
<input class="solids cu-btn1" focus="true" bindinput="inputSearchForHotels" confirm-type="search" style="width: 100%;"/>
</view>
<view class="flex-xis flex justify-end">
<button wx:if="{{hotelIndex>=0}}" data-id="-1" class="cu-btn1 line-green margin-left " style="width: 150rpx; margin:5rpx;" bindtap="SearchForHotels">搜索</button>
<button wx:if="{{hotelIndex>=0}}" data-id="-1" class="cu-btn1 line-green margin-left" style="width: 150rpx;margin:5rpx" bindtap="ShowSelHotel">确定</button>
</view>
</view>
</view>
</view>
<view class="cu-bar bg-white" style="height:85% ;width: 100%;">
<view style="height:100%;width: 40%;">
<scroll-view class="bg-white " scroll-into-view="{{'group'+selectGroupIndex}}" scroll-y style="height:100%;width: 100%;" scroll-with-animation scroll-top >
<view bindtap="bindgroup" data-index="{{idx}}" id="{{'group'+idx}}" wx:for="{{autho}}" wx:for-index="idx" wx:for-item="item">
<button class="text-sm cu1-btn lg {{idx==selectGroupIndex? 'text-green ':'text-black'}}" style="width:100%;" >{{item.HotelGroupsName}}({{item.Hotels.length}})</button>
</view>
</scroll-view>
</view>
<view style="height:100%;width: 60%;">
<scroll-view class="bg-white " scroll-y scroll-into-view="{{'Hotel'+hotelIndex}}" style="height:100%;width: 100%;" scroll-with-animation scroll-top >
<view class=" {{index==TabCurnode?'text-green ':'text-black'}}" id="{{'Hotel'+idx}}" 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>
</scroll-view>
</view>
</view>
</view>

101
pages/index/index.wxss Normal file
View File

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