app.controller('StdInfoCtrl', [ '$rootScope', '$scope', '$http', '$timeout', '$state', '$stateParams', function($rootScope, $scope, $http, $timeout, $state, $stateParams) { $scope.StdReg = angular.copy($rootScope.ArtStdReg); //生源地 // $rootScope.ajaxRequest({ // url : '../enrol/reg/province/list.htm' // }, function(response) { // $scope.provinceArray = response.array; // }); // //邮寄省份 // $rootScope.ajaxRequest({ // url : '../enrol/std/reg/province/list.htm' // }, function(response) { // $scope.provArray = response.array; // }); // //邮寄城市初始列表 // $rootScope.ajaxRequest({ // url : '../enrol/std/reg/city/alllist.htm' // }, function(response) { // $scope.cityArray = response.array; // }); // //过滤城市 // $scope.freshCity = function() { // $rootScope.ajaxRequest({ // url : '../enrol/std/reg/city/list.htm?province_id=' + $scope.StdReg.link_province // }, function(response) { // $scope.cityArray = response.array; // }); // } $scope.YmStdCategoryArray = []; /**************************** * 根据省份-查找该省份的文理区分 */ $scope.findProvinceArtScience = function () { $rootScope.ajaxRequest({ url: '../conf/std/reg/get/province.htm', data: {province_id: $scope.StdReg.std_province} }, function (response) { if (response.entity) { $scope.artArr = []; $scope.artArr = response.entity.art_science_status.split(","); for (const art of $scope.artArr) { for (const st of $rootScope.StdCategoryArray) { if (art == st.dict_value) { $scope.YmStdCategoryArray.push(st); break; } } } if($scope.YmStdCategoryArray.length == 1) { $scope.StdReg.std_param3 = $scope.YmStdCategoryArray[0].dict_value; } $scope.YmStdCategoryArray.unshift({dict_text: '请选择', dict_value: null}); } }); } // 获取截止时间标志 $scope.getDeadLineFlag = function() { $rootScope.ajaxRequest({ url : '../enrol/std/modify/info/flag/get.htm' }, function(response) { $scope.modifyFlag = response.entity; }); } $scope.findProvinceArtScience(); $scope.getDeadLineFlag(); //是否是中文 $scope.isChinese = function(str){ var reg = /^[\u4e00-\u9fa5]+$/; return reg.test(str); } /************** * 完善个人信息 */ $scope.saveExtendInfo = function(){ // 判断是否修改过属性 var change = false; for ( var attr in $scope.StdReg) { if ($scope.StdReg[attr] !== $rootScope.ArtStdReg[attr]) { change = true; break; } } /*if(change) { $.alert("报名时间已过,不允许修改个人信息!"); return; } if ($scope.StdReg["link_addr"] !== $rootScope.ArtStdReg["link_addr"]) { $.alert("已过邮寄地址修改时间[2021-01-12 22:00:00],不能修改!"); return; } if ($scope.StdReg["link_province"] !== $rootScope.ArtStdReg["link_province"]) { $.alert("已过邮寄地址修改时间[2021-01-12 22:00:00],不能修改!"); return; } if ($scope.StdReg["link_city"] !== $rootScope.ArtStdReg["link_city"]) { $.alert("已过邮寄地址修改时间[2021-01-12 22:00:00],不能修改!"); return; }*/ if ($scope.StdReg.link_mobile && $scope.StdReg.std_mobile == $scope.StdReg.link_mobile) { $.alert('紧急联系电话与本人手机号码不能相同!'); return false; } //政治面貌 if ($scope.StdReg.std_political == undefined || $scope.StdReg.std_political == '') { $.alert('请选择政治面貌!'); return false; } //科类 if ($scope.StdReg.std_param3 == undefined || $scope.StdReg.std_param3 == '' || $scope.StdReg.std_param3.length == 0) { $.alert('请选择科类!'); return false; } //科类 if ($scope.StdReg.std_param4 == undefined || $scope.StdReg.std_param4 == '' || $scope.StdReg.std_param4.length == 0) { $.alert('请选择毕业类型!'); return false; } //毕业学校 if ($rootScope.getParamValue('EnrolReg_ShowStdSchool','Active') == 'Active' && ($scope.StdReg.std_school == undefined || $scope.StdReg.std_school == '')) { $.alert('请填写毕业学校!'); return false; } //考生类别 if ($scope.StdReg.std_param5 == undefined || $scope.StdReg.std_param5 == '') { $.alert('请选择考生类别!'); return false; } /**毕业时间**/ if ($scope.StdReg.end_date == undefined || $scope.StdReg.end_date == '') { $.alert('请填写毕业时间!'); return false; } //紧急联系人 if ($scope.StdReg.link_man == undefined || $scope.StdReg.link_man == '') { $.alert('请填写紧急联系人!'); return false; } else if(!$scope.isChinese($scope.StdReg.link_man)) { $.alert('紧急联系人必须是汉字!'); return false; } //家长手机号 if ($scope.StdReg.link_mobile == undefined || $scope.StdReg.link_mobile == '') { $.alert('请填写联系人手机号!'); return false; } //通信地址 if ($rootScope.getParamValue('EnrolReg_LinkAddr','Active') == 'Active' && ($scope.StdReg.link_addr == undefined || $scope.StdReg.link_addr == '')) { $.alert('请填写通讯地址!'); return false; } //邮政编码 if ($scope.StdReg.link_postal == undefined || $scope.StdReg.link_postal == '' || $scope.StdReg.link_postal.length==0) { $.alert('请填写邮政编码!'); return false; } //电子邮箱 if ($rootScope.getParamValue('EnrolReg_email','Active') == 'Active') { if($scope.StdReg.email == undefined || $scope.StdReg.email == '') { $.alert('请填写电子邮箱!'); return false; } } $.showLoading("正在提交考生信息,请稍后...") $rootScope.ajaxRequest({ url : '../enrol/std/info/save.htm', data : $scope.StdReg }, function(response) { // $.toast("考生信息已保存!"); $.alert("考生信息已保存!") $.hideLoading(); $rootScope.ArtStdReg = response.entity; }); } //使用weiui自带的默认日期选择器 $('#showDatePicker').on('click', function() { weui.datePicker({ start: 1990, end: new Date().getFullYear()+1, defaultValue: [new Date().getFullYear(), new Date().getMonth()+1, new Date().getDate()], depth:2, onChange: function (result) { //console.log(result); }, onConfirm: function (result) { $scope.$apply(function () { $scope.StdReg.end_date = result[0].label + result[1].label; }); }, title: '日期选择' }); }); } ])