1
0
forked from dyf/APP

100J蓝牙上传语音待验证

This commit is contained in:
微微一笑
2026-03-18 18:09:31 +08:00
parent 2c9197833b
commit a9848bd299
5 changed files with 310 additions and 85 deletions

View File

@ -421,6 +421,27 @@
hideLoading(these);
}, 1200);
},
// 无网络时保存到本地,供蓝牙直接发送(不依赖 OSS
saveLocalForBle(filePath) {
const deviceId = these.Status.ID;
if (!deviceId) return;
const item = {
...these.cEdit,
localPath: filePath,
fileUrl: '',
deviceId,
id: 'local_' + these.cEdit.Id,
_createTime: these.cEdit.createTime || Common.DateFormat(new Date(), "yyyy年MM月dd日"),
_isLocal: true
};
const key = `100J_local_audio_${deviceId}`;
let list = uni.getStorageSync(key) || [];
list.unshift(item);
uni.setStorageSync(key, list);
these.AudioData.tempFilePath = "";
these.Status.isRecord = false;
uni.navigateBack();
},
// 保存录音并上传(已修复文件格式问题)
uploadLuYin() {
// 文件类型验证
@ -541,8 +562,10 @@
},
fail: (err) => {
console.error('上传文件失败:', err);
// 无网络时保存到本地,供蓝牙直接发送
these.saveLocalForBle(filePath);
uni.showToast({
title: '上传失败,请检查网络',
title: '网络不可用,已保存到本地,可通过蓝牙发送',
icon: 'none',
duration: 3000
});