...
|
...
|
@@ -11,7 +11,7 @@ var Dialog = require('../common/dialog').Dialog; |
|
|
|
|
|
var $sortItem = $('.sort-item'),
|
|
|
|
|
|
// $identity = $('#identity-wrap'),
|
|
|
$identity = $('#identity-wrap'),
|
|
|
$agreenShow = $('#agreen-show'),
|
|
|
$stuProv = $('#stu-province-show'),
|
|
|
$stuProvWrap = $stuProv.parent(),
|
...
|
...
|
@@ -20,14 +20,16 @@ var $sortItem = $('.sort-item'), |
|
|
$stuEdu = $('#stu-edu-show'),
|
|
|
$stuEduWrap = $stuEdu.parent(),
|
|
|
$stuYear = $('#stu-entrance-year-show'),
|
|
|
$stuYearWrap = $stuYear.parent();
|
|
|
$stuYearWrap = $stuYear.parent(),
|
|
|
$identityForm = $('#identity-form');
|
|
|
|
|
|
// $stuYearUl = $stuYear.next();
|
|
|
|
|
|
var $rightDia = $('#rights-dia'),
|
|
|
$couponDia = $('#coupon-dia');
|
|
|
|
|
|
var provFn;
|
|
|
var provFn,
|
|
|
identityFn;
|
|
|
|
|
|
var alertConfig,
|
|
|
makeAlert;
|
...
|
...
|
@@ -58,8 +60,7 @@ var redirect = { |
|
|
|
|
|
// handlebars模板
|
|
|
provFn = handlebars.compile($('#stu-select').html() || '');
|
|
|
|
|
|
// identityFn = handlebars.compile($('#identity-back').html() || '');
|
|
|
identityFn = handlebars.compile($('#identity-back').html() || '');
|
|
|
|
|
|
require('../plugins/slider');
|
|
|
|
...
|
...
|
@@ -82,7 +83,7 @@ function closeStuSelect() { |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 清除加载的下拉数据,还原点击状态
|
|
|
* 清除加载的下拉数据,还原点击状态,获取点击数据
|
|
|
* @param
|
|
|
* @param
|
|
|
*/
|
...
|
...
|
@@ -91,16 +92,48 @@ function clearSelectUl($li, code) { |
|
|
$ul = $li.parent();
|
|
|
|
|
|
var $show = $ul.prev(),
|
|
|
$wrap = $ul.parent();
|
|
|
$wrap = $ul.parent(),
|
|
|
$input = $wrap.prev();
|
|
|
|
|
|
$show.html($a.html());
|
|
|
if (arguments.length === 2) {
|
|
|
$show.attr(code, $a.attr(code));
|
|
|
$input.val($a.attr(code));
|
|
|
} else {
|
|
|
$input.val($a.html());
|
|
|
}
|
|
|
$ul.empty();
|
|
|
$wrap.removeClass('active');
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 最终提交表单
|
|
|
*/
|
|
|
function submitIdentity(json) {
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
url: '/product/students/verify',
|
|
|
data: json
|
|
|
}).then(function(data) {
|
|
|
if (data.code === 200) {
|
|
|
$identity.remove('.identity-back-wrap');
|
|
|
$identity.append(identityFn({
|
|
|
success: true
|
|
|
}));
|
|
|
} else {
|
|
|
$identity.remove('.identity-back-wrap');
|
|
|
$identity.append(identityFn({
|
|
|
fail: true
|
|
|
}));
|
|
|
|
|
|
$('#backForm').on('click', function() {
|
|
|
$identity.remove('.identity-back-wrap');
|
|
|
$identityForm.removeClass('hide');
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
lazyLoad($('img.lazy'));
|
|
|
|
|
|
// 根据配置执行展示弹窗
|
...
|
...
|
@@ -381,6 +414,58 @@ $('.enable .info').on('click', function(e) { |
|
|
redirect.gunangSrc = $(this).closest('a').get(0).href;
|
|
|
});
|
|
|
|
|
|
// $identity.html(identityFn({
|
|
|
// wait: true
|
|
|
// })); |
|
|
$('#identity-Btn').on('click', function() {
|
|
|
var identData = {
|
|
|
name: $('#stu-name').val(),
|
|
|
certNo: $('#stu-idNum').val(),
|
|
|
collegeName: $('#stu-school').val(),
|
|
|
educationDegree: $('#stu-edu').val(),
|
|
|
enrollmentYear: $('#stu-entrance-year').val()
|
|
|
};
|
|
|
|
|
|
var $prompt = $('#prompt'),
|
|
|
$agreen = $('#agreen-show');
|
|
|
|
|
|
if (identData.name === '') {
|
|
|
$prompt.html('真实姓名不能为空');
|
|
|
return;
|
|
|
}
|
|
|
if (!/^[\u4e00-\u9fa5a-zA-Z]{2,12}$/.test(identData.name)) {
|
|
|
$prompt.html('真实姓名为2~12个汉字或者英文');
|
|
|
return;
|
|
|
}
|
|
|
if (identData.certNo === '') {
|
|
|
$prompt.html('身份证号不能为空');
|
|
|
return;
|
|
|
}
|
|
|
if (!/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(identData.certNo)) {
|
|
|
$prompt.html('身份证号格式错误');
|
|
|
return;
|
|
|
}
|
|
|
if (identData.collegeName === '') {
|
|
|
$prompt.html('学校名称不能为空');
|
|
|
return;
|
|
|
}
|
|
|
if (identData.educationDegree === '') {
|
|
|
$prompt.html('学历程度不能为空');
|
|
|
return;
|
|
|
}
|
|
|
if (identData.enrollmentYear === '') {
|
|
|
$prompt.html('入学年份不能为空');
|
|
|
return;
|
|
|
}
|
|
|
if (!$agreen.hasClass('active')) {
|
|
|
$prompt.html('未同意Yoho!有货学生认证协议');
|
|
|
return;
|
|
|
}
|
|
|
$prompt.html('');
|
|
|
console.info(identData);
|
|
|
submitIdentity(identData);
|
|
|
$identityForm.addClass('hide');
|
|
|
$identity.remove('.identity-back-wrap');
|
|
|
$identity.append(identityFn({
|
|
|
wait: true
|
|
|
}));
|
|
|
|
|
|
|
|
|
}); |
...
|
...
|
|