修改移动端默认头像
This commit is contained in:
1 parent
866b510125
commit
ba5c521c96
2 files changed
+17
-6
No files matched your search
@@ -12,11 +12,7 @@
|
||||
<view class="user-section">
|
||||
<!-- 左侧用户信息 -->
|
||||
<view class="user-info" @click="handleUserClick">
|
||||
<image
|
||||
class="user-avatar"
|
||||
:src="userInfo.avatar || '/static/default-avatar.png'"
|
||||
mode="aspectFill"
|
||||
/>
|
||||
<image class="user-avatar" :src="avatarUrl" mode="aspectFill" />
|
||||
<view class="user-details">
|
||||
<text class="user-name">{{ userInfo.name }}</text>
|
||||
<text class="user-dept">{{ userInfo.deptName || '未设置部门' }}</text>
|
||||
@@ -555,6 +551,21 @@ export default {
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 头像URL处理
|
||||
avatarUrl() {
|
||||
console.log(this.userInfo.avatar);
|
||||
console.log(this.userInfo.avatar && this.userInfo.avatar.trim() !== '');
|
||||
console.log(
|
||||
this.userInfo.avatar && this.userInfo.avatar.trim() !== ''
|
||||
? this.userInfo.avatar
|
||||
: '/static/logo-2.png',
|
||||
);
|
||||
// 确保当avatar为空字符串、null或undefined时都显示默认图片
|
||||
return this.userInfo.avatar && this.userInfo.avatar.trim() !== ''
|
||||
? this.userInfo.avatar
|
||||
: '/static/logo-2.png';
|
||||
},
|
||||
|
||||
// 检查各模块是否有权限
|
||||
hasStudentServices() {
|
||||
return (
|
||||
|
||||
@@ -107,7 +107,7 @@ export const userManager = {
|
||||
|
||||
return {
|
||||
name: this.getDisplayName(),
|
||||
avatar: user.avatar || '/static/default-avatar.png',
|
||||
avatar: user.avatar || '/static/logo-2.png',
|
||||
deptName: user.deptName || '未设置部门',
|
||||
status: user.status,
|
||||
loginDate: user.loginDate,
|
||||
|
||||
Reference in new issue
Block a user