From abd175311196cbbbb8ee80196fd0fcba098d648b Mon Sep 17 00:00:00 2001
From: fengerli <528575642@qq.com>
Date: Mon, 29 Sep 2025 14:26:50 +0800
Subject: [PATCH 1/2] =?UTF-8?q?=E5=88=A4=E6=96=AD=E7=A6=BB=E7=BA=BF?=
=?UTF-8?q?=E6=95=85=E9=9A=9C=E7=8A=B6=E6=80=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pages/6170/deviceControl/index.vue | 4 +++-
pages/common/index/index.vue | 7 ++++---
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/pages/6170/deviceControl/index.vue b/pages/6170/deviceControl/index.vue
index 31b2306..a5e8c61 100644
--- a/pages/6170/deviceControl/index.vue
+++ b/pages/6170/deviceControl/index.vue
@@ -48,7 +48,9 @@
设备状态
- {{ deviceInfo.onlineStatus === 0 ? '离线' : '在线' }}
+
+ {{ deviceInfo.onlineStatus === 0 ? '离线' : deviceInfo.onlineStatus === 2 ? '故障' : '在线' }}
+
定位信息
diff --git a/pages/common/index/index.vue b/pages/common/index/index.vue
index 4947bab..702dcbb 100644
--- a/pages/common/index/index.vue
+++ b/pages/common/index/index.vue
@@ -50,6 +50,9 @@
离线
+ 故障
+
电量:{{ item.battery || '0' }}%
@@ -372,10 +375,9 @@
} else {
this.deviceList = [...this.deviceList, ...newDevices];
}
- // 关键:正确判断是否加载完成
+ // 判断是否加载完成
if (this.loadedCount >= this.total || newDevices.length < this.size) {
this.finished = true;
- console.log(`加载完成 - 已加载${this.loadedCount}/${this.total}`);
} else {
this.page++;
}
@@ -384,7 +386,6 @@
reject(res.msg || '获取数据失败');
}
}).catch((err) => {
- console.error('获取设备列表失败:', err);
reject(err);
}).finally(() => {
this.loading = false;
From e042436c5b869b75f56d782b5932b30ca00ebb10 Mon Sep 17 00:00:00 2001
From: fengerli <528575642@qq.com>
Date: Wed, 8 Oct 2025 14:08:45 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E9=A6=96=E9=A1=B5=EF=BC=8C=E4=B8=8B?=
=?UTF-8?q?=E6=8B=89=E5=8A=A0=E8=BD=BD=E9=97=AE=E9=A2=98=E4=BC=98=E5=8C=96?=
=?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pages/common/index/index.vue | 177 ++++++++++++++++++-----------------
pages/common/login/index.vue | 2 +-
2 files changed, 92 insertions(+), 87 deletions(-)
diff --git a/pages/common/index/index.vue b/pages/common/index/index.vue
index 702dcbb..a826162 100644
--- a/pages/common/index/index.vue
+++ b/pages/common/index/index.vue
@@ -23,58 +23,59 @@
位置
发送信息
-
-
-
-
-
-
+
+
+
+
+
+
+ 加载中...
+ 没有更多数据了
+
+
@@ -210,23 +211,25 @@
auto: false
},
upOption: {
- auto: false,
- noMoreSize: 1,
- offset: 80,
- empty: {
- tip: '暂无相关数据'
- }
+ auto: false,
+ noMoreSize: 0,
+ offset: 50,
+ isLock: false,
+ empty: {
+ tip: '暂无数据',
+ hideScroll: false
+ }
},
-
page: 1, // 当前页码
- size: 10, // 每页条数
+ size: 12, // 每页条数
total: 0, // 总数据量
loadedCount: 0,
loading: false,
finished: false,
deviceId: '',
deviceName: "", //重命名
- activeTabInfo: ''
+ activeTabInfo: '',
+ mescrollHeight: 0,
}
},
methods: {
@@ -237,39 +240,34 @@
downCallback() {
const currentDeviceType = this.activeTabInfo?.id === '' ? undefined : this.activeTabInfo?.id;
const tempList = [...this.deviceList];
-
// 重置分页参数
this.page = 1;
this.finished = false;
this.loadedCount = 0;
-
+ this.total = 0; // 重置总数
this.getData(currentDeviceType)
.then(() => {
-
this.mescroll.endDownScroll(true);
})
.catch(() => {
-
this.deviceList = tempList;
this.mescroll.endDownScroll(false);
});
},
// 上拉加载
upCallback() {
- // 防止重复加载
- if (this.finished || this.loading) {
+ if (this.loading) {
this.mescroll.endUpScroll(false);
return;
}
const currentDeviceType = this.activeTabInfo?.id === '' ? undefined : this.activeTabInfo?.id;
this.getData(currentDeviceType)
.then(() => {
- const hasMore = this.loadedCount < this.total;
- console.log(`上拉加载 - 已加载: ${this.loadedCount}, 总数: ${this.total}, 是否还有更多: ${hasMore}`);
+ // 如果本次加载的数据量为0,则说明没有更多数据
+ const hasMore = this.deviceList.length > 0 && this.deviceList.length % this.size === 0;
this.mescroll.endUpScroll(hasMore);
})
.catch(() => {
- // 失败时回退页码
this.page--;
this.mescroll.endUpScroll(false);
});
@@ -332,53 +330,48 @@
this.page = 1;
this.finished = false;
this.loadedCount = 0;
-
+ this.total = 0; // 重置总数
const deviceType = tab.id === '' ? undefined : tab.id;
+ this.$nextTick(() => {
+ this.getSystemInfoSyncH();
+ });
this.getData(deviceType);
-
if (this.mescroll) {
this.mescroll.resetUpScroll();
}
},
- // 获取设备列表 - 核心修复
+ // 获取设备列表
getData(deviceType = '') {
return new Promise((resolve, reject) => {
if (this.loading || this.finished) {
reject('正在加载或已无更多数据');
return;
}
-
this.loading = true;
let data = {
pageNum: this.page,
pageSize: this.size,
deviceType: deviceType
}
-
deviceInfo(data).then((res) => {
if (res.code == 200) {
- // 第一页加载时初始化总数据量
- if (this.page === 1) {
- this.total = res.total;
- this.loadedCount = 0; // 重置计数
- console.log(`第1页加载 - 总数据量: ${this.total}`);
- }
const newDevices = res.rows.map(device => ({
...device,
showConfirm: false
}));
- this.loadedCount += newDevices.length;
- console.log(`第${this.page}页加载 - 新增: ${newDevices.length}, 累计: ${this.loadedCount}`);
- // 数据累加
if (this.page === 1) {
+ this.total = Number(res.total) || 0;
this.deviceList = newDevices;
+ this.loadedCount = newDevices.length;
} else {
this.deviceList = [...this.deviceList, ...newDevices];
+ this.loadedCount += newDevices.length;
}
- // 判断是否加载完成
- if (this.loadedCount >= this.total || newDevices.length < this.size) {
+ const hasMoreData = this.loadedCount < this.total;
+ if (!hasMoreData) {
this.finished = true;
- } else {
+ }
+ if (hasMoreData) {
this.page++;
}
resolve();
@@ -564,7 +557,8 @@
onIntall() {
this.page = 1;
this.finished = false;
- this.loadedCount = 0; // 重置计数
+ this.loadedCount = 0;
+ this.total = 0;
const deviceType = this.activeTabInfo?.id === '' ? undefined : this.activeTabInfo?.id;
this.getData(deviceType);
setTimeout(() => {
@@ -594,8 +588,19 @@
})
.filter(Boolean);
},
+ // 动态计算屏幕高度
+ getSystemInfoSyncH() {
+ const sysInfo = uni.getSystemInfoSync();
+ const tabBarHeight = 80;
+ const sendBarHeight = 60;
+ const padding = 60;
+ const totalTopHeight = (this.navBarHeight) + (tabBarHeight + sendBarHeight + padding) * (sysInfo
+ .screenWidth / 750);
+ this.mescrollHeight = sysInfo.screenHeight - totalTopHeight;
+ }
},
onLoad() {
+ this.getSystemInfoSyncH()
this.getTab()
this.onIntall()
uni.$on('refreshDeviceList', () => {
@@ -974,4 +979,4 @@
width: 16px;
height: 16px;
}
-
+
\ No newline at end of file
diff --git a/pages/common/login/index.vue b/pages/common/login/index.vue
index 071f350..aa985df 100644
--- a/pages/common/login/index.vue
+++ b/pages/common/login/index.vue
@@ -74,7 +74,7 @@
showView: false,
phone: '13800138002', //手机号码
code: "123456", //验证码
- password: "",
+ password: "123456",
agreed: false,
isCounting: false,
countdown: 0,