单个题目排行榜功能

This commit is contained in:
jiayuqi7813
2022-07-18 18:23:34 +08:00
parent 5e6bb508f5
commit 0bdc6d5cc0

View File

@@ -1,6 +1,15 @@
<template> <template>
<div class="challenges-all"> <div class="challenges-all">
<div class="category"> <div class="category">
<el-dialog v-model="solvesVisible" :title=challenges.name
width="500px">
<el-table :data="solves" row-key="id" style="width: 100%">
<el-table-column label="用户名" prop="username"/>
<el-table-column label="时间" prop="submitted_at"/>
</el-table>
</el-dialog>
<el-container> <el-container>
<el-aside width="200px"> <el-aside width="200px">
<el-menu <el-menu
@@ -10,10 +19,7 @@
active-text-color="#f39c12" active-text-color="#f39c12"
class="el-menu-vertical-demo" class="el-menu-vertical-demo"
@open="handleOpen"
@close="handleClose"
@select="handleSelect" @select="handleSelect"
> >
<!-- background-color="#2d3039"--> <!-- background-color="#2d3039"-->
@@ -71,9 +77,14 @@
<div class="challenges-name" > <div class="challenges-name" >
{{challenges.name}} {{challenges.name}}
</div> </div>
<el-tag v-for="tag in tags" class="tag"> <div class="tag">
<el-tag v-for="tag in tags" class="tttag">
{{tag}} {{tag}}
</el-tag> </el-tag>
</div>
<div class="solves">
<el-button @click="solvesbycid" circle ><el-icon><Trophy /></el-icon></el-button>
</div>
</div> </div>
<div class="middle"> <div class="middle">
<div class="challenges-solve"> <div class="challenges-solve">
@@ -121,6 +132,7 @@
<el-button>hint</el-button> <el-button>hint</el-button>
</template> </template>
</el-popover> </el-popover>
</div> </div>
</el-col> </el-col>
@@ -135,6 +147,8 @@
</div> </div>
</template> </template>
<script> <script>
@@ -144,9 +158,14 @@ import {
Location, Location,
Setting, Setting,
} from '@element-plus/icons-vue' } from '@element-plus/icons-vue'
import dayjs from "dayjs";
import axios from "axios"; import axios from "axios";
import { ElNotification } from 'element-plus'; import { ElNotification } from 'element-plus';
import relativeTime from 'dayjs/plugin/relativeTime'
import 'dayjs/locale/zh-cn' // +
dayjs.extend(relativeTime)
dayjs.locale('zh-cn') //
export default { export default {
data() { data() {
@@ -159,6 +178,9 @@ export default {
challenges:[], challenges:[],
tags:[], tags:[],
attachment:[], attachment:[],
solvesVisible:false,
solves:[],
times:"",
} }
}, },
mounted() { mounted() {
@@ -176,6 +198,21 @@ export default {
}, },
methods: { methods: {
//解题数据查询
solvesbycid(){
this.solvesVisible = true;
axios.get('/api/v1/user/solves/cid/'+this.challenges.id).then(res => {
if(res.data.code===200){
this.solves = res.data.data;
if(this.solves == undefined){
this.solves = [];
}
this.solves.forEach(function(item,index) {
item.submitted_at= dayjs(item.submitted_at).fromNow()
})
}
})
},
bcard(index){ bcard(index){
this.challenges = this.data[index] this.challenges = this.data[index]
@@ -265,10 +302,14 @@ export default {
.challenges-name{ .challenges-name{
font-size: 25px; font-size: 25px;
font-weight: normal; font-weight: normal;
width: 100px;
} }
.tag{ .tag{
margin-top: 4px; margin-top: 5px;
margin-right: 5px; width: 500px;
display: flex;
}
.solves{
} }
} }
.middle{ .middle{