初始化

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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