Skip to content

Commit 8e39b23

Browse files
authored
Merge branch 'master' into add-user-edit-ztl
2 parents 0429b08 + f198829 commit 8e39b23

File tree

6 files changed

+121
-10
lines changed

6 files changed

+121
-10
lines changed

src/App.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
</div>
88
</div>
99
<Footer />
10-
<UserLogin></UserLogin>
11-
<UserRegister></UserRegister>
10+
<UserLogin v-if="$store.state.user.showlogin"></UserLogin>
11+
<UserRegister v-if="$store.state.user.showregister"></UserRegister>
1212
</div>
1313
</template>
1414

src/components/lib/AjaxTable.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
</el-table>
66
<el-pagination
77
:page-size="this.limit"
8-
:total="this.total"
98
background
109
layout="prev, pager, next, jumper, total"
1110
@current-change="this.onPageChange"

src/components/lib/captcha.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div class="captcha">
3-
<el-input v-model="captcha_answer" placeholder="Solve Captcha"></el-input>
3+
<el-input v-model="captcha_answer"></el-input>
44
<img class="captcha-img" v-if="loaded" @click="refresh_captcha();" :src="img_url" />
55
</div>
66
</template>

src/components/lib/tag.vue

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<template>
2+
<span :v-if="showTag" class="seg-tag" :style="style">
3+
<i :v-if="icon" :class="'el-icon-' + icon_detail"></i>{{content}}
4+
</span>
5+
</template>
6+
7+
<script>
8+
export default {
9+
name: 'SegmentTag',
10+
props: {
11+
content: {
12+
type: String,
13+
default: ''
14+
},
15+
icon: {
16+
type: Boolean,
17+
default: false
18+
},
19+
icon_detail: String,
20+
border: {
21+
type: Boolean,
22+
default: true
23+
},
24+
color: {
25+
type: String,
26+
default: '#606266'
27+
},
28+
border_color: {
29+
type: String,
30+
default: '#E4E7ED'
31+
},
32+
background_color: {
33+
type: String,
34+
default: 'rgb (244, 255, 255)'
35+
}
36+
},
37+
data() {
38+
return {
39+
style: '',
40+
showTag: false
41+
};
42+
},
43+
mounted() {
44+
this.style = 'color: ' + this.color + '; background-color: ' + this.background_color + ';';
45+
if(this.border) {
46+
this.style += 'border-color: '+ this.border_color + ';';
47+
}
48+
this.showTag = true;
49+
}
50+
};
51+
</script>
52+
53+
<style scoped>
54+
.seg-tag {
55+
display: inline-block;
56+
height: 32px;
57+
padding: 0 10px;
58+
line-height: 30px;
59+
font-size: 12px;
60+
font-weight: 500;
61+
border-width: 1px;
62+
border-style: solid;
63+
box-sizing: border-box;
64+
white-space: nowrap;
65+
margin: 3px;
66+
}
67+
</style>

src/components/problem/content.vue

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,23 @@
6565
<el-divider class="divider">Memery</el-divider>
6666
<div class="tool-content">{{memery}} MB</div>
6767
</el-card>
68+
<el-card shadow="never" class="margin-top">
69+
<div class="margin-bottom">
70+
<i class="el-icon-collection-tag" />
71+
Tags
72+
<div v-if="showTag" @click="showTag = false" id="tag-button"><i class="el-icon-arrow-up" />Hide tags</div>
73+
<div v-if="!showTag" @click="showTag = true" id="tag-button"><i class="el-icon-arrow-down" />Show tags</div>
74+
</div>
75+
<div class="tags" v-if="showTag">
76+
<SegmentTag
77+
v-for="item in rendertags"
78+
:key="item.content"
79+
:border_color="item.color"
80+
:content="item.content"
81+
>
82+
</SegmentTag>
83+
</div>
84+
</el-card>
6885
</div>
6986
</div>
7087
</div>
@@ -75,6 +92,7 @@
7592
import timeFormat from './../../methods/time';
7693
import apiurl from './../../apiurl';
7794
import MarkdownContainer from './../lib/MarkdownContainer.vue';
95+
import SegmentTag from './../lib/tag.vue';
7896
7997
export default {
8098
name: 'ProblemView',
@@ -90,10 +108,29 @@ export default {
90108
time: '-',
91109
memery: '-',
92110
timeAdd: 'Unknown',
93-
problemLoading: true
111+
tags: [],
112+
rendertags: [],
113+
problemLoading: true,
114+
showTag: false
94115
};
95116
},
96117
methods: {
118+
render_tags() {
119+
for(let i = 0; i < this.tags.length; i += 1) {
120+
this.$axios
121+
.get(apiurl('/problem/tag/' + this.tags[i]))
122+
.then(res => {
123+
let data = res.data;
124+
this.rendertags.push({
125+
color: data.res.color,
126+
content: data.res.content
127+
});
128+
})
129+
.catch(() => {
130+
131+
});
132+
}
133+
},
97134
loadproblem() {
98135
this.$axios
99136
.get(apiurl('/problem/' + String(this.$route.params.id)))
@@ -107,7 +144,9 @@ export default {
107144
this.time = data.time_limit;
108145
this.hidden = !data.enabled;
109146
this.timeAdd = timeFormat(data.date_added);
147+
this.tags = data.tags;
110148
this.problemLoading = false;
149+
this.render_tags();
111150
})
112151
.catch(err => {
113152
if(err.request.status === 404) {
@@ -127,7 +166,8 @@ export default {
127166
this.loadproblem();
128167
},
129168
components: {
130-
MarkdownContainer
169+
MarkdownContainer,
170+
SegmentTag
131171
}
132172
};
133173
</script>
@@ -146,6 +186,10 @@ export default {
146186
margin-top: 20px;
147187
}
148188
189+
.margin-bottom {
190+
margin-bottom: 15px;
191+
}
192+
149193
@media only screen and (max-width: 700px) {
150194
#pannel {
151195
z-index: 1000;
@@ -193,11 +237,13 @@ export default {
193237
border: 1px solid #e4e7ed;
194238
}
195239
196-
#full-screen-button {
240+
#full-screen-button,
241+
#tag-button {
197242
float: right;
198243
}
199244
200-
#full-screen-button:hover {
245+
#full-screen-button:hover,
246+
#tag-button:hover {
201247
cursor: pointer;
202248
}
203249

src/components/problem/edit.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ export default {
4343
submit() {
4444
this.buttonLoading = true;
4545
this.$axios
46-
.patch(apiurl('/problem/content'), {
47-
pid: Number(this.$route.params.id),
46+
.patch(apiurl('/problem/' + this.$route.params.id), {
4847
title: this.title,
4948
description: this.mdContent
5049
})

0 commit comments

Comments
 (0)