Skip to content

Commit 03fce6a

Browse files
committed
improved create problem
Signed-off-by: zhangtianli2006 <49156174+zhangtianli2006@users.noreply.github.com>
1 parent ec618ba commit 03fce6a

File tree

2 files changed

+27
-12
lines changed

2 files changed

+27
-12
lines changed

src/components/problem/create.vue

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,16 @@
2222
Title
2323
</div>
2424
<el-form-item>
25-
<el-input v-model="title" placeholder="Title"></el-input>
25+
<el-input v-model="title" placeholder="Title">
26+
<i v-if="errorTitle" slot="suffix" class="icon-error el-input__icon el-icon-circle-close"></i>
27+
<i v-else slot="suffix" class="icon-success el-input__icon el-icon-circle-check"></i>
28+
</el-input>
2629
</el-form-item>
2730
<el-form-item>
2831
<el-button
2932
type="primary"
3033
v-on:click="Submit();"
34+
:disabled="errorPID || errorTitle"
3135
>
3236
Edit Detail
3337
</el-button>
@@ -46,19 +50,30 @@ export default {
4650
return {
4751
pid: null,
4852
title: null,
49-
errorPID: true
53+
errorPID: true,
54+
errorTitle: true
5055
};
5156
},
5257
watch: {
5358
pid(val) {
54-
this.$axios
55-
.get(apiurl('/problem/' + String(val)))
56-
.then(() => {
57-
this.errorPID = true;
58-
})
59-
.catch(() => {
60-
this.errorPID = false;
61-
});
59+
if (val === '') {
60+
this.errorPID = true;
61+
} else {
62+
this.$axios
63+
.get(apiurl('/problem/' + String(val)))
64+
.then(() => {
65+
this.errorPID = true;
66+
})
67+
.catch(() => {
68+
this.errorPID = false;
69+
});
70+
}
71+
},
72+
title(val) {
73+
console.log(val);
74+
if (val !== null && val !== '') {
75+
this.errorTitle = false;
76+
}
6277
}
6378
},
6479
methods: {

src/components/problem/list.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@
4646
<el-checkbox v-model="showTags"> Show Tags</el-checkbox>
4747
<el-divider />
4848
<el-button
49-
type="info"
5049
style="width: 100%;"
5150
@click="$store.state.createProblem.displayCreateProblem = true;"
52-
plain
51+
size="medium"
5352
>
53+
<i class="el-icon-circle-plus" />
5454
Create New Problem
5555
</el-button>
5656
</el-card>

0 commit comments

Comments
 (0)