std_reg.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522
  1. app.controller('StdRegCtrl', [ '$rootScope', '$scope', '$http', '$timeout', '$state', '$stateParams', function($rootScope, $scope, $http, $timeout, $state, $stateParams) {
  2. $scope.showLiveCheckLoading = false;
  3. $scope.curStep = 'start';
  4. $scope.StdReg = {};
  5. $scope.YmStdCategoryArray = [];
  6. if(!$rootScope.loginSuccess)
  7. return;
  8. /****************************
  9. * 根据省份-查找该省份的文理区分
  10. */
  11. $scope.findProvinceArtScience = function () {
  12. $rootScope.ajaxRequest({
  13. url: '../conf/std/reg/get/province.htm',
  14. data: {province_id: $scope.StdReg.std_province}
  15. }, function (response) {
  16. if (response.entity) {
  17. $scope.artArr = [];
  18. if(response.entity.art_science_status) {
  19. $scope.artArr = response.entity.art_science_status.split(",");
  20. }
  21. for (const art of $scope.artArr) {
  22. for (const st of $rootScope.StdCategoryArray) {
  23. if (art === st.dict_value) {
  24. $scope.YmStdCategoryArray.push(st);
  25. break;
  26. }
  27. }
  28. }
  29. if($scope.YmStdCategoryArray.length === 1) {
  30. $scope.StdReg.std_param3 = $scope.YmStdCategoryArray[0].dict_value;
  31. }
  32. $scope.YmStdCategoryArray.unshift({dict_text: '请选择', dict_value: null});
  33. }
  34. });
  35. }
  36. if ($rootScope.ArtStdReg !== undefined) {
  37. $scope.StdReg = angular.extend({}, $rootScope.ArtStdReg);
  38. if ($scope.StdReg.reg_status === 'IdCard') {
  39. $scope.curStep = 'NoCrownPhotoWarning';
  40. } else if ($scope.StdReg.reg_status === 'NoCrownPhoto') {
  41. $scope.curStep = 'StdExtendInfo';
  42. $scope.findProvinceArtScience();
  43. }
  44. }
  45. $scope.getCategory = function () {
  46. if ($scope.YmStdCategoryArray.length < 1) {
  47. $scope.findProvinceArtScience();
  48. }
  49. }
  50. // 以下为邮寄相关接口
  51. /**生源地
  52. $rootScope.ajaxRequest({
  53. url : '../enrol/reg/province/list.htm'
  54. }, function(response) {
  55. $scope.provinceArray = response.array;
  56. });**/
  57. //邮寄省份
  58. /* $rootScope.ajaxRequest({
  59. url : '../enrol/std/reg/province/list.htm'
  60. }, function(response) {
  61. $scope.provArray = response.array;
  62. }); */
  63. /**邮寄城市初始列表
  64. $rootScope.ajaxRequest({
  65. url : '../enrol/std/reg/city/alllist.htm'
  66. }, function(response) {
  67. $scope.cityArray = response.array;
  68. }); */
  69. //过滤城市
  70. /* $scope.freshCity = function() {
  71. $rootScope.ajaxRequest({
  72. url : '../enrol/std/reg/city/list.htm?province_id=' + $scope.StdReg.link_province
  73. }, function(response) {
  74. $scope.cityArray = response.array;
  75. });
  76. } */
  77. //alert($rootScope.checkParamValue('EnrolVerifyStdIdentity', 'InActive', 'Active'));
  78. // alert($rootScope.getParamValue('EnrolVerifyStdIdentity', 'InActive'));
  79. // console.log($rootScope.FrameParam);
  80. //选择考生类型
  81. $scope.chooseStdType = function (d) {
  82. $rootScope.ajaxRequest({
  83. url: '../enrol/province/list/stdType.htm',
  84. data: {std_type: d.dict_value}
  85. }, function (response) {
  86. $scope.provinceArray = response.array;
  87. $scope.curStep = 'province';
  88. });
  89. }
  90. /***************************************************************************
  91. * 选择生源地
  92. */
  93. $scope.chooseProvince = function(p) {
  94. if(p.reg_status === 'InActive') {
  95. var msg = '未开放【'+p.province_name+'】考生注册!';
  96. if(p.reg_fetch_param !== undefined)
  97. msg = p.reg_fetch_param;
  98. $.alert(msg);
  99. return;
  100. }
  101. $scope.currentProvince = p;
  102. $scope.StdReg.std_province = p.province_id;
  103. $scope.StdReg.province_name = p.province_name;
  104. if ((p.province_id + '') === '90') {
  105. // 外国,护照
  106. $scope.curStep = 'PassportWarning';
  107. $scope.StdReg.cert_type = 'Passport';
  108. } else if ((p.province_id + '') === '71') {
  109. // 台湾,台湾居民往来大陆通行证,澳门,香港 港澳居民来往内地通行证
  110. $scope.curStep = 'IdCard71Warning';
  111. $scope.StdReg.cert_type = 'TaiWanPass';
  112. }else if ((p.province_id + '') === '80' || (p.province_id + '') === '81' || (p.province_id + '') === '82') {
  113. // 澳门,香港 港澳居民来往内地通行证
  114. $scope.curStep = 'HongKongMacaoPass';
  115. $scope.StdReg.cert_type = 'TaiWanPass';
  116. } else if (p.ksh_status === 'Active') {
  117. // 必须有高考报名号
  118. $scope.curStep = 'ExamIdWarning';
  119. } else {
  120. // 大陆,需要上传身份证
  121. $scope.curStep = 'IdCardWarning';
  122. $scope.StdReg.cert_type = 'IdCard';
  123. }
  124. $scope.findProvinceArtScience();
  125. }
  126. $scope.checkExamId = function() {
  127. $scope.StdReg.exam_id = $.trim($scope.StdReg.exam_id);
  128. if ($scope.StdReg.exam_id === undefined || $scope.StdReg.exam_id.length === 0) {
  129. $.alert('高考报名号必须填写!');
  130. return false;
  131. }
  132. $.showLoading("正在提交考生信息,请稍后...")
  133. $rootScope.ajaxRequest({
  134. url : '../enrol/reg/province/check.htm',
  135. data : $scope.StdReg
  136. }, function(response) {
  137. $.hideLoading();
  138. // 大陆,需要上传身份证
  139. $scope.curStep = 'IdCardWarning';
  140. $scope.StdReg.cert_type = 'IdCard';
  141. });
  142. }
  143. //非大陆考生通行证和证件号码判断
  144. $scope.isCert = function(str) {
  145. var pat = /^[a-zA-Z0-9()]+$/;
  146. return pat.test(str);
  147. }
  148. /***************************************************************************
  149. * 识别正确,保存用户信息
  150. */
  151. $scope.saveIdCard = function(flag) {
  152. $scope.StdReg.cert_id = $.trim($scope.StdReg.cert_id);
  153. $scope.StdReg.std_name = $.trim($scope.StdReg.std_name);
  154. $scope.StdReg.std_sex = $.trim($scope.StdReg.std_sex);
  155. $scope.StdReg.std_mobile = $.trim($scope.StdReg.std_mobile);
  156. $scope.StdReg.std_name_confirm = $.trim($scope.StdReg.std_name_confirm);
  157. if ($scope.StdReg.cert_id === undefined || $scope.StdReg.cert_id.length === 0) {
  158. $.alert('请输入证件号码!');
  159. return false;
  160. }
  161. if(flag === 2) {
  162. if ($scope.StdReg.std_param2 === undefined || $scope.StdReg.std_param2.length === 0) {
  163. $.alert('请输入身份证号码!');
  164. return false;
  165. }
  166. if($scope.StdReg.cert_id.indexOf('(') !==-1 || $scope.StdReg.cert_id.indexOf(')')!== -1) {
  167. $.alert('证件号码请输入半角括号!');
  168. return false;
  169. }
  170. if($scope.StdReg.std_param2.indexOf('(') !==-1 || $scope.StdReg.std_param2.indexOf(')') !== -1) {
  171. $.alert('身份证号码请输入半角括号!');
  172. return false;
  173. }
  174. if(!$scope.isCert($scope.StdReg.cert_id)) {
  175. if($scope.StdReg.std_province === '90') {
  176. $.alert('护照号只能为数字、字母、半角括号!');
  177. return false;
  178. } else {
  179. $.alert('证件号码只能为数字、字母、半角括号!');
  180. return false;
  181. }
  182. }
  183. if(!$scope.isCert($scope.StdReg.std_param2)) {
  184. $.alert('居民身份证只能为数字、字母、半角括号!');
  185. return false;
  186. }
  187. }
  188. if ($scope.StdReg.std_name === undefined || $scope.StdReg.std_name.length === 0) {
  189. $.alert('请输入考生姓名!');
  190. return false;
  191. }
  192. if ($scope.StdReg.std_sex === undefined || $scope.StdReg.std_sex.length === 0) {
  193. $.alert('请选择考生性别!');
  194. return false;
  195. }
  196. if ($scope.StdReg.std_mobile === undefined || $scope.StdReg.std_mobile.length !== 11) {
  197. $.alert('请输入正确的手机号码!');
  198. return false;
  199. }
  200. // 识别姓名和自输入姓名不相等
  201. if ($scope.StdReg.std_name_confirm !== $scope.StdReg.std_name) {
  202. $.alert("自动识别的姓名和考生确认的姓名不一致,请修改为正确的姓名!");
  203. return false;
  204. }
  205. $.showLoading("正在提交考生信息,请稍后...")
  206. //针对非大陆考生
  207. if(flag === 2) {
  208. $.confirm("请确认考生信息!", function() {
  209. // 点击确认后的回调函数
  210. $rootScope.ajaxRequest({
  211. url : '../enrol/reg/save.htm',
  212. data : $scope.StdReg
  213. }, function(response) {
  214. $.hideLoading();
  215. $scope.StdReg = response.entity;
  216. $rootScope.ArtStdReg = $scope.StdReg;
  217. // 上传免冠证件照
  218. if($scope.StdReg.std_image) {
  219. $scope.curStep = 'StdExtendInfo';
  220. } else {
  221. // 上传免冠证件照
  222. $scope.curStep = 'NoCrownPhotoWarning';
  223. }
  224. });
  225. }, function() {
  226. // 点击取消后的回调函数
  227. });
  228. } else {
  229. $rootScope.ajaxRequest({
  230. url : '../enrol/reg/save.htm',
  231. data : $scope.StdReg
  232. }, function(response) {
  233. $.hideLoading();
  234. $scope.StdReg = response.entity;
  235. $rootScope.ArtStdReg = $scope.StdReg;
  236. // 上传免冠证件照
  237. if($scope.StdReg.std_image) {
  238. $scope.curStep = 'StdExtendInfo';
  239. } else {
  240. // 上传免冠证件照
  241. $scope.curStep = 'NoCrownPhotoWarning';
  242. }
  243. });
  244. }
  245. }
  246. //是否是中文
  247. $scope.isChinese = function(str){
  248. var reg = /^[\u4e00-\u9fa5]+$/;
  249. return reg.test(str);
  250. }
  251. /***************************************************************************
  252. * 完善个人信息
  253. */
  254. $scope.saveExtendInfo = function() {
  255. // 考生
  256. if($rootScope.getParamValue('SchoolCode') === '51065' ) {
  257. if ($scope.StdReg.std_type === undefined || $scope.StdReg.std_type === '') {
  258. $.alert('请选择考生类型!');
  259. return false;
  260. }
  261. }
  262. if ($scope.StdReg.link_mobile && $scope.StdReg.std_mobile === $scope.StdReg.link_mobile) {
  263. $.alert('紧急联系人手机与本人手机号码不能相同!');
  264. return false;
  265. }
  266. //政治面貌
  267. if ($scope.StdReg.std_political === undefined || $scope.StdReg.std_political === '') {
  268. $.alert('请选择政治面貌!');
  269. return false;
  270. }
  271. //科类
  272. if ($scope.StdReg.std_param3 === undefined || $scope.StdReg.std_param3 === '' || $scope.StdReg.std_param3.length === 0) {
  273. $.alert('请选择科类!');
  274. return false;
  275. }
  276. //科类
  277. if ($scope.StdReg.std_param4 === undefined || $scope.StdReg.std_param4 === '' || $scope.StdReg.std_param4.length === 0) {
  278. $.alert('请选择毕业类型!');
  279. return false;
  280. }
  281. //毕业学校
  282. if ($rootScope.getParamValue('EnrolReg_ShowStdSchool','Active') === 'Active' &&
  283. ($scope.StdReg.std_school === undefined || $scope.StdReg.std_school === '')) {
  284. $.alert('请填写毕业学校!');
  285. return false;
  286. }
  287. //考生类别
  288. if ($scope.StdReg.std_param5 === undefined || $scope.StdReg.std_param5 === '') {
  289. $.alert('请选择考生类别!');
  290. return false;
  291. }
  292. /**毕业时间**/
  293. if ($scope.StdReg.end_date === undefined || $scope.StdReg.end_date === '') {
  294. $.alert('请填写毕业时间!');
  295. return false;
  296. }
  297. //紧急联系人
  298. if ($scope.StdReg.link_man === undefined || $scope.StdReg.link_man === '') {
  299. $.alert('请填写紧急联系人!');
  300. return false;
  301. } else if(!$scope.isChinese($scope.StdReg.link_man)) {
  302. $.alert('紧急联系人必须是汉字!');
  303. return false;
  304. }
  305. //家长手机号
  306. if ($scope.StdReg.link_mobile === undefined || $scope.StdReg.link_mobile === '') {
  307. $.alert('请填写联系人手机号!');
  308. return false;
  309. }
  310. //通信地址
  311. if ($rootScope.getParamValue('EnrolReg_LinkAddr','Active') === 'Active' &&
  312. ($scope.StdReg.link_addr === undefined || $scope.StdReg.link_addr === '')) {
  313. $.alert('请填写通讯地址!');
  314. return false;
  315. }
  316. //邮政编码
  317. if ($scope.StdReg.link_postal === undefined || $scope.StdReg.link_postal === '' || $scope.StdReg.link_postal.length===0) {
  318. $.alert('请填写邮政编码!');
  319. return false;
  320. }
  321. if ($scope.StdReg.link_postal.length!==6 || $scope.isChinese($scope.StdReg.link_postal)) {
  322. $.alert('请输入6位的邮政编码!');
  323. return false;
  324. }
  325. //电子邮箱
  326. if ($rootScope.getParamValue('EnrolReg_email','Active') === 'Active') {
  327. if($scope.StdReg.email === undefined || $scope.StdReg.email === '') {
  328. $.alert('请填写电子邮箱!');
  329. return false;
  330. }
  331. }
  332. $.confirm("请确认考生信息!", function() {
  333. // 点击确认后的回调函数
  334. $.showLoading("正在提交考生信息,请稍后...")
  335. $rootScope.ajaxRequest({
  336. url : '../enrol/std/info/save.htm',
  337. data : $scope.StdReg
  338. }, function(response) {
  339. $.hideLoading();
  340. // 显示注册成功
  341. $scope.curStep = 'RegSuccess';
  342. });
  343. }, function() {
  344. // 点击取消后的回调函数
  345. });
  346. }
  347. /***************************************************************************
  348. * 上传免冠证件照
  349. */
  350. /* $scope.uploadNoCrownPhoto = function() {
  351. $rootScope.uploadStdMaterialOnline('NoCrownPhoto', function() {
  352. // $scope.curStep = 'StdExtendInfo';
  353. if ($rootScope.checkParamValue('EnrolVerifyStdIdentity', 'InActive', 'Active')) {
  354. $scope.curStep = 'VerifySuccess';
  355. } else {
  356. $scope.curStep = 'StdExtendInfo';
  357. }
  358. });
  359. }*/
  360. let bizToken = sessionStorage.getItem("biz_token");
  361. if (bizToken) {
  362. $scope.showLiveCheckLoading = true;
  363. $rootScope.ajaxRequest(
  364. {
  365. url: "../std/register/live/result.htm",
  366. data: {
  367. bizToken: bizToken,
  368. },
  369. },
  370. function (res) {
  371. $scope.showLiveCheckLoading = false;
  372. // location.reload();
  373. $.hideLoading();
  374. if (res && res.result === 1) {
  375. $scope.curStep = "StdExtendInfo";
  376. }
  377. }
  378. );
  379. sessionStorage.removeItem("biz_token");
  380. }
  381. $scope.uploadNoCrownPhoto = function () {
  382. $rootScope.ajaxRequest(
  383. {
  384. url: "../std/register/live/token.htm",
  385. data: {
  386. stdName: $scope.StdReg.std_name,
  387. certId: $scope.StdReg.cert_id,
  388. },
  389. },
  390. function (res) {
  391. $.hideLoading();
  392. if (res && res.url && res.bizToken) {
  393. sessionStorage.setItem("biz_token", res.bizToken);
  394. location.href = res.url;
  395. }
  396. }
  397. );
  398. };
  399. $scope.goStep = function(step) {
  400. $scope.curStep = step;
  401. }
  402. $scope.openIdCard = function() {
  403. wx.chooseImage({
  404. count : 1, // 默认9
  405. sizeType : [ 'compressed' ], // 可以指定是原图还是压缩图,默认二者都有'original',
  406. sourceType : [ 'album', 'camera' ], // 可以指定来源是相册还是相机,默认二者都有
  407. success : function(res) {
  408. var localIds = res.localIds; // 返回选定照片的本地ID列表,localId可以作为img标签的src属性显示图片
  409. wx.uploadImage({
  410. localId : localIds[0], // 需要上传的图片的本地ID,由chooseImage接口获得
  411. isShowProgressTips : 1, // 默认为1,显示进度提示
  412. success : function(serverRes) {
  413. var serverId = serverRes.serverId; // 返回图片的服务器端ID
  414. $.showLoading("证件照片上传中,请稍后...")
  415. // 上传成功,去服务器取图片
  416. $rootScope.ajaxRequest({
  417. url : '../enrol/wx/reg/idcard/' + ($scope.StdReg.std_province < '70' ? '' : 'other/') + 'upload.htm',
  418. data : {
  419. media_id : serverId
  420. }
  421. }, function(response) {
  422. $.hideLoading();
  423. if ($scope.StdReg.std_province < '70') {
  424. //针对新疆少民,限定特定的民族才能选择这个类别
  425. if($scope.StdReg.std_province === '66') {
  426. var arr = ['维吾尔','哈萨克','蒙古','柯尔克孜','塔吉克','锡伯','乌孜别克','塔塔尔','达斡尔','藏','俄罗斯'];
  427. if(!arr.inArray(response.map.IdCardInfo.person_nation)) {
  428. $.hideLoading();
  429. $.alert('民族信息不匹配,请重新选择考生类型注册。<br>新疆少数民族协作计划面向维吾尔族、哈萨克族、蒙古族、柯尔克孜族、塔吉克族、锡伯族、乌孜别克族、塔塔尔族、达斡尔族、藏族、俄罗斯族考生报考', '提示');
  430. return;
  431. }
  432. }
  433. $scope.StdReg.cert_id = response.map.IdCardInfo.person_code;
  434. $scope.StdReg.std_name = response.map.IdCardInfo.person_name;
  435. $scope.StdReg.std_sex = response.map.IdCardInfo.person_sex;
  436. $scope.StdReg.std_nation = response.map.IdCardInfo.person_nation;
  437. $scope.StdReg.cert_addr = response.map.IdCardInfo.person_addr;
  438. $scope.curStep = 'IdCardResult';
  439. } else {
  440. //香港、台湾、澳门的考生,需要显示不同的提示
  441. if ($scope.StdReg.std_province === '71') {
  442. $scope.certTips = '请输入台湾身份证号码';
  443. } else if ($scope.StdReg.std_province === '80' || $scope.StdReg.std_province === '81') {
  444. $scope.certTips = '请输入香港身份证件号码';
  445. } else if ($scope.StdReg.std_province === '82') {
  446. $scope.certTips = '请输入澳门身份证件号码';
  447. } else {
  448. $scope.certTips = '请输入身份证号码';
  449. }
  450. $scope.curStep = 'IdCardOther';
  451. }
  452. $scope.StdReg.idcard_file_name = response.map.IdCardFileName;
  453. });
  454. },
  455. fail : function(error) {
  456. $.hideLoading();
  457. $.alert('系统繁忙,请稍侯再试', '错误提示');
  458. }
  459. });
  460. }
  461. });
  462. }
  463. //选择毕业日期
  464. $scope.getGraduateDate = function() {
  465. weui.datePicker({
  466. start: 1990,
  467. end: new Date().getFullYear(),
  468. defaultValue: [new Date().getFullYear(), new Date().getMonth()+1, new Date().getDate()],
  469. depth:2,
  470. onChange: function (result) {
  471. //console.log(result);
  472. },
  473. onConfirm: function (result) {
  474. $scope.$apply(function () {
  475. $scope.StdReg.end_date = result[0].label + result[1].label;
  476. });
  477. },
  478. title: '日期选择'
  479. });
  480. }
  481. } ])