100J蓝牙上传语音待验证
This commit is contained in:
@ -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
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user