Commit 2e2ede7 1 parent 6e69738 commit 2e2ede7 Copy full SHA for 2e2ede7
File tree 2 files changed +11
-21
lines changed
2 files changed +11
-21
lines changed Original file line number Diff line number Diff line change 2
2
<div class =" mt-8 flex w-full justify-between" >
3
3
<!-- 左侧头像区域 -->
4
4
<div class =" mr-16 hidden w-72 md:block" >
5
- <div class =" mx-auto h-56 w-56 overflow-hidden" >
5
+ <div
6
+ class =" mx-auto h-56 w-56 overflow-hidden rounded-full border-2 border-gray-300 bg-gray-300 dark:border-gray-700 dark:bg-gray-700"
7
+ >
8
+ <!-- 通过给定高度来自适应拉伸图片,如果图片不存在或者加载失败则显示外层的背景色(没有宽度) -->
6
9
<img
7
- class =" h-full w-full rounded-full border-2 border-gray-300 bg-gray-300 object-cover dark:border-gray-700 dark:bg-gray-700"
8
- :src =" userStore.userInfo?.picture || DEFAULT_AVATAR"
9
- @error =" onImageError"
10
+ class =" h-full object-cover"
11
+ :src =" userStore.userInfo?.picture!"
10
12
/>
11
13
</div >
12
14
<div class =" mt-4 truncate" >
@@ -57,17 +59,6 @@ const userStore = useUserStore();
57
59
const { learnRecord, setupLearnRecord, setQueryYear } = useLearnRecord ();
58
60
const { toggleYear } = useCalendarGraph ();
59
61
60
- // 默认 1x1 像素的透明 GIF 图片,用于消除头像图片加载失败时的白色边框
61
- const DEFAULT_AVATAR =
62
- " data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" ;
63
-
64
- function onImageError(e : Event ) {
65
- const target = e .target as HTMLImageElement ;
66
- if (target ) {
67
- target .src = DEFAULT_AVATAR ;
68
- }
69
- }
70
-
71
62
function useCalendarGraph() {
72
63
const data = ref <CalendarData []>([]);
73
64
const totalCount = ref <number >(0 );
Original file line number Diff line number Diff line change 55
55
class =" logged-in flex items-center"
56
56
>
57
57
<div
58
- class =" btn btn-square btn-ghost drawer-button "
58
+ class =" h-8 w-8 cursor-pointer overflow-hidden rounded-full bg-gray-300 transition-all hover:scale-125 hover:opacity-90 dark:bg-gray-700 "
59
59
@click =" handleShowUserMenu"
60
60
>
61
- <div class =" avatar" >
62
- <div class =" w-8 rounded-full" >
63
- <img :src =" userStore.userInfo?.picture!" />
64
- </div >
65
- </div >
61
+ <img
62
+ class =" h-full object-cover"
63
+ :src =" userStore.userInfo?.picture!"
64
+ />
66
65
</div >
67
66
</div >
68
67
<!-- 登录/注册 -->
You can’t perform that action at this time.
0 commit comments