Skip to content

Commit a856fc7

Browse files
committed
fix(SPA): 打赏用户为认证用户缺少认证标志的问题
issue #512
1 parent ab5af98 commit a856fc7

File tree

5 files changed

+75
-30
lines changed

5 files changed

+75
-30
lines changed

resources/spa/src/components/Avatar.vue

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<i
1616
v-if="icon"
1717
:style="icon"
18+
:class="iconClass"
1819
class="m-avatar-icon"
1920
/>
2021
</RouterLink>
@@ -37,6 +38,11 @@ export default {
3738
sex () {
3839
return ~~this.user.sex
3940
},
41+
iconClass () {
42+
if (this.anonymity) return false
43+
const { verified = {} } = this.user
44+
return verified.type
45+
},
4046
icon () {
4147
// 如果是匿名用户 不显示
4248
if (this.anonymity) return false
@@ -48,15 +54,8 @@ export default {
4854
// 如果有设置图标 使用设置的图标
4955
if (verified.icon) return { 'background-image': `url("${verified.icon}")` }
5056
// 否则根据认证类型使用相应的默认图标
51-
else if (verified.type === 'user') {
52-
return {
53-
'background-image': 'url(' + require('@/images/cert_user.png') + ')',
54-
}
55-
} else if (verified.type === 'org') {
56-
return {
57-
'background-image': 'url(' + require('@/images/cert_org.png') + ')',
58-
}
59-
} else return false
57+
else if (verified.type) return {}
58+
else return false
6059
},
6160
path () {
6261
return this.uid ? `/users/${this.uid}` : 'javascript:;'
@@ -84,3 +83,16 @@ export default {
8483
},
8584
}
8685
</script>
86+
87+
<style lang="less" scoped>
88+
.m-avatar-box {
89+
.m-avatar-icon {
90+
&.user {
91+
background-image: url('~@/images/cert_user.png');
92+
}
93+
&.org {
94+
background-image: url('~@/images/cert_org.png');
95+
}
96+
}
97+
}
98+
</style>

resources/spa/src/components/common/ArticleLikeBadge.vue

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
to="likers"
66
append
77
>
8-
<ul class="avatar-list">
9-
<li
8+
<div class="avatar-list">
9+
<Avatar
1010
v-for="({user = {}, id}, index) in likers.slice(0, 5)"
1111
:key="id"
12-
:style="{ zIndex: 5-index, backgroundImage: user.avatar && `url(${getAvatar(user)})`}"
13-
:class="`m-avatar-box-${user.sex}`"
14-
class="m-avatar-box tiny"
12+
:user="user"
13+
size="tiny"
14+
:style="{ zIndex: 5-index}"
1515
/>
16-
</ul>
16+
</div>
1717
<span class="total">{{ total | formatNum }}人点赞</span>
1818
</RouterLink>
1919
</template>
@@ -41,7 +41,20 @@ export default {
4141
align-items: center;
4242
4343
.avatar-list {
44+
position: relative;
4445
flex: none;
46+
47+
&::after {
48+
content: '';
49+
position: absolute;
50+
top: 0;
51+
left: 0;
52+
bottom: 0;
53+
right: 0;
54+
display: block;
55+
background: transparent;
56+
z-index: 7;
57+
}
4558
}
4659
4760
.total {

resources/spa/src/components/common/ArticleRewardBadge.vue

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@
55
共 <a href="javascript:;">{{ ~~amount }}</a> {{ currencyUnit }}
66
</p>
77
<RouterLink
8-
tag="ul"
8+
v-if="rewarders.length > 0"
9+
tag="div"
910
to="rewarders"
1011
append
1112
class="m-box m-aln-center m-art-rew-list"
1213
>
13-
<li
14-
v-for="{id, user} in rewarders"
15-
:key="id"
16-
:class="`m-avatar-box-${user.sex}`"
17-
class="m-flex-grow0 m-flex-shrink0 m-art-rew m-avatar-box tiny"
18-
:style="{backgroundImage: user.avatar && `url(${getAvatar(user.avatar)})`}"
19-
/>
20-
<li v-if="rewarders.length > 0" class="m-box m-aln-center">
21-
<svg class="m-style-svg m-svg-def" style="color: #bfbfbf;">
22-
<use xlink:href="#icon-arrow-right" />
23-
</svg>
24-
</li>
14+
<div class="avatar-list">
15+
<Avatar
16+
v-for="{id, user} in rewarders"
17+
:key="id"
18+
:user="user"
19+
size="small"
20+
/>
21+
</div>
22+
<svg class="m-box m-aln-center m-style-svg m-svg-def" style="color: #bfbfbf;">
23+
<use xlink:href="#icon-arrow-right" />
24+
</svg>
2525
</RouterLink>
2626
</div>
2727
</template>
@@ -42,3 +42,23 @@ export default {
4242
},
4343
}
4444
</script>
45+
46+
<style lang="less" scoped>
47+
.c-article-reward-badge {
48+
.avatar-list {
49+
position: relative;
50+
51+
&::after {
52+
content: '';
53+
position: absolute;
54+
top: 0;
55+
left: 0;
56+
bottom: 0;
57+
right: 0;
58+
display: block;
59+
background: transparent;
60+
z-index: 7;
61+
}
62+
}
63+
}
64+
</style>

resources/spa/src/page/feed/FeedList.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export default {
8888
},
8989
computed: {
9090
feedType () {
91-
return this.$route.query.type
91+
return this.$route.query.type || 'hot'
9292
},
9393
feeds () {
9494
return this.$store.getters[`feed/${this.feedType}`]

resources/spa/src/page/rank/components/RankListItem.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div class="rank-list-item">
33
<span :class="{ top: index < 3 }" class="rank">{{ index + 1 }}</span>
44

5-
<div class="rank-info" @click="to(`/users/${user.id}`)">
5+
<div class="rank-info" @click="$router.push(`/users/${user.id}`)">
66
<Avatar :user="user" class="rank-avatar" />
77
<div class="rank-title m-text-cut">
88
<h6>{{ user.name }}</h6>

0 commit comments

Comments
 (0)