layui.use(['element', 'form', 'layer', 'jquery', 'upload'], function () {
var element = layui.element,
form = layui.form,
layer = layui.layer,
$ = layui.jquery,
upload = layui.upload;
/** 上传个人照片 */
upload.render({
elem: '#uploadPhoto',
url: '/enroll/uploadPhoto',
accept: 'image',
acceptMime: 'image/*',
exts: 'jpg|jpeg|png',
size: '10240',
before: function (obj) {
layer.msg('正在上传,请稍候...', {time: 0, shade: 0.2});
},
done: function (res) {
layer.closeAll();
if (res.state == 'ok') {
$("#uploadPhoto").addClass('layui-hide');
$("#showPhoto").removeClass("layui-hide");
$('#photoUrl').val(res.url);
$('#showPhoto img').attr('src', res.url);
$("#captcha-input").val('');
$(".captcha").click();
} else if (res.state == 'fail') {
$('#showPhoto img').removeAttr('src');
showFailMsg(res.msg);
}
}
});
/** 删除个人照片 */
$(document).on('click', '#deletePhoto', function () {
layer.confirm('确定要删除图片?', {icon: 3, title: '提示'}, function (index) {
$('#photoUrl').val('');
$("#showPhoto").addClass('layui-hide');
$("#uploadPhoto").removeClass('layui-hide');
layer.close(index);
});
});
/** 上传飞行体检佐证材料 */
upload.render({
elem: '#uploadAirlinePhoto',
url: '/enroll/uploadAirlinePhoto',
accept: 'image',
acceptMime: 'image/*',
exts: 'jpg|jpeg|png',
size: '10240',
before: function (obj) {
layer.msg('正在上传,请稍候...', {time: 0, shade: 0.2});
},
done: function (res) {
layer.closeAll();
if (res.state == 'ok') {
$("#uploadAirlinePhoto").addClass('layui-hide');
$("#showAirlinePhoto").removeClass("layui-hide");
$('#airlinePhotoUrl').val(res.url);
$('#showAirlinePhoto img').attr('src', res.url);
} else if (res.state == 'fail') {
$('#showPhoto img').removeAttr('src');
showFailMsg(res.msg);
}
}
});
/** 删除飞行体检佐证材料 */
$(document).on('click', '#deleteAirlinePhoto', function () {
layer.confirm('确定要删除图片?', {icon: 3, title: '提示'}, function (index) {
$.ajax({
url: '/enroll/deleteAirlinePhoto',
type: 'post',
data: {
url: $('#airlinePhotoUrl').val()
},
dataType: 'json',
success: function (data) {
showOkMsg(data.msg);
$('#airlinePhotoUrl').val('');
$("#showAirlinePhoto").addClass('layui-hide');
$("#uploadAirlinePhoto").removeClass('layui-hide');
$('#showAirlinePhoto img').removeAttr('src');
}
});
layer.close(index);
});
});
/** 更新信息 */
form.on('submit(update)', function (data) {
var url = $("#photoUrl").val();
if (!url) {
$("#uploadPhoto").css("border", "1px dashed #FF5722");
layer.tips("请上传一寸照片", "#uploadPhoto", {tips: 1});
return false;
}
if (!data.field.captcha) {
$("#captcha").css("border", "1px dashed #FF5722");
layer.tips("请输入验证码", "#captcha", {tips: 1});
return false;
}
var age = getAgeByIdentity(data.field.identity);
if (age < 10 || age > 25) {
$("#identity").focus();
layer.tips("年龄不在招生范围内", "#identity", {tips: 1, time: 5000});
return false;
}
data.field.height = parseFloat(data.field.height).toFixed(1);
if (data.field.height < 50 || data.field.height > 200) {
$("#height").focus();
layer.tips("身高范围50 ~ 200cm", "#height", {tips: 1, time: 5000});
return false;
}
data.field.weight = parseFloat(data.field.weight).toFixed(1);
if (data.field.weight < 30 || data.field.weight > 150) {
$("#weight").focus();
layer.tips("体重范围30 ~ 150kg", "#weight", {tips: 1, time: 5000});
return false;
}
$.ajax({
url: '/info/update',
type: 'post',
data: data.field,
dataType: 'json',
beforeSend: function () {
layer.load(2);
},
success: function (res) {
layer.closeAll('loading');
if (res.state == 'ok') {
layer.open({
type: 1
, title: false //不显示标题栏
, area: '250px;'
, shade: 0.3
, closeBtn: 0
, shadeClose: true
, anim: 5
, id: 'LAY_layuipro'
, moveType: 1 //拖拽模式,0或者1
, content: '
' +
'
' +
'
' + res.msg + '
' +
'
'
});
} else if (res.state == 'fail') {
showFailMsg(res.msg);
$(".captcha").click();
}
}
});
return false;
});
/** 监听性别选择 */
form.on('radio(sexFilter)', function (data) {
if (data.value == 2) {
$(".isAirlineEnroll").attr("lay-verify", "");
$(".isAirlineCheck").attr("lay-verify", "");
$(".leftEye").attr("lay-verify", "");
$(".rightEye").attr("lay-verify", "");
$(".airlineEnrollContentSex").addClass("layui-hide");
} else {
$(".isAirlineEnroll").attr("lay-verify", "required");
$(".isAirlineCheck").attr("lay-verify", "otherReq");
$(".leftEye").attr("lay-verify", "required");
$(".rightEye").attr("lay-verify", "required");
$(".airlineEnrollContentSex").removeClass("layui-hide");
}
});
// /** 监听是否参加今年高考 **/
// form.on('select(currentExam)', function (data) {
// if (data.value == '0') {
// $(".finalExamYear-content").removeClass("layui-hide disabled");
// $(".final-exam-content-1").addClass("layui-hide disabled");
// $(".final-exam-content-0").removeClass("layui-hide disabled");
// $('select[name="nextYearFinalExamProvince1"] option[value=""]').prop("selected", true);
// $('select[name="nextYearFinalExamGroup1"] option[value=""]').prop("selected", true);
// } else {
// $(".finalExamYear-content").addClass("layui-hide disabled");
// $(".final-exam-content-1").removeClass("layui-hide disabled");
// $(".final-exam-content-0").addClass("layui-hide disabled");
// $('select[name="finalExamProvince"] option[value=""]').prop("selected", true);
// $('select[name="finalExamGroup"] option[value=""]').prop("selected", true);
// $('select[name="nextYearFinalExamProvince2"] option[value=""]').prop("selected", true);
// $('select[name="nextYearFinalExamGroup2"] option[value=""]').prop("selected", true);
// }
// form.render();
// });
// /** 监听班干部选择 */
// form.on('radio(isLeader)', function (data) {
// if (data.value == '0') {
// $(".duty").attr("lay-verify", "");
// $(".duty-item").addClass("layui-hide");
// } else {
// $(".duty").attr("lay-verify", "required");
// $(".duty-item").removeClass("layui-hide");
// }
// });
// /** 监听高考报名选择 */
// form.on('radio(isGaokaoEnroll)', function (data) {
// if (data.value == '1') {
// $(".gaokaoEnrollProvince").attr("lay-verify", "");
// $(".gaokaoEnrollCity").attr("lay-verify", "");
// $(".gaokaoEnrollCounty").attr("lay-verify", "");
// $(".gaokaoEnrollSchool").attr("lay-verify", "");
// $(".gaokaoEnrollContent").addClass("layui-hide");
// } else {
// $(".gaokaoEnrollProvince").attr("lay-verify", "requiredSelect");
// $(".gaokaoEnrollCity").attr("lay-verify", "requiredSelect");
// $(".gaokaoEnrollCounty").attr("lay-verify", "requiredSelect");
// $(".gaokaoEnrollSchool").attr("lay-verify", "required");
// $(".gaokaoEnrollContent").removeClass("layui-hide");
// }
// });
// /** 监听飞行员报名选择 */
// form.on('radio(isAirlineEnroll)', function (data) {
// if (data.value == '0') {
// $(".isAirlineCheck").attr("lay-verify", "");
// $(".leftEye").attr("lay-verify", "");
// $(".rightEye").attr("lay-verify", "");
// $(".airlineEnrollContent").addClass("layui-hide");
// } else {
// $(".isAirlineCheck").attr("lay-verify", "otherReq");
// $(".leftEye").attr("lay-verify", "required");
// $(".rightEye").attr("lay-verify", "required");
// $(".airlineEnrollContent").removeClass("layui-hide");
// }
// });
// /** 监听飞行员报名体检选择 */
// form.on('radio(isAirlineCheck)', function (data) {
// if (data.value == '0') {
// $(".airlineCheckContent").addClass("layui-hide");
// } else {
// $(".airlineCheckContent").removeClass("layui-hide");
// }
// });
// 毕业学校所在省
form.on('select(gaokaoEnrollProvince)', function (data) {
if (!data.value) {
$("#gaokaoEnrollCity").html("");
$("#gaokaoEnrollCounty").html("");
return;
}
layer.load(2);
$.ajax({
url: '/enroll/getArea',
type: 'post',
data: {
areaName: data.value
},
dataType: 'json',
success: function (res) {
layer.closeAll("loading");
if (res.state == 'ok') {
$("#gaokaoEnrollCity").html("");
$("#gaokaoEnrollCounty").html("");
$(res.areaList).each(function (i, n) {
$("#gaokaoEnrollCity").append("");
});
form.render();
} else if (res.state == 'fail') {
showFailMsg(res.msg);
} else if (res.state == 'over') {
jumpToUrl(res.url);
}
},
error: function () {
layer.closeAll('loading');
showFailMsg('网络异常,请稍后重试');
}
});
});
// 毕业学校所在市
form.on('select(gaokaoEnrollCity)', function (data) {
if (!data.value) {
$("#gaokaoEnrollCounty").html("");
return;
}
layer.load(2);
$.ajax({
url: '/enroll/getArea',
type: 'post',
data: {
areaName: data.value
},
dataType: 'json',
success: function (res) {
layer.closeAll("loading");
if (res.state == 'ok') {
$("#gaokaoEnrollCounty").html("");
$(res.areaList).each(function (i, n) {
$("#gaokaoEnrollCounty").append("");
});
form.render();
} else if (res.state == 'fail') {
showFailMsg(res.msg);
} else if (res.state == 'over') {
jumpToUrl(res.url);
}
},
error: function () {
layer.closeAll('loading');
showFailMsg('网络异常,请稍后重试');
}
});
});
/** 毕业学校所在省 */
form.on('select(graduateProvince)', function (data) {
if (!data.value) {
$("#graduateCity").html("");
$("#graduateCounty").html("");
return;
}
layer.load(2);
$.ajax({
url: '/enroll/getArea',
type: 'post',
data: {
areaName: data.value
},
dataType: 'json',
success: function (res) {
layer.closeAll("loading");
if (res.state == 'ok') {
$("#graduateCity").html("");
$("#graduateCounty").html("");
$(res.areaList).each(function (i, n) {
$("#graduateCity").append("");
});
form.render();
} else if (res.state == 'fail') {
showFailMsg(res.msg);
} else if (res.state == 'over') {
jumpToUrl(res.url);
}
},
error: function () {
layer.closeAll('loading');
showFailMsg('网络异常,请稍后重试');
}
});
});
/** 毕业学校所在市 */
form.on('select(graduateCity)', function (data) {
if (!data.value) {
$("#graduateCounty").html("");
return;
}
layer.load(2);
$.ajax({
url: '/enroll/getArea',
type: 'post',
data: {
areaName: data.value
},
dataType: 'json',
success: function (res) {
layer.closeAll("loading");
if (res.state == 'ok') {
$("#graduateCounty").html("");
$(res.areaList).each(function (i, n) {
$("#graduateCounty").append("");
});
form.render();
} else if (res.state == 'fail') {
showFailMsg(res.msg);
} else if (res.state == 'over') {
jumpToUrl(res.url);
}
},
error: function () {
layer.closeAll('loading');
showFailMsg('网络异常,请稍后重试');
}
});
});
/** 家庭所在省 */
form.on('select(addrProvince)', function (data) {
if (!data.value) {
$("#addrCity").html("");
$("#addrCounty").html("");
return;
}
layer.load(2);
$.ajax({
url: '/enroll/getArea',
type: 'post',
data: {
areaName: data.value
},
dataType: 'json',
success: function (res) {
layer.closeAll("loading");
if (res.state == 'ok') {
$("#addrCity").html("");
$("#addrCounty").html("");
$(res.areaList).each(function (i, n) {
$("#addrCity").append("");
});
form.render();
} else if (res.state == 'fail') {
showFailMsg(res.msg);
} else if (res.state == 'over') {
jumpToUrl(res.url);
}
},
error: function () {
layer.closeAll('loading');
showFailMsg('网络异常,请稍后重试');
}
});
});
/** 家庭所在市 */
form.on('select(addrCity)', function (data) {
if (!data.value) {
$("#addrCounty").html("");
return;
}
layer.load(2);
$.ajax({
url: '/enroll/getArea',
type: 'post',
data: {
areaName: data.value
},
dataType: 'json',
success: function (res) {
layer.closeAll("loading");
if (res.state == 'ok') {
$("#addrCounty").html("");
$(res.areaList).each(function (i, n) {
$("#addrCounty").append("");
});
form.render();
} else if (res.state == 'fail') {
showFailMsg(res.msg);
} else if (res.state == 'over') {
jumpToUrl(res.url);
}
},
error: function () {
layer.closeAll('loading');
showFailMsg('网络异常,请稍后重试');
}
});
});
/** 户口所在省 */
form.on('select(hukouProvince)', function (data) {
if (!data.value) {
$("#hukouCity").html("");
$("#hukouCounty").html("");
return;
}
layer.load(2);
$.ajax({
url: '/enroll/getArea',
type: 'post',
data: {
areaName: data.value
},
dataType: 'json',
success: function (res) {
layer.closeAll("loading");
if (res.state == 'ok') {
$("#hukouCity").html("");
$("#hukouCounty").html("");
$(res.areaList).each(function (i, n) {
$("#hukouCity").append("");
});
form.render();
} else if (res.state == 'fail') {
showFailMsg(res.msg);
} else if (res.state == 'over') {
jumpToUrl(res.url);
}
},
error: function () {
layer.closeAll('loading');
showFailMsg('网络异常,请稍后重试');
}
});
});
/** 户口所在市 */
form.on('select(hukouCity)', function (data) {
if (!data.value) {
$("#hukouCounty").html("");
return;
}
layer.load(2);
$.ajax({
url: '/enroll/getArea',
type: 'post',
data: {
areaName: data.value
},
dataType: 'json',
success: function (res) {
layer.closeAll("loading");
if (res.state == 'ok') {
$("#hukouCounty").html("");
$(res.areaList).each(function (i, n) {
$("#hukouCounty").append("");
});
form.render();
} else if (res.state == 'fail') {
showFailMsg(res.msg);
} else if (res.state == 'over') {
jumpToUrl(res.url);
}
},
error: function () {
layer.closeAll('loading');
showFailMsg('网络异常,请稍后重试');
}
});
});
/** 预选组合 */
form.on('select(preGroup)', function (data) {
if (!data.value) {
$("#campusId").html("");
return;
}
layer.load(2);
$.ajax({
url: '/enroll/getCampusByGroup',
type: 'post',
data: {
preGroupId: data.value
},
dataType: 'json',
success: function (res) {
layer.closeAll("loading");
if (res.state == 'ok') {
$("#campusId").html("");
$(res.campusList).each(function (i, n) {
$("#campusId").append("");
});
form.render();
} else if (res.state == 'fail') {
showFailMsg(res.msg);
} else if (res.state == 'over') {
jumpToUrl(res.url);
}
},
error: function () {
layer.closeAll('loading');
showFailMsg('网络异常,请稍后重试');
}
});
});
/** 高考模式 */
form.on('select(examModel)', function (data) {
$(".score-content").html('');
if (!data.value) {
$("#examProvince").html("");
$(".score-content").html('~ 请先选择高考模式与省份 ~
');
form.render();
return;
}
layer.load(2);
$.ajax({
url: '/info/getProvinceByModel',
type: 'post',
data: {
modelId: data.value
},
dataType: 'json',
success: function (res) {
layer.closeAll("loading");
if (res.state == 'ok') {
$("#examProvince").html("");
$(res.provinceList).each(function (i, n) {
$("#examProvince").append("");
});
form.render();
} else if (res.state == 'fail') {
showFailMsg(res.msg);
} else if (res.state == 'over') {
jumpToUrl(res.url);
}
},
error: function () {
layer.closeAll('loading');
showFailMsg('网络异常,请稍后重试');
}
});
$.ajax({
url: '/info/getPreGroupListByModel',
type: 'post',
data: {
modelId: data.value
},
dataType: 'json',
success: function (res) {
layer.closeAll("loading");
if (res.state == 'ok') {
$("#thisYearFinalExamGroup").html("");
$(res.preGroupList).each(function (i, n) {
$("#thisYearFinalExamGroup").append("");
});
form.render();
} else if (res.state == 'fail') {
showFailMsg(res.msg);
} else if (res.state == 'over') {
jumpToUrl(res.url);
}
},
error: function () {
layer.closeAll('loading');
showFailMsg('网络异常,请稍后重试');
}
});
});
/** 高考省份 */
// form.on('select("finalExamProvince")', function (data) {
// $.ajax({
// url: '/info/getPreGroupListByProvince',
// type: 'post',
// data: {
// province: data.value
// },
// dataType: 'json',
// success: function (res) {
// layer.closeAll("loading");
// if (res.state == 'ok') {
// $("#thisYearFinalExamGroup").html("");
// $(res.preGroupList).each(function (i, n) {
// $("#thisYearFinalExamGroup").append("");
// });
// form.render();
// } else if (res.state == 'fail') {
// showFailMsg(res.msg);
// } else if (res.state == 'over') {
// jumpToUrl(res.url);
// }
// },
// error: function () {
// layer.closeAll('loading');
// showFailMsg('网络异常,请稍后重试');
// }
// });
//
// });
/** 下一年-高考省份 */
form.on('select(nextExamProvice2)', function (data) {
$.ajax({
url: '/info/getPreGroupListByProvince',
type: 'post',
data: {
province: data.value
},
dataType: 'json',
success: function (res) {
layer.closeAll("loading");
if (res.state == 'ok') {
$("#nextYearFinalExamGroup2").html("");
$(res.preGroupList).each(function (i, n) {
$("#nextYearFinalExamGroup2").append("");
});
form.render();
} else if (res.state == 'fail') {
showFailMsg(res.msg);
} else if (res.state == 'over') {
jumpToUrl(res.url);
}
},
error: function () {
layer.closeAll('loading');
showFailMsg('网络异常,请稍后重试');
}
});
});
/** 下一年-高考省份 */
form.on('select(nextExamProvice1)', function (data) {
$.ajax({
url: '/info/getPreGroupListByProvince',
type: 'post',
data: {
province: data.value
},
dataType: 'json',
success: function (res) {
layer.closeAll("loading");
if (res.state == 'ok') {
$("#nextYearFinalExamGroup1").html("");
$(res.preGroupList).each(function (i, n) {
$("#nextYearFinalExamGroup1").append("");
});
form.render();
} else if (res.state == 'fail') {
showFailMsg(res.msg);
} else if (res.state == 'over') {
jumpToUrl(res.url);
}
},
error: function () {
layer.closeAll('loading');
showFailMsg('网络异常,请稍后重试');
}
});
});
/** 下一年-高考省份 */
form.on('select(nextExamProvice)', function (data) {
$.ajax({
url: '/info/getPreGroupListByProvince',
type: 'post',
data: {
province: data.value
},
dataType: 'json',
success: function (res) {
layer.closeAll("loading");
if (res.state == 'ok') {
$("#nextYearFinalExamGroup").html("");
$(res.preGroupList).each(function (i, n) {
$("#nextYearFinalExamGroup").append("");
});
form.render();
} else if (res.state == 'fail') {
showFailMsg(res.msg);
} else if (res.state == 'over') {
jumpToUrl(res.url);
}
},
error: function () {
layer.closeAll('loading');
showFailMsg('网络异常,请稍后重试');
}
});
});
/** 平时成绩——高考省份 */
form.on('select(examProvince)', function (data) {
if (data.value) {
layer.load(2);
$.ajax({
url: '/info/getSubjectByModel',
type: 'post',
data: {
modelId: $("#examModelId").val()
},
dataType: 'json',
success: function (res) {
layer.closeAll("loading");
if (res.state == 'ok') {
var content = '';
for (var t = 1; t <= 2; t++) {
content += '';
}
content += '';
$(".score-content").html(content);
form.render();
} else if (res.state == 'fail') {
showFailMsg(res.msg);
} else if (res.state == 'over') {
jumpToUrl(res.url);
}
},
error: function () {
layer.closeAll('loading');
showFailMsg('网络异常,请稍后重试');
}
});
}
});
/** 考试成绩提交 */
form.on('submit(scoreSub)', function (data) {
var times = $('input[name="times"]').map(function () {
return $(this).val();
}).get().join(',');
var subjectId = $('input[name="subjectId"]').map(function () {
return $(this).val();
}).get().join(',');
var score = $('input[name="score"]').map(function () {
return $(this).val() ? parseFloat($(this).val()).toFixed(1) : 0;
}).get().join(',');
data.field.times = times;
data.field.subjectId = subjectId;
data.field.score = score;
$.ajax({
url: '/info/saveExamScore',
type: 'post',
data: data.field,
dataType: 'json',
success: function (res) {
layer.closeAll("loading");
if (res.state == 'ok') {
showOkMsg(res.msg);
jumpToUrl('/nav')
} else if (res.state == 'fail') {
showFailMsg(res.msg);
} else if (res.state == 'over') {
jumpToUrl(res.url);
}
},
error: function () {
layer.closeAll('loading');
showFailMsg('网络异常,请稍后重试');
}
});
return false;
});
/** 家庭信息提交 */
form.on('submit(familySub)', function (data) {
$.ajax({
url: '/info/saveFamilyInfo',
type: 'post',
data: data.field,
dataType: 'json',
success: function (res) {
layer.closeAll("loading");
if (res.state == 'ok') {
showOkMsg(res.msg);
jumpToUrl('/nav')
} else if (res.state == 'fail') {
showFailMsg(res.msg);
} else if (res.state == 'over') {
jumpToUrl(res.url);
}
},
error: function () {
layer.closeAll('loading');
showFailMsg('网络异常,请稍后重试');
}
});
return false;
})
/** 高考成绩——高考省份 */
form.on('select(finalExamProvince)', function (data) {
if (data.value) {
layer.load(2);
$.ajax({
url: '/info/getSubjectByProvicne',
type: 'post',
data: {
province: data.value
},
dataType: 'json',
success: function (res) {
layer.closeAll("loading");
if (res.state == 'ok') {
var content =
'如考生号和准考证号只有一项,准考证号与考生号请填写一致,外语科目为非英语科目学生不予录取
' +
'' +
' ' +
'';
content += $(".form-content").html();
$(".score-content").html(content);
form.render();
upload.render({
elem: '#uploadScorePhoto',
url: '/info/uploadFinalScorePhoto',
accept: 'image',
acceptMime: 'image/*',
exts: 'jpg|jpeg|png',
size: '10240',
before: function (obj) {
layer.msg('正在上传,请稍候...', {time: 0, shade: 0.2});
},
done: function (res) {
layer.closeAll();
if (res.state == 'ok') {
$("#uploadScorePhoto").addClass('layui-hide');
$("#showPhoto").removeClass("layui-hide");
$('#finalScorePhotoUrl').val(res.url);
$('#showPhoto img').attr('src', res.url);
$("#captcha-input").val('');
$(".captcha").click();
} else if (res.state == 'fail') {
$('#showPhoto img').removeAttr('src');
showFailMsg(res.msg);
}
}
});
} else if (res.state == 'fail') {
showFailMsg(res.msg);
} else if (res.state == 'over') {
jumpToUrl(res.url);
}
},
error: function () {
layer.closeAll('loading');
showFailMsg('网络异常,请稍后重试');
}
});
$.ajax({
url: '/info/getPreGroupListByProvince',
type: 'post',
data: {
province: data.value
},
dataType: 'json',
success: function (res) {
layer.closeAll("loading");
if (res.state == 'ok') {
$("#thisYearFinalExamGroup").html("");
$(res.preGroupList).each(function (i, n) {
$("#thisYearFinalExamGroup").append("");
});
form.render();
} else if (res.state == 'fail') {
showFailMsg(res.msg);
} else if (res.state == 'over') {
jumpToUrl(res.url);
}
},
error: function () {
layer.closeAll('loading');
showFailMsg('网络异常,请稍后重试');
}
});
if($('#currentExam').val() == 1) {
$.ajax({
url: '/info/getAllProvince',
type: 'post',
dataType: 'json',
success: function (res) {
console.log(res);
layer.closeAll("loading");
if (res.state == 'ok') {
$("#nextYearFinalExamProvince2").html("");
$(res.provinceList).each(function (i, n) {
if(data.value == n.name) {
$("#nextYearFinalExamProvince2").append("");
} else {
$("#nextYearFinalExamProvince2").append("");
}
});
$("#nextYearFinalExamProvince1").html("");
$(res.provinceList).each(function (i, n) {
if(data.value == n.name) {
$("#nextYearFinalExamProvince1").append("");
} else {
$("#nextYearFinalExamProvince1").append("");
}
});
form.render();
} else if (res.state == 'fail') {
showFailMsg(res.msg);
} else if (res.state == 'over') {
jumpToUrl(res.url);
}
},
error: function () {
layer.closeAll('loading');
showFailMsg('网络异常,请稍后重试');
}
});
}
}
});
/** 明年高考组合 */
form.on('select(finalExamGroup)', function (data) {
if($('#currentExam').val() == 1) {
$.ajax({
url: '/info/getPreGroupListByProvince',
type: 'post',
data: {
province: $('#examProvince').val()
},
dataType: 'json',
success: function (res) {
layer.closeAll("loading");
if (res.state == 'ok') {
$("#nextYearFinalExamGroup2").html("");
$(res.preGroupList).each(function (i, n) {
if(data.value == n.name) {
$("#nextYearFinalExamGroup2").append("");
} else {
$("#nextYearFinalExamGroup2").append("");
}
});
form.render();
} else if (res.state == 'fail') {
showFailMsg(res.msg);
} else if (res.state == 'over') {
jumpToUrl(res.url);
}
},
error: function () {
layer.closeAll('loading');
showFailMsg('网络异常,请稍后重试');
}
});
}
});
/** 上传高考成绩截图 */
upload.render({
elem: '#uploadScorePhoto',
url: '/info/uploadFinalScorePhoto',
accept: 'images',
acceptMime: 'image/*',
exts: 'jpg|jpeg|png',
size: '10240',
before: function (obj) {
layer.msg('正在上传,请稍候...', {time: 0, shade: 0.2});
},
done: function (res) {
layer.closeAll();
console.log(res);
if (res.state == 'ok') {
$("#uploadScorePhoto").addClass('layui-hide');
$("#showPhoto").removeClass("layui-hide");
$('#finalScorePhotoUrl').val(res.url);
$('#showPhoto img').attr('src', res.url);
$("#captcha-input").val('');
$(".captcha").click();
} else if (res.state == 'fail') {
$('#showPhoto img').removeAttr('src');
showFailMsg(res.msg);
}
}
});
/** 上传高考成绩截图1 */
upload.render({
elem: '#uploadScorePhoto1',
url: '/info/uploadFinalScorePhoto',
accept: 'images',
acceptMime: 'image/*',
exts: 'jpg|jpeg|png',
size: '10240',
before: function (obj) {
layer.msg('正在上传,请稍候...', {time: 0, shade: 0.2});
},
done: function (res) {
layer.closeAll();
if (res.state == 'ok') {
$("#uploadScorePhoto1").addClass('layui-hide');
$("#showPhoto1").removeClass("layui-hide");
$('#finalScorePhotoUrl1').val(res.url);
$('#showPhoto1 img').attr('src', res.url);
$("#captcha-input").val('');
$(".captcha").click();
} else if (res.state == 'fail') {
$('#showPhoto1 img').removeAttr('src');
showFailMsg(res.msg);
}
}
});
/** 删除照片 */
$(document).on('click', '#deleteScorePhoto_r', function () {
layer.confirm('确定要删除图片?', {icon: 3, title: '提示'}, function (index) {
$.ajax({
url: '/info/deleteFinalScorePhoto',
type: 'post',
data: {
url: $('#finalScorePhotoUrl').val()
},
dataType: 'json',
success: function (data) {
showOkMsg(data.msg);
$('#finalScorePhotoUrl').val('');
$("#showPhoto").addClass('layui-hide');
$("#uploadScorePhoto").removeClass('layui-hide');
$('#showPhoto img').removeAttr('src');
}
});
layer.close(index);
});
});
$(document).on('click', '#deleteScorePhoto', function () {
layer.confirm('确定要删除图片?', {icon: 3, title: '提示'}, function (index) {
$('#finalScorePhotoUrl').val('');
$("#showPhoto").addClass('layui-hide');
$("#uploadScorePhoto").removeClass('layui-hide');
$('#showPhoto img').removeAttr('src');
layer.close(index);
});
});
$(document).on('click', '#deleteScorePhoto1', function () {
layer.confirm('确定要删除图片?', {icon: 3, title: '提示'}, function (index) {
$('#finalScorePhotoUrl1').val('');
$("#showPhoto1").addClass('layui-hide');
$("#uploadScorePhoto1").removeClass('layui-hide');
$('#showPhoto1 img').removeAttr('src');
layer.close(index);
});
});
/** 高考考试成绩提交 */
form.on('submit(finalScoreSub)', function (data) {
var currentExam = data.field.currentExam;
if ($("#finalScorePhotoUrl").val() == '' && currentExam == 1) {
layer.tips("请上传高考成绩截图", '#uploadScorePhoto', {tips: 1});
return false;
} else if (currentExam == 1) {
data.field.finalScorePhotoUrl=$("#finalScorePhotoUrl").val();
}
if ($("#finalScorePhotoUrl1").val() == '' && currentExam == 0) {
layer.tips("请上传证明材料", '#uploadScorePhoto', {tips: 1});
return false;
} else if (currentExam == 0) {
data.field.finalScorePhotoUrl=$("#finalScorePhotoUrl1").val();
}
var subjectId = $('.layui-form input[name="subjectId"]').map(function () {
return $(this).val();
}).get().join(',');
var score = $('.layui-form input[name="score"]').map(function () {
return $(this).val() ? parseFloat($(this).val()).toFixed(1) : 0;
}).get().join(',');
if (currentExam == 0) {
if ($("#nextYearFinalExamProvince").val()) {
data.field.nextYearFinalExamProvince = $("#nextYearFinalExamProvince").val();
} else {
data.field.nextYearFinalExamProvince = $("#nextYearFinalExamProvince1").val();
}
if ($("#nextYearFinalExamGroup").val()) {
data.field.nextYearFinalExamGroup = $("#nextYearFinalExamGroup").val();
} else {
data.field.nextYearFinalExamGroup = $("#nextYearFinalExamGroup1").val();
}
} else {
console.log($("#finalExamTotalScore").val());
if ($("#finalExamTotalScore").val()) {
data.field.finalExamTotalScore = $("#finalExamTotalScore").val();
} else {
data.field.finalExamTotalScore = $("#finalExamTotalScore1").val();
}
if ($("#finalExamRank").val()) {
data.field.finalExamRank = $("#finalExamRank").val();
} else {
data.field.finalExamRank = $("#finalExamRank1").val();
}
if ($("#checkScoreType").val()) {
data.field.checkScoreType = $("#checkScoreType").val();
} else {
data.field.checkScoreType = $("#checkScoreType1").val();
}
if ($("#nextYearFinalExamProvince").val()) {
data.field.nextYearFinalExamProvince = $("#nextYearFinalExamProvince").val();
} else {
data.field.nextYearFinalExamProvince = $("#nextYearFinalExamProvince2").val();
}
if ($("#nextYearFinalExamGroup").val()) {
data.field.nextYearFinalExamGroup = $("#nextYearFinalExamGroup").val();
} else {
data.field.nextYearFinalExamGroup = $("#nextYearFinalExamGroup2").val();
}
}
data.field.subjectId = subjectId;
data.field.score = score;
$.ajax({
url: '/info/saveFinalExamScore',
type: 'post',
data: data.field,
dataType: 'json',
success: function (res) {
layer.closeAll("loading");
if (res.state == 'ok') {
layer.open({
type: 1
, title: false //不显示标题栏
, area: '300px;'
, shade: 0.3
, closeBtn: 0
, shadeClose: true
, anim: 5
, id: 'LAY_layuipro'
, moveType: 1 //拖拽模式,0或者1
, content: '' +
'
' +
'
' + res.msg + '
' +
'
温馨提示:
' +
'
建议先通过以下几个方式充值到支付宝凑集足够的金额,一旦被录取,方便尽快缴费。
' +
'
1.首先检查支付宝余额是否充足
' +
'
2.或者支付宝余额宝内有足够的金额
' +
'
3.可以用支付宝绑定本人名下的银行卡,银行卡内有足够的余额用于支付
' +
'
4.如果银行卡有支付限额,可以让亲朋转账给自己凑足金额后支付,也可以让亲朋帮忙代为付款
' +
'
'
,end: function () {
jumpToUrl("/nav");
}
});
} else if (res.state == 'fail') {
showFailMsg(res.msg);
} else if (res.state == 'over') {
jumpToUrl(res.url);
}
},
error: function () {
layer.closeAll('loading');
showFailMsg('网络异常,请稍后重试');
}
});
return false;
});
/** 退费提交 */
form.on('submit(saveReturnFee)', function (data) {
layer.confirm("退款信息一经提交不可更改
请确认信息无误!", {icon: 3, title: '提示'}, function (index) {
$.ajax({
url: '/info/saveReturnFee',
type: 'post',
data: data.field,
dataType: 'json',
beforeSend: function () {
layer.msg('操作中,请耐心等候...', {icon: 16, shade: 0.1, time: 0});
},
success: function (res) {
layer.closeAll('dialog');
if (res.state == 'ok') {
showAlertAndJump(res.msg, res.url);
} else if (res.state == 'fail') {
showFailMsg(res.msg);
} else if (res.state == 'over') {
jumpToUrl(res.url);
}
},
error: function () {
layer.closeAll('dialog');
showFailMsg('网络异常,请稍后重试');
}
});
layer.close(index);
});
return false;
});
form.on('submit(addressInfoSub)', function (data) {
if ($(".layui-form input[name='preGroup']:checked").length > 3) {
layer.msg("高考选科组合最多选择3项");
return false;
}
var preGroup = $(".layui-form input[name='preGroup']:checked").map(function () {
return $(this).val();
}).get().join(',');
data.field.preGroup = preGroup;
$.ajax({
url: '/info/saveAddressInfo',
type: 'post',
data: data.field,
dataType: 'json',
beforeSend: function () {
layer.msg("正在处理,请稍后……", {time: 0});
},
success: function (res) {
layer.closeAll();
if (res.state == 'ok') {
showAlertAndJump(res.msg, res.url);
} else if (res.state == 'fail') {
showFailMsg(res.msg);
} else if (res.state == 'over') {
jumpToUrl(res.url);
}
},
error: function () {
layer.closeAll();
showFailMsg('网络异常,请稍后重试');
}
});
return false;
});
/** 监听特长生选择 */
form.on('radio(isSpecial)', function (data) {
if (data.value == '0') {
$(".specialContent_item").attr("lay-verify", "");
$(".specialContent").addClass("layui-hide");
} else {
$(".specialContent_item").attr("lay-verify", "requiredSelect");
$(".specialContent").removeClass("layui-hide");
}
});
// 特长生一级分类
form.on('select(specialI)', function (data) {
if (!data.value) {
$("#special_ii").html("");
return;
}
layer.load(2);
$.ajax({
url: '/enroll/getSpecialList',
type: 'post',
data: {
pId: data.value
},
dataType: 'json',
success: function (res) {
layer.closeAll("loading");
if (res.state == 'ok') {
$("#special_ii").html("");
$(res.data).each(function (i, n) {
$("#special_ii").append("");
});
form.render();
} else if (res.state == 'fail') {
showFailMsg(res.msg);
} else if (res.state == 'over') {
jumpToUrl(res.url);
}
},
error: function () {
layer.closeAll('loading');
showFailMsg('网络异常,请稍后重试');
}
});
});
// 特长生二级分类
form.on('select(specialII)', function (data) {
if (!data.value) {
$("#special_iii").html("");
return;
}
layer.load(2);
$.ajax({
url: '/enroll/getSpecialList',
type: 'post',
data: {
pId: data.value
},
dataType: 'json',
success: function (res) {
layer.closeAll("loading");
if (res.state == 'ok') {
$("#special_iii").html("");
$(res.data).each(function (i, n) {
$("#special_iii").append("");
});
form.render();
} else if (res.state == 'fail') {
showFailMsg(res.msg);
} else if (res.state == 'over') {
jumpToUrl(res.url);
}
},
error: function () {
layer.closeAll('loading');
showFailMsg('网络异常,请稍后重试');
}
});
});
});