bd 页面优化

This commit is contained in:
tianfeng 2025-08-22 11:26:50 +08:00
parent 3b9b359012
commit d59584fc28
2 changed files with 44 additions and 15 deletions

View File

@ -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}`, {

View File

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