[前端]整理js格式. 修复小bugs,关于比赛密码修改变量名称的错误,小组修改变量名称错误(以上都是在修改比赛页面内)[CI SKIP]

This commit is contained in:
esp 2015-08-24 18:08:32 +08:00
parent 7a46d26646
commit 53e82136e4
4 changed files with 31 additions and 31 deletions

View File

@ -66,7 +66,7 @@ require(["jquery", "avalon", "editor", "uploader", "bsAlert", "csrfToken", "date
bsAlert(data.data);
console.log(data);
}
}
}
});
console.log(JSON.stringify(ajaxData));
}
@ -92,28 +92,28 @@ require(["jquery", "avalon", "editor", "uploader", "bsAlert", "csrfToken", "date
choseGroupList: [],
passwordUsable: false,
addGroup: function() {
if (vm.group == -1) return;
if (vm.groupList[vm.group].id == 0){
vm.passwordUsable = true;
vm.choseGroupList = [];
for (var key in vm.groupList){
vm.groupList[key].chose = true;
}
}
vm.groupList[vm.group]. chose = true;
vm.choseGroupList.push({name:vm.groupList[vm.group].name, index:vm.group, id:vm.groupList[vm.group].id});
vm.group = -1;
},
removeGroup: function(groupIndex){
if (vm.groupList[vm.choseGroupList[groupIndex].index].id == 0){
vm.passwordUsable = false;
for (key in vm.groupList){
vm.groupList[key].chose = false;
}
}
vm.groupList[vm.choseGroupList[groupIndex].index].chose = false;
vm.choseGroupList.remove(vm.choseGroupList[groupIndex]);
}
if (vm.group == -1) return;
if (vm.groupList[vm.group].id == 0){
vm.passwordUsable = true;
vm.choseGroupList = [];
for (var key in vm.groupList){
vm.groupList[key].chose = true;
}
}
vm.groupList[vm.group]. chose = true;
vm.choseGroupList.push({name:vm.groupList[vm.group].name, index:vm.group, id:vm.groupList[vm.group].id});
vm.group = -1;
},
removeGroup: function(groupIndex){
if (vm.groupList[vm.choseGroupList[groupIndex].index].id == 0){
vm.passwordUsable = false;
for (key in vm.groupList){
vm.groupList[key].chose = false;
}
}
vm.groupList[vm.choseGroupList[groupIndex].index].chose = false;
vm.choseGroupList.remove(vm.choseGroupList[groupIndex]);
}
});
$.ajax({ // Get current user type

View File

@ -22,8 +22,8 @@ require(["jquery", "avalon", "csrfToken", "bsAlert", "editor", "datetimePicker",
return false;
}
if (vm.choseGroupList[0].id == 0) { //everyone | public contest
if (vm.password) {
ajaxData.password = vm.password;
if (vm.editPassword) {
ajaxData.password = vm.editPassword;
ajaxData.contest_type = 2;
}
else{
@ -59,8 +59,8 @@ require(["jquery", "avalon", "csrfToken", "bsAlert", "editor", "datetimePicker",
});
console.log(JSON.stringify(ajaxData));
}
return false;
});
return false;
});
if(avalon.vmodels.contestList){
// this page has been loaded before, so set the default value
@ -152,8 +152,8 @@ require(["jquery", "avalon", "csrfToken", "bsAlert", "editor", "datetimePicker",
if (vm.contestList[contestId-1].contest_type == 0) { //contest type == 0, contest in group
//Clear the choseGroupList
var stack = [], sp;
for (sp = 0; i < vm.editChoseGroupList.length; sp++){
stack.push(vm.editChoseGroupList[i].index);
for (sp = 0; sp < vm.choseGroupList.length; sp++){
stack. push(vm.choseGroupList[sp].index);
}
while (sp--){
vm.removeGroup(stack[sp]);

View File

@ -44,7 +44,7 @@
<div class="col-md-6">
<label>允许参加的用户</label>
<div class="form-group">
<select class="form-control" name="password" ms-duplex="group" ms-change="addGroup" value="-1">
<select class="form-control" ms-duplex="group" ms-change="addGroup" value="-1">
<option value="-1">请选择</option>
<option ms-repeat="groupList" ms-attr-value="$index" ms-visible="!el.chose">{{el.name}}</option>
</select>

View File

@ -87,7 +87,7 @@
<label>允许参加的用户</label>
<div class="form-group">
<select class="form-control" name="password" ms-duplex="group" ms-change="addGroup" value="-1">
<select class="form-control" ms-duplex="group" ms-change="addGroup" value="-1">
<option value="-1">请选择</option>
<option ms-repeat="groupList" ms-attr-value="$index" ms-visible="!el.chose">{{el.name}}</option>
</select>