-
Notifications
You must be signed in to change notification settings - Fork 473
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
issue #512
- Loading branch information
Showing
13 changed files
with
210 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,6 +58,22 @@ export function getRewards (feedId, params) { | |
return api.get(url, { params, validateStatus: s => s === 200 }) | ||
} | ||
|
||
/** | ||
* 获取点赞列表 | ||
* | ||
* @author mutoe <[email protected]> | ||
* @export | ||
* @param {number} feedId | ||
* @param {Object} params | ||
* @param {number} [params.limit=20] | ||
* @param {number} [params.after=0] | ||
* @returns {Promise<Object[]>} | ||
*/ | ||
export function getFeedLikers (feedId, params) { | ||
const url = `/feeds/${feedId}/likes` | ||
return api.get(url, { params, validateStatus: s => s === 200 }) | ||
} | ||
|
||
/** | ||
* 打赏动态 | ||
* @author mutoe <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -161,6 +161,22 @@ export function deleteNewsComment (newsId, commentId) { | |
}) | ||
} | ||
|
||
/** | ||
* 获取资讯点赞列表 | ||
* | ||
* @author mutoe <[email protected]> | ||
* @export | ||
* @param {number} newsId | ||
* @param {Object} params | ||
* @param {number} [params.limit] | ||
* @param {number} [params.after] | ||
* @returns {Promise<Object[]>} | ||
*/ | ||
export function getNewsLikers (newsId, params) { | ||
const url = `/news/${newsId}/likes` | ||
return api.get(url, { params, validateStatus: s => s === 200 }) | ||
} | ||
|
||
/** | ||
* 获取资讯打赏列表 | ||
* @author mutoe <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<template> | ||
<RouterLink | ||
tag="div" | ||
class="c-article-like-badge" | ||
to="likers" | ||
append | ||
> | ||
<ul class="avatar-list"> | ||
<li | ||
v-for="({user = {}, id}, index) in likers.slice(0, 5)" | ||
:key="id" | ||
:style="{ zIndex: 5-index, backgroundImage: user.avatar && `url(${getAvatar(user)})`}" | ||
:class="`m-avatar-box-${user.sex}`" | ||
class="m-avatar-box tiny" | ||
/> | ||
</ul> | ||
<span class="total">{{ total | formatNum }}人点赞</span> | ||
</RouterLink> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: 'ArticleLikeBadge', | ||
props: { | ||
likers: { type: Array, default: () => [] }, | ||
total: { type: Number, default: 0 }, | ||
}, | ||
methods: { | ||
getAvatar (user = {}) { | ||
const avatar = user.avatar | ||
if (!avatar) return '' | ||
return avatar.url || '' | ||
}, | ||
}, | ||
} | ||
</script> | ||
|
||
<style lang="less" scoped> | ||
.c-article-like-badge { | ||
display: flex; | ||
align-items: center; | ||
.avatar-list { | ||
flex: none; | ||
} | ||
.total { | ||
margin-left: 0.5em; | ||
color: @primary; | ||
} | ||
} | ||
</style> |
44 changes: 44 additions & 0 deletions
44
resources/spa/src/components/common/ArticleRewardBadge.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<template> | ||
<div class="c-article-reward-badge"> | ||
<p class="m-art-rew-label"> | ||
<a href="javascript:;">{{ total | formatNum }}</a> 人打赏, | ||
共 <a href="javascript:;">{{ ~~amount }}</a> {{ currencyUnit }} | ||
</p> | ||
<RouterLink | ||
tag="ul" | ||
to="rewarders" | ||
append | ||
class="m-box m-aln-center m-art-rew-list" | ||
> | ||
<li | ||
v-for="{id, user} in rewarders" | ||
:key="id" | ||
:class="`m-avatar-box-${user.sex}`" | ||
class="m-flex-grow0 m-flex-shrink0 m-art-rew m-avatar-box tiny" | ||
:style="{backgroundImage: user.avatar && `url(${getAvatar(user.avatar)})`}" | ||
/> | ||
<li v-if="rewarders.length > 0" class="m-box m-aln-center"> | ||
<svg class="m-style-svg m-svg-def" style="color: #bfbfbf;"> | ||
<use xlink:href="#icon-arrow-right" /> | ||
</svg> | ||
</li> | ||
</RouterLink> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: 'ArticleRewardBadge', | ||
props: { | ||
total: { type: [Number, String], default: 0 }, | ||
amount: { type: [Number, String], default: 0 }, | ||
rewarders: { type: Array, default: () => [] }, | ||
}, | ||
methods: { | ||
getAvatar (avatar) { | ||
if (!avatar) return undefined | ||
return avatar.url || null | ||
}, | ||
}, | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.