std_reg.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443
  1. app.controller('StdRegCtrl', ['$rootScope', '$scope', '$http', '$timeout', '$state', '$stateParams', function ($rootScope, $scope, $http, $timeout, $state, $stateParams) {
  2. $scope.curStep = 'start';
  3. $scope.StdReg = {};
  4. if (!$rootScope.loginSuccess)
  5. return;
  6. /****************************
  7. * 根据省份-查找该省份的文理区分
  8. */
  9. $scope.findProvinceArtScience = function () {
  10. $rootScope.ajaxRequest({
  11. url: '../conf/std/reg/get/province.htm',
  12. data: {province_id: $scope.StdReg.std_province}
  13. }, function (response) {
  14. if (response.entity) {
  15. $scope.stdType = [];
  16. $scope.artArr = [];
  17. $scope.artArr = response.entity.art_science_status.split(",");
  18. for (const art of $scope.artArr) {
  19. for (const st of $rootScope.StdTypeArray) {
  20. if (art == st.dict_value) {
  21. $scope.stdType.push(st);
  22. break;
  23. }
  24. }
  25. }
  26. }
  27. });
  28. }
  29. if ($rootScope.ArtStdReg !== undefined) {
  30. $scope.StdReg = angular.extend({}, $rootScope.ArtStdReg);
  31. if ($scope.StdReg.reg_status == 'IdCard') {
  32. $scope.curStep = 'NoCrownPhotoWarning';
  33. } else if ($scope.StdReg.reg_status == 'NoCrownPhoto') {
  34. $scope.curStep = 'StdExtendInfo';
  35. //开启高考科类
  36. if ($rootScope.getParamValue('EnrolReg_StdType', 'InActive') == 'Active' && $scope.StdReg.std_province < 70) {
  37. $scope.findProvinceArtScience();
  38. }
  39. }
  40. }
  41. $rootScope.ajaxRequest({
  42. url: '../enrol/reg/province/list.htm'
  43. }, function (response) {
  44. $scope.provinceArray = response.array;
  45. });
  46. //alert($rootScope.checkParamValue('EnrolVerifyStdIdentity', 'InActive', 'Active'));
  47. // alert($rootScope.getParamValue('EnrolVerifyStdIdentity', 'InActive'));
  48. // console.log($rootScope.FrameParam);
  49. /***************************************************************************
  50. * 选择生源地
  51. */
  52. $scope.chooseProvince = function (p) {
  53. if (p.reg_status == 'InActive') {
  54. var msg = '未开放【' + p.province_name + '】考生注册!';
  55. if (p.reg_fetch_param != undefined)
  56. msg = p.reg_fetch_param;
  57. $.alert(msg);
  58. return;
  59. }
  60. $scope.currentProvince = p;
  61. $scope.StdReg.std_province = p.province_id;
  62. $scope.StdReg.province_name = p.province_name;
  63. if ((p.province_id + '') == '90') {
  64. // 外国,护照
  65. $scope.curStep = 'PassportWarning';
  66. $scope.StdReg.cert_type = 'Passport';
  67. } else if ((p.province_id + '') == '71') {
  68. // 台湾,台湾居民往来大陆通行证,澳门,香港 港澳居民来往内地通行证
  69. $scope.curStep = 'IdCard71Warning';
  70. $scope.StdReg.cert_type = 'TaiWanPass';
  71. } else if ((p.province_id + '') == '81' || (p.province_id + '') == '82') {
  72. // 澳门,香港 港澳居民来往内地通行证
  73. $scope.curStep = 'HongKongMacaoPass';
  74. $scope.StdReg.cert_type = 'TaiWanPass';
  75. } else if ((p.province_id + '') == '91') { //永久居留证
  76. $scope.curStep = 'IdCard91Warning';
  77. $scope.StdReg.cert_type = 'JuZhuZhengPass';
  78. } else {
  79. if (p.ksh_status == 'Active') {
  80. // 必须有高考报名号
  81. $scope.curStep = 'ExamIdWarning';
  82. } else {
  83. // 大陆,需要上传身份证
  84. $scope.curStep = 'IdCardWarning';
  85. $scope.StdReg.cert_type = 'IdCard';
  86. }
  87. }
  88. //开启高考科类
  89. if ($rootScope.getParamValue('EnrolReg_StdType', 'InActive') == 'Active' && $scope.StdReg.std_province < 70) {
  90. $scope.findProvinceArtScience();
  91. }
  92. }
  93. $scope.checkExamId = function () {
  94. $scope.StdReg.exam_id = $.trim($scope.StdReg.exam_id);
  95. if ($scope.StdReg.exam_id == undefined || $scope.StdReg.exam_id.length == 0) {
  96. $.alert('高考报名号必须填写!');
  97. return false;
  98. }
  99. $.showLoading("正在提交考生信息,请稍后...")
  100. $rootScope.ajaxRequest({
  101. url: '../enrol/reg/province/check.htm',
  102. data: $scope.StdReg
  103. }, function (response) {
  104. $.hideLoading();
  105. // 大陆,需要上传身份证
  106. $scope.curStep = 'IdCardWarning';
  107. $scope.StdReg.cert_type = 'IdCard';
  108. });
  109. }
  110. /***************************************************************************
  111. * 识别正确,保存用户信息
  112. */
  113. $scope.saveIdCard = function () {
  114. $scope.StdReg.cert_id = $.trim($scope.StdReg.cert_id);
  115. $scope.StdReg.std_name = $.trim($scope.StdReg.std_name);
  116. $scope.StdReg.std_sex = $.trim($scope.StdReg.std_sex);
  117. $scope.StdReg.std_mobile = $.trim($scope.StdReg.std_mobile);
  118. if ($scope.StdReg.cert_id == undefined || $scope.StdReg.cert_id.length == 0) {
  119. $.alert('请输入证件号码信息!');
  120. return false;
  121. }
  122. if ($scope.StdReg.std_name == undefined || $scope.StdReg.std_name.length == 0) {
  123. $.alert('请输入考生姓名信息!');
  124. return false;
  125. }
  126. if ($scope.StdReg.std_name_verify == undefined || $scope.StdReg.std_name_verify.length == 0) {
  127. $.alert('请输入确认考生姓名!');
  128. return false;
  129. }
  130. if ($scope.StdReg.std_sex == undefined || $scope.StdReg.std_sex.length == 0) {
  131. $.alert('请选择考生性别!');
  132. return false;
  133. }
  134. //港澳台的考生-手机号码-不做限制
  135. if ($scope.StdReg.std_mobile == undefined || $scope.StdReg.std_mobile.length == 0 ||
  136. ($scope.StdReg.std_province < 70 && $scope.StdReg.std_mobile.length != 11)) {
  137. $.alert('请输入正确的手机号码!');
  138. return false;
  139. }
  140. if ($scope.StdReg.std_mobile_verify == undefined || $scope.StdReg.std_mobile_verify.length == 0 ||
  141. ($scope.StdReg.std_province < 70 && $scope.StdReg.std_mobile_verify.length != 11)) {
  142. $.alert('请输入正确的确认手机号码!');
  143. return false;
  144. }
  145. if ($scope.StdReg.std_mobile !== $scope.StdReg.std_mobile_verify) {
  146. $.alert('手机号码2次输入不一致,请检查!');
  147. return false;
  148. }
  149. if ($scope.StdReg.std_name !== $scope.StdReg.std_name_verify) {
  150. $.confirm('系统识别的姓名和你输入的姓名不一致,系统将以你的的输入为准,确认吗?', function () {
  151. $.showLoading("正在提交考生信息,请稍后...")
  152. $scope.StdReg.std_name = $scope.StdReg.std_name_verify;
  153. $rootScope.ajaxRequest({
  154. url: '../enrol/reg/save.htm',
  155. data: $scope.StdReg
  156. }, function (response) {
  157. $.hideLoading();
  158. $scope.StdReg = response.entity;
  159. $rootScope.ArtStdReg = $scope.StdReg;
  160. if ($scope.StdReg.std_image) {
  161. $scope.curStep = 'StdExtendInfo';
  162. } else {
  163. // 上传免冠证件照
  164. $scope.curStep = 'NoCrownPhotoWarning';
  165. }
  166. });
  167. }, function () {
  168. });
  169. } else {
  170. $.showLoading("正在提交考生信息,请稍后...")
  171. $rootScope.ajaxRequest({
  172. url: '../enrol/reg/save.htm',
  173. data: $scope.StdReg
  174. }, function (response) {
  175. $.hideLoading();
  176. $scope.StdReg = response.entity;
  177. $rootScope.ArtStdReg = $scope.StdReg;
  178. if ($scope.StdReg.std_image) {
  179. $scope.curStep = 'StdExtendInfo';
  180. } else {
  181. // 上传免冠证件照
  182. $scope.curStep = 'NoCrownPhotoWarning';
  183. }
  184. });
  185. }
  186. }
  187. //永久居留证-保存用户信息
  188. $scope.saveIdCardJuZhuZheng = function () {
  189. $scope.StdReg.cert_id = $.trim($scope.StdReg.cert_id);
  190. $scope.StdReg.std_name = $.trim($scope.StdReg.std_name);
  191. $scope.StdReg.std_sex = $.trim($scope.StdReg.std_sex);
  192. $scope.StdReg.std_mobile = $.trim($scope.StdReg.std_mobile);
  193. if ($scope.StdReg.cert_id == undefined || $scope.StdReg.cert_id.length == 0) {
  194. $.alert('请输入证件号码信息!');
  195. return false;
  196. }
  197. if ($scope.StdReg.std_name == undefined || $scope.StdReg.std_name.length == 0) {
  198. $.alert('请输入考生姓名信息!');
  199. return false;
  200. }
  201. if ($scope.StdReg.std_sex == undefined || $scope.StdReg.std_sex.length == 0) {
  202. $.alert('请选择考生性别!');
  203. return false;
  204. }
  205. /*if ($scope.StdReg.std_param2 == undefined || $scope.StdReg.std_param2.length == 0) {
  206. $.alert('请输入高考所在省份!');
  207. return false;
  208. }*/
  209. if ($scope.StdReg.exam_id == undefined || $scope.StdReg.exam_id.length == 0) {
  210. $.alert('请输入高考报名号!');
  211. return false;
  212. }
  213. //港澳台的考生-手机号码-不做限制
  214. if ($scope.StdReg.std_mobile == undefined || $scope.StdReg.std_mobile.length == 0 ||
  215. ($scope.StdReg.std_province < 70 && $scope.StdReg.std_mobile.length != 11)) {
  216. $.alert('请输入正确的手机号码!');
  217. return false;
  218. }
  219. $.showLoading("正在提交考生信息,请稍后...")
  220. $rootScope.ajaxRequest({
  221. url: '../enrol/reg/save.htm',
  222. data: $scope.StdReg
  223. }, function (response) {
  224. $.hideLoading();
  225. $scope.StdReg = response.entity;
  226. $rootScope.ArtStdReg = $scope.StdReg;
  227. if ($scope.StdReg.std_image) {
  228. $scope.curStep = 'StdExtendInfo';
  229. } else {
  230. // 上传免冠证件照
  231. $scope.curStep = 'NoCrownPhotoWarning';
  232. }
  233. });
  234. }
  235. /***************************************************************************
  236. * 完善个人信息
  237. */
  238. $scope.saveExtendInfo = function () {
  239. $.showLoading("正在提交考生信息,请稍后...")
  240. $rootScope.ajaxRequest({
  241. url: '../enrol/std/info/save.htm',
  242. data: $scope.StdReg
  243. }, function (response) {
  244. $.hideLoading();
  245. // 显示注册成功
  246. $scope.curStep = 'RegSuccess';
  247. });
  248. }
  249. /***************************************************************************
  250. * 上传免冠证件照
  251. */
  252. $scope.uploadNoCrownPhoto = function () {
  253. wx.chooseImage({
  254. count: 1, // 默认9
  255. sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有'original',
  256. sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
  257. success: function (res) {
  258. $scope.localIds = res.localIds;
  259. //$scope.curStep = 'NoCrownPhotoConfirm';
  260. // 返回图片下载后的本地ID
  261. wx.getLocalImgData({
  262. localId: res.localIds[0], // 图片的localID
  263. success: function (res) {
  264. $timeout(function () {
  265. $scope.localData = res.localData; // localData是图片的base64数据,可以用img标签显示
  266. //$scope.curStep = 'NoCrownPhotoConfirm';
  267. $scope.goStep('NoCrownPhotoConfirm');
  268. }, 200);
  269. }
  270. });
  271. }
  272. });
  273. // $rootScope.uploadStdMaterial('NoCrownPhoto', function() {
  274. // // $scope.curStep = 'StdExtendInfo';
  275. // //if ($rootScope.checkParamValue('EnrolVerifyStdIdentity', 'InActive', 'Active')) {
  276. // // $scope.curStep = 'VerifySuccess';
  277. // //} else {
  278. // $scope.curStep = 'StdExtendInfo';
  279. // //}
  280. // });
  281. }
  282. $scope.confirmCrownPhoto= function (step) {
  283. wx.uploadImage({
  284. localId : $scope.localIds[0], // 需要上传的图片的本地ID,由chooseImage接口获得
  285. isShowProgressTips : 1, // 默认为1,显示进度提示
  286. success : function(serverRes) {
  287. const serverId = serverRes.serverId; // 返回图片的服务器端ID
  288. $.showLoading("考生材料上传中,请稍候...")
  289. // 上传成功,去服务器取图片
  290. $timeout(function () {
  291. const vData = {
  292. std_id : $rootScope.ArtStdReg.std_id,
  293. media_id: serverId,
  294. material_type: 'NoCrownPhoto'
  295. };
  296. $rootScope.ajaxRequest({
  297. url : '../enrol/std/material/upload.htm',
  298. method : 'post',
  299. data : vData
  300. }, function(data) {
  301. $.hideLoading();
  302. $rootScope[material_type] = data.entity;
  303. $rootScope.ArtStdReg.std_image = data.entity.material_file;
  304. $scope.goStep('StdExtendInfo');
  305. });
  306. }, 200);
  307. },
  308. fail : function(error) {
  309. $.alert('图片服务器暂时无法访问,请稍侯再试', '错误提示');
  310. }
  311. });
  312. }
  313. $scope.goStep = function (step) {
  314. $scope.curStep = step;
  315. }
  316. $scope.openIdCard = function () {
  317. wx.chooseImage({
  318. count: 1, // 默认9
  319. sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有'original',
  320. sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
  321. success: function (res) {
  322. var localIds = res.localIds; // 返回选定照片的本地ID列表,localId可以作为img标签的src属性显示图片
  323. wx.uploadImage({
  324. localId: localIds[0], // 需要上传的图片的本地ID,由chooseImage接口获得
  325. isShowProgressTips: 1, // 默认为1,显示进度提示
  326. success: function (serverRes) {
  327. var serverId = serverRes.serverId; // 返回图片的服务器端ID
  328. $.showLoading("证件照片上传中,请稍后...")
  329. // 上传成功,去服务器取图片
  330. var url = '../enrol/wx/reg/idcard/' + ($scope.StdReg.std_province < '70' ? '' : 'other/') + 'upload.htm';
  331. if ($rootScope.getParamValue('SchoolCode') == '51065') {
  332. url = '../enrol/wx/reg/idcard/other/upload.htm';
  333. }
  334. $rootScope.ajaxRequest({
  335. url: url,
  336. data: {
  337. media_id: serverId
  338. }
  339. }, function (response) {
  340. $.hideLoading();
  341. if ($rootScope.getParamValue('SchoolCode') == '51065') {
  342. $scope.curStep = 'IdCardOther';
  343. } else {
  344. if ($scope.StdReg.std_province < '70') {
  345. $scope.StdReg.cert_id = response.map.IdCardInfo.person_code;
  346. $scope.StdReg.std_name = response.map.IdCardInfo.person_name;
  347. $scope.StdReg.std_sex = response.map.IdCardInfo.person_sex;
  348. $scope.StdReg.std_nation = response.map.IdCardInfo.person_nation;
  349. $scope.StdReg.cert_addr = response.map.IdCardInfo.person_addr;
  350. $scope.curStep = 'IdCardResult';
  351. } else if ($scope.StdReg.std_province == '91') {
  352. $scope.curStep = 'IdCardJuZhuZhengOther';
  353. } else {
  354. $scope.curStep = 'IdCardOther';
  355. }
  356. }
  357. $scope.StdReg.idcard_file_name = response.map.IdCardFileName;
  358. });
  359. },
  360. fail: function (error) {
  361. $.hideLoading();
  362. $.alert('图片服务器暂时无法访问,请稍侯再试', '错误提示');
  363. }
  364. });
  365. }
  366. });
  367. }
  368. //上传永久居留证
  369. $scope.openIdJzzCard = function () {
  370. wx.chooseImage({
  371. count: 1, // 默认9
  372. sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有'original',
  373. sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
  374. success: function (res) {
  375. var localIds = res.localIds; // 返回选定照片的本地ID列表,localId可以作为img标签的src属性显示图片
  376. wx.uploadImage({
  377. localId: localIds[0], // 需要上传的图片的本地ID,由chooseImage接口获得
  378. isShowProgressTips: 1, // 默认为1,显示进度提示
  379. success: function (serverRes) {
  380. var serverId = serverRes.serverId; // 返回图片的服务器端ID
  381. $.showLoading("证件照片上传中,请稍后...")
  382. // 上传成功,去服务器取图片
  383. var url = '../enrol/wx/reg/idcard/other/upload.htm';
  384. $rootScope.ajaxRequest({
  385. url: url,
  386. data: {
  387. media_id: serverId
  388. }
  389. }, function (response) {
  390. $.hideLoading();
  391. $scope.curStep = 'IdCardJuZhuZhengOther';
  392. $scope.StdReg.idcard_file_name = response.map.IdCardFileName;
  393. });
  394. },
  395. fail: function (error) {
  396. $.hideLoading();
  397. $.alert('图片服务器暂时无法访问,请稍侯再试', '错误提示');
  398. }
  399. });
  400. }
  401. });
  402. }
  403. //切换永久居留证
  404. $scope.changeJzz = function () {
  405. $.confirm("确定切换到上传永久居留证吗?(针对没有身份证,只有永久居留证的考生)", function () {
  406. // 点击确认后的回调函数
  407. $timeout(function () {
  408. $scope.curStep = 'IdCard91Warning';
  409. $scope.StdReg.cert_type = 'JuZhuZhengPass';
  410. }, 200);
  411. }, function () {
  412. // 点击取消后的回调函数
  413. });
  414. }
  415. }])