Skip to content

Commit 7e82652

Browse files
committed
feat: default avatar
1 parent 61ad85b commit 7e82652

File tree

5 files changed

+72
-9
lines changed

5 files changed

+72
-9
lines changed

pages/index.vue

+7-7
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<v-list-item-action>
1010
<div class="avatar-editable">
1111
<div class="avatar-wrapper">
12-
<img class="avatar-img" :src="avatar" aria-hidden="true">
12+
<img class="avatar-img" :src="avatar" aria-hidden="true" onerror="this.src='data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg=='">
1313
</div>
1414
<div class="avatar-mask">
1515
<v-icon color="#f5fafd" class="avatar-mask-icon">mdi-pencil</v-icon>
@@ -101,22 +101,22 @@ export default {
101101
flex-grow: 0;
102102
-webkit-flex-shrink: 0;
103103
flex-shrink: 0;
104-
-webkit-border-radius: 50%;
105-
border-radius: 50%;
104+
-webkit-border-radius: 4px;
105+
border-radius: 4px;
106106
margin-left: 16px;
107107
overflow: hidden;
108108
position: relative;
109109
width: 60px;
110110
height: 60px;
111111
}
112112
.avatar-wrapper {
113-
-webkit-border-radius: 50%;
114-
border-radius: 50%;
113+
-webkit-border-radius: 4px;
114+
border-radius: 4px;
115115
height: 100%;
116116
width: auto;
117117
}
118118
.avatar-img {
119-
border-radius: 50%;
119+
border-radius: 4px;
120120
width: 60px;
121121
height: 60px;
122122
}
@@ -129,7 +129,7 @@ export default {
129129
right: 0;
130130
text-align: center;
131131
}
132-
.avatar-mask-icon {
132+
.avatar-mask .avatar-mask-icon.v-icon {
133133
font-size: 16px;
134134
top: -4px;
135135
}

pages/set-avatar.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export default {
6060
.input-file { display: none; }
6161
.upload-button { margin-bottom: 16px; }
6262
.preview-avatar {
63-
border-radius: 50%;
63+
border-radius: 4px;
6464
width: 128px;
6565
height: 128px;
6666
margin: 16px;

server/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ config.dev = app.env !== 'production'
6868
}
6969
app.context.avatarFromName = name => {
7070
const { ALI_OSS_REGION, ALI_OSS_BUCKET, ALI_OSS_AVATAR_PREFIX } = process.env
71-
return `https://${ALI_OSS_BUCKET}.${ALI_OSS_REGION}.aliyuncs.com/${ALI_OSS_AVATAR_PREFIX || ''}${name}`
71+
return `https://${ALI_OSS_BUCKET}.${ALI_OSS_REGION}.aliyuncs.com/${ALI_OSS_AVATAR_PREFIX || ''}${name || 'default.svg'}`
7272
}
7373
app.context.createOrder = async function () {
7474
try {

static/avatar/default.inkscape.svg

+60
Loading

static/avatar/default.svg

+3
Loading

0 commit comments

Comments
 (0)