From fc1fad05792c801db710690a8947190198424d33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=AE=E5=BE=AE=E4=B8=80=E7=AC=91?= <709648985@qq.com> Date: Fri, 21 Nov 2025 14:43:23 +0800 Subject: [PATCH 1/3] ios --- pages/6155/deviceDetail.vue | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/pages/6155/deviceDetail.vue b/pages/6155/deviceDetail.vue index 952b0be..e1103dc 100644 --- a/pages/6155/deviceDetail.vue +++ b/pages/6155/deviceDetail.vue @@ -896,7 +896,7 @@ }, 1500); } //视频上传 - let uplploadVideo = (videoPath) => { + let uplploadVideo = (videoPath, width, height) => { return new Promise((resolve, reject) => { let start = new Date(); @@ -915,7 +915,9 @@ "clientid": clientid }, formData: { - code: 2 + code: 2, + width: width, + height: height }, timeout: 600000, fail: (ex) => { @@ -1147,16 +1149,36 @@ let width = Math.round(res.width); let height = Math.round(res.height); let duration = res.duration; - console.log("视频信息 - 宽度:", width, "高度:", height, "时长:", duration); + + // 获取平台信息 + const systemInfo = uni.getSystemInfoSync(); + const platform = systemInfo.platform; + const isIOS = platform === 'ios'; + + console.log("平台:", platform, "uni.chooseVideo返回 - 宽度:", width, "高度:", height, "时长:", duration); + + // iOS特殊处理:如果返回的是80*40,很可能是160*80的一半(iOS的bug) + if (isIOS && width === 80 && height === 40) { + console.log("检测到iOS特殊情况:返回80*40,实际应该是160*80,进行修正"); + width = 160; + height = 80; + } + + // 检查分辨率是否符合要求 + let checkResolution = (w, h) => { + // 使用容差比较,允许1像素的误差 + return Math.abs(w - 160) <= 1 && Math.abs(h - 80) <= 1; + }; + let err = []; if (duration < 2) { err.push("视频时长至少2秒"); } - // 使用容差比较,允许1像素的误差(iOS可能有精度问题) - if (Math.abs(width - 160) > 1 || Math.abs(height - 80) > 1) { + if (!checkResolution(width, height)) { err.push("视频宽高必须是160*80,当前分辨率:" + width + "*" + height); } + if (err.length > 0) { err = err.join(";"); these.showPop({ @@ -1167,11 +1189,12 @@ }); return; } + showLoading(these, { text: '正在上传' }); setTimeout(() => { - uplploadVideo(path).then(result => { + uplploadVideo(path, width, height).then(result => { let data = result.data; let convertedData = []; From 31b189dd728ba4cb1433a27bce063f0586370914 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=AE=E5=BE=AE=E4=B8=80=E7=AC=91?= <709648985@qq.com> Date: Fri, 21 Nov 2025 15:59:58 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=85=B3=E9=97=AD=E5=8E=8B=E5=A1=91?= =?UTF-8?q?=E4=BF=9D=E8=AF=81ios=E6=AD=A3=E5=B8=B86155?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/6155/deviceDetail.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/pages/6155/deviceDetail.vue b/pages/6155/deviceDetail.vue index e1103dc..5317a44 100644 --- a/pages/6155/deviceDetail.vue +++ b/pages/6155/deviceDetail.vue @@ -1142,6 +1142,7 @@ uni.chooseVideo({ sourceType: ['album'], + compressed: false, // 关闭视频压缩,确保上传原始文件 success: function(res) { console.log("res=", res); let path = res.tempFilePath; From 76d40bc0965b2ce4ce253bbb28bdc30233152c6c Mon Sep 17 00:00:00 2001 From: fengerli <528575642@qq.com> Date: Fri, 21 Nov 2025 16:12:55 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=BA=E5=91=98?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E6=97=B6=E9=97=B4=E5=89=8D=E5=90=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/6155/deviceDetail.vue | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/pages/6155/deviceDetail.vue b/pages/6155/deviceDetail.vue index e1103dc..cc87725 100644 --- a/pages/6155/deviceDetail.vue +++ b/pages/6155/deviceDetail.vue @@ -585,7 +585,7 @@ console.log(`字段 ${key} 不在 formData 中,跳过更新`); } }); - + // 强制触发视图更新,确保电量显示同步 these.$forceUpdate(); console.log("更新后的电量:", these.formData.battary); @@ -1091,7 +1091,7 @@ dataView.setUint8(packetSize - 1, 0xFF); } let inteval = parseInt(this.inteval ? this.inteval : 80); - + console.log(inteval, 'intevalinteval'); ble.sendData(f.deviceId, buffer, f.writeServiceId, f .wirteCharactId).then(() => { if (ReSendNo) { @@ -1149,27 +1149,28 @@ let width = Math.round(res.width); let height = Math.round(res.height); let duration = res.duration; - + // 获取平台信息 const systemInfo = uni.getSystemInfoSync(); const platform = systemInfo.platform; const isIOS = platform === 'ios'; - - console.log("平台:", platform, "uni.chooseVideo返回 - 宽度:", width, "高度:", height, "时长:", duration); - + + console.log("平台:", platform, "uni.chooseVideo返回 - 宽度:", width, "高度:", height, + "时长:", duration); + // iOS特殊处理:如果返回的是80*40,很可能是160*80的一半(iOS的bug) if (isIOS && width === 80 && height === 40) { console.log("检测到iOS特殊情况:返回80*40,实际应该是160*80,进行修正"); width = 160; height = 80; } - + // 检查分辨率是否符合要求 let checkResolution = (w, h) => { // 使用容差比较,允许1像素的误差 return Math.abs(w - 160) <= 1 && Math.abs(h - 80) <= 1; }; - + let err = []; if (duration < 2) { err.push("视频时长至少2秒"); @@ -1178,7 +1179,7 @@ if (!checkResolution(width, height)) { err.push("视频宽高必须是160*80,当前分辨率:" + width + "*" + height); } - + if (err.length > 0) { err = err.join(";"); these.showPop({ @@ -1189,7 +1190,7 @@ }); return; } - + showLoading(these, { text: '正在上传' }); @@ -1579,8 +1580,9 @@ dataView.setUint8(bufferSize - 1, 0xFF); - let inteval = parseInt(this.inteval ? this.inteval : 50); - console.log("inteval=", inteval) + let inteval = 100; + //parseInt(this.inteval ? this.inteval : 80); + //console.log("inteval=", inteval) ble.sendData(f.deviceId, buffer, f.writeServiceId, f .wirteCharactId, 30).then(() => {