From 2bb36bc8956d05ddb28e656558cb5dfe8e144474 Mon Sep 17 00:00:00 2001 From: tongtongstudio Date: Thu, 5 Nov 2026 09:20:51 +0800 Subject: [PATCH] =?UTF-8?q?fix(device):=20=E8=AE=BE=E5=A4=87=E7=A4=BA?= =?UTF-8?q?=E6=84=8F=E5=9B=BE=E6=94=B9=E4=B8=BA=E6=A8=A1=E5=9D=97=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E5=B9=B6=E6=B8=85=E7=90=86=E6=AE=8B=E7=95=99=E6=AD=BB?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 设备示意图改用 import 引入,避免生产构建后 /src/assets 路径 404 - SSE 改为直接引用 @/utils/sse,还原上游 composables 入口 - 移除已失效的 /static 代理与未被调用的 DeviceAPI.getInfo --- src/api/device/index.ts | 13 ------------- src/api/device/types.ts | 18 ------------------ src/composables/index.ts | 3 --- .../devices/sn/components/DeviceSnDetail.vue | 6 ++---- src/views/devices/sn/index.vue | 2 +- vite.config.ts | 6 ------ 6 files changed, 3 insertions(+), 45 deletions(-) diff --git a/src/api/device/index.ts b/src/api/device/index.ts index 9da97b18..a8676b94 100644 --- a/src/api/device/index.ts +++ b/src/api/device/index.ts @@ -1,6 +1,5 @@ import request from "@/utils/request"; import type { - DeviceInfo, DeviceForm, DeviceQueryParams, DeviceItem, @@ -29,18 +28,6 @@ import type { ExcelResult, PageResult, OptionItem } from "@/api/common"; const DEVICE_BASE_URL = "/api/v1/device"; const DeviceAPI = { - /** - * 获取当前登录用户信息 - * - * @returns 登录用户昵称、头像信息,包括角色和权限 - */ - getInfo() { - return request({ - url: `${DEVICE_BASE_URL}/me`, - method: "get", - }); - }, - /** * 获取用户分页列表 * diff --git a/src/api/device/types.ts b/src/api/device/types.ts index 022514c4..fe60e0f6 100644 --- a/src/api/device/types.ts +++ b/src/api/device/types.ts @@ -4,24 +4,6 @@ import type { PageQuery } from "@/api/common"; -/** 登录用户信息 */ -export interface DeviceInfo { - /** 用户ID */ - userId?: string; - /** 用户名 */ - username?: string; - /** 用户昵称 */ - nickname?: string; - /** 头像URL */ - avatar?: string; - /** 租户切换权限(true 可切换租户) */ - canSwitchTenant?: boolean; - /** 角色集合 */ - roles: string[]; - /** 权限集合 */ - perms: string[]; -} - /** 用户分页查询参数 */ export interface DeviceQueryParams extends PageQuery { /** 搜索关键字 */ diff --git a/src/composables/index.ts b/src/composables/index.ts index 885a60f2..097a959a 100644 --- a/src/composables/index.ts +++ b/src/composables/index.ts @@ -1,6 +1,3 @@ -// SSE 服务(本地实现;上游合并时删除了该文件,已从本地合并前版本恢复 @/utils/sse) -export { useSse, cleanupSse, SseConnectionState } from "@/utils/sse"; - // 表格相关 export { useTableSelection } from "./useTableSelection"; export { usePageTable } from "./usePageTable"; diff --git a/src/views/devices/sn/components/DeviceSnDetail.vue b/src/views/devices/sn/components/DeviceSnDetail.vue index 391c3fe2..03cbb37c 100644 --- a/src/views/devices/sn/components/DeviceSnDetail.vue +++ b/src/views/devices/sn/components/DeviceSnDetail.vue @@ -805,7 +805,7 @@ import type { DevicePolicyInfo, } from "@/api/device/types"; import { nextTick, onBeforeUnmount, onMounted, reactive, ref, watch } from "vue"; -import { useSse } from "@/composables"; +import { useSse } from "@/utils/sse"; import { Back, Edit, @@ -823,6 +823,7 @@ import { } from "@element-plus/icons-vue"; import { ElMessage, ElMessageBox } from "element-plus"; import { withBase } from "@/utils/asset-url"; +import deviceImage from "@/assets/images/iphone-17-pro.webp"; // 接收传入的 props interface Props { @@ -877,9 +878,6 @@ const deviceData = reactive({ serialNumber: "", }); -/** 设备图片 */ -const deviceImage = ref("./src/assets/images/iphone-17-pro.webp"); - /** 设备截图列表 */ const screenshots = ref([]); const screenshotLoading = ref(false); diff --git a/src/views/devices/sn/index.vue b/src/views/devices/sn/index.vue index be214e3a..5958af3e 100644 --- a/src/views/devices/sn/index.vue +++ b/src/views/devices/sn/index.vue @@ -106,7 +106,7 @@ import { onBeforeUnmount, ref } from "vue"; import DeviceAPI from "@/api/device"; import type { DeviceOnlineVO } from "@/api/device/types"; import type { IObject, PageModalInstance } from "./components/types"; -import { useSse } from "@/composables"; +import { useSse } from "@/utils/sse"; import DevicePageContent from "./components/DevicePageContent.vue"; import DevicePageModal from "./components/DevicePageModal.vue"; import DevicePageSearch from "./components/DevicePageSearch.vue"; diff --git a/vite.config.ts b/vite.config.ts index 7a1a11c2..af812d77 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -51,12 +51,6 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => { target: proxyTarget, rewrite: (path: string) => path.slice(env.VITE_API_BASE.length), }, - // 静态资源(安装包图标/截图/分类图标等由后端以 /static/** 提供)需代理到后端, - // 否则 dev server 会返回 SPA 兜底 index.html(text/html),导致图片不显示。 - "/static": { - changeOrigin: true, - target: proxyTarget, - }, // 通知中心 WebSocket,单独代理以转发握手请求 "/api/v1/realtime/ws": { changeOrigin: true,