1
0
forked from dyf/APP

Compare commits

..

5 Commits

Author SHA1 Message Date
48da6d0e1c 6170上传加裁剪功能 2025-09-11 14:21:16 +08:00
55620449e4 Merge branch 'main' of http://47.107.152.87:3000/dyf/APP 2025-09-10 10:47:08 +08:00
d7a91a6df2 适配灯光弹框 2025-09-10 10:47:04 +08:00
07064b4b85 修复扫码绑定完成返回键,首页未刷新问题 2025-09-10 10:42:11 +08:00
6ee45f6868 修改bug 2025-09-05 18:48:46 +08:00
4 changed files with 62 additions and 58 deletions

View File

@ -58,7 +58,9 @@
// 处理像素数据并发送 // 处理像素数据并发送
const eventChannel = these.getOpenerEventChannel(); const eventChannel = these.getOpenerEventChannel();
console.log("res.data.length="+res.data.length); console.log("res.data.length="+res.data.length);
eventChannel.emit('ImgCutOverPath', {
picPath: e.tempFilePath
});
eventChannel.emit('ImgCutOver',{piexls:res.data,picPath:e.tempFilePath}); eventChannel.emit('ImgCutOver',{piexls:res.data,picPath:e.tempFilePath});

View File

@ -545,15 +545,6 @@
}); });
return; return;
} }
// 防重复提交
if (this.isProcessing) return;
let loadingShown = false;
uni.showLoading({
title: '处理中...',
mask: true
});
loadingShown = true;
this.isProcessing = true
if (this.selectedItemIndex === null) return; if (this.selectedItemIndex === null) return;
const selectedItem = this.items[this.selectedItemIndex]; const selectedItem = this.items[this.selectedItemIndex];
let data = { let data = {
@ -573,15 +564,15 @@
}) })
uni.hideLoading(); uni.hideLoading();
this.lightModeA = false; this.lightModeA = false;
this.isProcessing = false //this.isProcessing = false
loadingShown = false //loadingShown = false
} else { } else {
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
icon: 'none' icon: 'none'
}) })
this.isProcessing = false //this.isProcessing = false
loadingShown = false //loadingShown = false
uni.hideLoading(); uni.hideLoading();
} }
}) })
@ -599,15 +590,6 @@
}); });
return; return;
} }
// 防重复提交
if (this.isProcessing) return;
let loadingShown = false;
uni.showLoading({
title: '处理中...',
mask: true
});
loadingShown = true;
this.isProcessing = true
const instructValue = this.isLaserOn ? 0 : 1; const instructValue = this.isLaserOn ? 0 : 1;
let data = { let data = {
deviceId: this.computedDeviceId, deviceId: this.computedDeviceId,
@ -625,15 +607,11 @@
this.isLaserOn = !this.isLaserOn; this.isLaserOn = !this.isLaserOn;
this.currentlaserMode = this.isLaserOn ? "开启" : "关闭"; this.currentlaserMode = this.isLaserOn ? "开启" : "关闭";
this.lightModeC = false; this.lightModeC = false;
this.isProcessing = false
loadingShown = false
} else { } else {
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
icon: 'none' icon: 'none'
}); });
this.isProcessing = false
loadingShown = false
} }
}) })
}, },
@ -652,11 +630,9 @@
sizeType: ['original', 'compressed'], sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'], sourceType: ['album', 'camera'],
success: (res) => { success: (res) => {
// 将选择的图片赋值给selectedImage
const file = res.tempFiles[0]; const file = res.tempFiles[0];
const fileSize = file.size || 0; const fileSize = file.size || 0;
if (fileSize > 2 * 1024 * 1024) { if (fileSize > 2 * 1024 * 1024) {
console.log(`文件过大: ${fileSize} 字节`); // 调试日志
uni.showToast({ uni.showToast({
title: '图片大小不能超过2MB', title: '图片大小不能超过2MB',
icon: 'none', icon: 'none',
@ -664,13 +640,19 @@
}); });
return; return;
} }
this.selectedImage = res.tempFilePaths[0]; let that = this;
console.log('选择的图片:', res); uni.navigateTo({
url: "/pages/6155/ImgCrop",
events: {
ImgCutOverPath :function (data) {
that.selectedImage = data.picPath;
}
}, },
fail: (err) => { success(ev) {
uni.showToast({ ev.eventChannel.emit('checkImg', {
title: '选择图片失败', data: res.tempFiles[0].path,
icon: 'none' });
}
}); });
} }
}); });
@ -1178,25 +1160,30 @@
// 1设备切换灯光实时返回 // 1设备切换灯光实时返回
switch (deviceState[0]) { switch (deviceState[0]) {
case 1: case 1:
this.currentMainMode = this.getMainLightModeLabel(deviceState[ this.currentMainMode = this.getMainLightModeLabel(
deviceState[
1]); 1]);
this.sliderValue = deviceState[2]; this.sliderValue = deviceState[2];
this.deviceInfo.batteryRemainingTime = deviceState[3]; this.deviceInfo.batteryRemainingTime = deviceState[3];
break; break;
// 12为设备实时上报 // 12为设备实时上报
case 12: case 12:
this.currentMainMode = this.getMainLightModeLabel(deviceState[ this.currentMainMode = this.getMainLightModeLabel(
deviceState[
1]); 1]);
this.isLaserOn = deviceState[2] === 1; this.isLaserOn = deviceState[2] === 1; //第3位表示当时激光灯档位
this.currentlaserMode = this.isLaserOn ? "开启" : "关闭"; this.currentlaserMode = this.isLaserOn ? "开启" : "关闭";
if (this.deviceInfo) { if (this.deviceInfo) {
this.deviceInfo.batteryPercentage = deviceState[3]; this.deviceInfo.batteryPercentage = deviceState[
this.deviceInfo.chargeState = deviceState[4]; 3]; //第4位电量百分比
this.deviceInfo.batteryRemainingTime = deviceState[5]; this.deviceInfo.chargeState = deviceState[
4]; //第5位为充电状态0没有充电1正在充电2为已充满
this.deviceInfo.batteryRemainingTime = deviceState[
5]; //第6位200代表电池剩余续航时间200分钟
} }
setTimeout(() => { setTimeout(() => {
if (this.deviceInfo.batteryPercentage < if (this.deviceInfo.batteryPercentage < 20 &&
20) { this.deviceInfo.chargeState == 0) {
this.popupType = 'bettery'; this.popupType = 'bettery';
this.popupMessage = '请及时充电'; this.popupMessage = '请及时充电';
this.showPopupFlag = true; this.showPopupFlag = true;
@ -1648,7 +1635,7 @@
/* 弹窗主体 */ /* 弹窗主体 */
.agreement-popup { .agreement-popup {
width: 100%; width: 100%;
height: 50%; /* height: 50%; */
background-color: rgb(42, 42, 42); background-color: rgb(42, 42, 42);
border-radius: 60rpx 60rpx 0rpx 0rpx; border-radius: 60rpx 60rpx 0rpx 0rpx;
padding: 40rpx; padding: 40rpx;

View File

@ -87,6 +87,21 @@
} }
}, },
}, },
// 处理返回键
onBackPress() {
// 如果绑定成功了,返回时也要刷新首页
if (this.isSuccess) {
uni.$emit('refreshDeviceList');
}
return false; // 允许正常返回
},
// 页面卸载时处理
onUnload() {
// 如果绑定成功了,卸载时也要刷新首页
if (this.isSuccess) {
uni.$emit('refreshDeviceList');
}
},
onLoad(options) { onLoad(options) {
if (options.deviceId) { if (options.deviceId) {
this.deviceId = decodeURIComponent(options.deviceId); this.deviceId = decodeURIComponent(options.deviceId);

View File

@ -6,7 +6,7 @@
<image src="/static/images/common/logo.png" class="logo"></image> <image src="/static/images/common/logo.png" class="logo"></image>
</view> </view>
<view class="user-right"> <view class="user-right">
<view class="user-title">富源晟科技</view> <view class="user-title">武汉星汉</view>
<view class="ID">ID:123456</view> <view class="ID">ID:123456</view>
</view> </view>
</view> </view>