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