Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/assets/code_mirror/tomorrow.css
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
}

.CodeMirror-gutters {
background: #f9f9f9;
background: #fcfcfc;
border-right: none;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<template>
<span class="segment-tag" :style="style">
<span class="tag" :style="style">
<i :v-if="icon" :class="'el-icon-' + icon_detail"></i>{{content}}
</span>
</template>

<script>
export default {
name: 'SegmentTag',
name: 'ProblemTag',
props: {
content: {
type: String,
Expand Down Expand Up @@ -55,7 +55,7 @@ export default {
</script>

<style scoped>
.segment-tag {
.tag {
display: inline-block;
padding: 0 10px;
font-size: 12px;
Expand Down
9 changes: 4 additions & 5 deletions src/components/problem/content.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,14 @@
</div>
</div>
<div class="tags" v-if="showTag">
<SegmentTag
<ProblemTag
v-for="item in rendertags"
:key="item.content"
color="#fff"
:border_color="item.color"
:background_color="item.color"
:content="item.content"
>
</SegmentTag>
/>
</div>
</el-card>
</div>
Expand All @@ -100,7 +99,7 @@
import timeFormat from './../../methods/time';
import apiurl from './../../apiurl';
import MarkdownContainer from './../lib/MarkdownContainer.vue';
import SegmentTag from './../lib/tag.vue';
import ProblemTag from './../lib/problemTag.vue';

export default {
name: 'ProblemView',
Expand Down Expand Up @@ -174,7 +173,7 @@ export default {
},
components: {
MarkdownContainer,
SegmentTag
ProblemTag
}
};
</script>
Expand Down
20 changes: 12 additions & 8 deletions src/components/problem/edit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</el-row>
</el-card>
<el-card class="item">
<el-button type="primary" @click="submit" :loading="buttonLoading">Submit</el-button>
<el-button type="primary" @click="submit">Submit</el-button>
<el-button @click="back();">Back</el-button>
<ConfirmDelete
buttonName="Delete"
Expand Down Expand Up @@ -93,7 +93,10 @@
</el-row>
</el-card>
<el-card v-loading="contentLoading" class="item">
<div slot="header" class="clearfix"><i class="el-icon-document" /> Content</div>
<div slot="header" class="clearfix">
<i class="el-icon-document" />
Content
</div>
<MarkdownEditor v-model="mdContent" />
</el-card>
</div>
Expand All @@ -111,7 +114,6 @@ export default {
title: '',
mdContent: 'Loading...',
contentLoading: true,
buttonLoading: false,
time: 'Unknown',
memery: 'Unknown',
disable: false,
Expand All @@ -137,15 +139,19 @@ export default {
this.contentLoading = false;
})
.catch(err => {
this.$SegmentMessage.error(this, 'Problem loading error');
console.log(err);
if (err.request.status === 404) {
this.$SegmentMessage.error(this, 'Problem not found');
} else if (err.request.status === 403) {
this.$SegmentMessage.error(this, 'Permission denied');
} else {
this.$SegmentMessage.error(this, 'Unkown error');
}
});
},
back() {
this.$router.push('/problem/' + this.$route.params.id);
},
submit() {
this.buttonLoading = true;
this.$axios
.patch(apiurl('/problem/' + this.$route.params.id), {
title: this.title,
Expand All @@ -156,7 +162,6 @@ export default {
enabled: !this.disable
})
.then(() => {
this.buttonLoading = false;
this.$SegmentMessage.success(this, 'Your changes have been submitted');
})
.catch(err => {
Expand All @@ -167,7 +172,6 @@ export default {
} else {
this.$SegmentMessage.error(this, 'Unkown error');
}
this.buttonLoading = false;
});
},
delete() {
Expand Down
7 changes: 0 additions & 7 deletions src/components/problem/list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
v-model="limit"
:step="10"
:min="10"
@change="refresh"
style="margin-top: 10px;"
/>
</el-col>
Expand Down Expand Up @@ -119,12 +118,6 @@ export default {
x.tag = (<listTag tags={ x.tags }></listTag>);

return x;
},
refresh() {
// this.alive = false;
// this.$nextTick(() => {
// this.alive = true;
// });
}
},
components: {
Expand Down
8 changes: 4 additions & 4 deletions src/components/problem/listTag.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<template>
<div>
<div v-if="$store.state.tags.displayTags">
<SegmentTag
<ProblemTag
v-for="item in this.rendertags"
:key="item.content"
color="#fff"
height="22"
:height="22"
:border_color="item.color"
:background_color="item.color"
:content="item.content"
Expand All @@ -15,7 +15,7 @@
</template>

<script>
import SegmentTag from './../lib/tag.vue';
import ProblemTag from './../lib/problemTag.vue';
import apiurl from './../../apiurl';
import AWaitLock from './../../methods/lock';

Expand Down Expand Up @@ -74,7 +74,7 @@ export default {
this.loadTag();
},
components: {
SegmentTag,
ProblemTag
},
};
</script>
6 changes: 5 additions & 1 deletion src/components/user/content.vue
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,11 @@ export default {
this.solved = data.solved;
this.submit = data.submit_time;
this.timeJoin = timeFormat(data.date_joined);
this.lastLogin = timeFormat(data.last_login);
if (data.last_login == null) {
this.lastLogin = 'Never';
} else {
this.lastLogin = timeFormat(data.last_login);
}
this.isRoot = data.is_superuser;
this.isStaff = data.is_staff;
this.isActive = data.is_active;
Expand Down
18 changes: 18 additions & 0 deletions src/components/user/edit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,15 @@ export default {
this.isActive = data.is_active;
this.lang = String(data.lang);
}
})
.catch(err => {
if (err.request.status === 404) {
this.$SegmentMessage.error(this, 'User not found');
} else if (err.request.status === 403) {
this.$SegmentMessage.error(this, 'Permission denied');
} else {
this.$SegmentMessage.error(this, 'Unkown error');
}
});
},
submit() {
Expand All @@ -154,6 +163,15 @@ export default {
lang: this.lang
});
}
})
.catch(err => {
if (err.request.status === 404) {
this.$SegmentMessage.error(this, 'User not found');
} else if (err.request.status === 403) {
this.$SegmentMessage.error(this, 'Permission denied');
} else {
this.$SegmentMessage.error(this, 'Unkown error');
}
});
}
},
Expand Down