diff --git a/web/src/main/resources/static/js/jlw/competition/add.js b/web/src/main/resources/static/js/jlw/competition/add.js
index be6dda96..eb8d3981 100644
--- a/web/src/main/resources/static/js/jlw/competition/add.js
+++ b/web/src/main/resources/static/js/jlw/competition/add.js
@@ -1,4 +1,4 @@
-layui.define([ 'form', 'laydate', 'table','element','upload','competitionApi','tree'], function(exports) {
+layui.define(['form', 'laydate', 'table', 'element', 'upload', 'competitionApi', 'tree'], function (exports) {
var form = layui.form;
var competitionApi = layui.competitionApi;
var index = layui.index;
@@ -18,18 +18,22 @@ layui.define([ 'form', 'laydate', 'table','element','upload','competitionApi','t
var tag_ = 0; //用于判断是否第一次加载编辑对话框的树结构 避免多次加载
var getTreeByCourseLabelTypes = []; //编辑对话框的树结构 数据
- if(!$.isEmpty($("input[name='competitionId']").val())){
- var ret = Common.getAjax("/jlw/competition/view.json",{competitionId:$("input[name='competitionId']").val(),part: 1});
- if(ret.code == 0){
+ if (!$.isEmpty($("input[name='competitionId']").val())) {
+ var ret = Common.getAjax("/jlw/competition/view.json", {
+ competitionId: $("input[name='competitionId']").val(),
+ part: 1
+ });
+ if (ret.code == 0) {
$("#competitionGeneralization textarea").val(Lib.repLaceltgt(ret.data.competitionGeneralizationOriginal));
- }else {
- layer.msg(ret.msg, {icon: 2,time: 1500});
+ } else {
+ layer.msg(ret.msg, {icon: 2, time: 1500});
}
}
var editor1 = Lib.editorMd("competitionGeneralization"),//大赛概况
editor2,//获奖名单
editor3,//动态内容
- editor4;//常见问题
+ editor4,//常见问题
+ editor12;//校园风采
//上传LOGO
upload.render({
@@ -37,7 +41,7 @@ layui.define([ 'form', 'laydate', 'table','element','upload','competitionApi','t
, url: Common.ctxPath + "/jlw/file/update.do"
, done: function (res) {//每成功一次调用
$("#logo").hide();
- layui.$('#uploadDemoView').removeClass('layui-hide').find('img').attr('src',Common.ctxPath + res.data.src);
+ layui.$('#uploadDemoView').removeClass('layui-hide').find('img').attr('src', Common.ctxPath + res.data.src);
$("input[name='competitionLogo']").val(res.data.src);
}
});
@@ -47,7 +51,7 @@ layui.define([ 'form', 'laydate', 'table','element','upload','competitionApi','t
, url: Common.ctxPath + "/jlw/file/update.do"
, done: function (res) {//每成功一次调用
$("#competitionCarouselImage1").hide();
- layui.$('#competitionCarouselImage1_1').removeClass('layui-hide').find('img').attr('src',Common.ctxPath + res.data.src);
+ layui.$('#competitionCarouselImage1_1').removeClass('layui-hide').find('img').attr('src', Common.ctxPath + res.data.src);
$("input[name='competitionCarouselImage1']").val(res.data.src);
}
});
@@ -57,7 +61,7 @@ layui.define([ 'form', 'laydate', 'table','element','upload','competitionApi','t
, url: Common.ctxPath + "/jlw/file/update.do"
, done: function (res) {//每成功一次调用
$("#competitionCarouselImage2").hide();
- layui.$('#competitionCarouselImage2_1').removeClass('layui-hide').find('img').attr('src',Common.ctxPath + res.data.src);
+ layui.$('#competitionCarouselImage2_1').removeClass('layui-hide').find('img').attr('src', Common.ctxPath + res.data.src);
$("input[name='competitionCarouselImage2']").val(res.data.src);
}
});
@@ -67,7 +71,7 @@ layui.define([ 'form', 'laydate', 'table','element','upload','competitionApi','t
, url: Common.ctxPath + "/jlw/file/update.do"
, done: function (res) {//每成功一次调用
$("#competitionCarouselImage3").hide();
- layui.$('#competitionCarouselImage3_1').removeClass('layui-hide').find('img').attr('src',Common.ctxPath + res.data.src);
+ layui.$('#competitionCarouselImage3_1').removeClass('layui-hide').find('img').attr('src', Common.ctxPath + res.data.src);
$("input[name='competitionCarouselImage3']").val(res.data.src);
}
});
@@ -78,7 +82,7 @@ layui.define([ 'form', 'laydate', 'table','element','upload','competitionApi','t
, url: Common.ctxPath + "/jlw/file/update.do"
, done: function (res) {//每成功一次调用
$("#newsPicture").hide();
- layui.$('#uploadDemoView_1').removeClass('layui-hide').find('img').attr('src',Common.ctxPath + res.data.src);
+ layui.$('#uploadDemoView_1').removeClass('layui-hide').find('img').attr('src', Common.ctxPath + res.data.src);
$("input[name='competitionNewsPicture']").val(res.data.src);
}
});
@@ -86,12 +90,12 @@ layui.define([ 'form', 'laydate', 'table','element','upload','competitionApi','t
laydate.render({
elem: '#enrollRange'
- ,range: "至" //或 range: '~' 来自定义分割字符
- ,type: 'datetime'
- ,trigger: 'click'
- ,format: 'yyyy-MM-dd HH:mm'
- ,done: function(value, date, endDate){
- if(!$.isEmpty(value)){
+ , range: "至" //或 range: '~' 来自定义分割字符
+ , type: 'datetime'
+ , trigger: 'click'
+ , format: 'yyyy-MM-dd HH:mm'
+ , done: function (value, date, endDate) {
+ if (!$.isEmpty(value)) {
$("#addForm input[name='competitionEnrollStartTime']").val(value.split(" 至 ")[0]);
$("#addForm input[name='competitionEnrollEndTime']").val(value.split(" 至 ")[1]);
}
@@ -99,12 +103,12 @@ layui.define([ 'form', 'laydate', 'table','element','upload','competitionApi','t
});
laydate.render({
elem: '#enrollRange2'
- ,range: "至" //或 range: '~' 来自定义分割字符
- ,type: 'datetime'
- ,trigger: 'click'
- ,format: 'yyyy-MM-dd HH:mm'
- ,done: function(value, date, endDate){
- if(!$.isEmpty(value)){
+ , range: "至" //或 range: '~' 来自定义分割字符
+ , type: 'datetime'
+ , trigger: 'click'
+ , format: 'yyyy-MM-dd HH:mm'
+ , done: function (value, date, endDate) {
+ if (!$.isEmpty(value)) {
$("#addForm input[name='competitionFreetrialStartTime']").val(value.split(" 至 ")[0]);
$("#addForm input[name='competitionFreetrialEndTime']").val(value.split(" 至 ")[1]);
}
@@ -112,15 +116,15 @@ layui.define([ 'form', 'laydate', 'table','element','upload','competitionApi','t
});
laydate.render({
elem: '#contestRange'
- ,range: "至" //或 range: '~' 来自定义分割字符
- ,type: 'datetime'
- ,format: 'yyyy-MM-dd HH:mm'
- ,done: function(value, date, endDate){
- if(!$.isEmpty(value)){
+ , range: "至" //或 range: '~' 来自定义分割字符
+ , type: 'datetime'
+ , format: 'yyyy-MM-dd HH:mm'
+ , done: function (value, date, endDate) {
+ if (!$.isEmpty(value)) {
$("#addForm input[name='competitionContestStartTime']").val(value.split(" 至 ")[0]);
$("#addForm input[name='competitionContestEndTime']").val(value.split(" 至 ")[1]);
//$(".renWu").show();
- }else {
+ } else {
$("#addForm input[name='competitionContestStartTime']").val("");
$("#addForm input[name='competitionContestEndTime']").val("");
// $(".renWu").hide();
@@ -132,14 +136,14 @@ layui.define([ 'form', 'laydate', 'table','element','upload','competitionApi','t
laydate.render({
elem: '#renwu3'
- ,range: "至" //或 range: '~' 来自定义分割字符
- ,type: 'datetime'
- ,format: 'yyyy-MM-dd HH:mm'
- ,done: function(value, date, endDate){
- if(!$.isEmpty(value)){
+ , range: "至" //或 range: '~' 来自定义分割字符
+ , type: 'datetime'
+ , format: 'yyyy-MM-dd HH:mm'
+ , done: function (value, date, endDate) {
+ if (!$.isEmpty(value)) {
$("#addForm input[name='competitionTaskThreeStartTime']").val(value.split(" 至 ")[0]);
$("#addForm input[name='competitionTaskThreeEndTime']").val(value.split(" 至 ")[1]);
- }else {
+ } else {
$("#addForm input[name='competitionTaskThreeStartTime']").val("");
$("#addForm input[name='competitionTaskThreeEndTime']").val("");
}
@@ -147,26 +151,26 @@ layui.define([ 'form', 'laydate', 'table','element','upload','competitionApi','t
});
var view = {
- init:function(){
- Lib.initGenrealForm($("#addForm"),form);
+ init: function () {
+ Lib.initGenrealForm($("#addForm"), form);
this.initSubmit();
},
- initSubmit:function(){
- $("#addButton").click(function(){
+ initSubmit: function () {
+ $("#addButton").click(function () {
saveInfo(1);//先保存再发布
var param = {
- competitionStatus:1,
- competitionId:$("input[name='competitionId']").val()
+ competitionStatus: 1,
+ competitionId: $("input[name='competitionId']").val()
}
- if($.isEmpty(param.competitionId)){
+ if ($.isEmpty(param.competitionId)) {
layer.msg("请先添加大赛!", {
offset: ['50%'],
icon: 2,
time: 1500 //2秒关闭(如果不配置,默认是3秒)
});
- return ;
+ return;
}
- var ret = Common.postAjax("/jlw/competition/editCompetitionStatus.json",param);
+ var ret = Common.postAjax("/jlw/competition/editCompetitionStatus.json", param);
layer.msg(ret.code == 0 ? "发布成功!" : ret.msg, {
offset: ['50%'],
icon: ret.code == 0 ? 1 : 2,
@@ -178,8 +182,8 @@ layui.define([ 'form', 'laydate', 'table','element','upload','competitionApi','t
}
});
});
-
- $("#addButton-cancel").click(function(){
+
+ $("#addButton-cancel").click(function () {
Lib.closeFrame();
});
}
@@ -187,8 +191,8 @@ layui.define([ 'form', 'laydate', 'table','element','upload','competitionApi','t
//监听tab切换
var onSign = 0; //当前显示的tab
- element.on('tab(docDemoTabBrief)', function(){
- saveInfo(1,onSign);
+ element.on('tab(docDemoTabBrief)', function () {
+ saveInfo(1, onSign);
var sign = this.getAttribute('lay-id');
loadView(sign);
});
@@ -196,24 +200,24 @@ layui.define([ 'form', 'laydate', 'table','element','upload','competitionApi','t
//切换大赛模式 1:个人赛 2:团队赛
form.on('select(select_competitionType)', function (obj) {
competitionType_ = obj.value;
- if(competitionType_ == 1){
+ if (competitionType_ == 1) {
$(".competitionTeamLimit").hide();
$("input[name='competitionTeamLimit_1'],input[name='competitionTeamLimit_2']").val("");
- }else if(competitionType_ == 2){
+ } else if (competitionType_ == 2) {
$(".competitionTeamLimit").show();
}
});
//提交保存数据
- function submitInfo(param,t){
+ function submitInfo(param, t) {
var url = "/jlw/competition/add.json";
- if(!$.isEmpty(param.competitionId)){
+ if (!$.isEmpty(param.competitionId)) {
url = "/jlw/competition/edit.json";
}
- var ret = Common.postAjax(url,param);
- if(ret.code == 0){
- if(t != 1){
- layer.msg("保存成功!",{
+ var ret = Common.postAjax(url, param);
+ if (ret.code == 0) {
+ if (t != 1) {
+ layer.msg("保存成功!", {
offset: ['50%'],
icon: 1,
time: 1500 //2秒关闭(如果不配置,默认是3秒)
@@ -222,8 +226,8 @@ layui.define([ 'form', 'laydate', 'table','element','upload','competitionApi','t
$("input[name='competitionId']").val(ret.data);
parent.Lib.tableRefresh();
//showTitle();
- }else {
- layer.msg(ret.msg,{
+ } else {
+ layer.msg(ret.msg, {
offset: ['50%'],
icon: 2,
time: 1500 //2秒关闭(如果不配置,默认是3秒)
@@ -233,131 +237,166 @@ layui.define([ 'form', 'laydate', 'table','element','upload','competitionApi','t
}
//上一步
- $(".syb").click(function (){
+ $(".syb").click(function () {
saveInfo(1);
var i = $(".layui-tab-brief .layui-this").attr("lay-id");//当前操作tab位置
//切换相应位置tab
$(".layui-tab-brief .layui-this").removeClass("layui-this");
- $(".layui-tab-brief .layui-tab-title li:eq("+ (i - 1) +")").addClass("layui-this");
+ $(".layui-tab-brief .layui-tab-title li:eq(" + (i - 1) + ")").addClass("layui-this");
$(".layui-tab-brief .layui-show").removeClass("layui-show");
- $(".layui-tab-brief .layui-tab-content .layui-tab-item:eq("+ (i - 1) +")").addClass("layui-show");
+ $(".layui-tab-brief .layui-tab-content .layui-tab-item:eq(" + (i - 1) + ")").addClass("layui-show");
loadView(i - 1);
});
//下一步
- $(".xyb").click(function (){
+ $(".xyb").click(function () {
saveInfo(1);
var i = $(".layui-tab-brief .layui-this").attr("lay-id");//当前操作tab位置
//切换相应位置tab
$(".layui-tab-brief .layui-this").removeClass("layui-this");
- $(".layui-tab-brief .layui-tab-title li:eq("+ (Number(i) + 1) +")").addClass("layui-this");
+ $(".layui-tab-brief .layui-tab-title li:eq(" + (Number(i) + 1) + ")").addClass("layui-this");
$(".layui-tab-brief .layui-show").removeClass("layui-show");
- $(".layui-tab-brief .layui-tab-content .layui-tab-item:eq("+ (Number(i) + 1) +")").addClass("layui-show");
+ $(".layui-tab-brief .layui-tab-content .layui-tab-item:eq(" + (Number(i) + 1) + ")").addClass("layui-show");
loadView(Number(i) + 1);
});
//上一步下一步 时 加载 //sign = 0:大赛概况 1:竞赛时间 2:参赛学员 3:大赛任务 4:成绩权重 5:大赛评委
- function loadView(sign){
+ //part 代表部分值 1大赛概况 2竞赛时间 3参赛学员 4大赛任务 5成绩权重 6大赛评委 7获奖名单 8大赛动态 9常见问题
+ function loadView(sign) {
onSign = sign;
- if(sign == 0){
+ if (sign == 0) {
$(".syb").hide();
$(".xyb").show();
$(".sbx").show();
- }else if(sign == 1 || sign == 2 || sign == 3 || sign == 4
+ } else if (sign == 1 || sign == 2 || sign == 3 || sign == 4
+ || sign == 5
|| sign == 6
|| sign == 7
- || sign == 8
- || sign == 5 ){
+ || sign == 9
+ || sign == 10
+ || sign == 11) {
$(".syb").show();
$(".xyb").show();
$(".sbx").show();
- if(sign == 3){
+ if (sign == 3) {
loadDSRW();
}
- if(sign == 8 && $.isEmpty(editor2)){
- if(!$.isEmpty($("input[name='competitionId']").val())){
- var ret = Common.getAjax("/jlw/competition/view.json",{competitionId:$("input[name='competitionId']").val(),part: 7});
- if(ret.code == 0){
- $("#competitionAwardList textarea").val(Lib.repLaceltgt(ret.data.competitionAwardListOriginal));
- }else {
- layer.msg(ret.msg, {icon: 2,time: 1500});
+ if (sign == 6 && $.isEmpty(editor4)) {
+ if (!$.isEmpty($("input[name='competitionId']").val())) {
+ var ret = Common.getAjax("/jlw/competition/view.json", {
+ competitionId: $("input[name='competitionId']").val(),
+ part: 9
+ });
+ if (ret.code == 0) {
+ $("#competitionCommonProblem textarea").val(Lib.repLaceltgt(ret.data.competitionCommonProblemOriginal));
+ } else {
+ layer.msg(ret.msg, {icon: 2, time: 1500});
}
}
- editor2 = Lib.editorMd("competitionAwardList");
+ editor4 = Lib.editorMd("competitionCommonProblem");
}
- if(sign == 6 && $.isEmpty(editor4)){
- if(!$.isEmpty($("input[name='competitionId']").val())){
- var ret = Common.getAjax("/jlw/competition/view.json",{competitionId:$("input[name='competitionId']").val(),part: 9});
- if(ret.code == 0){
- $("#competitionCommonProblem textarea").val(Lib.repLaceltgt(ret.data.competitionCommonProblemOriginal));
- }else {
- layer.msg(ret.msg, {icon: 2,time: 1500});
+ if (sign == 7 && $.isEmpty(editor3)) {
+ if (!$.isEmpty($("input[name='competitionId']").val())) {
+ var ret = Common.getAjax("/jlw/competition/view.json", {
+ competitionId: $("input[name='competitionId']").val(),
+ part: 8
+ });
+ if (ret.code == 0) {
+ $("#competitionNewsContent textarea").val(Lib.repLaceltgt(ret.data.competitionAwardListOriginal));
+ } else {
+ layer.msg(ret.msg, {icon: 2, time: 1500});
}
}
- editor4 = Lib.editorMd("competitionCommonProblem");
+ editor3 = Lib.editorMd("competitionNewsContent");
}
- }else if(sign == 8){
+ } else if (sign == 8 || sign == 12) {
$(".syb").show();
$(".xyb").hide();
$(".sbx").show();
- if($.isEmpty(editor3)) {
- editor3 = Lib.editorMd("competitionNewsContent");
+ if (sign == 8 && $.isEmpty(editor2)) {
+ if (!$.isEmpty($("input[name='competitionId']").val())) {
+ var ret = Common.getAjax("/jlw/competition/view.json", {
+ competitionId: $("input[name='competitionId']").val(),
+ part: 7
+ });
+ if (ret.code == 0) {
+ $("#competitionAwardList textarea").val(Lib.repLaceltgt(ret.data.competitionAwardListOriginal));
+ } else {
+ layer.msg(ret.msg, {icon: 2, time: 1500});
+ }
+ }
+ editor2 = Lib.editorMd("competitionAwardList");
}
- }else{
+ if (sign == 12 && $.isEmpty(editor12)) {
+ if (!$.isEmpty($("input[name='competitionId']").val())) {
+ var ret = Common.getAjax("/jlw/competition/view.json", {
+ competitionId: $("input[name='competitionId']").val(),
+ part: 7
+ });
+ if (ret.code == 0) {
+ $("#competitionXYFC textarea").val(Lib.repLaceltgt(ret.data.competitionAwardListOriginal));
+ } else {
+ layer.msg(ret.msg, {icon: 2, time: 1500});
+ }
+ }
+ editor12 = Lib.editorMd("competitionXYFC");
+ }
+ } else {
$(".sbx").hide();
}
- if(sign == 2 || sign == 5){//上一步、保存、下一步的位置
- $(".sbx").css("margin-left",0);
- }else if(sign == 0 || sign == 1){
- $(".sbx").css("margin-left",190);
- }else {
- $(".sbx").css("margin-left",60);
+ if (sign == 2 || sign == 5) {//上一步、保存、下一步的位置
+ $(".sbx").css("margin-left", 0);
+ } else if (sign == 0 || sign == 1) {
+ $(".sbx").css("margin-left", 190);
+ } else {
+ $(".sbx").css("margin-left", 60);
}
//保存的位置显示
- if(sign == 0 || sign == 3 || sign == 4){
+ if (sign == 0 || sign == 3 || sign == 4) {
$(".bc").removeClass("bc_c").removeClass("bc_c_").addClass("bc_r").show();
- }else if(sign == 2 || sign == 5){
+ } else if (sign == 2 || sign == 5) {
$(".bc").addClass("bc_c").removeClass("bc_c_").removeClass("bc_r").show();
- }else if(sign == 1){
+ } else if (sign == 1) {
$(".bc").removeClass("bc_c").addClass("bc_c_").removeClass("bc_r").show();
- }else {
+ } else {
$(".bc").hide();
}
}
+
//保存获奖名单
- $("#addCompetitionAwardList").click(function (){
+ $("#addCompetitionAwardList").click(function () {
var competitionAwardList = editor2.getPreviewedHTML();//获奖名单 html
var competitionAwardListOriginal = Lib.repLaceString(editor2.getMarkdown());//获奖名单 Markdown 源码
var param = {
- competitionAwardList:competitionAwardList,
- competitionAwardListOriginal:competitionAwardListOriginal,
- competitionId:$("input[name='competitionId']").val()
+ competitionAwardList: competitionAwardList,
+ competitionAwardListOriginal: competitionAwardListOriginal,
+ competitionId: $("input[name='competitionId']").val()
}
submitInfo(param);
});
//保存大赛动态
- $("#addCompetitionNews").click(function (){
+ $("#addCompetitionNews").click(function () {
var competitionNewsContent = editor3.getPreviewedHTML();//动态内容 html
var competitionNewsContentOriginal = Lib.repLaceString(editor3.getMarkdown());//动态内容 Markdown 源码
- if($.isEmpty(competitionNewsContent)){
- layer.msg("请填写大赛动态详情!",{icon:2});
- return ;
+ if ($.isEmpty(competitionNewsContent)) {
+ layer.msg("请填写大赛动态详情!", {icon: 2});
+ return;
}
var competitionNewsPicture = $("input[name='competitionNewsPicture']").val();//动态图片
- if($.isEmpty(competitionNewsPicture)){
- layer.msg("请上传动态图!",{icon:2});
- return ;
+ if ($.isEmpty(competitionNewsPicture)) {
+ layer.msg("请上传动态图!", {icon: 2});
+ return;
}
- var ret = Common.postAjax("/jlw/competitionNews/add.json",{
- competitionNewsContent:competitionNewsContent,
- competitionNewsContentOriginal:competitionNewsContentOriginal,
- competitionNewsPicture:competitionNewsPicture,
- competitionId:$("input[name='competitionId']").val()
- });
+ var ret = Common.postAjax("/jlw/competitionNews/add.json", {
+ competitionNewsContent: competitionNewsContent,
+ competitionNewsContentOriginal: competitionNewsContentOriginal,
+ competitionNewsPicture: competitionNewsPicture,
+ competitionId: $("input[name='competitionId']").val()
+ });
layer.msg(ret.code == 0 ? "保存成功!" : ret.msg, {
offset: ['50%'],
icon: ret.code == 0 ? 1 : 2,
@@ -367,10 +406,10 @@ layui.define([ 'form', 'laydate', 'table','element','upload','competitionApi','t
var htm = '
' +
' ' +
' ' +
- '
'+ret.data.competitionNewsAddTime+'
' +
+ '
' + ret.data.competitionNewsAddTime + '
' +
'
' +
- '
+')
' +
- '
'+ret.data.competitionNewsContent+'
' +
+ '
 + ')
' +
+ '
' + ret.data.competitionNewsContent + '
' +
'
' +
'
' +
' ';
@@ -379,27 +418,27 @@ layui.define([ 'form', 'laydate', 'table','element','upload','competitionApi','t
$("input[name='competitionNewsPicture']").val("");//动态图片
$("#newsPicture").show();
- layui.$('#uploadDemoView_1').addClass('layui-hide').find('img').attr('src',"");
+ layui.$('#uploadDemoView_1').addClass('layui-hide').find('img').attr('src', "");
}
});
});
- //保存常见问题
- $("#addCommonProblem").click(function (){
+ //保存常见问题
+ $("#addCommonProblem").click(function () {
var competitionCommonProblem = editor4.getPreviewedHTML();//常见问题内容 html
var competitionCommonProblemOriginal = Lib.repLaceString(editor4.getMarkdown());//常见问题内容 Markdown 源码
var param = {
- competitionCommonProblem:competitionCommonProblem,
- competitionCommonProblemOriginal:competitionCommonProblemOriginal,
- competitionId:$("input[name='competitionId']").val()
+ competitionCommonProblem: competitionCommonProblem,
+ competitionCommonProblemOriginal: competitionCommonProblemOriginal,
+ competitionId: $("input[name='competitionId']").val()
}
submitInfo(param);
});
//显示获奖名单、大赛动态、常见问题
- function showTitle(){
+ function showTitle() {
$(".hjmd,.dsdt,.cjwt").show();
}
@@ -409,12 +448,12 @@ layui.define([ 'form', 'laydate', 'table','element','upload','competitionApi','t
$(".see_competition_user").click(see_c_user);
//移除参赛学员 (个人)
$(".del_competition_user").click(del_c_user);
- $(".export_gr").click(function (){ //导出个人赛参赛人员信息
- window.open(Common.ctxPath + "/jlw/competition/export.json?competitionId="+ $("input[name='competitionId']").val()+"&beCompetitionStudent=1");
+ $(".export_gr").click(function () { //导出个人赛参赛人员信息
+ window.open(Common.ctxPath + "/jlw/competition/export.json?competitionId=" + $("input[name='competitionId']").val() + "&beCompetitionStudent=1");
});
- $(".export_td").click(function (){ //导出团队赛参赛人员信息
- window.open(Common.ctxPath + "/jlw/competition/export.json?competitionId="+ $("input[name='competitionId']").val()+"&beCompetitionStudent=1");
+ $(".export_td").click(function () { //导出团队赛参赛人员信息
+ window.open(Common.ctxPath + "/jlw/competition/export.json?competitionId=" + $("input[name='competitionId']").val() + "&beCompetitionStudent=1");
});
@@ -429,24 +468,24 @@ layui.define([ 'form', 'laydate', 'table','element','upload','competitionApi','t
//搜索未参赛人 (团队)
$(".select_student_td").click(select_student_td);
- function select_student(){
+ function select_student() {
var studentTempJson = new Array();
- $.each(studentTempMap,function(i,item){
+ $.each(studentTempMap, function (i, item) {
studentTempJson.push({
- studentsId:item.studentsId,
- teamName:item.teamName,
- studentsIds:item.studentsIds
+ studentsId: item.studentsId,
+ teamName: item.teamName,
+ studentsIds: item.studentsIds
});
});
- var si = onTag == 1?3:onTag == 3?2:onTag == 4?3:"";
+ var si = onTag == 1 ? 3 : onTag == 3 ? 2 : onTag == 4 ? 3 : "";
competitionStuTable[onTag].reload({
where: {
- studentTempJson:JSON.stringify(studentTempJson),
- competitionId:$("input[name='competitionId']").val(),
- beCompetitionStudent:1,
- studentName:$(".csyh input[name='studentName']").val(),
- classIds:!$.isEmpty(treeList[si])?treeList[si].getValue('value').join(","):"",
- studentStatuses:"1,2"
+ studentTempJson: JSON.stringify(studentTempJson),
+ competitionId: $("input[name='competitionId']").val(),
+ beCompetitionStudent: 1,
+ studentName: $(".csyh input[name='studentName']").val(),
+ classIds: !$.isEmpty(treeList[si]) ? treeList[si].getValue('value').join(",") : "",
+ studentStatuses: "1,2"
},
page: {
curr: 1
@@ -454,23 +493,23 @@ layui.define([ 'form', 'laydate', 'table','element','upload','competitionApi','t
});
}
- function select_student_no(){
+ function select_student_no() {
var studentTempJson = new Array();
- $.each(studentTempMap,function(i,item){
+ $.each(studentTempMap, function (i, item) {
studentTempJson.push({
- studentsId:item.studentsId,
- teamName:item.teamName,
- studentsIds:item.studentsIds
+ studentsId: item.studentsId,
+ teamName: item.teamName,
+ studentsIds: item.studentsIds
});
});
- var si = onTag == 1?3:onTag == 3?2:onTag == 4?3:"";
+ var si = onTag == 1 ? 3 : onTag == 3 ? 2 : onTag == 4 ? 3 : "";
competitionStuTable[onTag].reload({
where: {
- studentTempJson:JSON.stringify(studentTempJson),
- competitionId:$("input[name='competitionId']").val(),
- beCompetitionStudent:2,
- studentName:$(".csyh input[name='studentName_no']").val(),
- classIds:!$.isEmpty(treeList[si])?treeList[si].getValue('value').join(","):""
+ studentTempJson: JSON.stringify(studentTempJson),
+ competitionId: $("input[name='competitionId']").val(),
+ beCompetitionStudent: 2,
+ studentName: $(".csyh input[name='studentName_no']").val(),
+ classIds: !$.isEmpty(treeList[si]) ? treeList[si].getValue('value').join(",") : ""
},
page: {
curr: 1
@@ -478,47 +517,48 @@ layui.define([ 'form', 'laydate', 'table','element','upload','competitionApi','t
});
}
- function select_student_td(){
+ function select_student_td() {
var studentTempJson = new Array();
- $.each(studentTempMap,function(i,item){
+ $.each(studentTempMap, function (i, item) {
studentTempJson.push({
- studentsId:item.studentsId,
- teamName:item.teamName,
- studentsIds:item.studentsIds
+ studentsId: item.studentsId,
+ teamName: item.teamName,
+ studentsIds: item.studentsIds
});
});
- var si = onTag == 1?3:onTag == 3?2:onTag == 4?3:"";
+ var si = onTag == 1 ? 3 : onTag == 3 ? 2 : onTag == 4 ? 3 : "";
competitionStuTable[onTag].reload({
where: {
- studentTempJson:JSON.stringify(studentTempJson),
- competitionId:$("input[name='competitionId']").val(),
- beCompetitionStudent:1,
- studentName:$(".csyh input[name='studentName_td']").val(),
- classIds:!$.isEmpty(treeList[si])?treeList[si].getValue('value').join(","):"",
- studentStatuses:"1,2"
+ studentTempJson: JSON.stringify(studentTempJson),
+ competitionId: $("input[name='competitionId']").val(),
+ beCompetitionStudent: 1,
+ studentName: $(".csyh input[name='studentName_td']").val(),
+ classIds: !$.isEmpty(treeList[si]) ? treeList[si].getValue('value').join(",") : "",
+ studentStatuses: "1,2"
},
page: {
curr: 1
}
});
}
- function search_dz(){
+
+ function search_dz() {
var studentTempJson = new Array();
- $.each(studentTempMap,function(i,item){
+ $.each(studentTempMap, function (i, item) {
studentTempJson.push({
- studentsId:item.studentsId,
- teamName:item.teamName,
- studentsIds:item.studentsIds
+ studentsId: item.studentsId,
+ teamName: item.teamName,
+ studentsIds: item.studentsIds
});
});
- var si = onTag == 1?3:onTag == 3?2:onTag == 4?3:"";
+ var si = onTag == 1 ? 3 : onTag == 3 ? 2 : onTag == 4 ? 3 : "";
competitionStuTable[onTag].reload({
where: {
- studentTempJson:JSON.stringify(studentTempJson),
- competitionId:$("input[name='competitionId']").val(),
- beCompetitionStudent:2,
- studentName:$(".csyh input[name='studentName_td']").val(),
- classIds:!$.isEmpty(treeList[si])?treeList[si].getValue('value').join(","):""
+ studentTempJson: JSON.stringify(studentTempJson),
+ competitionId: $("input[name='competitionId']").val(),
+ beCompetitionStudent: 2,
+ studentName: $(".csyh input[name='studentName_td']").val(),
+ classIds: !$.isEmpty(treeList[si]) ? treeList[si].getValue('value').join(",") : ""
},
page: {
curr: 1
@@ -535,13 +575,13 @@ layui.define([ 'form', 'laydate', 'table','element','upload','competitionApi','t
var treeList = [];
//监听是否允许自主报名切换 1:允许 2:不允许
form.on('radio(zzbm)', function (obj) {
- if(obj.value == 1){
+ if (obj.value == 1) {
$(".demo1").show();
$(".demo4").show();
- if($.isEmpty(treeList[1])){
+ if ($.isEmpty(treeList[1])) {
treeList[1] = xmSelect.render({
el: document.querySelector('#demo1'),
- name:"onCourseInfoId",
+ name: "onCourseInfoId",
autoRow: true,
theme: {
color: '#1e9fff',
@@ -566,19 +606,19 @@ layui.define([ 'form', 'laydate', 'table','element','upload','competitionApi','t
},
filterable: true,
height: '300px',
- data: function(){
+ data: function () {
return getTreeByCourseLabelTypes
},
});
}
- }else {
+ } else {
$(".demo1").hide();
$(".demo4").hide();
}
});
//选择参赛人
- function see_c_user(){
+ function see_c_user() {
layer.open({
type: 1,
title: "选择参赛学员",
@@ -591,53 +631,53 @@ layui.define([ 'form', 'laydate', 'table','element','upload','competitionApi','t
loadCompetitionUser(1);
}, yes: function (index) {
var studentTempJson = new Array();
- if(!$.isEmpty(competitionStuIds_no)){
- if((competitionStuIds_no +"").indexOf(",") < 0){
+ if (!$.isEmpty(competitionStuIds_no)) {
+ if ((competitionStuIds_no + "").indexOf(",") < 0) {
studentTempJson.push({
- studentsId:competitionStuIds_no
+ studentsId: competitionStuIds_no
});
- }else {
+ } else {
var info = (competitionStuIds_no).split(",");
- for(var i = 0;i编辑";
- }else {
+ } else {
return (d.teamName || ' ') + "编辑";
}
}
- },{
- field : 'studentName',
- title : '队长',align: "center",hide:tag == 2?false:true,width:100
- },{
- field : 'teamStudentNames',
- title : '组员',align: "center",hide:tag == 2?false:true,templet:function (d) {
- if(!$.isEmpty(d.teamStudentNames)){
+ }, {
+ field: 'studentName',
+ title: '队长', align: "center", hide: tag == 2 ? false : true, width: 100
+ }, {
+ field: 'teamStudentNames',
+ title: '组员', align: "center", hide: tag == 2 ? false : true, templet: function (d) {
+ if (!$.isEmpty(d.teamStudentNames)) {
var html = "";
var teamStudentsIds = d.teamStudentsIds.split(",");
- $.each(d.teamStudentNames.split(","),function(n,v) {
- html += ""+v+"ဇ";
- if(n < d.teamStudentNames.split(",").length - 1){
+ $.each(d.teamStudentNames.split(","), function (n, v) {
+ html += "" + v + "ဇ";
+ if (n < d.teamStudentNames.split(",").length - 1) {
html += "/";
}
});
return html;
- }else {
+ } else {
return "";
}
}
- },{
- field : 'classIdText',width:100,
- title : '操作',align: "center",hide:tag == 2?false:true,templet:function (d){
+ }, {
+ field: 'classIdText', width: 100,
+ title: '操作', align: "center", hide: tag == 2 ? false : true, templet: function (d) {
return '选择组员';
}
}
- ] ],done: function (res, curr, count) {
- if(tag == 2){ //团队赛
- $("td[data-field='teamName']").click(function (){ //监听点击团队编辑时只有编辑显示
+ ]], done: function (res, curr, count) {
+ if (tag == 2) { //团队赛
+ $("td[data-field='teamName']").click(function () { //监听点击团队编辑时只有编辑显示
var this_ = $(this);
- setTimeout(function (){
- if(this_.find("input").val() == " 编辑" || this_.find("input").val() == "编辑"){
- this_.find("input").val(this_.find("input").val().replace("编辑","").replace(/ /g,""));
+ setTimeout(function () {
+ if (this_.find("input").val() == " 编辑" || this_.find("input").val() == "编辑") {
+ this_.find("input").val(this_.find("input").val().replace("编辑", "").replace(/ /g, ""));
}
- },1);
+ }, 1);
});
- $(".dy i").click(function (){
+ $(".dy i").click(function () {
var studentId = $(this).attr("studentId");//队长ID
var teamStudentsIds = $(this).attr("teamStudentsIds");//队员ID
- studentTempMap[studentId].studentsIds = Lib.stringRemove(studentTempMap[studentId].studentsIds,teamStudentsIds);
+ studentTempMap[studentId].studentsIds = Lib.stringRemove(studentTempMap[studentId].studentsIds, teamStudentsIds);
$(this).parent().next().remove();
$(this).parent().remove();
});
}
- if(!$.isEmpty(res.classIds) && res.classIds != -1){
- if($.isEmpty(treeList[1])){
+ if (!$.isEmpty(res.classIds) && res.classIds != -1) {
+ if ($.isEmpty(treeList[1])) {
treeList[1] = xmSelect.render({
el: document.querySelector('#demo1'),
- name:"onCourseInfoId",
+ name: "onCourseInfoId",
autoRow: true,
theme: {
color: '#1e9fff',
@@ -779,7 +826,7 @@ layui.define([ 'form', 'laydate', 'table','element','upload','competitionApi','t
showLine: true,
simple: false,
indent: 20,
- },model: {
+ }, model: {
label: {
type: 'block',
block: {
@@ -792,17 +839,17 @@ layui.define([ 'form', 'laydate', 'table','element','upload','competitionApi','t
},
filterable: true,
height: '300px',
- data: function(){
+ data: function () {
return getTreeByCourseLabelTypes
},
- hide:function(){
+ hide: function () {
loadTreeList4();
}
});
- loadTreeList4(res.classIds,res.excludedStudentIds);
+ loadTreeList4(res.classIds, res.excludedStudentIds);
}
- $("input[name='classIds'][value='1']").prop("checked",true);
- $("input[name='classIds'][value='2']").prop("checked",false);
+ $("input[name='classIds'][value='1']").prop("checked", true);
+ $("input[name='classIds'][value='2']").prop("checked", false);
$(".demo1").show();
$(".demo4").show();
treeList[1].append(res.classIds.split(","));
@@ -810,25 +857,25 @@ layui.define([ 'form', 'laydate', 'table','element','upload','competitionApi','t
}
//tag = 个人赛(0:已选参赛人 1:未选参赛人) 团队赛(2:已选参赛人 3:选队长 4:未选参赛人团队)
- if(tag == 0 || tag == 2){
+ if (tag == 0 || tag == 2) {
studentTempMap = res.studentTempMap;
}
- var ta = tag == 0?'studentTable':tag==1 || tag == 4 ?"studentTable_no":tag == 2?'studentTable_td':tag ==3?"studentTable_no_dz":"";
- if(tag == 0){
- Lib.tableFX(this,table.cache[ta],competitionStuIds,'studentId'); //回显
- }else if(tag ==3){
- Lib.tableFX(this,table.cache[ta],competitionStuIds_no_dz,'studentId'); //回显
- }else if(tag == 1 || tag == 2 || tag ==4){
- Lib.tableFX(this,table.cache[ta],competitionStuIds_no,'studentId'); //回显
+ var ta = tag == 0 ? 'studentTable' : tag == 1 || tag == 4 ? "studentTable_no" : tag == 2 ? 'studentTable_td' : tag == 3 ? "studentTable_no_dz" : "";
+ if (tag == 0) {
+ Lib.tableFX(this, table.cache[ta], competitionStuIds, 'studentId'); //回显
+ } else if (tag == 3) {
+ Lib.tableFX(this, table.cache[ta], competitionStuIds_no_dz, 'studentId'); //回显
+ } else if (tag == 1 || tag == 2 || tag == 4) {
+ Lib.tableFX(this, table.cache[ta], competitionStuIds_no, 'studentId'); //回显
}
}
});
- if(tag == 1 || tag == 3 || tag == 4){ //选择队长对话框
- var si = tag == 1?3:tag == 3?2:tag == 4?3:"";
- if($.isEmpty(treeList[si])){
+ if (tag == 1 || tag == 3 || tag == 4) { //选择队长对话框
+ var si = tag == 1 ? 3 : tag == 3 ? 2 : tag == 4 ? 3 : "";
+ if ($.isEmpty(treeList[si])) {
treeList[si] = xmSelect.render({
- el: document.querySelector('#demo'+si),
- name:"onCourseInfoId",
+ el: document.querySelector('#demo' + si),
+ name: "onCourseInfoId",
autoRow: true,
theme: {
color: '#1e9fff',
@@ -842,21 +889,21 @@ layui.define([ 'form', 'laydate', 'table','element','upload','competitionApi','t
},
filterable: true,
height: '300px',
- data: function(){
+ data: function () {
return getTreeByCourseLabelTypes
}
});
$("#demo" + si + " .xm-search").addClass("layui-row").append
- ('')
- .find("input").css("width","300px").css("float","left");
- $('#demo' +si+' .all_'+si).click(function (){
- if((tag == 1 || tag == 3 || tag == 4) && treeList[si].getValue("value").length > 0){
- var ret = Common.getAjax("/jlw/competition/getListByClassIds.json",{classIds:treeList[si].getValue("value").join(",")});
- if(ret.code == 0){
- if(tag == 3 && !$.isEmpty(ret.data)){
+ ('')
+ .find("input").css("width", "300px").css("float", "left");
+ $('#demo' + si + ' .all_' + si).click(function () {
+ if ((tag == 1 || tag == 3 || tag == 4) && treeList[si].getValue("value").length > 0) {
+ var ret = Common.getAjax("/jlw/competition/getListByClassIds.json", {classIds: treeList[si].getValue("value").join(",")});
+ if (ret.code == 0) {
+ if (tag == 3 && !$.isEmpty(ret.data)) {
competitionStuIds_no_dz = ret.data;
}
- if((tag == 1 || tag == 4) && !$.isEmpty(ret.data)){
+ if ((tag == 1 || tag == 4) && !$.isEmpty(ret.data)) {
competitionStuIds_no = ret.data;
}
competitionStuTable[onTag].reload({
@@ -864,20 +911,20 @@ layui.define([ 'form', 'laydate', 'table','element','upload','competitionApi','t
curr: 1
}
});
- }else {
+ } else {
layer.msg(ret.msg);
}
}
});
- }else {
+ } else {
treeList[si].setValue([]);
}
}
//编辑队名
- table.on('edit(studentTable_td)', function(obj){ //注:edit是固定事件名,test是table原始容器的属性 lay-filter="对应的值"
+ table.on('edit(studentTable_td)', function (obj) { //注:edit是固定事件名,test是table原始容器的属性 lay-filter="对应的值"
// console.log(obj.value); //得到修改后的值
// console.log(obj.field); //当前编辑的字段名
// console.log(obj.data); //所在行的所有相关数据
@@ -885,137 +932,137 @@ layui.define([ 'form', 'laydate', 'table','element','upload','competitionApi','t
});
//监听选择与取消已报名学生 注:实现了分页也可以选择
- table.on('checkbox(studentTable)', function(obj){
- if(obj.checked){ //选中
+ table.on('checkbox(studentTable)', function (obj) {
+ if (obj.checked) { //选中
var student = obj.data;
- if(obj.type == "all"){//全选
+ if (obj.type == "all") {//全选
var checkStatus = table.checkStatus('studentTable').data;
- for(var i = 0; i < checkStatus.length;i++){
- if((","+competitionStuIds+",").indexOf(checkStatus[i].studentId) < 0){
- if(!$.isEmpty(competitionStuIds)){
+ for (var i = 0; i < checkStatus.length; i++) {
+ if (("," + competitionStuIds + ",").indexOf(checkStatus[i].studentId) < 0) {
+ if (!$.isEmpty(competitionStuIds)) {
competitionStuIds += "," + checkStatus[i].studentId;
- }else {
+ } else {
competitionStuIds = checkStatus[i].studentId;
}
}
}
- }else {
- if(!$.isEmpty(competitionStuIds)){
+ } else {
+ if (!$.isEmpty(competitionStuIds)) {
competitionStuIds += "," + obj.data.studentId;
- }else {
+ } else {
competitionStuIds = obj.data.studentId;
}
}
- }else{//取消全选
- if(obj.type == "all"){//全选
+ } else {//取消全选
+ if (obj.type == "all") {//全选
var checkStatus = table.cache["studentTable"];
- for(var i = 0; i移除';
}
}
- ] ],done: function (res, curr, count) {
- if(tag == 1){
+ ]], done: function (res, curr, count) {
+ if (tag == 1) {
tempTeacherIds = res.tempTeacherIds;
}
- if(tag == 1){
- Lib.tableFX(this,table.cache['teacherTable'],teacherIds,'teacherId'); //回显
- }else if(tag == 2){
- Lib.tableFX(this,table.cache['teacherTable_no'],teacherIds_no,'teacherId'); //回显
+ if (tag == 1) {
+ Lib.tableFX(this, table.cache['teacherTable'], teacherIds, 'teacherId'); //回显
+ } else if (tag == 2) {
+ Lib.tableFX(this, table.cache['teacherTable_no'], teacherIds_no, 'teacherId'); //回显
}
}
});
//监听选择与取消已报名学生 注:实现了分页也可以选择
- table.on('checkbox(teacherTable)', function(obj){
- if(obj.checked){ //选中
+ table.on('checkbox(teacherTable)', function (obj) {
+ if (obj.checked) { //选中
var student = obj.data;
- if(obj.type == "all"){//全选
+ if (obj.type == "all") {//全选
var checkStatus = table.checkStatus('teacherTable').data;
- for(var i = 0; i < checkStatus.length;i++){
- if((","+teacherIds+",").indexOf(checkStatus[i].teacherId) < 0){
- if(!$.isEmpty(teacherIds)){
+ for (var i = 0; i < checkStatus.length; i++) {
+ if (("," + teacherIds + ",").indexOf(checkStatus[i].teacherId) < 0) {
+ if (!$.isEmpty(teacherIds)) {
teacherIds += "," + checkStatus[i].teacherId;
- }else {
+ } else {
teacherIds = checkStatus[i].teacherId;
}
}
}
- }else {
- if(!$.isEmpty(teacherIds)){
+ } else {
+ if (!$.isEmpty(teacherIds)) {
teacherIds += "," + obj.data.teacherId;
- }else {
+ } else {
teacherIds = obj.data.teacherId;
}
}
- }else{//取消全选
- if(obj.type == "all"){//全选
+ } else {//取消全选
+ if (obj.type == "all") {//全选
var checkStatus = table.cache["teacherTable"];
- for(var i = 0; i
-
+