diff --git a/WebRoot/html/ypzs/view/apply.html b/WebRoot/html/ypzs/view/apply.html
index 4628509..1ad9010 100644
--- a/WebRoot/html/ypzs/view/apply.html
+++ b/WebRoot/html/ypzs/view/apply.html
@@ -15,22 +15,22 @@
@@ -42,29 +42,29 @@
@@ -97,7 +97,24 @@
, layer = layui.layer;
- var stageId = -1;
+ //学段
+ var stageId = 0;
+ //上传户口本照片ID
+ var imgId = "0";
+ //task_id
+ var taskId = 0;
+
+ //获取当前task_id
+ $.ajax({
+ type: "GET",
+ dataType: "json",
+ url: "/FengHuang/yp/getCurrentTaskInfo",
+ success: function (res) {
+ taskId = res.task_id;
+ }
+ });
+
+
//拖拽上传
@@ -105,26 +122,52 @@
elem: "#uploadImg"
, url: "/FengHuang/yp/uploadPic"
, done: function (res) {
- console.log(res);
- layer.msg('上传成功');
- layui.$('#uploadView').removeClass('layui-hide').find('img').attr('src', res.files.file);
+ layer.msg("上传成功!", {
+ icon: 1,
+ time: 1500
+ });
+ imgId = res.uuid;
+ layui.$('#uploadView').removeClass('layui-hide').find('img').attr('src', res.base64);
}
});
+
+ //提交
form.on('submit(save-apply)', function (data) {
+ if (stageId > 0) {
+ var fields = data.field;
- if (stageId == -1) {
- layer.msg("身份证输入有误,请重新输入!", {
- icon: 2,
- time: 2500
- });
+ $.ajax({
+ type: "POST",
+ url: "/FengHuang/yp/save",
+ data: { "task_id": taskId, "name": fields.name, "xb": fields.xb, "sfzh": fields.sfzh, "bx_id": stageId, "address": fields.address, "father_name": fields.father_name, "mother_name": fields.mother_name, "tel": fields.tel, "uuid": imgId },
+ success: function (data) {
+ console.log(data)
+ }
+ });
}
+ else {
+ if (stageId == -1) {
+ layer.msg("身份证输入有误,请重新输入!", {
+ icon: 2,
+ time: 2500
+ });
+ } else {
+ layer.msg("年龄不符合本次报名范围!", {
+ icon: 2,
+ time: 2500
+ });
+ }
+ return;
+ }
+
+
// window.location = "./success.html";
});
$('#idcard').blur(function () {
- if (stageId != -1) {
+ if (stageId > 0) {
$.ajax({
type: "GET",
dataType: "json",
@@ -135,13 +178,16 @@
stageId = res.bx_id;
}
else {
- stageId = -1;
- layer.msg(res.bx_name);
+ stageId = res.bx_id;
+ if (stageId == -1) {
+ $("#stageTag").html("身份证输入有误,请重新输入!");
+ } else {
+ $("#stageTag").html("年龄不符合本次报名范围!");
+ }
}
}
});
}
-
});
$('#idcard').bind('input propertychange', function () {
@@ -156,14 +202,18 @@
stageId = res.bx_id;
}
else {
- stageId = -1;
- layer.msg(res.bx_name);
+ stageId = res.bx_id;
+ if (stageId == -1) {
+ $("#stageTag").html("身份证输入有误,请重新输入!");
+ } else {
+ $("#stageTag").html("年龄不符合本次报名范围!");
+ }
}
}
});
}
if ($(this).val().length == 0) {
- stageId = -1;
+ stageId = 0;
$("#stageTag").html("输入身份证号后自动识别");
}
});