Skip to content

Commit 8775b37

Browse files
committed
feat: add identicon
1 parent f361063 commit 8775b37

File tree

2 files changed

+43
-2
lines changed

2 files changed

+43
-2
lines changed

src/components/ManageProfileEdit.vue

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@
77
修改個人資料:
88
</div>
99
<div class="p-6 bg-white border-b border-gray-200">
10+
<div class="px-3 mb-3">
11+
<img
12+
:src="identicon"
13+
:alt="fields.nickname"
14+
class="rounded-full w-18 h-18 mx-auto"
15+
title="來自 Gravatar 的大頭貼"
16+
>
17+
</div>
1018
<div class="rounded bg-white md:flex">
1119
<label
1220
class="w-full py-1 text-gray-600 md:w-16"
@@ -27,12 +35,31 @@
2735
<div class="p-6 bg-white border-b border-gray-200">
2836
若要修改電子郵件地址,請點
2937
<span
30-
class="cursor-pointer text-sky-500 hover:text-sky-700"
38+
class="cursor-pointer text-sky-600 hover:text-sky-500"
3139
@click="onClickUpdateEmail"
3240
>
3341
此處
3442
</span>
3543
44+
<div class="text-sm text-gray-600 mt-1">
45+
本系統儲存你的電子郵件地址僅供識別使用,不會用於任何廣告或行銷用途。該資訊為存取本帳號的唯一識別方法,請務必使用最常用的電子郵件地址,以免遺失帳號存取權限。
46+
</div>
47+
</div>
48+
<div class="p-6 bg-white border-b border-gray-200">
49+
若要修改大頭貼,須前往
50+
<span
51+
class="cursor-pointer text-sky-600 hover:text-sky-500"
52+
@click="onClickUpdateAvatar"
53+
>
54+
Gravatar.com
55+
</span>
56+
57+
<div class="text-sm text-gray-600 mt-1">
58+
我們使用 Gravatar 服務來提供大頭貼,您可以在 Gravatar 網站上使用您的電子郵件地址註冊帳號,並上傳您的大頭貼。
59+
</div>
60+
<div class="text-sm text-gray-600 mt-1">
61+
本系統不會儲存您的大頭貼,而是透過去識別化技術提供對應大頭貼的圖片網址。
62+
</div>
3663
</div>
3764
<div class="p-6 bg-white border-gray-200 text-right">
3865
<button
@@ -68,6 +95,10 @@ const props = defineProps({
6895
type: String,
6996
required: true,
7097
},
98+
avatarHash: {
99+
type: String,
100+
required: true,
101+
},
71102
});
72103
73104
const emits = defineEmits(["state", "status"]);
@@ -83,12 +114,21 @@ const isDisabled = computed(() => {
83114
return isLoad.value || isDone.value;
84115
});
85116
117+
const identicon = computed(() => {
118+
const {avatarHash} = props;
119+
return `https://api.gravatar.com/avatar/${avatarHash}?d=identicon`;
120+
});
121+
86122
const onClickUpdateEmail = () => {
87123
emits("state", {
88124
name: "ManageUpdateEmailRequest",
89125
});
90126
};
91127
128+
const onClickUpdateAvatar = () => {
129+
window.open("https://gravatar.com");
130+
};
131+
92132
const onClickCancel = () => {
93133
location.reload();
94134
};

src/components/ManageProfileShow.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
您好,{{ myProfile.nickname }},這裡是您的個人資料:
1515
</div>
1616
<div class="px-6 py-4 bg-white border-b border-gray-200 md:flex">
17-
<div class="item-center px-3 mb-3 md:mb-0">
17+
<div class="px-3 mb-3 md:mb-0">
1818
<img
1919
:src="identicon"
2020
:alt="myProfile.nickname"
@@ -157,6 +157,7 @@ const onClickEdit = () => {
157157
name: "ManageProfileEdit",
158158
props: {
159159
nickname: myProfile.nickname,
160+
avatarHash: myProfile.avatar_hash,
160161
},
161162
});
162163
};

0 commit comments

Comments
 (0)