diff --git a/src/utils/http.js b/src/utils/http.js
index c18b3fc..632b2e7 100644
--- a/src/utils/http.js
+++ b/src/utils/http.js
@@ -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}`, {
diff --git a/src/views/BDCenterView.vue b/src/views/BDCenterView.vue
index 1fdfca1..33235f4 100644
--- a/src/views/BDCenterView.vue
+++ b/src/views/BDCenterView.vue
@@ -15,7 +15,13 @@
-
{{ (userInfo.userNickname || userInfo.name).charAt(0) }}
+
![]()
+
{{ getAvatarPlaceholder() }}
{{ userInfo.userNickname || userInfo.name }}
@@ -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 {