std_reg.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533
  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(flag == 1) {
  202. if ($scope.StdReg.std_name_confirm == undefined || $scope.StdReg.std_name_confirm.length === 0) {
  203. $.alert('请输入确认姓名!');
  204. return false;
  205. }
  206. if ($scope.StdReg.std_name_confirm != $scope.StdReg.std_name) {
  207. $.alert("自动识别的姓名和考生确认的姓名不一致,请修改为正确的姓名!");
  208. return false;
  209. }
  210. }
  211. $.showLoading("正在提交考生信息,请稍后...")
  212. //针对非大陆考生
  213. if(flag == 2) {
  214. $.confirm("请确认考生信息!", function() {
  215. // 点击确认后的回调函数
  216. $rootScope.ajaxRequest({
  217. url : '../enrol/reg/save.htm',
  218. data : $scope.StdReg
  219. }, function(response) {
  220. $.hideLoading();
  221. $scope.StdReg = response.entity;
  222. $rootScope.ArtStdReg = $scope.StdReg;
  223. // 上传免冠证件照
  224. if($scope.StdReg.std_image) {
  225. $scope.curStep = 'StdExtendInfo';
  226. } else {
  227. // 上传免冠证件照
  228. $scope.curStep = 'NoCrownPhotoWarning';
  229. }
  230. });
  231. }, function() {
  232. // 点击取消后的回调函数
  233. });
  234. } else {
  235. $rootScope.ajaxRequest({
  236. url : '../enrol/reg/save.htm',
  237. data : $scope.StdReg
  238. }, function(response) {
  239. $.hideLoading();
  240. $scope.StdReg = response.entity;
  241. $rootScope.ArtStdReg = $scope.StdReg;
  242. // 上传免冠证件照
  243. if($scope.StdReg.std_image) {
  244. $scope.curStep = 'StdExtendInfo';
  245. } else {
  246. // 上传免冠证件照
  247. $scope.curStep = 'NoCrownPhotoWarning';
  248. }
  249. });
  250. }
  251. }
  252. //是否是中文
  253. $scope.isChinese = function(str){
  254. var reg = /^[\u4e00-\u9fa5]+$/;
  255. return reg.test(str);
  256. }
  257. /***************************************************************************
  258. * 完善个人信息
  259. */
  260. $scope.saveExtendInfo = function() {
  261. // 考生
  262. if($rootScope.getParamValue('SchoolCode') === '51065' ) {
  263. if ($scope.StdReg.std_type === undefined || $scope.StdReg.std_type === '') {
  264. $.alert('请选择考生类型!');
  265. return false;
  266. }
  267. }
  268. if ($scope.StdReg.link_mobile && $scope.StdReg.std_mobile == $scope.StdReg.link_mobile) {
  269. $.alert('紧急联系人手机与本人手机号码不能相同!');
  270. return false;
  271. }
  272. //政治面貌
  273. if ($scope.StdReg.std_political == undefined || $scope.StdReg.std_political == '') {
  274. $.alert('请选择政治面貌!');
  275. return false;
  276. }
  277. //科类
  278. if ($scope.StdReg.std_param3 == undefined || $scope.StdReg.std_param3 == '' || $scope.StdReg.std_param3.length === 0) {
  279. $.alert('请选择科类!');
  280. return false;
  281. }
  282. //科类
  283. if ($scope.StdReg.std_param4 == undefined || $scope.StdReg.std_param4 == '' || $scope.StdReg.std_param4.length == 0) {
  284. $.alert('请选择毕业类型!');
  285. return false;
  286. }
  287. //毕业学校
  288. if ($rootScope.getParamValue('EnrolReg_ShowStdSchool','Active') == 'Active' &&
  289. ($scope.StdReg.std_school == undefined || $scope.StdReg.std_school == '')) {
  290. $.alert('请填写毕业学校!');
  291. return false;
  292. }
  293. //考生类别
  294. if ($scope.StdReg.std_param5 == undefined || $scope.StdReg.std_param5 == '') {
  295. $.alert('请选择考生类别!');
  296. return false;
  297. }
  298. /**毕业时间**/
  299. if ($scope.StdReg.end_date == undefined || $scope.StdReg.end_date == '') {
  300. $.alert('请填写毕业时间!');
  301. return false;
  302. }
  303. //紧急联系人
  304. if ($scope.StdReg.link_man == undefined || $scope.StdReg.link_man == '') {
  305. $.alert('请填写紧急联系人!');
  306. return false;
  307. } else if(!$scope.isChinese($scope.StdReg.link_man)) {
  308. $.alert('紧急联系人必须是汉字!');
  309. return false;
  310. }
  311. //家长手机号
  312. if ($scope.StdReg.link_mobile == undefined || $scope.StdReg.link_mobile == '') {
  313. $.alert('请填写联系人手机号!');
  314. return false;
  315. }
  316. //通信地址
  317. if ($rootScope.getParamValue('EnrolReg_LinkAddr','Active') == 'Active' &&
  318. ($scope.StdReg.link_addr == undefined || $scope.StdReg.link_addr == '')) {
  319. $.alert('请填写通讯地址!');
  320. return false;
  321. }
  322. //邮政编码
  323. if ($scope.StdReg.link_postal == undefined || $scope.StdReg.link_postal == '' || $scope.StdReg.link_postal.length===0) {
  324. $.alert('请填写邮政编码!');
  325. return false;
  326. }
  327. if ($scope.StdReg.link_postal.length!==6 || $scope.isChinese($scope.StdReg.link_postal)) {
  328. $.alert('请输入6位的邮政编码!');
  329. return false;
  330. }
  331. //电子邮箱
  332. if ($rootScope.getParamValue('EnrolReg_email','Active') == 'Active') {
  333. if($scope.StdReg.email == undefined || $scope.StdReg.email == '') {
  334. $.alert('请填写电子邮箱!');
  335. return false;
  336. }
  337. }
  338. $.confirm("请确认考生信息!", function() {
  339. // 点击确认后的回调函数
  340. $.showLoading("正在提交考生信息,请稍后...")
  341. $rootScope.ajaxRequest({
  342. url : '../enrol/std/info/save.htm',
  343. data : $scope.StdReg
  344. }, function(response) {
  345. $.hideLoading();
  346. // 显示注册成功
  347. $scope.curStep = 'RegSuccess';
  348. });
  349. }, function() {
  350. // 点击取消后的回调函数
  351. });
  352. }
  353. /***************************************************************************
  354. * 上传免冠证件照
  355. */
  356. $scope.uploadNoCrownPhotoOther = function() {
  357. $rootScope.uploadStdMaterialOnline('NoCrownPhoto', function() {
  358. // $scope.curStep = 'StdExtendInfo';
  359. if ($rootScope.checkParamValue('EnrolVerifyStdIdentity', 'InActive', 'Active')) {
  360. $scope.curStep = 'VerifySuccess';
  361. } else {
  362. $scope.curStep = 'StdExtendInfo';
  363. }
  364. });
  365. }
  366. let bizToken = sessionStorage.getItem("biz_token");
  367. // 找不到取最新的bizToken
  368. if (!bizToken) {
  369. bizToken = $scope.StdReg.biz_token;
  370. }
  371. if (bizToken) {
  372. $scope.showLiveCheckLoading = true;
  373. $rootScope.ajaxRequest(
  374. {
  375. url: "../std/register/live/result.htm",
  376. data: {
  377. bizToken: bizToken,
  378. },
  379. },
  380. function (res) {
  381. $scope.showLiveCheckLoading = false;
  382. // location.reload();
  383. $.hideLoading();
  384. if (res && res.result == 1) {
  385. $scope.curStep = "StdExtendInfo";
  386. }
  387. }
  388. );
  389. sessionStorage.removeItem("biz_token");
  390. }
  391. $scope.uploadNoCrownPhoto = function () {
  392. $rootScope.ajaxRequest(
  393. {
  394. url: "../std/register/live/token.htm",
  395. data: {
  396. stdName: $scope.StdReg.std_name,
  397. certId: $scope.StdReg.cert_id,
  398. },
  399. },
  400. function (res) {
  401. $.hideLoading();
  402. if (res && res.url && res.bizToken) {
  403. sessionStorage.setItem("biz_token", res.bizToken);
  404. location.href = res.url;
  405. }
  406. }
  407. );
  408. };
  409. $scope.goStep = function(step) {
  410. $scope.curStep = step;
  411. }
  412. $scope.openIdCard = function() {
  413. wx.chooseImage({
  414. count : 1, // 默认9
  415. sizeType : [ 'compressed' ], // 可以指定是原图还是压缩图,默认二者都有'original',
  416. sourceType : [ 'album', 'camera' ], // 可以指定来源是相册还是相机,默认二者都有
  417. success : function(res) {
  418. var localIds = res.localIds; // 返回选定照片的本地ID列表,localId可以作为img标签的src属性显示图片
  419. wx.uploadImage({
  420. localId : localIds[0], // 需要上传的图片的本地ID,由chooseImage接口获得
  421. isShowProgressTips : 1, // 默认为1,显示进度提示
  422. success : function(serverRes) {
  423. var serverId = serverRes.serverId; // 返回图片的服务器端ID
  424. $.showLoading("证件照片上传中,请稍后...")
  425. // 上传成功,去服务器取图片
  426. $rootScope.ajaxRequest({
  427. url : '../enrol/wx/reg/idcard/' + ($scope.StdReg.std_province < '70' ? '' : 'other/') + 'upload.htm',
  428. data : {
  429. media_id : serverId
  430. }
  431. }, function(response) {
  432. $.hideLoading();
  433. if ($scope.StdReg.std_province < '70') {
  434. //针对新疆少民,限定特定的民族才能选择这个类别
  435. if($scope.StdReg.std_province == '66') {
  436. var arr = ['维吾尔','哈萨克','蒙古','柯尔克孜','塔吉克','锡伯','乌孜别克','塔塔尔','达斡尔','藏','俄罗斯'];
  437. if(!arr.inArray(response.map.IdCardInfo.person_nation)) {
  438. $.hideLoading();
  439. $.alert('民族信息不匹配,请重新选择考生类型注册。<br>新疆少数民族协作计划面向维吾尔族、哈萨克族、蒙古族、柯尔克孜族、塔吉克族、锡伯族、乌孜别克族、塔塔尔族、达斡尔族、藏族、俄罗斯族考生报考', '提示');
  440. return;
  441. }
  442. }
  443. $scope.StdReg.cert_id = response.map.IdCardInfo.person_code;
  444. $scope.StdReg.std_name = response.map.IdCardInfo.person_name;
  445. $scope.StdReg.std_sex = response.map.IdCardInfo.person_sex;
  446. $scope.StdReg.std_nation = response.map.IdCardInfo.person_nation;
  447. $scope.StdReg.cert_addr = response.map.IdCardInfo.person_addr;
  448. $scope.curStep = 'IdCardResult';
  449. } else {
  450. //香港、台湾、澳门的考生,需要显示不同的提示
  451. if ($scope.StdReg.std_province == '71') {
  452. $scope.certTips = '请输入台湾身份证号码';
  453. } else if ($scope.StdReg.std_province == '80' || $scope.StdReg.std_province == '81') {
  454. $scope.certTips = '请输入香港身份证件号码';
  455. } else if ($scope.StdReg.std_province == '82') {
  456. $scope.certTips = '请输入澳门身份证件号码';
  457. } else {
  458. $scope.certTips = '请输入身份证号码';
  459. }
  460. $scope.curStep = 'IdCardOther';
  461. }
  462. $scope.StdReg.idcard_file_name = response.map.IdCardFileName;
  463. });
  464. },
  465. fail : function(error) {
  466. $.hideLoading();
  467. $.alert('系统繁忙,请稍侯再试', '错误提示');
  468. }
  469. });
  470. }
  471. });
  472. }
  473. //选择毕业日期
  474. $scope.getGraduateDate = function() {
  475. weui.datePicker({
  476. start: 1990,
  477. end: new Date().getFullYear(),
  478. defaultValue: [new Date().getFullYear(), new Date().getMonth()+1, new Date().getDate()],
  479. depth:2,
  480. onChange: function (result) {
  481. //console.log(result);
  482. },
  483. onConfirm: function (result) {
  484. $scope.$apply(function () {
  485. $scope.StdReg.end_date = result[0].label + result[1].label;
  486. });
  487. },
  488. title: '日期选择'
  489. });
  490. }
  491. } ])