增加比赛的题目的有色气球

This commit is contained in:
Himit_ZH 2021-10-08 22:06:39 +08:00
parent 3827e3f27d
commit 060538f079
16 changed files with 281 additions and 34 deletions

View File

@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="top.hcode.hoj.dao.ContestProblemMapper">
<select id="getContestProblemList" resultType="top.hcode.hoj.pojo.vo.ContestProblemVo">
select cp.id,cp.display_id,cp.cid,cp.pid,cp.display_title,
select cp.id,cp.display_id,cp.cid,cp.pid,cp.display_title,cp.color,
(select count(*) from judge
<where>
cpid=cp.id and cid=cp.cid and pid=cp.pid

View File

@ -33,6 +33,9 @@ public class ContestProblemVo implements Serializable {
@ApiModelProperty(value = "该题目在比赛中的标题,默认为原名字")
private String displayTitle;
@ApiModelProperty(value = "该题目在比赛中的气球颜色")
private String color;
@ApiModelProperty(value = "该题目的ac通过数")
private Integer ac;

View File

@ -44,6 +44,8 @@ public class ContestProblem implements Serializable {
@ApiModelProperty(value = "该题目在比赛中的标题,默认为原名字")
private String displayTitle;
@ApiModelProperty(value = "气球的颜色")
private String color;
@TableField(fill = FieldFill.INSERT)
private Date gmtCreate;

View File

@ -82,6 +82,12 @@ public class UserInfo implements Serializable {
@ApiModelProperty(value = "个性介绍")
private String signature;
@ApiModelProperty(value = "头衔、称号")
private String titleName;
@ApiModelProperty(value = "头衔、称号的颜色")
private String titleColor;
@ApiModelProperty(value = "0可用-1不可用")
private int status;

View File

@ -261,6 +261,27 @@ a:hover {
.home-title {
color: #409eff;
}
.contest-username {
display: block;
overflow: hidden;
color: black;
font-size: 13.5px;
font-weight: 550;
}
.contest-school {
font-size: 12px;
font-weight: normal;
color: dimgrey;
}
.female-flag {
margin-right: 20px !important;
background-color: rgb(255, 193, 10);
border-radius: 4px;
color: rgb(73, 36, 0);
padding: 1px 3px !important;
}
.bg-female {
background-color: rgb(255, 153, 203);
}

View File

@ -166,7 +166,8 @@ export const m = {
Enter_The_Problem_Display_ID_in_the_Contest:'Enter The Problem Display ID in the Contest',
Problem_ID_is_required:'Problem ID is required',
The_Problem_Display_ID_in_the_Contest_is_required:'The Problem Display ID in the Contest is required',
Balloon_Color:'Balloon Color',
Update_Balloon_Color_Successfully:'Update the Balloon color of the problem successfully!',
// /views/admin/problem/Problem.vue
Problem_Display_ID: 'Problem Display ID',

View File

@ -166,6 +166,8 @@ export const m = {
Enter_The_Problem_Display_ID_in_the_Contest:'请输入该题目在比赛中展示ID',
Problem_ID_is_required:'题目ID不能为空',
The_Problem_Display_ID_in_the_Contest_is_required:'题目在比赛中的展示ID不能为空',
Balloon_Color:'气球颜色',
Update_Balloon_Color_Successfully:'更新该题气球颜色成功!',
// /views/admin/problem/Problem.vue
Problem_Display_ID: '题目展示ID',

View File

@ -17,6 +17,7 @@ const state = {
table: true,
chart: true,
},
disPlayIdMapColor:{} // 展示id对应的气球颜色
}
const getters = {
@ -154,7 +155,12 @@ const mutations = {
state.forceUpdate = payload.value
},
changeContestProblems(state, payload) {
state.contestProblems = payload.contestProblems
state.contestProblems = payload.contestProblems;
let tmp={};
for(var j = 0,len = payload.contestProblems.length; j < len; j++){
tmp[payload.contestProblems[j].displayId] = payload.contestProblems[j].color;
}
state.disPlayIdMapColor = tmp;
},
changeContestRankLimit(state, payload) {
state.rankLimit = payload.rankLimit

View File

@ -144,6 +144,22 @@
contestProblemMap[row.id]['displayTitle']
}}
</p>
<span v-if="contestProblemMap[row.id]">
{{ $t('m.Balloon_Color') }}<el-color-picker
v-model="contestProblemMap[row.id].color"
show-alpha
:predefine="predefineColors"
size="small"
style="vertical-align: middle;"
@change="
changeContestProblemColor(
contestProblemMap[row.id].id,
contestProblemMap[row.id].color
)
"
>
</el-color-picker>
</span>
<span v-else>{{ row.title }}</span>
</template>
</vxe-table-column>
@ -357,6 +373,16 @@ export default {
otherOJProblemId: '',
REMOTE_OJ: {},
displayId: '',
predefineColors: [
'#ff4500',
'#ff8c00',
'#ffd700',
'#90ee90',
'#00ced1',
'#1e90ff',
'#c71585',
],
};
},
mounted() {
@ -552,6 +578,15 @@ export default {
}
);
},
changeContestProblemColor(id, color) {
let data = {
id: id,
color: color,
};
api.admin_setContestProblemInfo(data).then((res) => {
myMessage.success(this.$i18n.t('m.Update_Balloon_Color_Successfully'));
});
},
},
watch: {
$route(newVal, oldVal) {

View File

@ -440,9 +440,6 @@ export default {
</script>
<style scoped>
@media screen and (min-width: 768px) {
.contest-body {
padding: 0 3%;
}
.contest-time .left {
text-align: left;
}

View File

@ -63,6 +63,39 @@
<vxe-table-column
field="username"
fixed="left"
v-if="!isMobileView"
min-width="300"
:title="$t('m.User')"
header-align="center"
align="left"
>
<template v-slot="{ row }">
<avatar
:username="row[contest.rankShowName]"
:inline="true"
:size="37"
color="#FFF"
:src="row.avatar"
:title="row[contest.rankShowName]"
></avatar>
<span style="float:right;text-align:right">
<a @click="getUserHomeByUsername(row.uid, row.username)">
<span class="contest-username"
><span class="female-flag" v-if="row.gender == 'female'"
>Girl</span
>{{ row[contest.rankShowName] }}</span
>
<span class="contest-school" v-if="row.school">{{
row.school
}}</span>
</a>
</span>
</template>
</vxe-table-column>
<vxe-table-column
field="username"
v-else
min-width="300"
:title="$t('m.User')"
header-align="center"
@ -130,6 +163,24 @@
:key="problem.displayId"
>
<template v-slot:header>
<span style="vertical-align: top;" v-if="problem.color">
<svg
t="1633685184463"
class="icon"
viewBox="0 0 1088 1024"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
p-id="5840"
width="25"
height="25"
>
<path
d="M575.872 849.408c-104.576 0-117.632-26.56-119.232-31.808-6.528-22.528 32.896-70.592 63.744-96.768l-1.728-2.624c137.6-42.688 243.648-290.112 243.648-433.472A284.544 284.544 0 0 0 478.016 0a284.544 284.544 0 0 0-284.288 284.736c0 150.4 116.352 415.104 263.744 438.336-25.152 29.568-50.368 70.784-39.104 108.928 12.608 43.136 62.72 63.232 157.632 63.232 7.872 0 11.52 9.408 4.352 19.52-21.248 29.248-77.888 63.424-167.68 63.424V1024c138.944 0 215.936-74.816 215.936-126.528a46.72 46.72 0 0 0-16.32-36.608 56.32 56.32 0 0 0-36.416-11.456zM297.152 297.472c0 44.032-38.144 25.344-38.144-38.656 0-108.032 85.248-195.712 190.592-195.712 62.592 0 81.216 39.232 38.08 39.232-105.152 0.064-190.528 87.04-190.528 195.136z"
:fill="problem.color"
p-id="5841"
></path>
</svg>
</span>
<span
><a
@click="getContestProblemById(problem.displayId)"
@ -422,6 +473,9 @@ export default {
contest() {
return this.$store.state.contest.contest;
},
isMobileView() {
return window.screen.width < 768;
},
},
};
</script>
@ -483,24 +537,3 @@ a.emphasis:hover {
padding-right: 5px !important;
}
</style>
<style>
.contest-username {
display: block;
overflow: hidden;
color: black;
font-size: 13.5px;
font-weight: 550;
}
.contest-school {
font-size: 12px;
font-weight: normal;
color: dimgrey;
}
.female-flag {
margin-right: 20px !important;
background-color: rgb(255, 193, 10);
border-radius: 4px;
color: rgb(73, 36, 0);
padding: 1px 3px !important;
}
</style>

View File

@ -42,7 +42,32 @@
field="displayId"
:title="$t('m.Problem_ID')"
min-width="100"
></vxe-table-column>
>
<template v-slot="{ row }">
<span
style="vertical-align: top;"
v-if="disPlayIdMapColor[row.displayId]"
>
<svg
t="1633685184463"
class="icon"
viewBox="0 0 1088 1024"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
p-id="5840"
width="25"
height="25"
>
<path
d="M575.872 849.408c-104.576 0-117.632-26.56-119.232-31.808-6.528-22.528 32.896-70.592 63.744-96.768l-1.728-2.624c137.6-42.688 243.648-290.112 243.648-433.472A284.544 284.544 0 0 0 478.016 0a284.544 284.544 0 0 0-284.288 284.736c0 150.4 116.352 415.104 263.744 438.336-25.152 29.568-50.368 70.784-39.104 108.928 12.608 43.136 62.72 63.232 157.632 63.232 7.872 0 11.52 9.408 4.352 19.52-21.248 29.248-77.888 63.424-167.68 63.424V1024c138.944 0 215.936-74.816 215.936-126.528a46.72 46.72 0 0 0-16.32-36.608 56.32 56.32 0 0 0-36.416-11.456zM297.152 297.472c0 44.032-38.144 25.344-38.144-38.656 0-108.032 85.248-195.712 190.592-195.712 62.592 0 81.216 39.232 38.08 39.232-105.152 0.064-190.528 87.04-190.528 195.136z"
:fill="disPlayIdMapColor[row.displayId]"
p-id="5841"
></path>
</svg>
</span>
<span>{{ row.displayId }}</span>
</template>
</vxe-table-column>
<vxe-table-column
field="first_blood"
:title="'AC' + $t('m.Status')"
@ -111,6 +136,7 @@
<script>
import api from '@/common/api';
import myMessage from '@/common/message';
import { mapState } from 'vuex';
const Pagination = () => import('@/components/oj/common/Pagination');
export default {
name: 'ACM-Info-Admin',
@ -127,6 +153,16 @@ export default {
acInfoList: [],
};
},
computed: {
...mapState({
disPlayIdMapColor: (state) => state.contest.disPlayIdMapColor,
}),
},
beforeCreate() {
if (this.$store.state.contest.contestProblems.length === 0) {
this.$store.dispatch('getContestProblems');
}
},
mounted() {
this.getACInfo(1);
},

View File

@ -6,6 +6,7 @@
auto-resize
highlight-hover-row
:data="problems"
align="center"
@cell-click="goContestProblem"
>
<!-- OI赛制的最近提交显示 -->
@ -69,11 +70,29 @@
</el-tooltip>
</template>
</vxe-table-column>
<vxe-table-column
field="displayId"
width="80"
title="#"
></vxe-table-column>
<vxe-table-column field="displayId" width="80" title="#">
<template v-slot="{ row }">
<span style="vertical-align: top;" v-if="row.color">
<svg
t="1633685184463"
class="icon"
viewBox="0 0 1088 1024"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
p-id="5840"
width="25"
height="25"
>
<path
d="M575.872 849.408c-104.576 0-117.632-26.56-119.232-31.808-6.528-22.528 32.896-70.592 63.744-96.768l-1.728-2.624c137.6-42.688 243.648-290.112 243.648-433.472A284.544 284.544 0 0 0 478.016 0a284.544 284.544 0 0 0-284.288 284.736c0 150.4 116.352 415.104 263.744 438.336-25.152 29.568-50.368 70.784-39.104 108.928 12.608 43.136 62.72 63.232 157.632 63.232 7.872 0 11.52 9.408 4.352 19.52-21.248 29.248-77.888 63.424-167.68 63.424V1024c138.944 0 215.936-74.816 215.936-126.528a46.72 46.72 0 0 0-16.32-36.608 56.32 56.32 0 0 0-36.416-11.456zM297.152 297.472c0 44.032-38.144 25.344-38.144-38.656 0-108.032 85.248-195.712 190.592-195.712 62.592 0 81.216 39.232 38.08 39.232-105.152 0.064-190.528 87.04-190.528 195.136z"
:fill="row.color"
p-id="5841"
></path>
</svg>
</span>
<span>{{ row.displayId }}</span>
</template>
</vxe-table-column>
<vxe-table-column
field="displayTitle"
:title="$t('m.Title')"
@ -138,6 +157,7 @@ export default {
JUDGE_STATUS: {},
RULE_TYPE: {},
isGetStatusOk: false,
testcolor: 'rgba(0, 206, 209, 1)',
};
},
mounted() {

View File

@ -64,6 +64,39 @@
<vxe-table-column
field="username"
fixed="left"
v-if="!isMobileView"
min-width="300"
:title="$t('m.User')"
header-align="center"
align="left"
>
<template v-slot="{ row }">
<avatar
:username="row[contest.rankShowName]"
:inline="true"
:size="37"
color="#FFF"
:src="row.avatar"
:title="row[contest.rankShowName]"
></avatar>
<span style="float:right;text-align:right">
<a @click="getUserHomeByUsername(row.uid, row.username)">
<span class="contest-username"
><span class="female-flag" v-if="row.gender == 'female'"
>Girl</span
>{{ row[contest.rankShowName] }}</span
>
<span class="contest-school" v-if="row.school">{{
row.school
}}</span>
</a>
</span>
</template>
</vxe-table-column>
<vxe-table-column
field="username"
v-else
min-width="300"
:title="$t('m.User')"
header-align="center"
@ -96,7 +129,6 @@
<vxe-table-column
field="realname"
min-width="96"
fixed="left"
:title="$t('m.RealName')"
v-if="isContestAdmin"
>
@ -124,6 +156,24 @@
:key="problem.displayId"
>
<template v-slot:header>
<span style="vertical-align: top;" v-if="problem.color">
<svg
t="1633685184463"
class="icon"
viewBox="0 0 1088 1024"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
p-id="5840"
width="25"
height="25"
>
<path
d="M575.872 849.408c-104.576 0-117.632-26.56-119.232-31.808-6.528-22.528 32.896-70.592 63.744-96.768l-1.728-2.624c137.6-42.688 243.648-290.112 243.648-433.472A284.544 284.544 0 0 0 478.016 0a284.544 284.544 0 0 0-284.288 284.736c0 150.4 116.352 415.104 263.744 438.336-25.152 29.568-50.368 70.784-39.104 108.928 12.608 43.136 62.72 63.232 157.632 63.232 7.872 0 11.52 9.408 4.352 19.52-21.248 29.248-77.888 63.424-167.68 63.424V1024c138.944 0 215.936-74.816 215.936-126.528a46.72 46.72 0 0 0-16.32-36.608 56.32 56.32 0 0 0-36.416-11.456zM297.152 297.472c0 44.032-38.144 25.344-38.144-38.656 0-108.032 85.248-195.712 190.592-195.712 62.592 0 81.216 39.232 38.08 39.232-105.152 0.064-190.528 87.04-190.528 195.136z"
:fill="problem.color"
p-id="5841"
></path>
</svg>
</span>
<span
><a
@click="getContestProblemById(problem.displayId)"
@ -245,6 +295,9 @@ export default {
contest() {
return this.$store.state.contest.contest;
},
isMobileView() {
return window.screen.width < 768;
},
},
methods: {
...mapActions(['getContestProblems']),

View File

@ -270,4 +270,33 @@ CALL contest_Add_rank_show_name ;
DROP PROCEDURE contest_Add_rank_show_name;
/*
* 2021.10.08 user_info增加性别列gender
*/
DROP PROCEDURE
IF EXISTS contest_problem_Add_color;
DELIMITER $$
CREATE PROCEDURE contest_problem_Add_color ()
BEGIN
IF NOT EXISTS (
SELECT
1
FROM
information_schema.`COLUMNS`
WHERE
table_name = 'contest_problem'
AND column_name = 'color'
) THEN
ALTER TABLE contest_problem ADD COLUMN `color` VARCHAR(255) NULL COMMENT '气球颜色';
ALTER TABLE user_info ADD COLUMN `title_name` VARCHAR(255) NULL COMMENT '头衔、称号';
ALTER TABLE user_info ADD COLUMN `title_color` VARCHAR(255) NULL COMMENT '头衔、称号的颜色';
END
IF ; END$$
DELIMITER ;
CALL contest_problem_Add_color ;
DROP PROCEDURE contest_problem_Add_color;

View File

@ -219,6 +219,7 @@ CREATE TABLE `contest_problem` (
`cid` bigint(20) unsigned NOT NULL COMMENT '比赛id',
`pid` bigint(20) unsigned NOT NULL COMMENT '题目id',
`display_title` varchar(255) NOT NULL COMMENT '该题目在比赛中的标题,默认为原名字',
`color` varchar(255) DEFAULT NULL COMMENT '气球颜色',
`gmt_create` datetime DEFAULT CURRENT_TIMESTAMP,
`gmt_modified` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`,`cid`,`pid`),
@ -720,6 +721,8 @@ CREATE TABLE `user_info` (
`email` varchar(320) DEFAULT NULL COMMENT '邮箱',
`avatar` varchar(255) DEFAULT NULL COMMENT '头像地址',
`signature` mediumtext COMMENT '个性签名',
`title_name` varchar(255) DEFAULT NULL COMMENT '头衔、称号',
`title_color` varchar(255) DEFAULT NULL COMMENT '头衔、称号的颜色',
`status` int(11) NOT NULL DEFAULT '0' COMMENT '0可用1不可用',
`gmt_create` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`gmt_modified` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',