65 lines
2.1 KiB
Vue
65 lines
2.1 KiB
Vue
<template lang="pug">
|
|
#userlist
|
|
h3 Registered Users ({{ pagination.total }})
|
|
.pgn
|
|
span.pagenum Page {{ pagination.page }} of {{ pagination.pages }}
|
|
.button(v-if='pagination.page > 1', v-on:click='getUsers(pagination.page - 1)') Previous
|
|
.button(v-for='n in pagination.pages', v-on:click='getUsers(n)', v-bind:class='{active: n == pagination.page}') {{ n }}
|
|
.button(v-if='pagination.page < pagination.pages', v-on:click='getUsers(pagination.page + 1)') Next
|
|
.list.users
|
|
.user.list-item(v-for='user in users')
|
|
.avatar
|
|
img(v-if='user.avatar_file', v-bind:src="'/usercontent/images/' + user.avatar_file")
|
|
img(v-else='v-else', src='/static/image/avatar.png')
|
|
.info
|
|
.stamps
|
|
.noactive(v-if='user.activated == false', title='Not activated.')
|
|
i.fa.fa-fw.fa-envelope
|
|
.display_name {{ user.display_name }}
|
|
.username {{ user.id }} - {{ user.username }} ({{ user.uuid }})
|
|
.email {{ user.email }}
|
|
.privilege Privilege: level {{ user.nw_privilege }}
|
|
.timestamp {{ new Date(user.created_at).toString() }}
|
|
.external(v-if='!user.password')
|
|
b Used external login
|
|
.button.ban(v-if='user.bannable', v-on:click='banning = user.id')
|
|
i.fa.fa-fw.fa-ban
|
|
| Ban User
|
|
ban-modal(:show='banning', @close='banning = 0', :id='banning')
|
|
</template>
|
|
|
|
<script>
|
|
import BanModal from './BanModal.vue'
|
|
|
|
export default {
|
|
data: function () {
|
|
return {
|
|
pagination: {
|
|
offset: 0,
|
|
page: 1,
|
|
pages: 1,
|
|
perPage: 6,
|
|
total: 0
|
|
},
|
|
users: [],
|
|
banning: 0
|
|
}
|
|
},
|
|
components: {
|
|
BanModal
|
|
},
|
|
methods: {
|
|
getUsers: function (page) {
|
|
this.$http.get('/admin/api/users?page=' + page).then(data => {
|
|
if (data.body && data.body.error) return
|
|
this.pagination = data.body.page
|
|
this.users = data.body.users
|
|
})
|
|
}
|
|
},
|
|
mounted: function () {
|
|
this.getUsers(1)
|
|
}
|
|
}
|
|
</script>
|