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

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

View File

@@ -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<any, DeviceInfo>({
url: `${DEVICE_BASE_URL}/me`,
method: "get",
});
},
/**
* 获取用户分页列表
*

View File

@@ -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 {
/** 搜索关键字 */

View File

@@ -1,6 +1,3 @@
// SSE 服务(本地实现;上游合并时删除了该文件,已从本地合并前版本恢复 @/utils/sse)
export { useSse, cleanupSse, SseConnectionState } from "@/utils/sse";
// 表格相关
export { useTableSelection } from "./useTableSelection";
export { usePageTable } from "./usePageTable";

View File

@@ -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<DeviceScreenshot[]>([]);
const screenshotLoading = ref(false);

View File

@@ -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";

View File

@@ -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,