std_reg.js 8.2 KB

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