Skip to content

Commit

Permalink
add log page`
Browse files Browse the repository at this point in the history
  • Loading branch information
黄冠 committed Jun 24, 2019
1 parent 5600199 commit 95ec92c
Showing 1 changed file with 74 additions and 0 deletions.
74 changes: 74 additions & 0 deletions web/pages/log.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<template>
<div>
<el-page-header @back="goBack" title="" content="Today Logs Rank">
</el-page-header>
<el-table

:data="tableData"
style="width: 100%">
<el-table-column
label="Name"
width="500">
<template slot-scope="scope">
<a :href="'/h/' + scope.row.info.id">{{ scope.row.info.name }}</a>
</template>
</el-table-column>
<el-table-column
prop="reqs"
label="Requests"
width="90">
</el-table-column>
<el-table-column
label="Last Log Time">
<template slot-scope="scope">
{{ scope.row.atime | datetime }}
</template>
</el-table-column>
</el-table>
<div>
<el-pagination
background
layout="prev, pager, next"
@current-change="handleChangePage"
:current-page="currentPage"
:page-size="20"
:pager-count="11"
:total="2000">
</el-pagination>
</div>
</div>
</template>


<script type="text/javascript">
export default {
layout: 'search',
async asyncData({$axios, error, query}) {
const page = parseInt(query.p || 1)
const params = {
start: (page - 1) * 10,
count: 20
}
const res = await $axios.$get('/apis/log', {params: params})
return {tableData: res.items, currentPage: page}
},
methods: {
handleChangePage(val) {
window.location = '/log?p=' + val
}
}
};
</script>

<style type="text/css" scoped>
.el-pagination {
margin: 30px 0 10px 0;
}
.el-page-header {
margin: 0 0 10px 0;
}
</style>

0 comments on commit 95ec92c

Please sign in to comment.