std_reg_gobal.js 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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. if ($rootScope.ArtStdReg !== undefined) {
  7. $scope.StdReg = angular.extend({}, $rootScope.ArtStdReg);
  8. if ($scope.StdReg.reg_status == 'IdCard') {
  9. $scope.curStep = 'NoCrownPhotoWarning';
  10. } else if ($scope.StdReg.reg_status == 'NoCrownPhoto') {
  11. $scope.curStep = 'StdExtendInfo';
  12. }
  13. }
  14. $rootScope.ajaxRequest({
  15. url : '../enrol/reg/province/list.htm'
  16. }, function(response) {
  17. $scope.provinceArray = response.array;
  18. });
  19. //alert($rootScope.checkParamValue('EnrolVerifyStdIdentity', 'InActive', 'Active'));
  20. // alert($rootScope.getParamValue('EnrolVerifyStdIdentity', 'InActive'));
  21. // console.log($rootScope.FrameParam);
  22. /***************************************************************************
  23. * 选择生源地
  24. */
  25. $scope.chooseProvince = function(p) {
  26. if(p.reg_status == 'InActive') {
  27. var msg = '未开放【'+p.province_name+'】考生注册!';
  28. if(p.reg_fetch_param != undefined)
  29. msg = p.reg_fetch_param;
  30. $.alert(msg);
  31. return;
  32. }
  33. $scope.currentProvince = p;
  34. $scope.StdReg.std_province = p.province_id;
  35. $scope.StdReg.province_name = p.province_name;
  36. if (p.province_id < '70') {
  37. if (p.ksh_status == 'Active') {
  38. // 必须有高考报名号
  39. $scope.curStep = 'ExamIdWarning';
  40. } else {
  41. // 大陆,需要上传身份证
  42. $scope.curStep = 'IdCardWarning';
  43. $scope.StdReg.cert_type = 'IdCard';
  44. }
  45. } else if ((p.province_id + '') == '90') {
  46. // 外国,护照
  47. $scope.curStep = 'PassportWarning';
  48. $scope.StdReg.cert_type = 'Passport';
  49. } else if ((p.province_id + '') == '71') {
  50. // 台湾,台湾居民往来大陆通行证,澳门,香港 港澳居民来往内地通行证
  51. $scope.curStep = 'IdCard71Warning';
  52. $scope.StdReg.cert_type = 'TaiWanPass';
  53. } else {
  54. // 澳门,香港 港澳居民来往内地通行证
  55. $scope.curStep = 'IdCard80Warning';
  56. $scope.StdReg.cert_type = 'HongKongMacaoPass';
  57. }
  58. }
  59. $scope.checkExamId = function() {
  60. $scope.StdReg.exam_id = $.trim($scope.StdReg.exam_id);
  61. if ($scope.StdReg.exam_id == undefined || $scope.StdReg.exam_id.length == 0) {
  62. $.alert('高考报名号必须填写!');
  63. return false;
  64. }
  65. $.showLoading("正在提交考生信息,请稍后...")
  66. $rootScope.ajaxRequest({
  67. url : '../enrol/reg/province/check.htm',
  68. data : $scope.StdReg
  69. }, function(response) {
  70. $.hideLoading();
  71. // 大陆,需要上传身份证
  72. $scope.curStep = 'IdCardWarning';
  73. $scope.StdReg.cert_type = 'IdCard';
  74. });
  75. }
  76. /***************************************************************************
  77. * 识别正确,保存用户信息
  78. */
  79. $scope.saveIdCard = function() {
  80. $scope.StdReg.cert_id = $.trim($scope.StdReg.cert_id);
  81. $scope.StdReg.std_name = $.trim($scope.StdReg.std_name);
  82. $scope.StdReg.std_sex = $.trim($scope.StdReg.std_sex);
  83. $scope.StdReg.std_mobile = $.trim($scope.StdReg.std_mobile);
  84. if ($scope.StdReg.cert_id == undefined || $scope.StdReg.cert_id.length == 0) {
  85. $.alert('请输入证件号码信息!');
  86. return false;
  87. }
  88. if ($scope.StdReg.std_name == undefined || $scope.StdReg.std_name.length == 0) {
  89. $.alert('请输入考生姓名信息!');
  90. return false;
  91. }
  92. if ($scope.StdReg.std_sex == undefined || $scope.StdReg.std_sex.length == 0) {
  93. $.alert('请选择考生性别!');
  94. return false;
  95. }
  96. if ($scope.StdReg.std_mobile == undefined || $scope.StdReg.std_mobile.length != 11) {
  97. $.alert('请输入正确的手机号码!');
  98. return false;
  99. }
  100. // 央美香港考生
  101. if($rootScope.getParamValue('SchoolCode') == '10047' && $scope.StdReg.std_province == '81') {
  102. if ($scope.StdReg.std_type == undefined || $scope.StdReg.std_type == '') {
  103. $.alert('请选择参加文化考试的方式!');
  104. return false;
  105. }
  106. }
  107. $.showLoading("正在提交考生信息,请稍后...")
  108. $rootScope.ajaxRequest({
  109. url : '../enrol/reg/save.htm',
  110. data : $scope.StdReg
  111. }, function(response) {
  112. $.hideLoading();
  113. $scope.StdReg = response.entity;
  114. $rootScope.ArtStdReg = $scope.StdReg;
  115. // 上传免冠证件照
  116. $scope.curStep = 'NoCrownPhotoWarning';
  117. });
  118. }
  119. /***************************************************************************
  120. * 完善个人信息
  121. */
  122. $scope.saveExtendInfo = function() {
  123. $.showLoading("正在提交考生信息,请稍后...")
  124. $rootScope.ajaxRequest({
  125. url : '../enrol/std/info/save.htm',
  126. data : $scope.StdReg
  127. }, function(response) {
  128. $.hideLoading();
  129. // 显示注册成功
  130. $scope.curStep = 'RegSuccess';
  131. });
  132. }
  133. /***************************************************************************
  134. * 上传免冠证件照
  135. */
  136. $scope.uploadNoCrownPhoto = function() {
  137. $rootScope.uploadStdMaterial('NoCrownPhoto', function() {
  138. // $scope.curStep = 'StdExtendInfo';
  139. if ($rootScope.checkParamValue('EnrolVerifyStdIdentity', 'InActive', 'Active')) {
  140. $scope.curStep = 'VerifySuccess';
  141. } else {
  142. $scope.curStep = 'StdExtendInfo';
  143. }
  144. });
  145. }
  146. $scope.goStep = function(step) {
  147. $scope.curStep = step;
  148. }
  149. $scope.openIdCard = function() {
  150. wx.chooseImage({
  151. count : 1, // 默认9
  152. sizeType : [ 'compressed' ], // 可以指定是原图还是压缩图,默认二者都有'original',
  153. sourceType : [ 'album', 'camera' ], // 可以指定来源是相册还是相机,默认二者都有
  154. success : function(res) {
  155. var localIds = res.localIds; // 返回选定照片的本地ID列表,localId可以作为img标签的src属性显示图片
  156. wx.uploadImage({
  157. localId : localIds[0], // 需要上传的图片的本地ID,由chooseImage接口获得
  158. isShowProgressTips : 1, // 默认为1,显示进度提示
  159. success : function(serverRes) {
  160. var serverId = serverRes.serverId; // 返回图片的服务器端ID
  161. $.showLoading("证件照片上传中,请稍后...")
  162. // 上传成功,去服务器取图片
  163. $rootScope.ajaxRequest({
  164. url : '../enrol/wx/reg/idcard/' + ($scope.StdReg.std_province < '70' ? '' : 'other/') + 'upload.htm',
  165. data : {
  166. media_id : serverId
  167. }
  168. }, function(response) {
  169. $.hideLoading();
  170. if ($scope.StdReg.std_province < '70') {
  171. $scope.StdReg.cert_id = response.map.IdCardInfo.person_code;
  172. $scope.StdReg.std_name = response.map.IdCardInfo.person_name;
  173. $scope.StdReg.std_sex = response.map.IdCardInfo.person_sex;
  174. $scope.StdReg.std_nation = response.map.IdCardInfo.person_nation;
  175. $scope.StdReg.cert_addr = response.map.IdCardInfo.person_addr;
  176. $scope.curStep = 'IdCardResult';
  177. } else {
  178. $scope.curStep = 'IdCardOther';
  179. }
  180. $scope.StdReg.idcard_file_name = response.map.IdCardFileName;
  181. });
  182. },
  183. fail : function(error) {
  184. $.hideLoading();
  185. $.alert('图片服务器暂时无法访问,请稍侯再试', '错误提示');
  186. }
  187. });
  188. }
  189. });
  190. }
  191. } ])