优化100j
This commit is contained in:
@ -105,7 +105,9 @@
|
||||
videRenameAudioFile,
|
||||
deviceDeleteAudioFile,
|
||||
deviceUpdateVoice,
|
||||
updateBleStatus
|
||||
updateBleStatus,
|
||||
sync100JBleProtocolFromHelper,
|
||||
remove100JVoiceBleCache
|
||||
} from '@/api/100J/HBY100-J.js'
|
||||
import { baseURL } from '@/utils/request.js'
|
||||
import {
|
||||
@ -431,7 +433,10 @@
|
||||
let task = () => {
|
||||
if (item._isLocal) {
|
||||
// 本地项:从本地存储移除
|
||||
const key = `100J_local_audio_${this.device.deviceId}`;
|
||||
const devId = this.device.deviceId;
|
||||
const vid = (item.id != null && item.id !== '') ? item.id : item.fileId;
|
||||
remove100JVoiceBleCache(devId, vid);
|
||||
const key = `100J_local_audio_${devId}`;
|
||||
let list = uni.getStorageSync(key) || [];
|
||||
list = list.filter(l => l.id !== item.id && l.Id !== item.Id);
|
||||
uni.setStorageSync(key, list);
|
||||
@ -528,12 +533,16 @@
|
||||
const raw = item.fileUrl || item.url || item.filePath || item.audioUrl || item.ossUrl || '';
|
||||
fileUrl = (typeof raw === 'string' && raw) ? (raw.startsWith('/') ? (baseURL + raw) : raw) : '';
|
||||
} else {
|
||||
// 本地项:localPath 优先,无则用 fileUrl(mergeLocal 中可能只有 fileUrl 存路径)
|
||||
if (!localPath && item.fileUrl) localPath = item.fileUrl;
|
||||
// 本地项:localPath 优先;mergeLocal 可能把路径放在 fileUrl,但勿把 http 当成本地路径
|
||||
if (!localPath && item.fileUrl) {
|
||||
const cand = String(item.fileUrl).trim();
|
||||
if (cand && !/^https?:\/\//i.test(cand)) localPath = cand;
|
||||
}
|
||||
}
|
||||
const data = {
|
||||
id: item.id,
|
||||
fileUrl,
|
||||
id: (item.id != null && item.id !== '') ? item.id : item.fileId,
|
||||
// 本地合并项 mergeLocal 会把路径写在 fileUrl,需带给接口层做 effectiveLocal 兜底
|
||||
fileUrl: item._isLocal ? (typeof item.fileUrl === 'string' ? item.fileUrl : '') : fileUrl,
|
||||
localPath,
|
||||
onProgress: (p) => { this.updateProgress = p; },
|
||||
// 不传「蓝牙连接中」类提示:关蓝牙走 4G 时易误导;进度条 + 必要时全局请稍候即可
|
||||
@ -546,8 +555,9 @@
|
||||
this.isUpdating = false;
|
||||
this.updateProgress = 0;
|
||||
}
|
||||
}, 60000);
|
||||
deviceUpdateVoice(data).then((RES) => {
|
||||
}, 120000); // 蓝牙分片+MTU 协商+大包写入较慢,60s 易误报「操作超时」
|
||||
// 进入列表时的蓝牙快照可能过期;与 HBY100 详情页一致,从 BleHelper 按 MAC 再对齐一次,否则常静默走 4G、看不到 [100J-蓝牙] 分片日志
|
||||
sync100JBleProtocolFromHelper(this.device).then(() => deviceUpdateVoice(data)).then((RES) => {
|
||||
clearTimeout(overallTimer);
|
||||
if (RES.code == 200) {
|
||||
// 蓝牙上传:进度已由 onProgress 更新,直接完成
|
||||
@ -596,7 +606,8 @@
|
||||
}).catch((err) => {
|
||||
clearTimeout(overallTimer);
|
||||
this.isUpdating = false;
|
||||
uni.showToast({ title: err.message || '操作失败', icon: 'none', duration: 2000 });
|
||||
this.updateProgress = 0;
|
||||
uni.showToast({ title: err.message || '操作失败', icon: 'none', duration: 2500 });
|
||||
});
|
||||
},
|
||||
closePop: function() {
|
||||
|
||||
Reference in New Issue
Block a user