-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
83e86b1
commit c024f69
Showing
5 changed files
with
217 additions
and
53 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 |
---|---|---|
@@ -0,0 +1,100 @@ | ||
<template> | ||
<div class="user-list"> | ||
<template v-for="item in data"> | ||
<div class="user" :class="{ small: !displayUserName }" | ||
v-if="item['all_sum_amount'] >= min && item['all_sum_amount'] < max"> | ||
<img class="avatar" :src="item.user.avatar" :alt="item.user.name"> | ||
<div class="user-name" v-if="displayUserName"> | ||
<span class="name">{{ item.user.name }}</span> | ||
<span class="amount">¥{{ item.all_sum_amount }}</span> | ||
</div> | ||
</div> | ||
</template> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import axios from 'axios' | ||
export default { | ||
name: 'chargeThanks', | ||
props: { | ||
displayUserName: Boolean, | ||
min: { | ||
type: Number, | ||
default: 0 | ||
}, | ||
max: { | ||
type: Number, | ||
default: Infinity | ||
} | ||
}, | ||
methods: { | ||
get_sponsors: function () { | ||
axios.get('https://server.amiyabot.com:10001/get_sponsors').then(res => { | ||
this.data = JSON.parse(res.data) | ||
this.data.sort((a, b) => { | ||
return b.all_sum_amount - a.all_sum_amount | ||
}) | ||
}) | ||
} | ||
}, | ||
data() { | ||
return { | ||
data: [] | ||
} | ||
}, | ||
mounted() { | ||
this.get_sponsors() | ||
} | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
.user-list { | ||
display: flex; | ||
flex-wrap: wrap; | ||
} | ||
.user { | ||
display: flex; | ||
align-items: center; | ||
margin-bottom: 5px; | ||
} | ||
.user:not(.small) { | ||
width: 25%; | ||
} | ||
.avatar { | ||
width: 50px; | ||
height: 50px; | ||
border-radius: 50%; | ||
border: 1px solid #b74ec9; | ||
margin-left: 5px; | ||
} | ||
.small .avatar { | ||
width: 40px; | ||
height: 40px; | ||
} | ||
.user-name { | ||
width: calc(100% - 85px); | ||
margin: 0 20px 0 10px; | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
.user-name > .name { | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
white-space: nowrap; | ||
} | ||
.amount { | ||
font-size: 12px; | ||
font-weight: bold; | ||
color: #ff9800; | ||
} | ||
</style> |
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