完成用户列表

This commit is contained in:
jiayuqi7813
2022-06-27 20:27:32 +08:00
parent 360335476e
commit c8563b7e64
5 changed files with 76 additions and 2 deletions

View File

@@ -4,7 +4,7 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" /> <link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title> <title>SNCTF</title>
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>

View File

@@ -1,5 +1,6 @@
<template> <template>
<!-- <div id="myChart"></div>--> <!-- <div id="myChart"></div>-->
<h1 class="title">排名</h1>
<el-row class="row-bg" justify="center"> <el-row class="row-bg" justify="center">
<el-col :span="16"> <el-col :span="16">
<el-table :data="tableData" style="width: 100%" stripe :row-class-name="tableRowClassName"> <el-table :data="tableData" style="width: 100%" stripe :row-class-name="tableRowClassName">
@@ -35,6 +36,11 @@ export default {
</script> </script>
<style> <style>
.title{
display: flex;
justify-content: center;
color: #dddddd;
}
.el-table .warning-row { .el-table .warning-row {
--el-table-tr-bg-color: var(--el-color-warning-light-9); --el-table-tr-bg-color: var(--el-color-warning-light-9);
} }

View File

@@ -0,0 +1,48 @@
<template>
<h1 class="title">
用户
</h1>
<el-row class="row-bg" justify="center">
<el-col :span="16">
<el-table :data="tableData" style="width: 100%" stripe :row-class-name="tableRowClassName">
<el-table-column prop="id" label="Id" width="180" />
<el-table-column prop="username" label="User" width="180" />
<el-table-column prop="affiliation" label="Affiliation" />
<el-table-column prop="country" label="Country" />
<el-table-column prop="website" label="Website" />
</el-table>
</el-col>
</el-row>
</template>
<script>
import axios from "axios";
export default {
data(){
return{
tableData:[],
}
},
mounted() {
axios.get('/api/v1/user/users').then(res => {
if (res.data.code === 200) {
console.log(res.data.data);
this.tableData = res.data.data;
}
})
}
}
</script>
<style lang="less" scoped>
.title{
display: flex;
justify-content: center;
color: #dddddd;
}
</style>

View File

@@ -1,8 +1,11 @@
import { createRouter, createWebHistory } from 'vue-router' import { createRouter, createWebHistory } from 'vue-router'
import home from "../views/Home.vue";
import Login from '../views/Login.vue' import Login from '../views/Login.vue'
import Challenge from '../views/Challenges.vue' import Challenge from '../views/Challenges.vue'
import Scoreboard from '../views/Scoreboard.vue' import Scoreboard from '../views/Scoreboard.vue'
import Notification from "../views/Notification.vue"; import Notification from "../views/Notification.vue";
import users from "../views/Users.vue";
const routerHistory = createWebHistory() const routerHistory = createWebHistory()
const router = createRouter({ const router = createRouter({
@@ -15,7 +18,7 @@ const router = createRouter({
{ {
path: '/home', path: '/home',
name:'Home', name:'Home',
component: () => import('../views/Home.vue') component:home,
}, },
{ {
path:'/login', path:'/login',
@@ -37,6 +40,11 @@ const router = createRouter({
path:'/notification', path:'/notification',
name:'Notification', name:'Notification',
component: Notification, component: Notification,
},
{
path:'/users',
name:'users',
component: users,
} }
] ]
}) })

12
src/views/Users.vue Normal file
View File

@@ -0,0 +1,12 @@
<template>
<Navbar></Navbar>
<userlist></userlist>
</template>
<script>
import Navbar from "../components/Navbar.vue";
import userlist from "../components/userlist.vue";
export default {
components: {Navbar,userlist},
}
</script>