From 9af30b8b8adecb7e0b94c6c49d90ff03b1e4ee5c Mon Sep 17 00:00:00 2001 From: DEV_DSW <562304744@qq.com> Date: Thu, 28 May 2026 11:56:13 +0800 Subject: [PATCH] refactor: update icon system, fix login and add temp auth refactor all icon map references from zniconsMap to iconsMap across the codebase standardize icon import paths and add complete src/assets/fonts/znicons.ts definition file fix login page query selector typo and replace hardcoded client ID with environment variable add temporary auth token injection in request utility using env var update ZnIcon documentation and development environment config --- .env.development | 5 ++++- .trae/documents/ZnIcon字体图标组件封装计划.md | 10 +++++----- src/assets/fonts/{znicons.js => znicons.ts} | 2 +- src/components/CreateServiceOrder/index.vue | 4 ++-- src/components/GoodDetail/index.vue | 4 ++-- src/components/RefundPopup/index.vue | 4 ++-- src/components/ZnIcon/index.vue | 4 ++-- src/pages/goods/components/GoodFacility/index.vue | 2 +- src/pages/login/index.vue | 4 ++-- src/pages/quick/components/Tabs/index.vue | 4 ++-- src/static/fonts/znicons.js | 2 -- src/utils/request.ts | 3 +++ 12 files changed, 26 insertions(+), 22 deletions(-) rename src/assets/fonts/{znicons.js => znicons.ts} (97%) delete mode 100644 src/static/fonts/znicons.js diff --git a/.env.development b/.env.development index f17b54c..721a99b 100644 --- a/.env.development +++ b/.env.development @@ -11,4 +11,7 @@ VITE_API_TIMEOUT_MS = 10000 VITE_SOCKET_BASE_URL = "/ingress/agent/ws/chat" # Client ID -VITE_CLIENT_ID = "12" \ No newline at end of file +VITE_CLIENT_ID = "12" + +# Token +VITE_TOKEN = "eyJraWQiOiJiMTVhZTk0Mi03MjI5LTMyOWUtODA1Yi0wNjFlNmRjYTE1MDQiLCJhbGciOiJSUzI1NiJ9.eyJ0ZW5hbnRfaWQiOjEsInN1YiI6ImJyb3RoZXI4IiwiY2xpZW50SWQiOiJwaWciLCJpc3MiOiJodHRwczovL3BpZzRjbG91ZC5jb20iLCJjbGllbnRfaWQiOiJwaWciLCJhdXRob3JpdGllcyI6WyIvbWFya2V0aW5nL2luZGV4IiwiUk9MRV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c19zeXNwdWJsaWNwYXJhbV9hZGQiLCJzeXNfc3lzcHVibGljcGFyYW1fZGVsIiwic3lzX3N5c3B1YmxpY3BhcmFtX2VkaXQiLCJzeXNfdG9rZW5fZGVsIiwic3lzX3VzZXJfYWRkIiwic3lzX3VzZXJfZGVsIiwic3lzX3VzZXJfZWRpdCIsInN5c191c2VyX2V4cG9ydCJdLCJhdWQiOiJwaWciLCJsaWNlbnNlIjoiaHR0cHM6Ly9waWc0Y2xvdWQuY29tIiwibmJmIjoxNzc5OTM3MDMzLCJ1c2VyX2lkIjoiMTk2NjEzNTA2MDA2NTc4NzkwNiIsInNjb3BlIjpbInNlcnZlciJdLCJleHAiOjE3Nzk5ODAyMzMsImRlcHRfaWQiOjEsImlhdCI6MTc3OTkzNzAzMywianRpIjoiNzhiM2E3ODgtOGUwZS00Zjc2LWEwMDgtOGYxYzI4M2YxN2ZiIiwidXNlcm5hbWUiOiJicm90aGVyOCJ9.p6GSKT9JPbXD_L7BBGx4j4-amhqZZmzSVnjOZrAZ7klA3WfqWfNw6xgOgKyJHNeXgdJpFlJ-vw3vTTPxuaUJJ-57ugGc60PjH4PC5ARVGvGe4psbXDEw3oYJPBquzLSFDqwCpYThAvTxXmjE6EA6mlrw5y6__-dF5HREu0Bspew2z5a3DvUR4swBFz3g3yZnQCoYXoY32W7akJ5xz2oYjsib411_bAOkFTSsmde2qXqOZ2ij2hUjImCtEaURP0Exep8J_1AOFBp0VoWuhFlPHj6B1-JmyOW4d_aDEa3bUpo46iA_GsXOfSqVzekdhO1bU0KZQzCmiNqawhECdtW3Jw" \ No newline at end of file diff --git a/.trae/documents/ZnIcon字体图标组件封装计划.md b/.trae/documents/ZnIcon字体图标组件封装计划.md index e6329ce..f8683b6 100644 --- a/.trae/documents/ZnIcon字体图标组件封装计划.md +++ b/.trae/documents/ZnIcon字体图标组件封装计划.md @@ -14,8 +14,8 @@ - 字体映射表存在:`src/assets/fonts/znicons.js` - 字体文件存在:`src/assets/fonts/znicons.ttf` - 组件骨架存在但为空:`src/components/ZnIcon/index.vue`(0 行) -- 业务中大量使用 `` + `zniconsMap[...]` 的方式展示字体图标,并且存在历史路径导入: - - `import { zniconsMap } from "@/static/fonts/znicons(.js)"`(仓库内当前没有 `src/static/`) +- 业务中大量使用 `` + `iconsMap[...]` 的方式展示字体图标,并且存在历史路径导入: + - `import { iconsMap } from "@/static/fonts/znicons(.js)"`(仓库内当前没有 `src/static/`) - 多处样式中通过 `@font-face` 引用 `@/static/fonts/znicons.ttf`,但仓库内无该字体路径,导致字体加载不稳定: - `src/components/ImageSwiper/styles/index.scss` - `src/components/GoodDetail/index.vue` @@ -42,7 +42,7 @@ #### Props 设计(建议) -- `name: string`(必填;对应 `zniconsMap` 的 key) +- `name: string`(必填;对应 `iconsMap` 的 key) - `size?: number | string`(默认 16;number 按 px 处理,string 原样写入) - `color?: string`(可选;不传则使用 `currentColor`,便于 Tailwind `text-*` 控制) - `title?: string`(可选;用于无障碍/tooltip) @@ -72,9 +72,9 @@ ### 3) 增加历史导入路径兼容层(不改业务代码也能编译) -新增文件:`src/static/fonts/znicons.js` +新增文件:`src/assets/fonts/znicons.js` -- 仅做 re-export:`export { zniconsMap } from "@/assets/fonts/znicons.js"` +- 仅做 re-export:`export { iconsMap } from "@/assets/fonts/znicons"` 说明: diff --git a/src/assets/fonts/znicons.js b/src/assets/fonts/znicons.ts similarity index 97% rename from src/assets/fonts/znicons.js rename to src/assets/fonts/znicons.ts index d0a53bc..3ed0d61 100644 --- a/src/assets/fonts/znicons.js +++ b/src/assets/fonts/znicons.ts @@ -1,4 +1,4 @@ -export const zniconsMap = { +export const iconsMap = { "zn-wifi": "\ue681", "zn-bath": "\ue69a", "zn-frame": "\ue683", diff --git a/src/components/CreateServiceOrder/index.vue b/src/components/CreateServiceOrder/index.vue index 7d41639..554e59b 100644 --- a/src/components/CreateServiceOrder/index.vue +++ b/src/components/CreateServiceOrder/index.vue @@ -38,7 +38,7 @@
- {{ zniconsMap["zn-camera"] }} + {{ iconsMap["zn-camera"] }}
@@ -74,7 +74,7 @@ import { ref, computed, onMounted, nextTick, defineProps, watch } from "vue"; import { SCROLL_TO_BOTTOM } from "@/constants/constant"; import { createWorkOrder } from "@/api/workOrder"; import { uploadFile } from "@/api/upload"; -import { zniconsMap } from "@/assets/fonts/znicons"; +import { iconsMap } from "@/assets/fonts/znicons"; const props = defineProps({ toolCall: { diff --git a/src/components/GoodDetail/index.vue b/src/components/GoodDetail/index.vue index 84edb6f..1e1c288 100644 --- a/src/components/GoodDetail/index.vue +++ b/src/components/GoodDetail/index.vue @@ -13,7 +13,7 @@ }">
- {{ zniconsMap[moduleItem.moduleIcon] }} + {{ iconsMap[moduleItem.moduleIcon] }} {{ moduleItem.moduleTitle }} @@ -33,7 +33,7 @@ import { defineProps } from "vue"; import Vue3MarkdownIt from 'vue3-markdown-it'; import ModuleTitle from "@/components/ModuleTitle/index.vue"; -import { zniconsMap } from "@/assets/fonts/znicons"; +import { iconsMap } from "@/assets/fonts/znicons"; // Props定义 const props = defineProps({ diff --git a/src/components/RefundPopup/index.vue b/src/components/RefundPopup/index.vue index e10d252..556f40b 100644 --- a/src/components/RefundPopup/index.vue +++ b/src/components/RefundPopup/index.vue @@ -12,7 +12,7 @@
- {{ zniconsMap["zn-refund"] }} + {{ iconsMap["zn-refund"] }} {{ refundTitle }} @@ -29,7 +29,7 @@