From 4b4365a42d7d4b285adc4f262a64fec74973bb22 Mon Sep 17 00:00:00 2001 From: tongtongstudio Date: Wed, 5 Aug 2026 17:13:00 +0800 Subject: [PATCH] =?UTF-8?q?feat(device):=20=E6=96=B0=E5=A2=9E=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E5=B7=B2=E5=AE=89=E8=A3=85=E5=BA=94=E7=94=A8=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 为设备详情页添加应用信息标签页,支持查看已安装应用列表、打开/清除/卸载应用,以及上传应用图标等操作。 --- src/api/system/device/index.ts | 50 +++++ src/api/system/device/types.ts | 30 +++ src/components/DeviceSn/DeviceSnDetail.vue | 236 ++++++++++++++++++++- 3 files changed, 312 insertions(+), 4 deletions(-) diff --git a/src/api/system/device/index.ts b/src/api/system/device/index.ts index 8a7817ab..87eae437 100644 --- a/src/api/system/device/index.ts +++ b/src/api/system/device/index.ts @@ -15,6 +15,7 @@ import type { DeviceNetworkInfo, DeviceOtherInfo, DeviceSecurityInfo, + ApkInstallInfo, } from "./types"; import type { ExcelResult, PageResult, OptionItem } from "@/api/common"; @@ -355,6 +356,55 @@ const DeviceAPI = { method: "get", }); }, + + /** 设备已安装应用列表 */ + getApkList(serialno: string) { + return request({ + url: `${DEVICE_BASE_URL}/${serialno}/apk_list`, + method: "get", + }); + }, + + /** 打开应用 */ + launchApp(sn: string, packageName: string) { + return request({ + url: `${DEVICE_BASE_URL}/${sn}/app/launch`, + method: "post", + data: { packageName }, + }); + }, + + /** 清除应用数据 */ + clearAppData(sn: string, packageName: string) { + return request({ + url: `${DEVICE_BASE_URL}/${sn}/app/clear_data`, + method: "post", + data: { packageName }, + }); + }, + + /** 卸载应用 */ + uninstallApp(sn: string, packageName: string) { + return request({ + url: `${DEVICE_BASE_URL}/${sn}/app/uninstall`, + method: "post", + data: { packageName }, + }); + }, + + /** 上传应用图标(全局图标库) */ + uploadAppIcon(packageName: string, file: File) { + const formData = new FormData(); + formData.append("file", file); + return request({ + url: `/api/v1/app-icons/${packageName}/upload`, + method: "post", + data: formData, + headers: { + "Content-Type": "multipart/form-data", + }, + }); + }, }; export default DeviceAPI; diff --git a/src/api/system/device/types.ts b/src/api/system/device/types.ts index 995df1c6..574425a6 100644 --- a/src/api/system/device/types.ts +++ b/src/api/system/device/types.ts @@ -329,3 +329,33 @@ export interface DeviceOtherInfo { freeRam?: string; totalRam?: string; } + +// ===================== 设备应用信息 ===================== + +/** 设备已安装应用信息 */ +export interface ApkInstallInfo { + /** 包名 */ + packageName?: string; + /** 应用名称 */ + appName?: string; + /** 版本名称 */ + versionName?: string; + /** 版本号 */ + versionCode?: number; + /** 安装时间 */ + installTime?: Date | string; + /** 最后更新时间 */ + lastUpdateTime?: Date | string; + /** Apk文件大小 */ + apkSize?: number; + /** App数据占用空间 */ + dataSize?: number; + /** App缓存占用空间 */ + cacheSize?: number; + /** apk MD5 */ + md5?: string; + /** 是否为系统应用 */ + systemApp?: boolean; + /** 应用图标访问地址 */ + iconUrl?: string; +} diff --git a/src/components/DeviceSn/DeviceSnDetail.vue b/src/components/DeviceSn/DeviceSnDetail.vue index 19d658d7..71fd4fc8 100644 --- a/src/components/DeviceSn/DeviceSnDetail.vue +++ b/src/components/DeviceSn/DeviceSnDetail.vue @@ -452,7 +452,75 @@
- +
+ + + 刷新应用列表 + +
+ + + + + + + + + + + + + + + + + + + + +
@@ -486,6 +554,7 @@