修复markdown的样式问题

This commit is contained in:
Himit_ZH 2021-06-30 15:47:20 +08:00
parent 6e4e8a44de
commit 62f9e3af37
18 changed files with 186 additions and 77 deletions

View File

@ -60,7 +60,7 @@ public class AdminAccountController {
.forEach(role -> rolesList.add(role.getRole()));
if (rolesList.contains("admin") || rolesList.contains("root")){ // 超级管理员或管理员
if (rolesList.contains("admin") || rolesList.contains("root") || rolesList.contains("problem_admin")){ // 超级管理员或管理员题目管理员
String jwt = jwtUtils.generateToken(userRoles.getUid());
response.setHeader("Authorization", jwt); //放到信息头部
response.setHeader("Access-Control-Expose-Headers", "Authorization");

View File

@ -208,9 +208,13 @@ public class AdminContestController {
IPage<Problem> iPage = new Page<>(currentPage, limit);
// 根据cid在ContestProblem表中查询到对应pid集合
QueryWrapper<ContestProblem> contestProblemQueryWrapper = new QueryWrapper<>();
contestProblemQueryWrapper.select("pid").eq("cid", cid);
contestProblemQueryWrapper.eq("cid", cid);
List<Long> pidList = new LinkedList<>();
contestProblemService.list(contestProblemQueryWrapper).forEach(contestProblem -> {
List<ContestProblem> contestProblemList = contestProblemService.list(contestProblemQueryWrapper);
HashMap<Long, Object> contestProblemMap = new HashMap<>();
contestProblemList.forEach(contestProblem -> {
contestProblemMap.put(contestProblem.getPid(), contestProblem);
pidList.add(contestProblem.getPid());
});
@ -241,11 +245,12 @@ public class AdminContestController {
}
IPage<Problem> problemList = problemService.page(iPage, problemQueryWrapper);
if (problemList.getTotal() == 0) { // 未查询到一条数据
return CommonResult.successResponse(problemList, "暂无数据");
} else {
return CommonResult.successResponse(problemList, "获取成功");
}
HashMap<String, Object> contestProblem = new HashMap<>();
contestProblem.put("problemList", problemList);
contestProblem.put("contestProblemMap", contestProblemMap);
return CommonResult.successResponse(contestProblem, "获取成功");
}
@GetMapping("/problem")
@ -407,7 +412,7 @@ public class AdminContestController {
contestProblemQueryWrapper.eq("cid", cid)
.and(QueryWrapper -> QueryWrapper.eq("pid", pid)
.or()
.eq("display_id",displayId));
.eq("display_id", displayId));
ContestProblem contestProblem = contestProblemService.getOne(contestProblemQueryWrapper, false);
if (contestProblem != null) {
return CommonResult.errorResponse("添加失败该题目已添加或者题目的比赛展示ID已存在", CommonResult.STATUS_FAIL);
@ -441,7 +446,7 @@ public class AdminContestController {
QueryWrapper<Problem> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("problem_id", name.toUpperCase() + "-" + problemId);
Problem problem = problemService.getOne(queryWrapper,false);
Problem problem = problemService.getOne(queryWrapper, false);
// 如果该题目不存在需要先导入
if (problem == null) {
@ -467,7 +472,7 @@ public class AdminContestController {
contestProblemQueryWrapper.eq("cid", cid)
.and(QueryWrapper -> queryWrapper.eq("pid", finalProblem.getId())
.or()
.eq("display_id",displayId));
.eq("display_id", displayId));
ContestProblem contestProblem = contestProblemService.getOne(contestProblemQueryWrapper, false);
if (contestProblem != null) {
return CommonResult.errorResponse("添加失败该题目已添加或者题目的比赛展示ID已存在", CommonResult.STATUS_FAIL);

View File

@ -44,8 +44,8 @@ public class CFProblemStrategy extends ProblemStrategy {
info.setTitle(ReUtil.get("<div class=\"title\">\\s*" + problemNum + "\\. ([\\s\\S]*?)</div>", html, 1).trim());
info.setTimeLimit(1000 * Integer.parseInt(ReUtil.get("</div>([\\d\\.]+) (seconds?|s)\\s*</div>", html, 1)));
double timeLimit = 1000 * Double.parseDouble(ReUtil.get("</div>([\\d\\.]+) (seconds?|s)\\s*</div>", html, 1));
info.setTimeLimit((int) timeLimit);
info.setMemoryLimit(Integer.parseInt(ReUtil.get("</div>(\\d+) (megabytes|MB)\\s*</div>", html, 1)));
@ -71,9 +71,9 @@ public class CFProblemStrategy extends ProblemStrategy {
for (int i = 0; i < inputExampleList.size() && i < outputExampleList.size(); i++) {
sb.append("<input>");
sb.append(inputExampleList.get(i).replace("<br>", "")).append("</input>");
sb.append(inputExampleList.get(i).replace("<br>", "\n")).append("</input>");
sb.append("<output>");
sb.append(outputExampleList.get(i).replace("<br>", "")).append("</output>");
sb.append(outputExampleList.get(i).replace("<br>", "\n")).append("</output>");
}
info.setExamples(sb.toString());

View File

@ -95,7 +95,8 @@
<!-- 主查询 -->
<select id="getAdminUserList" resultMap="map_UserRolesList" resultType="list">
SELECT u.* FROM user_info u, (SELECT DISTINCT ur.uid AS uid FROM user_role ur WHERE ur.role_id=1000 OR ur.role_id=1001) t
SELECT u.* FROM user_info u, (SELECT DISTINCT ur.uid AS uid FROM user_role ur
WHERE ur.role_id=1000 OR ur.role_id=1001 OR ur.role_id=1008) t
<where>
t.uid = u.uuid
<if test="keyword!=null and keyword!=''">

View File

@ -6,7 +6,7 @@ export default {
Vue.directive('highlight', {
deep: true,
bind: function (el, binding) {
Array.from(el.querySelectorAll('code')).forEach((target) => {
Array.from(el.querySelectorAll('pre code')).forEach((target) => {
if (binding.value) {
target.textContent = binding.value
}
@ -14,7 +14,7 @@ export default {
})
},
componentUpdated: function (el, binding) {
Array.from(el.querySelectorAll('code')).forEach((target) => {
Array.from(el.querySelectorAll('pre code')).forEach((target) => {
if (binding.value) {
target.textContent = binding.value
}

View File

@ -52,6 +52,7 @@ export const m = {
// /views/admin/general/User.vue
General_User: 'User',
Created_Time:'Created Time',
Delete:'Delete',
OnlyAdmin:'OnlyAdmin',
User_Type: 'User Type',
@ -124,6 +125,9 @@ export const m = {
// /views/admin/problem/ProblemList.vue
Contest_Problem_List: 'Contest Problem List',
Display_ID:'Display ID',
Display_Title:'Display Title',
Original_Display:'Original Display',
Contest_Display:'Contest Display',
Add_Rmote_OJ_Problem:'Add Remote OJ Problem',
Add_From_Public_Problem:'Add From Public Problem',
Auth:'Auth',

View File

@ -52,6 +52,7 @@ export const m = {
// /views/admin/general/User.vue
General_User: '用户管理',
Created_Time:'创建时间',
Delete:'删除',
OnlyAdmin:'仅显示管理员',
User_Type: '用户角色',
@ -124,8 +125,11 @@ export const m = {
// /views/admin/problem/ProblemList.vue
Contest_Problem_List: '比赛题目列表',
Display_ID:'展示ID',
Display_Title:'展示标题',
Add_Rmote_OJ_Problem:'添加远程OJ题目',
Add_From_Public_Problem:'从公共题库添加题目',
Original_Display:'原题显示',
Contest_Display:'比赛显示',
Auth:'权限',
Modified_User:'最近修改者',
Public_Problem:'公开题目',

View File

@ -245,7 +245,7 @@ export const m = {
OI_Ranklist: 'OI Ranklist',
// /views/oj/discussion/discussionList.vue
Created_Time:'Created Time',
Release_Time:'Release Time',
Likes:'Likes',
Views:'Views',
Edit:'Edit',

View File

@ -247,7 +247,7 @@ export const m = {
OI_Ranklist: 'OI 排行榜',
// /views/oj/discussion/discussionList.vue
Created_Time:'发布时间',
Release_Time:'发布时间',
Likes:'点赞',
Views:'浏览',
Edit:'编辑',

View File

@ -25,7 +25,12 @@
align="center"
>
<vxe-table-column field="id" width="80" title="ID"> </vxe-table-column>
<vxe-table-column field="title" min-width="150" :title="$t('m.Title')">
<vxe-table-column
field="title"
min-width="150"
:title="$t('m.Title')"
show-overflow
>
</vxe-table-column>
<vxe-table-column :title="$t('m.Type')" width="100">
<template v-slot="{ row }">
@ -73,7 +78,7 @@
<template v-slot="{ row }">
<p>Start Time: {{ row.startTime | localtime }}</p>
<p>End Time: {{ row.endTime | localtime }}</p>
<p>Create Time: {{ row.gmtCreate | localtime }}</p>
<p>Created Time: {{ row.gmtCreate | localtime }}</p>
<p>Creator: {{ row.author }}</p>
</template>
</vxe-table-column>

View File

@ -43,12 +43,14 @@
<vxe-table-column
field="title"
:title="$t('m.Title')"
show-overflow
min-width="150"
></vxe-table-column>
<vxe-table-column
field="author"
:title="$t('m.Author')"
min-width="150"
show-overflow
></vxe-table-column>
<vxe-table-column
field="likeNum"
@ -169,6 +171,7 @@
<vxe-table-column
min-width="150"
field="reporter"
show-overflow
:title="$t('m.Reporter')"
>
</vxe-table-column>

View File

@ -28,6 +28,7 @@
<vxe-table-column
min-width="150"
field="title"
show-overflow
:title="$t('m.Announcement_Title')"
>
</vxe-table-column>
@ -52,6 +53,7 @@
<vxe-table-column
min-width="150"
field="username"
show-overflow
:title="$t('m.Author')"
>
</vxe-table-column>

View File

@ -50,21 +50,25 @@
field="uid"
title="UUID"
width="130"
show-overflow
></vxe-table-column>
<vxe-table-column
field="username"
:title="$t('m.User')"
min-width="140"
show-overflow
></vxe-table-column>
<vxe-table-column
field="realname"
:title="$t('m.RealName')"
min-width="140"
show-overflow
></vxe-table-column>
<vxe-table-column
field="email"
:title="$t('m.Email')"
min-width="150"
show-overflow
></vxe-table-column>
<vxe-table-column
field="gmtCreate"

View File

@ -49,9 +49,8 @@
stripe
auto-resize
:data="problemList"
ref="xTable"
ref="adminProblemList"
:loading="loading"
@row-dblclick="handleDblclick"
align="center"
>
<vxe-table-column min-width="64" field="id" title="ID">
@ -60,32 +59,73 @@
min-width="100"
field="problemId"
:title="$t('m.Display_ID')"
v-if="!contestId"
>
</vxe-table-column>
<vxe-table-column field="title" min-width="150" :title="$t('m.Title')">
<vxe-table-column
field="title"
min-width="150"
:title="$t('m.Title')"
show-overflow
v-if="!contestId"
>
</vxe-table-column>
<vxe-table-column
min-width="150"
:title="$t('m.Original_Display')"
v-if="isContest"
align="left"
>
<template v-slot="{ row }">
<p v-if="contestId">
{{ $t('m.Display_ID') }}{{ row.problemId }}
</p>
<p v-if="contestId">{{ $t('m.Title') }}{{ row.title }}</p>
<span v-else>{{ row.problemId }}</span>
</template>
</vxe-table-column>
<vxe-table-column
min-width="150"
:title="$t('m.Contest_Display')"
v-if="isContest"
align="left"
>
<template v-slot="{ row }">
<p v-if="contestProblemMap[row.id]">
{{ $t('m.Display_ID') }}{{
contestProblemMap[row.id]['displayId']
}}
</p>
<p v-if="contestProblemMap[row.id]">
{{ $t('m.Title') }}{{
contestProblemMap[row.id]['displayTitle']
}}
</p>
<span v-else>{{ row.title }}</span>
</template>
</vxe-table-column>
<vxe-table-column
field="author"
min-width="130"
:title="$t('m.Author')"
show-overflow
>
</vxe-table-column>
<vxe-table-column
min-width="150"
field="gmtCreate"
:title="$t('m.Created_Time')"
>
<vxe-table-column min-width="120" :title="$t('m.Created_Time')">
<template v-slot="{ row }">
{{ row.gmtCreate | localtime }}
</template>
</vxe-table-column>
<vxe-table-column
field="modifiedUser"
min-width="130"
min-width="96"
:title="$t('m.Modified_User')"
show-overflow
>
</vxe-table-column>
<vxe-table-column min-width="130" field="auth" :title="$t('m.Auth')">
<vxe-table-column min-width="100" :title="$t('m.Auth')">
<template v-slot="{ row }">
<el-select
v-model="row.auth"
@ -257,6 +297,7 @@ export default {
pageSize: 10,
total: 0,
problemList: [],
contestProblemMap: {},
keyword: '',
loading: false,
currentPage: 1,
@ -275,18 +316,22 @@ export default {
};
},
mounted() {
this.init();
},
computed: {
...mapGetters(['userInfo', 'isSuperAdmin', 'isProblemAdmin']),
isContest() {
return !(this.routeName == 'admin-problem-list' && !this.contestId);
},
},
methods: {
init() {
this.routeName = this.$route.name;
this.contestId = this.$route.params.contestId;
this.getProblemList(this.currentPage);
this.REMOTE_OJ = Object.assign({}, REMOTE_OJ);
},
computed: {
...mapGetters(['userInfo', 'isSuperAdmin', 'isProblemAdmin']),
},
methods: {
handleDblclick(row) {
row.isEditing = true;
},
goEdit(problemId) {
if (this.routeName === 'admin-problem-list') {
this.$router.push({
@ -321,29 +366,36 @@ export default {
},
getProblemList(page = 1) {
this.loading = true;
let funcName =
this.routeName === 'admin-problem-list'
? 'admin_getProblemList'
: 'admin_getContestProblemList';
let params = {
limit: this.pageSize,
currentPage: page,
keyword: this.keyword,
cid: this.contestId,
};
api[funcName](params).then(
if (this.routeName === 'admin-problem-list') {
api.admin_getProblemList(params).then(
(res) => {
this.loading = false;
this.total = res.data.data.total;
for (let problem of res.data.data.records) {
problem.isEditing = false;
}
this.problemList = res.data.data.records;
},
(err) => {
this.loading = false;
}
);
} else {
api.admin_getContestProblemList(params).then(
(res) => {
this.loading = false;
this.total = res.data.data.problemList.total;
this.problemList = res.data.data.problemList.records;
this.contestProblemMap = res.data.data.contestProblemMap;
},
(err) => {
this.loading = false;
}
);
}
},
changeProblemAuth(row) {
@ -452,9 +504,12 @@ export default {
},
watch: {
$route(newVal, oldVal) {
this.contestId = newVal.params.contestId;
this.routeName = newVal.name;
this.getProblemList(this.currentPage);
if (
newVal.params.contestId != oldVal.params.contestId ||
newVal.name != oldVal.name
) {
this.init();
}
},
},
};

View File

@ -77,7 +77,7 @@
>
<span>
<i class="fa fa-clock-o"> {{ $t('m.Created_Time') }}</i>
<i class="fa fa-clock-o"> {{ $t('m.Release_Time') }}</i>
<span>
<el-tooltip
:content="discussion.gmtCreate | localtime"

View File

@ -143,7 +143,7 @@
<span class="pr pl hidden-xs-only">
<label class="fw"><i class="fa fa-clock-o"></i></label
><span>
{{ $t('m.Created_Time') }}<el-tooltip
{{ $t('m.Release_Time') }}<el-tooltip
:content="discussion.gmtCreate | localtime"
placement="top"
>

View File

@ -68,6 +68,7 @@
>
</div>
<div class="question-intr">
<template v-if="!isCFProblem">
<span
>{{ $t('m.Time_Limit') }}C/C++
{{ problemData.problem.timeLimit }}MS{{ $t('m.Other') }}
@ -75,9 +76,27 @@
><br />
<span
>{{ $t('m.Memory_Limit') }}C/C++
{{ problemData.problem.memoryLimit }}MB{{ $t('m.Other') }}
{{ problemData.problem.memoryLimit }}MB{{
$t('m.Other')
}}
{{ problemData.problem.memoryLimit * 2 }}MB</span
><br />
</template>
<template v-else>
<span
>{{ $t('m.Time_Limit') }}{{
problemData.problem.timeLimit
}}MS</span
>
<br />
<span
>{{ $t('m.Memory_Limit') }}{{
problemData.problem.memoryLimit
}}MB</span
><br />
</template>
<span
>{{ $t('m.Level') }}{{
PROBLEM_LEVEL[problemData.problem.difficulty]['name']
@ -981,6 +1000,13 @@ export default {
});
}
},
isCFProblem() {
if (this.problemID.indexOf('CF-') == 0) {
return true;
} else {
return false;
}
},
},
beforeRouteLeave(to, from, next) {
//

View File

@ -264,11 +264,11 @@ export default {
methods: {
doCopy() {
this.$copyText(this.submission.code).then(
function(e) {
() => {
myMessage.success(this.$i18n.t('m.Copied_successfully'));
},
function(e) {
myMessage.success(this.$i18n.t('m.复制失败'));
() => {
myMessage.success(this.$i18n.t('m.Copied_failed'));
}
);
},