update
This commit is contained in:
@@ -14,7 +14,7 @@ class CreateAnnouncementSerializer(serializers.Serializer):
|
|||||||
|
|
||||||
class AnnouncementSerializer(serializers.ModelSerializer):
|
class AnnouncementSerializer(serializers.ModelSerializer):
|
||||||
create_time = DateTimeTZField()
|
create_time = DateTimeTZField()
|
||||||
last_update_time = DateTimeTZField
|
last_update_time = DateTimeTZField()
|
||||||
|
|
||||||
class UserSerializer(serializers.ModelSerializer):
|
class UserSerializer(serializers.ModelSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
<td>{{ user.email }}</td>
|
<td>{{ user.email }}</td>
|
||||||
<td>{{ $t(adminType[user.admin_type]) }}</td>
|
<td>{{ $t(adminType[user.admin_type]) }}</td>
|
||||||
<td>
|
<td>
|
||||||
<button class="btn-sm btn-info" v-on:click="edit(user.id)">{{ $t("user.edit") }}</button>
|
<button class="btn-sm btn-info" v-on:click="edit(user.id)">{{ $t("adminUtils.edit") }}</button>
|
||||||
<a target="_blank" href="/submissions/?user_id={{ user.id }}">
|
<a target="_blank" href="/submissions/?user_id={{ user.id }}">
|
||||||
{{ $t("user.submission") }}
|
{{ $t("user.submission") }}
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -3,12 +3,12 @@
|
|||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<tr>
|
<tr>
|
||||||
<th>ID</th>
|
<th>ID</th>
|
||||||
<th>{{ $t("announcement.title") }}</th>
|
<th>{{ $t("adminUtils.title") }}</th>
|
||||||
<th>{{ $t("announcement.createTime") }}</th>
|
<th>{{ $t("adminUtils.createTime") }}</th>
|
||||||
<th>{{ $t("announcement.lastUpdateTime") }}</th>
|
<th>{{ $t("adminUtils.lastUpdateTime") }}</th>
|
||||||
<th>{{ $t("announcement.createdBy") }}</th>
|
<th>{{ $t("adminUtils.createdBy") }}</th>
|
||||||
<th>{{ $t("announcement.isVisible") }}</th>
|
<th>{{ $t("adminUtils.isVisible") }}</th>
|
||||||
<th>{{ $t("announcement.management") }}</th>
|
<th>{{ $t("adminUtils.management") }}</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr v-for="announcement in announcementList">
|
<tr v-for="announcement in announcementList">
|
||||||
<td>{{ announcement.id }}</td>
|
<td>{{ announcement.id }}</td>
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
<td>{{ announcement.created_by.username }}</td>
|
<td>{{ announcement.created_by.username }}</td>
|
||||||
<td>{{ $t(announcementStatus[announcement.visible?1:0]) }}</td>
|
<td>{{ $t(announcementStatus[announcement.visible?1:0]) }}</td>
|
||||||
<td>
|
<td>
|
||||||
<button class="btn-sm btn-info" v-on:click="edit(announcement.id)">{{ $t("announcement.edit") }}</button>
|
<button class="btn-sm btn-info" v-on:click="edit(announcement.id)">{{ $t("adminUtils.edit") }}</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
export default({
|
export default({
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
announcementStatus: ["announcement.visible", "announcement.invisible"],
|
announcementStatus: ["adminUtils.visible", "adminUtils.invisible"],
|
||||||
announcementList: [],
|
announcementList: [],
|
||||||
pagination: {
|
pagination: {
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
|
|||||||
@@ -5,11 +5,12 @@
|
|||||||
<form v-on:submit="submit">
|
<form v-on:submit="submit">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
<label>{{ $t("announcement.title") }}</label>
|
<label>{{ $t("adminUtils.title") }}</label>
|
||||||
<input type="text" class="form-control">
|
<input type="text" class="form-control">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
<simditor editorid="createAnnouncement"></simditor>
|
<label>{{ $t("adminUtils.content") }}</label>
|
||||||
|
<simditor editorid="createAnnouncement" v-ref:editor></simditor>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@@ -30,6 +31,8 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
route: {
|
||||||
|
},
|
||||||
components: {
|
components: {
|
||||||
simditor
|
simditor
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,11 +6,12 @@
|
|||||||
<form v-on:submit="submit">
|
<form v-on:submit="submit">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
<label>{{ $t("announcement.title") }}</label>
|
<label>{{ $t("adminUtils.title") }}</label>
|
||||||
<input type="text" class="form-control">
|
<input type="text" class="form-control">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
<simditor editorid="editAnnouncement"></simditor>
|
<label>{{ $t("adminUtils.content") }}</label>
|
||||||
|
<simditor editorid="editAnnouncement" :content="content" v-ref:editor></simditor>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@@ -25,7 +26,10 @@
|
|||||||
|
|
||||||
export default({
|
export default({
|
||||||
data() {
|
data() {
|
||||||
return {}
|
return {
|
||||||
|
announcement: {},
|
||||||
|
content: ""
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
submit() {
|
submit() {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<ul class="pagination pagination-lg">
|
<ul class="pagination pagination-lg">
|
||||||
<li class="{{ pagination.currentPage > 1 ? '' : 'disabled' }}">
|
<li class="{{ pagination.currentPage > 1 ? '' : 'disabled' }}">
|
||||||
<a href="#" aria-label="Previous" @click.prevent="changePage(1)">
|
<a href="#" aria-label="Previous" @click.prevent="changePage(1)">
|
||||||
<span aria-hidden="true">上一页</span>
|
<span aria-hidden="true">{{ $t("pagination.firstPage") }}</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="{{ pagination.currentPage > 1 ? '' : 'disabled' }}">
|
<li class="{{ pagination.currentPage > 1 ? '' : 'disabled' }}">
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
</li>
|
</li>
|
||||||
<li class="{{ pagination.currentPage < pagination.totalPages ? '' : 'disabled' }}">
|
<li class="{{ pagination.currentPage < pagination.totalPages ? '' : 'disabled' }}">
|
||||||
<a href="#" aria-label="Next" @click.prevent="changePage(pagination.totalPages)">
|
<a href="#" aria-label="Next" @click.prevent="changePage(pagination.totalPages)">
|
||||||
<span aria-hidden="true">最后一页</span>
|
<span aria-hidden="true">{{ $t("pagination.lastPage") }}</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -82,10 +82,12 @@
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
changePage(page) {
|
changePage(page) {
|
||||||
|
if (page > 0 && page <= this.pagination.totalPages) {
|
||||||
this.$set('pagination.currentPage', page);
|
this.$set('pagination.currentPage', page);
|
||||||
this.$router.go({name: this.$route.name, params: {page: page}});
|
this.$router.go({name: this.$route.name, params: {page: page}});
|
||||||
this.callback();
|
this.callback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -6,10 +6,30 @@
|
|||||||
import SimditorMakrdown from "simditor-markdown"
|
import SimditorMakrdown from "simditor-markdown"
|
||||||
|
|
||||||
export default{
|
export default{
|
||||||
props: ["editorid"],
|
data() {
|
||||||
|
return {
|
||||||
|
editor: {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
editorid: {
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
content: {
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
setContent(content){
|
||||||
|
this.editor.setValue(content);
|
||||||
|
},
|
||||||
|
getContent() {
|
||||||
|
return this.editor.getValue();
|
||||||
|
}
|
||||||
|
},
|
||||||
attached() {
|
attached() {
|
||||||
var self = this;
|
var self = this;
|
||||||
var editor = new Simditor({
|
self.editor = new Simditor({
|
||||||
textarea: document.getElementById(self.editorid),
|
textarea: document.getElementById(self.editorid),
|
||||||
upload: {url: "/", fileKey: "file"},
|
upload: {url: "/", fileKey: "file"},
|
||||||
toolbar: ['bold', 'italic', 'underline', 'color', 'image', 'ol', 'ul', 'markdown']
|
toolbar: ['bold', 'italic', 'underline', 'color', 'image', 'ol', 'ul', 'markdown']
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ export default {
|
|||||||
announcementManagement: "公告管理"
|
announcementManagement: "公告管理"
|
||||||
},
|
},
|
||||||
pagination: {
|
pagination: {
|
||||||
first: "首页",
|
firstPage: "首页",
|
||||||
last: "末页"
|
lastPage: "末页"
|
||||||
},
|
},
|
||||||
request: {
|
request: {
|
||||||
error: "请求失败",
|
error: "请求失败",
|
||||||
@@ -25,7 +25,7 @@ export default {
|
|||||||
adminType: "用户类型",
|
adminType: "用户类型",
|
||||||
createTime: "注册时间",
|
createTime: "注册时间",
|
||||||
management: "管理",
|
management: "管理",
|
||||||
edit: "编辑",
|
|
||||||
submission: "提交",
|
submission: "提交",
|
||||||
newPassword: "新密码",
|
newPassword: "新密码",
|
||||||
leaveBlankIfDoNotChangePassword: "不需要修改密码请留空",
|
leaveBlankIfDoNotChangePassword: "不需要修改密码请留空",
|
||||||
@@ -48,20 +48,28 @@ export default {
|
|||||||
announcementList: "公告列表",
|
announcementList: "公告列表",
|
||||||
editAnnouncement: "编辑公告",
|
editAnnouncement: "编辑公告",
|
||||||
createAnnouncement: "创建公告",
|
createAnnouncement: "创建公告",
|
||||||
title: "标题",
|
|
||||||
createTime: "创建时间",
|
|
||||||
lastUpdateTime: "最后更新",
|
|
||||||
createdBy: "创建人",
|
|
||||||
isVisible: "是否可见",
|
|
||||||
visible: "可见",
|
|
||||||
invisible: "隐藏",
|
|
||||||
management: "管理",
|
|
||||||
edit: "编辑",
|
|
||||||
},
|
},
|
||||||
adminUtils: {
|
adminUtils: {
|
||||||
search: "搜索",
|
search: "搜索",
|
||||||
inputKeyword: "输入关键词",
|
inputKeyword: "输入关键词",
|
||||||
submit: "提交",
|
submit: "提交",
|
||||||
|
edit: "编辑",
|
||||||
|
|
||||||
|
title: "标题",
|
||||||
|
createTime: "创建时间",
|
||||||
|
lastUpdateTime: "最后更新",
|
||||||
|
createdBy: "创建人",
|
||||||
|
|
||||||
|
isVisible: "是否可见",
|
||||||
|
visible: "可见",
|
||||||
|
invisible: "隐藏",
|
||||||
|
|
||||||
|
management: "管理",
|
||||||
|
content: "内容",
|
||||||
|
|
||||||
back: "返回",
|
back: "返回",
|
||||||
saveChanges: "保存修改",
|
saveChanges: "保存修改",
|
||||||
|
|||||||
Reference in New Issue
Block a user