std_info.js 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. app.controller('StdInfoCtrl', [ '$rootScope', '$scope', '$http', '$timeout', '$state', '$stateParams', function($rootScope, $scope, $http, $timeout, $state, $stateParams) {
  2. $scope.StdReg = angular.copy($rootScope.ArtStdReg);
  3. //生源地
  4. // $rootScope.ajaxRequest({
  5. // url : '../enrol/reg/province/list.htm'
  6. // }, function(response) {
  7. // $scope.provinceArray = response.array;
  8. // });
  9. // //邮寄省份
  10. // $rootScope.ajaxRequest({
  11. // url : '../enrol/std/reg/province/list.htm'
  12. // }, function(response) {
  13. // $scope.provArray = response.array;
  14. // });
  15. // //邮寄城市初始列表
  16. // $rootScope.ajaxRequest({
  17. // url : '../enrol/std/reg/city/alllist.htm'
  18. // }, function(response) {
  19. // $scope.cityArray = response.array;
  20. // });
  21. // //过滤城市
  22. // $scope.freshCity = function() {
  23. // $rootScope.ajaxRequest({
  24. // url : '../enrol/std/reg/city/list.htm?province_id=' + $scope.StdReg.link_province
  25. // }, function(response) {
  26. // $scope.cityArray = response.array;
  27. // });
  28. // }
  29. $scope.YmStdCategoryArray = [];
  30. /****************************
  31. * 根据省份-查找该省份的文理区分
  32. */
  33. $scope.findProvinceArtScience = function () {
  34. $rootScope.ajaxRequest({
  35. url: '../conf/std/reg/get/province.htm',
  36. data: {province_id: $scope.StdReg.std_province}
  37. }, function (response) {
  38. if (response.entity) {
  39. $scope.artArr = [];
  40. $scope.artArr = response.entity.art_science_status.split(",");
  41. for (const art of $scope.artArr) {
  42. for (const st of $rootScope.StdCategoryArray) {
  43. if (art == st.dict_value) {
  44. $scope.YmStdCategoryArray.push(st);
  45. break;
  46. }
  47. }
  48. }
  49. if($scope.YmStdCategoryArray.length == 1) {
  50. $scope.StdReg.std_param3 = $scope.YmStdCategoryArray[0].dict_value;
  51. }
  52. $scope.YmStdCategoryArray.unshift({dict_text: '请选择', dict_value: null});
  53. }
  54. });
  55. }
  56. // 获取截止时间标志
  57. $scope.getDeadLineFlag = function() {
  58. $rootScope.ajaxRequest({
  59. url : '../enrol/std/modify/info/flag/get.htm'
  60. }, function(response) {
  61. $scope.modifyFlag = response.entity;
  62. });
  63. }
  64. $scope.findProvinceArtScience();
  65. $scope.getDeadLineFlag();
  66. //是否是中文
  67. $scope.isChinese = function(str){
  68. var reg = /^[\u4e00-\u9fa5]+$/;
  69. return reg.test(str);
  70. }
  71. /**************
  72. * 完善个人信息
  73. */
  74. $scope.saveExtendInfo = function(){
  75. // 判断是否修改过属性
  76. var change = false;
  77. for ( var attr in $scope.StdReg) {
  78. if ($scope.StdReg[attr] !== $rootScope.ArtStdReg[attr]) {
  79. change = true;
  80. break;
  81. }
  82. }
  83. /*if(change) {
  84. $.alert("报名时间已过,不允许修改个人信息!");
  85. return;
  86. }
  87. if ($scope.StdReg["link_addr"] !== $rootScope.ArtStdReg["link_addr"]) {
  88. $.alert("已过邮寄地址修改时间[2021-01-12 22:00:00],不能修改!");
  89. return;
  90. }
  91. if ($scope.StdReg["link_province"] !== $rootScope.ArtStdReg["link_province"]) {
  92. $.alert("已过邮寄地址修改时间[2021-01-12 22:00:00],不能修改!");
  93. return;
  94. }
  95. if ($scope.StdReg["link_city"] !== $rootScope.ArtStdReg["link_city"]) {
  96. $.alert("已过邮寄地址修改时间[2021-01-12 22:00:00],不能修改!");
  97. return;
  98. }*/
  99. if ($scope.StdReg.link_mobile && $scope.StdReg.std_mobile == $scope.StdReg.link_mobile) {
  100. $.alert('紧急联系电话与本人手机号码不能相同!');
  101. return false;
  102. }
  103. //政治面貌
  104. if ($scope.StdReg.std_political == undefined || $scope.StdReg.std_political == '') {
  105. $.alert('请选择政治面貌!');
  106. return false;
  107. }
  108. //科类
  109. if ($scope.StdReg.std_param3 == undefined || $scope.StdReg.std_param3 == '' || $scope.StdReg.std_param3.length == 0) {
  110. $.alert('请选择科类!');
  111. return false;
  112. }
  113. //科类
  114. if ($scope.StdReg.std_param4 == undefined || $scope.StdReg.std_param4 == '' || $scope.StdReg.std_param4.length == 0) {
  115. $.alert('请选择毕业类型!');
  116. return false;
  117. }
  118. //毕业学校
  119. if ($rootScope.getParamValue('EnrolReg_ShowStdSchool','Active') == 'Active' &&
  120. ($scope.StdReg.std_school == undefined || $scope.StdReg.std_school == '')) {
  121. $.alert('请填写毕业学校!');
  122. return false;
  123. }
  124. //考生类别
  125. if ($scope.StdReg.std_param5 == undefined || $scope.StdReg.std_param5 == '') {
  126. $.alert('请选择考生类别!');
  127. return false;
  128. }
  129. /**毕业时间**/
  130. if ($scope.StdReg.end_date == undefined || $scope.StdReg.end_date == '') {
  131. $.alert('请填写毕业时间!');
  132. return false;
  133. }
  134. //紧急联系人
  135. if ($scope.StdReg.link_man == undefined || $scope.StdReg.link_man == '') {
  136. $.alert('请填写紧急联系人!');
  137. return false;
  138. } else if(!$scope.isChinese($scope.StdReg.link_man)) {
  139. $.alert('紧急联系人必须是汉字!');
  140. return false;
  141. }
  142. //家长手机号
  143. if ($scope.StdReg.link_mobile == undefined || $scope.StdReg.link_mobile == '') {
  144. $.alert('请填写联系人手机号!');
  145. return false;
  146. }
  147. //通信地址
  148. if ($rootScope.getParamValue('EnrolReg_LinkAddr','Active') == 'Active' &&
  149. ($scope.StdReg.link_addr == undefined || $scope.StdReg.link_addr == '')) {
  150. $.alert('请填写通讯地址!');
  151. return false;
  152. }
  153. //邮政编码
  154. if ($scope.StdReg.link_postal == undefined || $scope.StdReg.link_postal == '' || $scope.StdReg.link_postal.length==0) {
  155. $.alert('请填写邮政编码!');
  156. return false;
  157. }
  158. //电子邮箱
  159. if ($rootScope.getParamValue('EnrolReg_email','Active') == 'Active') {
  160. if($scope.StdReg.email == undefined || $scope.StdReg.email == '') {
  161. $.alert('请填写电子邮箱!');
  162. return false;
  163. }
  164. }
  165. $.showLoading("正在提交考生信息,请稍后...")
  166. $rootScope.ajaxRequest({
  167. url : '../enrol/std/info/save.htm',
  168. data : $scope.StdReg
  169. }, function(response) {
  170. // $.toast("考生信息已保存!");
  171. $.alert("考生信息已保存!")
  172. $.hideLoading();
  173. $rootScope.ArtStdReg = response.entity;
  174. });
  175. }
  176. //使用weiui自带的默认日期选择器
  177. $('#showDatePicker').on('click', function() {
  178. weui.datePicker({
  179. start: 1990,
  180. end: new Date().getFullYear()+1,
  181. defaultValue: [new Date().getFullYear(), new Date().getMonth()+1, new Date().getDate()],
  182. depth:2,
  183. onChange: function (result) {
  184. //console.log(result);
  185. },
  186. onConfirm: function (result) {
  187. $scope.$apply(function () {
  188. $scope.StdReg.end_date = result[0].label + result[1].label;
  189. });
  190. },
  191. title: '日期选择'
  192. });
  193. });
  194. } ])