From b4d9a61b4783c21b17469e320f39f77c81a1459a Mon Sep 17 00:00:00 2001 From: "zhonghua.li" Date: Sun, 19 Apr 2026 21:00:05 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=9C=8D=E5=8A=A1=E5=88=97?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/ServiceList.vue | 62 +++++++++---------- pages/ucenter/ucenter.vue | 41 ++++++++---- 2 files changed, 59 insertions(+), 44 deletions(-) diff --git a/pages-subpackage/furniture_customer/components/ServiceList.vue b/pages-subpackage/furniture_customer/components/ServiceList.vue index a178c9d..691faad 100644 --- a/pages-subpackage/furniture_customer/components/ServiceList.vue +++ b/pages-subpackage/furniture_customer/components/ServiceList.vue @@ -76,9 +76,6 @@ class="service-action-menu" v-if="selectedServiceItem && selectedServiceItem.id === item.id && showServiceActionMenu" @click.stop> - - 删除 - 查看 @@ -88,6 +85,10 @@ AI分析 + + AI精提 + + 录音 @@ -210,12 +211,10 @@ item: item }); }, - // 处理AI分析 - async handleAnalysis(item) { + // 处理AI分析(与 AI精提 共用请求体 AudioManagement,仅接口路径与文案不同) + async postAudioManagementAi(item, { apiPath, loadingTitle, successFallback, errorLabel }) { this.closeServiceActionMenu(); - try { - // 获取录音记录ID const recordId = item.id || item.rawData?.id; if (!recordId) { uni.showToast({ @@ -224,20 +223,13 @@ }); return; } - - // 获取完整的 AudioManagement 对象,优先使用 rawData,如果没有则使用 item 的字段构建 const audioManagement = item.rawData || { id: recordId }; - uni.showLoading({ - title: 'AI分析中...' + title: loadingTitle }); - - // 调用AI分析接口:/api/audioManagement/AIAnlyzById - const url = getApiUrl('/api/audioManagement/AIAnlyzById'); - - // 获取认证信息 + const url = getApiUrl(apiPath); let tenantId = ''; let token = ''; try { @@ -246,8 +238,6 @@ } catch (e) { console.error('获取认证信息失败:', e); } - - // 构建请求头 const headers = { 'Content-Type': 'application/json' }; @@ -257,25 +247,20 @@ if (tenantId) { headers['X-Tenant-Id'] = tenantId; } - const res = await uni.request({ url: url, method: 'POST', data: audioManagement, header: headers, - timeout: 60000 // AI分析可能需要较长时间,设置60秒超时 + timeout: 60000 }); - uni.hideLoading(); - if (res.statusCode === 200 && res.data && res.data.success) { uni.showToast({ - title: res.data.message || 'AI分析请求已提交', + title: res.data.message || successFallback, icon: 'success', duration: 2000 }); - - // 如果返回了更新后的数据,通知父组件更新列表项 if (res.data.data) { const d = res.data.data; const updatedItem = { @@ -286,36 +271,47 @@ audioFileExtension: d.audioFileExtension != null ? d.audioFileExtension : item.audioFileExtension, recordingText: d.recordingText != null ? d.recordingText : item.recordingText }; - - // 通知父组件更新该项 this.$emit('updateItem', { recordId: recordId, data: updatedItem }); - - // 触发详情查看事件,使用更新后的数据打开详情页 this.$emit('itemClick', updatedItem); } else { - // 如果没有返回数据,仍然打开详情页 this.$emit('itemClick', item); } } else { uni.showToast({ - title: res.data?.message || 'AI分析失败', + title: res.data?.message || `${errorLabel}失败`, icon: 'none', duration: 2000 }); } } catch (error) { uni.hideLoading(); - console.error('AI分析失败:', error); + console.error(`${errorLabel}失败:`, error); uni.showToast({ - title: `AI分析失败: ${error.errMsg || error.message || '未知错误'}`, + title: `${errorLabel}失败: ${error.errMsg || error.message || '未知错误'}`, icon: 'none', duration: 2000 }); } }, + handleAnalysis(item) { + return this.postAudioManagementAi(item, { + apiPath: '/api/audioManagement/AIAnlyzById', + loadingTitle: 'AI分析中...', + successFallback: 'AI分析请求已提交', + errorLabel: 'AI分析' + }); + }, + handleAnalysisDetail(item) { + return this.postAudioManagementAi(item, { + apiPath: '/api/audioManagement/AIAnlyzByIdForDetail', + loadingTitle: 'AI精提中...', + successFallback: 'AI精提请求已提交', + errorLabel: 'AI精提' + }); + }, // 处理录音 handleAudio(item) { this.closeServiceActionMenu(); diff --git a/pages/ucenter/ucenter.vue b/pages/ucenter/ucenter.vue index abf2b0c..363abac 100644 --- a/pages/ucenter/ucenter.vue +++ b/pages/ucenter/ucenter.vue @@ -53,8 +53,13 @@ {{loginUserInfo.email}} - - + + 设备总数 @@ -69,8 +74,8 @@ {{totalProjects}} {{item.text}} - - + +