mainConfig.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  1. app.config([ '$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider) {
  2. $stateProvider.state('baseInfo', {
  3. abstract:true,
  4. url : "/baseInfo",
  5. templateUrl : "./std_base_info.html",
  6. controller : 'StdBaseInfoCtrl'
  7. }).state('baseInfo.basic', {
  8. url : "/basic",
  9. templateUrl : "./std_base_info_basic.html",
  10. controller : 'StdBaseInfoBasicCtrl'
  11. }).state('baseInfo.contact', {
  12. url : "/contact",
  13. templateUrl : "./std_base_info_contact.html",
  14. controller : 'StdBaseInfoContactCtrl'
  15. }).state('baseInfo.experience', {
  16. url : "/experience",
  17. templateUrl : "./std_base_info_experience.html",
  18. controller : 'StdBaseInfoExperienceCtrl'
  19. }).state('baseInfo.pic', {
  20. url : "/pic",
  21. templateUrl : "./std_base_info_pic.html",
  22. controller : 'StdBaseInfoPicCtrl'
  23. }).state('basicInfoConfirm', {
  24. url : "/basicInfoConfirm",
  25. templateUrl : "./std_basic_info_confirm.html",
  26. controller : 'StdBasicInfoConfirmCtrl'
  27. }).state('graduateSchool', {
  28. url : "/graduateSchool",
  29. templateUrl : "./std_graduate_school.html",
  30. controller : 'StdGraduateSchoolCtrl'
  31. }).state('major_bss', {
  32. url : "/major_bss",
  33. templateUrl : "./std_apply_major.html",
  34. controller : 'StdApplyMajorCtrl'
  35. }).state('confirm', {
  36. url : "/confirm",
  37. templateUrl : "./std_info_confirm.html",
  38. controller : 'StdInfoConfirmCtrl'
  39. }).state('modifyPassword', {
  40. url : "/modifyPassword",
  41. templateUrl : "./std_modify_password.html",
  42. controller : 'StdModifyPasswordCtrl'
  43. }).state('disableUser', {
  44. url : "/disableUser",
  45. templateUrl : "./std_disable_user.html",
  46. controller : 'StdDisableUserCtrl'
  47. }).state('luqu_bss', {
  48. url : "/luqu_bss",
  49. templateUrl : "./std_luqu_bss.html",
  50. controller : 'StdLuquBssCtrl'
  51. }).state('niluqu_query', {
  52. url : "/niluqu_query",
  53. templateUrl : "./std_niluqu_query.html",
  54. controller : 'StdNiluquQueryCtrl'
  55. }).state('niluqu_confirm', {
  56. url : "/niluqu_confirm",
  57. templateUrl : "./std_niluqu_confirm.html",
  58. controller : 'StdNiluquConfirmCtrl'
  59. }).state('baseInfoModify', {
  60. url : "/baseInfoModify",
  61. templateUrl : "./std_base_info_modify.html",
  62. controller : 'StdBaseInfoModifyApplyCtrl'
  63. }).state('mianshi', {
  64. url : "/mianshi",
  65. templateUrl : "./std_face_score.html",
  66. controller: 'StdFaceScoreCtrl'
  67. }).state('faceScoreFuhe', {
  68. url : "/faceScoreFuhe",
  69. templateUrl : "./std_face_score_fuhe.html",
  70. controller : 'StdFaceScoreFuheCtrl'
  71. }).state('faceScoreFuheResult', {
  72. url : "/faceScoreFuheResult",
  73. templateUrl : "./std_face_score_fuhe_result.html",
  74. controller : 'StdFaceScoreFuheResultCtrl'
  75. }).state('scoreFuhe', {
  76. url : "/scoreFuhe",
  77. templateUrl : "./std_score_modify.html",
  78. controller : 'StdScoreFuheCtrl'
  79. }).state('scoreFuheResult', {
  80. url : "/scoreFuheResult",
  81. templateUrl : "./std_score_modify_list.html",
  82. controller : 'StdScoreModifyListCtrl'
  83. }).state('ticket_bss', {
  84. url : "/ticket_bss",
  85. templateUrl : "./ticket_bss.html",
  86. controller : 'TicketBssCtrl'
  87. }).state('examNotice', {
  88. url : "/examNotice",
  89. templateUrl : "./std_exam_notice.html",
  90. controller : 'StdExamNoticeCtrl'
  91. }).state('examTimeNotice', {
  92. url : "/examTimeNotice",
  93. templateUrl : "./std_exam_time_notice.html",
  94. controller : 'StdExamTimeNoticeCtrl'
  95. })
  96. }]);
  97. app.controller('AppCtrl', function($rootScope, $scope, $http, $timeout, $state, myConfig, $cookieStore, $window, Upload, toaster, $q) {
  98. $rootScope.session = $cookieStore.get('aeeaps-sesssion');
  99. $rootScope.host_url = myConfig.url;
  100. $rootScope.frameParams = {};
  101. $rootScope.frameParams.yes = 1;
  102. $rootScope.frameParams.no = 2;
  103. $rootScope.appTitle="北京外国语大学保送生报名系统";
  104. var p_modules = $http({
  105. url : myConfig.url + '/acquire/modules?session=' + $rootScope.session,
  106. method : 'GET'
  107. }).success(function(data) {
  108. if(data.code == 0){
  109. $rootScope.modules = data.result.modules;
  110. $rootScope.bkType = data.result.bkType;
  111. if($rootScope.modules.length > 0){
  112. $state.go($rootScope.modules[0])
  113. }
  114. }else{
  115. $rootScope.dialogMsg(data.errorMsg, function(){
  116. window.location = "index.html";
  117. })
  118. }
  119. }).error(function() {
  120. });
  121. var p_user = $http({
  122. url : myConfig.url + '/user/info?session=' + $rootScope.session,
  123. method : 'GET'
  124. }).success(function(data) {
  125. if(data.code == 0){
  126. $rootScope.loginUser = data.result;
  127. }else{
  128. $rootScope.dialogMsg(data.errorMsg, function(){
  129. window.location = "index.html";
  130. })
  131. }
  132. }).error(function() {
  133. });
  134. var p_confirm = $http({
  135. url : myConfig.url + '/acquire/confirmStatus?session=' + $rootScope.session,
  136. method : 'GET'
  137. }).success(function(data) {
  138. if(data.code == 0){
  139. if(data.result && data.result.finish_time){
  140. $rootScope.stdConfirmed = true;
  141. }
  142. }else{
  143. $rootScope.dialogMsg(data.errorMsg, function(){
  144. window.location = "index.html";
  145. })
  146. }
  147. }).error(function() {
  148. });
  149. var p_examNoticeConfirm = $http({
  150. url : myConfig.url + '/acquire/getExamNoticeConfirm?session=' + $rootScope.session,
  151. method : 'GET'
  152. }).success(function(data) {
  153. if(data.code == 0){
  154. if(data.code == 0){
  155. $scope.examNoticeConfirm = data.result;
  156. if($scope.examNoticeConfirm.confirm_time){
  157. $rootScope.stdExamNoticeConfirmed = true;
  158. }else{
  159. $rootScope.stdExamNoticeConfirmed = false;
  160. }
  161. }
  162. }else{
  163. $rootScope.dialogMsg(data.errorMsg, function(){
  164. window.location = "index.html";
  165. })
  166. }
  167. }).error(function() {
  168. });
  169. var p_province = $http({
  170. url : myConfig.url + '/frame/province',
  171. method : 'GET'
  172. }).success(function(data) {
  173. if(data.code == 0){
  174. $rootScope.provinceAll = data.result;
  175. }else{
  176. $rootScope.dialogMsg(data.message, function(){
  177. window.location = "index.html";
  178. })
  179. }
  180. }).error(function() {
  181. });
  182. var p_area = $http({
  183. url : myConfig.url + '/frame/area_all',
  184. method : 'GET'
  185. }).success(function(data) {
  186. if(data.code == 0){
  187. $rootScope.areaAll = data.result;
  188. }else{
  189. $rootScope.dialogMsg(data.message, function(){
  190. window.location = "index.html";
  191. })
  192. }
  193. }).error(function() {
  194. });
  195. var p_city = $http({
  196. url : myConfig.url + '/frame/city_all',
  197. method : 'GET'
  198. }).success(function(data) {
  199. if(data.code == 0){
  200. $rootScope.cityAll = data.result;
  201. }else{
  202. $rootScope.dialogMsg(data.message, function(){
  203. window.location = "index.html";
  204. })
  205. }
  206. }).error(function() {
  207. });
  208. var p_minzu = $http({
  209. url : myConfig.url + '/frame/params/minzu',
  210. method : 'GET'
  211. }).success(function(data) {
  212. if(data.code == 0){
  213. $rootScope.minzuList = data.result;
  214. }
  215. }).error(function() {
  216. });
  217. $scope.myPromise = $q.all([p_minzu, p_province, p_area, p_city, p_confirm, p_user, p_modules]);
  218. $rootScope.goNext = function(url, isFormChanged) {
  219. if(isFormChanged){
  220. $rootScope.dialogMsg('您已修改表单内容,请确认是否保存表单');
  221. }else{
  222. $state.go(url);
  223. }
  224. return false;
  225. }
  226. $rootScope.goUrl = function(url, ctrl) {
  227. $state.go(url);
  228. return false;
  229. }
  230. $rootScope.logout = function() {
  231. $http({
  232. url : $rootScope.host_url + '/user/logout?session=' + $rootScope.session,
  233. method : 'POST'
  234. }).success(function(data) {
  235. });
  236. window.location = 'index.html';
  237. }
  238. $rootScope.help = function() {
  239. $window.open('help.html');
  240. // window.location = 'help.html';
  241. }
  242. $rootScope.guide = function() {
  243. $window.open('input_desc.html');
  244. }
  245. $rootScope.errorMsg = function(msg) {
  246. var d = dialog({
  247. title : '错误提示',
  248. content : msg,
  249. ok : function() {
  250. },
  251. okValue : '确定',
  252. width : 350
  253. });
  254. d.showModal();
  255. }
  256. $rootScope.dialogMsg = function(msg, fn) {
  257. var vFn = fn == undefined ? (function() {
  258. }) : fn
  259. var d = dialog({
  260. title : '操作提示',
  261. content : msg,
  262. ok : vFn,
  263. okValue : '确定',
  264. width : 320
  265. });
  266. d.showModal();
  267. }
  268. $rootScope.viewFile = function(file){
  269. $window.open($rootScope.host_url + '/' + file.path);
  270. }
  271. $rootScope.viewFileByPath = function(filePath){
  272. $window.open($rootScope.host_url + '/' + filePath);
  273. }
  274. // upload on file select or drop
  275. $rootScope.upload = function (file, invalidFiles, item, form) {
  276. if(invalidFiles && invalidFiles.length > 0){
  277. if(invalidFiles[0].$error == 'maxSize'){
  278. toaster.pop('error', '文件大小超过2M');
  279. }else{
  280. toaster.pop('error', '上传失败,请重试');
  281. }
  282. }
  283. if(!file) return;
  284. Upload.upload({
  285. url: $rootScope.host_url + '/upload?session=' + $rootScope.session,
  286. data: {file: file}
  287. }).then(function (resp) {
  288. var path = resp.data.result.path;
  289. if(!item.files){
  290. item.files = [];
  291. }
  292. item.files.push(resp.data.result);
  293. item.updateFile = true;
  294. form.$setDirty();
  295. toaster.pop('warning', "上传成功,请点击保存按钮。");
  296. }, function (resp) {
  297. }, function (evt) {
  298. });
  299. };
  300. $rootScope.upload = function (file, invalidFiles, item, form, dir) {
  301. if(invalidFiles && invalidFiles.length > 0){
  302. if(invalidFiles[0].$error == 'maxSize'){
  303. toaster.pop('error', '文件大小超过2M');
  304. }else{
  305. toaster.pop('error', '上传失败,请重试');
  306. }
  307. }
  308. if(!file) return;
  309. Upload.upload({
  310. url: $rootScope.host_url + '/upload?session=' + $rootScope.session,
  311. data: {file: file, dir: dir}
  312. }).then(function (resp) {
  313. var path = resp.data.result.path;
  314. if(!item.files){
  315. item.files = [];
  316. }
  317. item.files.push(resp.data.result);
  318. item.updateFile = true;
  319. form.$setDirty();
  320. toaster.pop('warning', "上传成功,请点击保存按钮。");
  321. }, function (resp) {
  322. }, function (evt) {
  323. });
  324. };
  325. $rootScope.removeFile = function(item, index, form){
  326. item.updateFile = true;
  327. item.files.splice(index, 1);
  328. toaster.pop('warning', "删除成功,请点击保存按钮。");
  329. form.$setDirty();
  330. }
  331. $rootScope.checkValue = function(field, value, min, max){
  332. if(value < min){
  333. $rootScope.errorMsg(field + "输入值小于最小值:" + min);
  334. }
  335. if(value > max){
  336. $rootScope.errorMsg(field + "输入值大于最大值:" + max);
  337. }
  338. }
  339. $rootScope.preprocessHtml = function(html){
  340. return html.replace(/%/g, '%%');
  341. }
  342. $rootScope.revertHtml = function(html){
  343. return html.replace(/%%/g, '%');
  344. }
  345. } );