Browse Source

Merge branch 'master' of zhaojunzhe/fair-web into master

pull/31/head
richie 5 years ago committed by Gogs
parent
commit
79aafe1ee9
  1. 20
      views/admin_classify.ejs

20
views/admin_classify.ejs

@ -7,6 +7,10 @@
.current-classify{ .current-classify{
margin-bottom: 20px; margin-bottom: 20px;
} }
.classify{
height:85%;
overflow: auto;
}
</style> </style>
<div id="classify" v-cloak> <div id="classify" v-cloak>
<div class="ui modal classify"> <div class="ui modal classify">
@ -54,6 +58,7 @@
<el-pagination <el-pagination
@current-change="handlePageChange" @current-change="handlePageChange"
layout="prev, pager, next" layout="prev, pager, next"
:current-page.sync="currentPage"
:total="problemCount"> :total="problemCount">
</el-pagination> </el-pagination>
</div> </div>
@ -113,7 +118,8 @@
problemList: [], problemList: [],
usedProblemId: [], usedProblemId: [],
multipleSelection: [], multipleSelection: [],
problemCount: -1 problemCount: -1,
currentPage:1
}, },
created: function() { created: function() {
this.getClassifyInfo(); this.getClassifyInfo();
@ -126,7 +132,6 @@
url: '/api/pagination/allproblem', url: '/api/pagination/allproblem',
type: 'GET', type: 'GET',
success: function (data) { success: function (data) {
console.log(data.problemInfo.count);
that.problemCount = parseInt(data.problemInfo.count); that.problemCount = parseInt(data.problemInfo.count);
}, },
error: function (XMLHttpRequest, textStatus, errorThrown) { error: function (XMLHttpRequest, textStatus, errorThrown) {
@ -180,7 +185,7 @@
}) })
}, },
handleSelectionChange(val) { handleSelectionChange(val) {
this.multipleSelection = val; this.multipleSelection = this.multipleSelection.concat(val);
}, },
getClassifyInfo: function() { getClassifyInfo: function() {
let that = this; let that = this;
@ -233,12 +238,11 @@
}, },
show: function(id){ show: function(id){
let that = this; let that = this;
console.log(id);
this.getProblemPagination(1) this.getProblemPagination(1)
if (id) { if (id) {
this.classifyId = id; this.classifyId = id;
// this.getProblemPagination(1)
this.getClassifyInfos(id); this.getClassifyInfos(id);
this.currentPage = 1;
} else { } else {
this.resetModal(); this.resetModal();
} }
@ -257,10 +261,11 @@
name: this.classifyName, name: this.classifyName,
intro: this.classifyIntro, intro: this.classifyIntro,
order: this.order, order: this.order,
problemIdArray: this.multipleSelection.map(function(item){ problemIdArray: [...new Set(this.multipleSelection.map(function(item){
return item.id return item.id
}) }))]
} }
console.log(obj.problemIdArray);
if (this.classifyId === -1) { if (this.classifyId === -1) {
$.ajax({ $.ajax({
url: '/api/practice/create', url: '/api/practice/create',
@ -270,6 +275,7 @@
success: function (data) { success: function (data) {
if (data.error_code) { if (data.error_code) {
alert('创建失败'); alert('创建失败');
that.resetModal();
} else { } else {
alert('添加成功'); alert('添加成功');
that.resetModal(); that.resetModal();

Loading…
Cancel
Save