std_reg.js 13 KB

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