bd 页面优化
This commit is contained in:
parent
3b9b359012
commit
d59584fc28
@ -135,9 +135,6 @@ export async function request(url, options = {}) {
|
||||
}
|
||||
|
||||
try {
|
||||
if (DEBUG_MODE) {
|
||||
console.log('🚀 API Request:', fullUrl, JSON.stringify(config.headers))
|
||||
}
|
||||
|
||||
const response = await fetch(fullUrl, config)
|
||||
|
||||
@ -158,10 +155,6 @@ export async function request(url, options = {}) {
|
||||
|
||||
const result = await response.json()
|
||||
|
||||
if (DEBUG_MODE) {
|
||||
console.log('✅ API Response:', result)
|
||||
}
|
||||
|
||||
// 检查业务状态
|
||||
if (result.status === false) {
|
||||
throw new ApiError(result.errorMsg || result.message || `API Error: ${result.errorCode}`, {
|
||||
|
||||
@ -15,7 +15,13 @@
|
||||
|
||||
<div class="user-info">
|
||||
<div class="avatar">
|
||||
<span>{{ (userInfo.userNickname || userInfo.name).charAt(0) }}</span>
|
||||
<img
|
||||
v-if="userInfo.userAvatar"
|
||||
:src="userInfo.userAvatar"
|
||||
:alt="userInfo.name"
|
||||
@error="handleImageError"
|
||||
/>
|
||||
<span v-else class="avatar-placeholder">{{ getAvatarPlaceholder() }}</span>
|
||||
</div>
|
||||
<div class="user-details">
|
||||
<h3>{{ userInfo.userNickname || userInfo.name }}</h3>
|
||||
@ -163,16 +169,15 @@ const connectToApp = async () => {
|
||||
|
||||
// 用户信息
|
||||
const userInfo = reactive({
|
||||
name: 'User1',
|
||||
id: '1234567890',
|
||||
userNickname: 'User1',
|
||||
account: '1234567890'
|
||||
userNickname: '',
|
||||
id: '',
|
||||
userAvatar: '',
|
||||
})
|
||||
|
||||
// 薪资信息
|
||||
const salaryInfo = reactive({
|
||||
lastMonth: '12345',
|
||||
thisMonth: '12345'
|
||||
lastMonth: '',
|
||||
thisMonth: ''
|
||||
})
|
||||
|
||||
// 获取团队成员数量
|
||||
@ -228,7 +233,8 @@ const fetchTeamEntry = async () => {
|
||||
|
||||
// 更新用户信息显示
|
||||
userInfo.userNickname = response.body.memberProfile.userNickname
|
||||
userInfo.account = response.body.memberProfile.account
|
||||
userInfo.id = response.body.memberProfile.account
|
||||
userInfo.userAvatar = response.body.memberProfile.userAvatar
|
||||
}
|
||||
|
||||
// 获取用户ID后检查身份
|
||||
@ -314,10 +320,25 @@ const transfer = () => {
|
||||
router.push('/transfer')
|
||||
}
|
||||
|
||||
// 处理头像图片加载失败
|
||||
const handleImageError = (event) => {
|
||||
// 图片加载失败时,清空userAvatar,显示占位符
|
||||
userInfo.userAvatar = ''
|
||||
}
|
||||
|
||||
// 获取头像占位符(用户名首字母)
|
||||
const getAvatarPlaceholder = () => {
|
||||
if (userInfo.name && userInfo.name.length > 0) {
|
||||
return userInfo.name.charAt(0).toUpperCase()
|
||||
}
|
||||
return 'U' // 默认显示 'U'
|
||||
}
|
||||
|
||||
// 页面加载时先连接APP,然后获取数据
|
||||
onMounted(async () => {
|
||||
// 先连接APP获取认证信息
|
||||
await connectToApp()
|
||||
await fetchTeamEntry()
|
||||
await getAgentMonth()
|
||||
await fetchTeamMemberCount()
|
||||
})
|
||||
@ -403,6 +424,21 @@ onMounted(async () => {
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
margin-right: 12px;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.avatar img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
border-radius: 25px;
|
||||
}
|
||||
|
||||
.avatar .avatar-placeholder {
|
||||
color: white;
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.user-details {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user