fix(device): 设备示意图改为模块导入并清理残留死代码

- 设备示意图改用 import 引入,避免生产构建后 /src/assets 路径 404
- SSE 改为直接引用 @/utils/sse,还原上游 composables 入口
- 移除已失效的 /static 代理与未被调用的 DeviceAPI.getInfo
This commit is contained in:
tongtong committed 2026-11-05 09:20:51 +08:00
1 parent d36248ead6
commit 2bb36bc895
6 files changed
+3 -45

No files matched your search

-13
View File
@@ -1,6 +1,5 @@
import request from "@/utils/request"; import request from "@/utils/request";
import type { import type {
DeviceInfo,
DeviceForm, DeviceForm,
DeviceQueryParams, DeviceQueryParams,
DeviceItem, DeviceItem,
@@ -29,18 +28,6 @@ import type { ExcelResult, PageResult, OptionItem } from "@/api/common";
const DEVICE_BASE_URL = "/api/v1/device"; const DEVICE_BASE_URL = "/api/v1/device";
const DeviceAPI = { const DeviceAPI = {
/**
* 获取当前登录用户信息
*
* @returns 登录用户昵称、头像信息,包括角色和权限
*/
getInfo() {
return request<any, DeviceInfo>({
url: `${DEVICE_BASE_URL}/me`,
method: "get",
});
},
/** /**
* 获取用户分页列表 * 获取用户分页列表
* *
-18
View File
@@ -4,24 +4,6 @@
import type { PageQuery } from "@/api/common"; 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 { export interface DeviceQueryParams extends PageQuery {
/** 搜索关键字 */ /** 搜索关键字 */
-3
View File
@@ -1,6 +1,3 @@
// SSE 服务(本地实现;上游合并时删除了该文件,已从本地合并前版本恢复 @/utils/sse)
export { useSse, cleanupSse, SseConnectionState } from "@/utils/sse";
// 表格相关 // 表格相关
export { useTableSelection } from "./useTableSelection"; export { useTableSelection } from "./useTableSelection";
export { usePageTable } from "./usePageTable"; export { usePageTable } from "./usePageTable";
@@ -805,7 +805,7 @@ import type {
DevicePolicyInfo, DevicePolicyInfo,
} from "@/api/device/types"; } from "@/api/device/types";
import { nextTick, onBeforeUnmount, onMounted, reactive, ref, watch } from "vue"; import { nextTick, onBeforeUnmount, onMounted, reactive, ref, watch } from "vue";
import { useSse } from "@/composables"; import { useSse } from "@/utils/sse";
import { import {
Back, Back,
Edit, Edit,
@@ -823,6 +823,7 @@ import {
} from "@element-plus/icons-vue"; } from "@element-plus/icons-vue";
import { ElMessage, ElMessageBox } from "element-plus"; import { ElMessage, ElMessageBox } from "element-plus";
import { withBase } from "@/utils/asset-url"; import { withBase } from "@/utils/asset-url";
import deviceImage from "@/assets/images/iphone-17-pro.webp";
// 接收传入的 props // 接收传入的 props
interface Props { interface Props {
@@ -877,9 +878,6 @@ const deviceData = reactive({
serialNumber: "", serialNumber: "",
}); });
/** 设备图片 */
const deviceImage = ref("./src/assets/images/iphone-17-pro.webp");
/** 设备截图列表 */ /** 设备截图列表 */
const screenshots = ref<DeviceScreenshot[]>([]); const screenshots = ref<DeviceScreenshot[]>([]);
const screenshotLoading = ref(false); const screenshotLoading = ref(false);
+1 -1
View File
@@ -106,7 +106,7 @@ import { onBeforeUnmount, ref } from "vue";
import DeviceAPI from "@/api/device"; import DeviceAPI from "@/api/device";
import type { DeviceOnlineVO } from "@/api/device/types"; import type { DeviceOnlineVO } from "@/api/device/types";
import type { IObject, PageModalInstance } from "./components/types"; import type { IObject, PageModalInstance } from "./components/types";
import { useSse } from "@/composables"; import { useSse } from "@/utils/sse";
import DevicePageContent from "./components/DevicePageContent.vue"; import DevicePageContent from "./components/DevicePageContent.vue";
import DevicePageModal from "./components/DevicePageModal.vue"; import DevicePageModal from "./components/DevicePageModal.vue";
import DevicePageSearch from "./components/DevicePageSearch.vue"; import DevicePageSearch from "./components/DevicePageSearch.vue";
-6
View File
@@ -51,12 +51,6 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
target: proxyTarget, target: proxyTarget,
rewrite: (path: string) => path.slice(env.VITE_API_BASE.length), rewrite: (path: string) => path.slice(env.VITE_API_BASE.length),
}, },
// 静态资源(安装包图标/截图/分类图标等由后端以 /static/** 提供)需代理到后端,
// 否则 dev server 会返回 SPA 兜底 index.html(text/html),导致图片不显示。
"/static": {
changeOrigin: true,
target: proxyTarget,
},
// 通知中心 WebSocket,单独代理以转发握手请求 // 通知中心 WebSocket,单独代理以转发握手请求
"/api/v1/realtime/ws": { "/api/v1/realtime/ws": {
changeOrigin: true, changeOrigin: true,