From 150b92163f7bce4ee87406ffd2bc1d12be54b530 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8C=BF=E5=B0=8F=E5=A4=A9?= <1638245306@qq.com> Date: Sun, 1 Jun 2025 19:51:25 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=8F=98=E5=8C=96:?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 初始化生成utf-8编码 --- .../dvadmin/system/management/commands/generate_init_json.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/dvadmin/system/management/commands/generate_init_json.py b/backend/dvadmin/system/management/commands/generate_init_json.py index b074344..7d6eb08 100644 --- a/backend/dvadmin/system/management/commands/generate_init_json.py +++ b/backend/dvadmin/system/management/commands/generate_init_json.py @@ -29,7 +29,7 @@ class Command(BaseCommand): def serializer_data(self, serializer, query_set: QuerySet): serializer = serializer(query_set, many=True) data = json.loads(json.dumps(serializer.data, ensure_ascii=False)) - with open(os.path.join(BASE_DIR, f'init_{query_set.model._meta.model_name}.json'), 'w') as f: + with open(os.path.join(BASE_DIR, f'init_{query_set.model._meta.model_name}.json'), 'w',encoding='utf-8') as f: json.dump(data, f, indent=4, ensure_ascii=False) return From 5a980f3b547b5fe016fafb69b3df1b0881bfe0a9 Mon Sep 17 00:00:00 2001 From: 1638245306 <1638245306@qq.com> Date: Mon, 9 Jun 2025 15:08:51 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat(user):=20=E6=B7=BB=E5=8A=A0=E7=94=A8?= =?UTF-8?q?=E6=88=B7=20ID=20=E5=B1=9E=E6=80=A7=E5=B9=B6=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 UserInfosState 接口中添加 id属性 - 在 userInfo store 中添加用户 ID 相关逻辑 - 更新 getUserInfos 和 updateUserInfos 方法以处理用户 ID - 注释掉水平菜单滚动定位代码 --- web/src/layout/navMenu/horizontal.vue | 2 +- web/src/stores/interface/index.ts | 1 + web/src/stores/userInfo.ts | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/web/src/layout/navMenu/horizontal.vue b/web/src/layout/navMenu/horizontal.vue index e7fcfca..192db7f 100644 --- a/web/src/layout/navMenu/horizontal.vue +++ b/web/src/layout/navMenu/horizontal.vue @@ -93,7 +93,7 @@ const initElMenuOffsetLeft = () => { nextTick(() => { let els = document.querySelector('.el-menu.el-menu--horizontal li.is-active'); if (!els) return false; - elMenuHorizontalScrollRef.value.$refs.wrapRef.scrollLeft = els.offsetLeft; + // elMenuHorizontalScrollRef.value.$refs.wrapRef.scrollLeft = els.offsetLeft; }); }; // 路由过滤递归函数 diff --git a/web/src/stores/interface/index.ts b/web/src/stores/interface/index.ts index aeb8420..145375a 100644 --- a/web/src/stores/interface/index.ts +++ b/web/src/stores/interface/index.ts @@ -6,6 +6,7 @@ import {useFrontendMenuStore} from "/@/stores/frontendMenu"; // 用户信息 export interface UserInfosState { + id:'', avatar: string; username: string; name: string; diff --git a/web/src/stores/userInfo.ts b/web/src/stores/userInfo.ts index 01aea20..9250f93 100644 --- a/web/src/stores/userInfo.ts +++ b/web/src/stores/userInfo.ts @@ -12,6 +12,7 @@ import headerImage from '/@/assets/img/headerImage.png'; export const useUserInfo = defineStore('userInfo', { state: (): UserInfosStates => ({ userInfos: { + id:'', avatar: '', username: '', name: '', @@ -37,6 +38,7 @@ export const useUserInfo = defineStore('userInfo', { this.userInfos.pwd_change_count = count; }, async updateUserInfos(userInfos:any) { + this.userInfos.id = userInfos.id; this.userInfos.username = userInfos.name; this.userInfos.avatar = userInfos.avatar; this.userInfos.name = userInfos.name; @@ -54,6 +56,7 @@ export const useUserInfo = defineStore('userInfo', { this.userInfos = Session.get('userInfo'); } else { let userInfos: any = await this.getApiUserInfo(); + this.userInfos.id = userInfos.id; this.userInfos.username = userInfos.data.name; this.userInfos.avatar = userInfos.data.avatar; this.userInfos.name = userInfos.data.name; @@ -74,6 +77,7 @@ export const useUserInfo = defineStore('userInfo', { url: '/api/system/user/user_info/', method: 'get', }).then((res:any)=>{ + this.userInfos.id = res.data.id; this.userInfos.username = res.data.name; this.userInfos.avatar = (res.data.avatar && getBaseURL(res.data.avatar)) || headerImage; this.userInfos.name = res.data.name;