fix: 资产相关页面微调

This commit is contained in:
zxr
2026-08-01 16:24:52 +08:00
parent dbda9f76fb
commit 7353c4eede
35 changed files with 273 additions and 271 deletions

View File

@@ -93,7 +93,8 @@
<li>
<a-dropdown trigger="click">
<a-avatar :size="32" :style="{ marginRight: '8px' }">
<img alt="avatar" :src="avatar" />
<img v-if="avatar" alt="avatar" :src="avatar" />
<icon-user v-else />
</a-avatar>
<template #content>
<a-doption>
@@ -149,7 +150,7 @@ const { changeLocale, currentLocale }: any = useLocale()
const { isFullscreen, toggle: toggleFullScreen } = useFullscreen()
const locales = [...LOCALE_OPTIONS]
const avatar = computed(() => {
return userStore.avatar || '//p3-armor.byteimg.com/tos-cn-i-49unhts6dw/dfdba5317c0c20ce20e64fac803d52bc.svg~tplv-49unhts6dw-image.image'
return userStore.avatar
})
const theme = computed(() => {
return appStore.theme

View File

@@ -25,6 +25,7 @@
import { ref, watch } from 'vue'
import { Message } from '@arco-design/web-vue'
import { resetUserPassword } from '@/api/module/user'
import type { UserItem } from '@/api/types'
import SafeStorage, { AppStorageKey } from '@/utils/safeStorage'
interface Props {
@@ -79,12 +80,12 @@ const handleSavePassword = async () => {
try {
// 从 SafeStorage 获取登录用户信息
const userInfo = SafeStorage.get(AppStorageKey.USER_INFO) || {}
const userInfo = SafeStorage.get<UserItem>(AppStorageKey.USER_INFO)
const res = await resetUserPassword({
account: userInfo.account || '',
account: userInfo?.account || '',
code: '123456', // 暂时没校验,随便传
password: form.value.newPassword,
phone: userInfo.phone || '13800138000', // 暂时没校验,随便传
phone: userInfo?.phone || '13800138000', // 暂时没校验,随便传
})
if (res.code === 0) {

View File

@@ -29,6 +29,7 @@
import { ref, watch } from 'vue'
import { Message } from '@arco-design/web-vue'
import { modifyUser } from '@/api/module/user'
import type { UserItem } from '@/api/types'
import SafeStorage, { AppStorageKey } from '@/utils/safeStorage'
interface Props {
@@ -56,11 +57,11 @@ watch(
visible.value = val
if (val) {
// 打开时从存储中获取用户信息
const userInfo = SafeStorage.get(AppStorageKey.USER_INFO) || {}
const userInfo = SafeStorage.get<UserItem>(AppStorageKey.USER_INFO)
form.value = {
account: userInfo.account || '',
name: userInfo.name || '',
email: userInfo.email || '',
account: userInfo?.account || '',
name: userInfo?.name || '',
email: userInfo?.email || '',
}
}
}
@@ -76,11 +77,11 @@ const handleSaveProfile = async () => {
loading.value = true
try {
const userInfo = SafeStorage.get(AppStorageKey.USER_INFO) || {}
const userInfo = SafeStorage.get<UserItem>(AppStorageKey.USER_INFO)
const updatedUserInfo = {
...userInfo,
...form.value,
id: userInfo.user_id,
id: userInfo?.user_id ?? userInfo?.id,
}
const res = await modifyUser(updatedUserInfo)