bd 页面优化
This commit is contained in:
parent
3b9b359012
commit
d59584fc28
@ -135,9 +135,6 @@ export async function request(url, options = {}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (DEBUG_MODE) {
|
|
||||||
console.log('🚀 API Request:', fullUrl, JSON.stringify(config.headers))
|
|
||||||
}
|
|
||||||
|
|
||||||
const response = await fetch(fullUrl, config)
|
const response = await fetch(fullUrl, config)
|
||||||
|
|
||||||
@ -158,10 +155,6 @@ export async function request(url, options = {}) {
|
|||||||
|
|
||||||
const result = await response.json()
|
const result = await response.json()
|
||||||
|
|
||||||
if (DEBUG_MODE) {
|
|
||||||
console.log('✅ API Response:', result)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查业务状态
|
// 检查业务状态
|
||||||
if (result.status === false) {
|
if (result.status === false) {
|
||||||
throw new ApiError(result.errorMsg || result.message || `API Error: ${result.errorCode}`, {
|
throw new ApiError(result.errorMsg || result.message || `API Error: ${result.errorCode}`, {
|
||||||
|
|||||||
@ -15,7 +15,13 @@
|
|||||||
|
|
||||||
<div class="user-info">
|
<div class="user-info">
|
||||||
<div class="avatar">
|
<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>
|
||||||
<div class="user-details">
|
<div class="user-details">
|
||||||
<h3>{{ userInfo.userNickname || userInfo.name }}</h3>
|
<h3>{{ userInfo.userNickname || userInfo.name }}</h3>
|
||||||
@ -163,16 +169,15 @@ const connectToApp = async () => {
|
|||||||
|
|
||||||
// 用户信息
|
// 用户信息
|
||||||
const userInfo = reactive({
|
const userInfo = reactive({
|
||||||
name: 'User1',
|
userNickname: '',
|
||||||
id: '1234567890',
|
id: '',
|
||||||
userNickname: 'User1',
|
userAvatar: '',
|
||||||
account: '1234567890'
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// 薪资信息
|
// 薪资信息
|
||||||
const salaryInfo = reactive({
|
const salaryInfo = reactive({
|
||||||
lastMonth: '12345',
|
lastMonth: '',
|
||||||
thisMonth: '12345'
|
thisMonth: ''
|
||||||
})
|
})
|
||||||
|
|
||||||
// 获取团队成员数量
|
// 获取团队成员数量
|
||||||
@ -228,7 +233,8 @@ const fetchTeamEntry = async () => {
|
|||||||
|
|
||||||
// 更新用户信息显示
|
// 更新用户信息显示
|
||||||
userInfo.userNickname = response.body.memberProfile.userNickname
|
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后检查身份
|
// 获取用户ID后检查身份
|
||||||
@ -314,10 +320,25 @@ const transfer = () => {
|
|||||||
router.push('/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,然后获取数据
|
// 页面加载时先连接APP,然后获取数据
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
// 先连接APP获取认证信息
|
// 先连接APP获取认证信息
|
||||||
await connectToApp()
|
await connectToApp()
|
||||||
|
await fetchTeamEntry()
|
||||||
await getAgentMonth()
|
await getAgentMonth()
|
||||||
await fetchTeamMemberCount()
|
await fetchTeamMemberCount()
|
||||||
})
|
})
|
||||||
@ -403,6 +424,21 @@ onMounted(async () => {
|
|||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
margin-right: 12px;
|
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 {
|
.user-details {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user