PageSourceSearch

https://www.whuhzzs.com/style/web/js/common/user.js

js whuhzzs.com collected 2026-09-26 05:10:15 UTC 28,467 bytes, 927 lines download raw bytes

1$(function(){
2	if($('#pageViewId').val() == "userInfo" && isNull($('#userId').val())){
3		openLogin();
4	}
5	$("#stAgree").click(function(){
6		$(this).toggleClass("active");
7	})
8	
9	$(".loginbtn").click(function(){
10		openLogin();
11	})
12	
13	//登录点击关闭
14	  $(".closelogin").click(function(){
15		$(".monitor").hide();
16		$(".loginwrap").hide();
17		$("body").css({ 
18			  "overflow-x":"auto",
19			  "overflow-y":"auto" 
20			});
21	})
22	
23	//注册服务协议
24	$(".servicebtn").click(function(){
25		$(".monitor").show();
26		$(".serviceAgreement").show();
27		$("body").css({ 
28			  "overflow-x":"hidden",
29			  "overflow-y":"hidden" 
30			});
31	})
32	
33	$(".define").click(function(){
34		$(".monitor").hide();
35		$(".serviceAgreement").hide();
36		$("body").css({ 
37			  "overflow-x":"auto",
38			  "overflow-y":"auto" 
39			});
40	})
41	
42//	$(".nextstep").click(function(){
43//		$(".tempphone").hide();
44//		$(".nextstep").hide();
45//		$(".temppass,.stepdefine").show()
46//	})
47	
48})
49
50function logout(){
51	$.ajax({
52		type:'post',
53		url:local_host +"user/logout",
54		data:{},
55		success:function(dataMap){
56			window.location.reload();
57		}
58	})
59}
60
61function openLogin(){
62	$(".monitor").show();
63	$(".loginwrap").show();
64	$("body").css({ 
65	  "overflow-x":"hidden",
66	  "overflow-y":"hidden" 
67	});
68}
69
70app.controller('j-register-validate', function($scope,$http) {
71
72	//禁止输入空格
73    function Trim(str, is_global) {
74        var result;
75        result = str.replace(/(^\s+)|(\s+$)/g, "");
76        if (is_global.toLowerCase() == "g") {
77            result = result.replace(/\s/g, "");
78        }
79        return result;
80    }
81    $scope.NoSapceInput = function (e,input_name) {
82        var curValue = e.target.value;
83        if(curValue.indexOf(" ") >= 0){
84        	$("#errorSpaceCode").css("display","block");
85        }else{
86        	$("#errorSpaceCode").css("display","none");
87        }
88        $scope[input_name] = curValue.replace(" ","");
89        $scope[input_name] = Trim(curValue, "g"); 
90        var keynum;
91        if (window.event) // IE 
92        {
93            keynum = e.keyCode
94        }
95        else if (e.which) // Netscape/Firefox/Opera 
96        {
97            keynum = e.which
98        }
99        if (keynum == 32) {
100            return false;
101        }
102        return true;
103    }
104    
105    //提交注册用户
106    $scope.register = function(){
107    	if($("#stAgree").hasClass("active") && $("#errorSpaceCode").attr("style").indexOf("none") > 0){
108    		$("#userProtocol").css("display","none");
109	    	$http({
110	    		method:'POST',
111	            url:local_host +"user/register-data",
112	            params:{"phone":$("input[name='phone']").val(),"email":$("input[name='email']").val(),
113	            	"password":$("input[name='password']").val(),"checkCode":$("input[name='checkCode']").val()}
114	        }).then(function(response){
115	        	if(response.data.result == "success"){
116	        		var publisherId = $("#publisherId").val();
117	        		if(!isNull(publisherId) && publisherId !="index"){
118	        			window.location.href = local_host + "/journal/"+publisherId;
119	        		}else{
120	        			window.location.href = local_host ;
121	        		}
122	    	        
123	            }else{
124	            	$("#errorCode").css("display","block");
125	            }
126	        },function(response){
127	        	console.log("系统异常");
128	        	alert("系统异常");
129	        });
130    	}else{
131    		if(!$("#stAgree").hasClass("active")){
132    			$("#userProtocol").css("display","block");
133    		}
134    	}
135    }
136
137}); 
138
139/**
140 * 注册获取验证码
141 * @param $scope
142 * @param $http
143 * @param $interval
144 * @returns
145 */
146app.controller('registerCode', function($scope,$http,$interval) {
147    $scope.canClick=false;
148    $scope.description = "获取验证码";
149    $scope.loadRegister = function() {  
150    	if(window.localStorage.secondsf){
151        	timerHandler = $interval(function(){
152        		if(window.localStorage.secondsf <= 0){
153        			 $interval.cancel(timerHandler);  
154        			 delete window.localStorage.secondsf;
155        			 $scope.description="获取验证码";
156        			 $scope.canClick=false;
157                }else{
158                	 $scope.description=window.localStorage.secondsf+"s后重发";
159                	 window.localStorage.secondsf--;
160                	 $scope.canClick=true;
161                	 $("#phoneRegister .gettestcode").prop("disabled",true);
162                }
163        	},1000)
164        }
165   } 
166    var timerHandler;
167    $scope.getRegisterCode = function(){
168    	$http({
169    		method:'POST',
170            url:local_host +"user/send-phone-register-code",
171            params:{"phone":$("input[name='phone']").val()}
172        }).then(function(response){
173        	if(response.data.result == "success"){
174        		  if(window.localStorage.secondsf){
175        			  $scope.description= window.localStorage.secondsf + "后重发";
176        		  }else{
177        			  $scope.description="60s后重发";
178        			  window.localStorage.secondsf=59;
179        		  }
180		        timerHandler =$interval(function(){
181		            if(window.localStorage.secondsf<=0){
182		                $interval.cancel(timerHandler);    
183		                delete window.localStorage.secondsf;
184		                $scope.description="获取验证码";
185		                $scope.canClick=false;   
186		            }else{
187		                $scope.description = window.localStorage.secondsf+"s后重发";
188		                window.localStorage.secondsf--;
189		                $scope.canClick=true;
190		                $("#phoneRegister .gettestcode").prop("disabled",true);
191		            }
192		        },1000)
193	        }
194        },function(response){
195        	console.log("系统异常");
196        	alert("系统异常");
197        });
198    };
199});
200
201/**
202 * 登录获取验证码
203 * @param $scope
204 * @param $http
205 * @param $interval
206 * @returns
207 */
208app.controller('loginCode', function($scope,$http,$interval) {
209    $scope.canClick=false;
210    $scope.description = "获取验证码";
211    $scope.loadLogin = function() {  
212    	if(window.localStorage.secondsl){
213        	timerHandler = $interval(function(){
214        		if(window.localStorage.secondsl <= 0){
215        			 $interval.cancel(timerHandler);  
216        			 delete window.localStorage.secondsl;
217        			 $scope.description="获取验证码";
218        			 $scope.canClick=false;
219                }else{
220                	 $scope.description=window.localStorage.secondsl+"s后重发";
221                	 window.localStorage.secondsl--;
222                	 $scope.canClick=true;
223                	 $("#phonelogin .gettestcode").prop("disabled",true);
224                }
225        	},1000)
226        }
227   } 
228    var timerHandler;
229    $scope.getLoginCode = function(){
230    	$http({
231    		method:'POST',
232            url:local_host +"user/send-phone-login-code",
233            params:{"phone":$("input[name='lphone']").val()}
234        }).then(function(response){
235        	if(response.data.result == "success"){
236        		  if(window.localStorage.secondsl){
237        			  $scope.description= window.localStorage.secondsl + "后重发";
238        		  }else{
239        			  $scope.description="60s后重发";
240        			  window.localStorage.secondsl=59;
241        		  }
242		        timerHandler =$interval(function(){
243		            if(window.localStorage.secondsl<=0){
244		                $interval.cancel(timerHandler);    
245		                delete window.localStorage.secondsl;
246		                $scope.description="获取验证码";
247		                $scope.canClick=false;   
248		            }else{
249		                $scope.description = window.localStorage.secondsl+"s后重发";
250		                window.localStorage.secondsl--;
251		                $scope.canClick=true;
252		                $("#phonelogin .gettestcode").prop("disabled",true);
253		            }
254		        },1000)
255	        }
256        },function(response){
257        	console.log("系统异常");
258        	alert("系统异常");
259        });
260    };
261});
262
263/**
264 * 忘记密码获取验证码
265 * @param $scope
266 * @param $http
267 * @param $interval
268 * @returns
269 */
270app.controller('forgetCode', function($scope,$http,$interval) {
271    $scope.canClick=false;
272    $scope.description = "获取验证码";
273    $scope.loadForget = function() {  
274    	if(window.localStorage.secondsf){
275        	timerHandler = $interval(function(){
276        		if(window.localStorage.secondsf <= 0){
277        			 $interval.cancel(timerHandler);  
278        			 delete window.localStorage.secondsf;
279        			 $scope.description="获取验证码";
280        			 $scope.canClick=false;
281                }else{
282                	 $scope.description=window.localStorage.secondsf+"s后重发";
283                	 window.localStorage.secondsf--;
284                	 $scope.canClick=true;
285                	 $("#phoneForget .gettestcode").prop("disabled",true);
286                }
287        	},1000)
288        }
289   } 
290    var timerHandler;
291    $scope.getForgetCode = function(){
292    	$http({
293    		method:'POST',
294            url:local_host +"user/send-phone-modifypassword-code",
295            params:{"phone":$("input[name='fphone']").val()}
296        }).then(function(response){
297        	if(response.data.result == "success"){
298        		  if(window.localStorage.secondsf){
299        			  $scope.description= window.localStorage.secondsf + "后重发";
300        		  }else{
301        			  $scope.description="60s后重发";
302        			  window.localStorage.secondsf=59;
303        		  }
304		        timerHandler =$interval(function(){
305		            if(window.localStorage.secondsf<=0){
306		                $interval.cancel(timerHandler);    
307		                delete window.localStorage.secondsf;
308		                $scope.description="获取验证码";
309		                $scope.canClick=false;   
310		            }else{
311		                $scope.description = window.localStorage.secondsf+"s后重发";
312		                window.localStorage.secondsf--;
313		                $scope.canClick=true;
314		                $("#phoneForget .gettestcode").prop("disabled",true);
315		            }
316		        },1000)
317	        }
318        },function(response){
319        	console.log("系统异常");
320        	alert("系统异常");
321        });
322    };
323});
324
325/**
326 * 注册验证唯手机一性:不存在为true,存在为false
327 */
328app.directive('ensureUnique', ['$http', function($http) {
329	return {
330	    require: 'ngModel',
331	    link: function(scope, ele, attrs, c) {
332	    	scope.$watch(attrs.ngModel, function() {
333	    		var phone = $("input[name='phone']").val();
334	    		if(!isNull(phone)){
335			        $http({
336			        	method: 'POST',
337			        	url: '/user/register-phone-validate',
338			        	params: {'phone': phone}
339			        }).success(function(data, status, headers, cfg) {
340			        	if(data.result == "success"){
341			        		c.$setValidity('unique', true);
342			        	}else{
343			        		c.$setValidity('unique', false);
344			        	}
345			        }).error(function(data, status, headers, cfg) {
346			        	c.$setValidity('unique', false);
347			         });
348	    		}
349	    	});
350	    }
351	}
352}]);
353
354/**
355 * 登录,忘记密码验证唯手机一性:存在为true,不存在为false
356 */
357app.directive('ensureUnique2', ['$http', function($http) {
358	return {
359	    require: 'ngModel',
360	    link: function(scope, ele, attrs, c) {
361	    	scope.$watch(attrs.ngModel, function() {
362	    		var phone = $("input[name='fphone']").val();
363	    		if(isNull(phone)){
364	    			phone = $("input[name='lphone']").val();
365	    		}
366	    		if(!isNull(phone)){
367			        $http({
368			        	method: 'POST',
369			        	url: '/user/register-phone-validate',
370			        	params: {'phone': phone}
371			        }).success(function(data, status, headers, cfg) {
372			        	if(data.result == "success"){
373			        		c.$setValidity('unique', false);
374			        	}else{
375			        		c.$setValidity('unique', true);
376			        	}
377			        }).error(function(data, status, headers, cfg) {
378			        	c.$setValidity('unique', false);
379			         });
380	    		}
381	    	});
382	    }
383	}
384}]);
385
386app.controller('login', function($scope,$http,$interval) {
387    
388    $scope.accountLogin = function(){
389    	$http({
390    		method:'POST',
391            url:local_host +"user/password-login",
392            params:{"loginAccount":$("input[name='account']").val(),'password':$("input[name='password']").val()}
393        }).then(function(response){
394        	if(response.data.result == "success"){
395        		if(window.location.href.indexOf("forget-pwd") > 0){
396        			window.location.href = local_host;
397        		}else{
398        			window.location.reload();
399        		}
400	        }else{
401	        	$("#errorPassword").css("display","block");
402	        }
403        },function(response){
404        	console.log("系统异常");
405        	alert("系统异常");
406        });
407    };
408    
409    $scope.phoneLogin = function(){
410    	$http({
411    		method:'POST',
412            url:local_host +"user/checkcode-login",
413            params:{"phone":$("input[name='lphone']").val(),'checkCode':$("input[name='lcheckCode']").val()}
414        }).then(function(response){
415        	if(response.data.result == "success"){
416        		if(window.location.href.indexOf("forget-pwd") > 0){
417        			window.location.href = local_host;
418        		}else{
419        			window.location.reload();
420        		}
421	        }else{
422	        	$("#lerrorCode").css("display","block");
423	        }
424        },function(response){
425        	console.log("系统异常");
426        	alert("系统异常");
427        });
428    };
429});
430
431app.controller('forgetPassword', function($scope,$http,$interval) {
432    
433    $scope.nextStep = function(){
434    	$http({
435    		method:'POST',
436            url:local_host +"user/modify-password-checkcode",
437            params:{"phone":$("input[name='fphone']").val(),'checkCode':$("input[name='fcheckCode']").val()}
438        }).then(function(response){
439        	if(response.data.result == "success"){
440        		$(".tempphone").hide();
441        		$(".nextstep").hide();
442        		$(".temppass,.stepdefine").show()
443	        }else{
444	        	$("#ferrorCode").css("display","block");
445	        }
446        },function(response){
447        	console.log("系统异常");
448        	alert("系统异常");
449        });
450    };
451    
452    $scope.modifyPassword = function(){
453    	if($("input[name='fpassword']").val() == $("input[name='fpassword2']").val()){
454	    	$http({
455	    		method:'POST',
456	            url:local_host +"user/modify-password",
457	            params:{"phone":$("input[name='fphone']").val(),'password':$("input[name='fpassword']").val()}
458	        }).then(function(response){
459	        	if(response.data.result == "success"){
460	        		$(".monitor").show();
461	        		$(".loginwrap").show();
462	        		$("body").css({ 
463        			  "overflow-x":"hidden",
464        			  "overflow-y":"hidden" 
465        			});
466		        }else{
467		        	alert("系统异常");
468		        }
469	        },function(response){
470	        	console.log("系统异常");
471	        	alert("系统异常");
472	        });
473    	}else{
474    		$("#ferrorPassword").css("display","block");
475    	}
476    };
477});
478
479//获取上次登录记录
480app.controller('j-user-log', function($scope, $http) {
481	var userId = $('#userId').val();
482	if(!isNull(userId)){
483		$http({
484			 method:'post',
485	         url:local_host +"user/latest-user-log",
486	         params:{'userId':userId}
487	     }).then(function(response){
488	    	 //成功时执行
489	    	 if(response.data.result == 'success'){
490	    		 $scope.userLog = response.data.data;
491	    	 }else{
492	    		 console.log(response.data.message);
493	    	 }
494	     },function(response){
495	         //失败时执行 
496	         console.log(response.data.message);
497	     });
498	}
499});
500
501//获取关注的分类号,关键词,作者信息
502app.controller('j-user-attention', function($scope, $http) {
503	var userId = $('#userId').val();
504	if(!isNull(userId)){
505		$http({
506			 method:'post',
507	         url:local_host +"user/user-attention-data",
508	         params:{'userId':userId}
509	     }).then(function(response){
510	    	 //成功时执行
511	    	 if(response.data.result == 'success'){
512	    		 $scope.userAttention = response.data.data;
513	    	 }else{
514	    		 console.log(response.data.message);
515	    	 }
516	     },function(response){
517	         //失败时执行 
518	         console.log(response.data.message);
519	     });
520	}
521	
522	$scope.saveAttention = function() {
523		var classNumber = $('#classNumber').val();
524		if(isNull(classNumber)){
525			classNumber = "";
526		}
527		var keyword = $('#keyword').val();
528		if(isNull(keyword)){
529			keyword = "";
530		}
531		var author = $('#author').val();
532		if(isNull(author)){
533			author = "";
534		}
535		$http({
536			 method:'post',
537	         url:local_host +"user/save-user-attention",
538	         params:{'userId':userId,'classNumber':classNumber,'keyword':keyword,'author':author}
539	     }).then(function(response){
540	    	 //成功时执行
541	    	 if(response.data.result == 'success'){
542	    		 alert("保存成功!");
543	    	 }else{
544	    		 alert("系统异常,保存失败!");
545	    	 }
546	     },function(response){
547	         //失败时执行 
548	         console.log(response.data.message);
549	     });
550	}
551});
552
553//保存关注的分类号,关键词和作者
554app.controller('j-user-attention-save', function($scope, $http) {
555	var userId = $('#userId').val();
556	if(!isNull(userId)){
557		var classNumber = $('#classNumber').val();
558		if(isNull(classNumber)){
559			classNumber = "";
560		}
561		var keyword = $('#keyword').val();
562		if(isNull(keyword)){
563			keyword = "";
564		}
565		var author = $('#author').val();
566		if(isNull(author)){
567			author = "";
568		}
569		$http({
570			 method:'post',
571	         url:local_host +"user/save-user-attention",
572	         params:{'userId':userId,'classNumber':classNumber,'keyword':keyword,'author':author}
573	     }).then(function(response){
574	    	 //成功时执行
575	    	 if(response.data.result == 'success'){
576	    		 $scope.userAttention = response.data.data;
577	    	 }else{
578	    		 console.log(response.data.message);
579	    	 }
580	     },function(response){
581	         //失败时执行 
582	         console.log(response.data.message);
583	     });
584	}
585});
586
587
588/**
589 * 用户关注列表:分类号,关键词,作者等文章
590 * @param $scope
591 * @param $http
592 * @returns
593 */
594app.controller('j-user-attention-list', function($scope, $http) {
595	//输出A-Z  26个大写字母
596	
597	//页面第一次加载
598	/*setTimeout(function() { 
599		$scope.paginationData(0);
600	});*/
601	//点击页码加载
602	$scope.gotopage = function(page) {
603		if(isNull(page)){
604			$scope.paginationData(1);
605		}else{
606			$('#pageNum').val(page);
607			$scope.paginationData(2);
608		}
609	}
610	//输入页码加载
611	$scope.enterEvent = function (e) {
612		if(loadCommonPagesEnter(e)){
613			$scope.paginationData(1);
614		}
615    };
616    
617    $scope.toAttentionViewPage = function(attentionType) {
618    	//0:分类号;1:关键词;2:作者;
619    	$('#pageNum').val(1);
620    	$('#attentionType').val(attentionType);
621    	$scope.paginationData(0);
622	}
623  
624	$scope.paginationData = function(type) {
625	    
626		var currentpage = 0;
627		if(type == 1){
628			currentpage = $("input.inputpagenum").val();
629		}else{
630			currentpage = $('#pageNum').val();
631		}
632		var limit = $('#limit').val();
633		if(isNull(limit)){
634			limit = 10;
635		}
636		
637		var attentionType = $('#attentionType').val();
638		if(isNull(attentionType)){
639			attentionType = "";
640		}
641		
642		var userId = $('#userId').val();
643		if(isNull(userId)){
644			userId = "";
645		}
646		
647		$http({
648			 method:'post',
649	         url:local_host +"user/attention-list-data",
650	         params:{'userId':userId,'type':attentionType,'pageNum':currentpage,'limit':limit}
651	     }).then(function(response){
652	    	 //成功时执行
653	    	 if(response.data.result == 'success'){
654	    		 if(attentionType == 0){
655	    			 $scope.attentionsClass = response.data.data.data;
656	    		 }else if(attentionType == 1){
657	    			 $scope.attentionsKeyword = response.data.data.data;
658	    		 }else if(attentionType == 2){
659	    			 $scope.attentionsAuthor = response.data.data.data;
660	    		 }
661	    		 
662	    		 var count = response.data.data.count;
663	    		 var totalpage = Math.ceil(count/limit);
664	    		 $scope.count =  count;
665	    		 $scope.totalpage =  totalpage;
666	    		 $scope.currentpage =  Number(currentpage);
667	    		 $scope.pageList = new Array();
668	    		 $scope.pageList = loadCommonPages(count,totalpage,currentpage,limit);
669	    		 
670	    		 $('#amount').val(count);
671	    		 $('#totalpage').val(totalpage);
672	    		 $('.loading-show').hide();
673	    	 }else{
674	    		 console.log(response.data.message);
675	    	 }
676	     },function(response){
677	         //失败时执行 
678	         console.log(response.data.message);
679	     });
680	 }
681});
682
683/**
684 * 用户收藏列表:type==>0:论文;1:图书;2:讲座;3:会议;
685 * @param $scope
686 * @param $http
687 * @returns
688 */
689app.controller('j-user-collection-list', function($scope, $http) {
690	//输出A-Z  26个大写字母
691	
692	//页面第一次加载
693	/*setTimeout(function() { 
694		$scope.paginationData(0);
695	});*/
696	//点击页码加载
697	$scope.gotopage = function(page) {
698		if(isNull(page)){
699			$scope.paginationData(1);
700		}else{
701			$('#pageNum').val(page);
702			$scope.paginationData(2);
703		}
704	}
705	//输入页码加载
706	$scope.enterEvent = function (e) {
707		if(loadCommonPagesEnter(e)){
708			$scope.paginationData(1);
709		}
710    };
711    
712    $scope.toCollectionViewPage = function(collectionType) {
713    	$('#pageNum').val(1);
714    	//0:论文;1:图书;2:讲座;3:会议;
715    	$('#collectionType').val(collectionType);
716    	$scope.paginationData(0);
717	}
718    
719    //取消收藏
720    $scope.toCancelCollection = function(id) {
721    	if(!isNull(id)){
722	    	$http({
723				 method:'post',
724		         url:local_host +"user/cancel-collection-user",
725		         params:{'id':id}
726		     }).then(function(response){
727		    	 //成功时执行
728		    	 if(response.data.result == 'success'){
729		    		 //$scope.collection = response.data.data;
730		    		 alert("取消收藏成功!");
731		    	 }else{
732		    		 console.log(response.data.message);
733		    	 }
734		     },function(response){
735		         //失败时执行 
736		         console.log(response.data.message);
737		     });
738	    }
739	}
740  
741	$scope.paginationData = function(type) {
742	    
743		var currentpage = 0;
744		if(type == 1){
745			currentpage = $("input.inputpagenum").val();
746		}else{
747			currentpage = $('#pageNum').val();
748		}
749		var limit = $('#limit').val();
750		if(isNull(limit)){
751			limit = 10;
752		}
753		
754		var collectionType = $('#collectionType').val();
755		if(isNull(collectionType)){
756			collectionType = "";
757		}
758		
759		var userId = $('#userId').val();
760		if(isNull(userId)){
761			userId = "";
762		}
763		
764		$http({
765			 method:'post',
766	         url:local_host +"user/collection-user-data",
767	         params:{'userId':userId,'type':collectionType,'pageNum':currentpage,'limit':limit}
768	     }).then(function(response){
769	    	 //成功时执行
770	    	 if(response.data.result == 'success'){
771	    		 $scope.collections = response.data.data;
772	    		 
773	    		 var count = response.data.count;
774	    		 var totalpage = Math.ceil(count/limit);
775	    		 $scope.count =  count;
776	    		 $scope.totalpage =  totalpage;
777	    		 $scope.currentpage =  Number(currentpage);
778	    		 $scope.pageList = new Array();
779	    		 $scope.pageList = loadCommonPages(count,totalpage,currentpage,limit);
780	    		 
781	    		 $('#amount').val(count);
782	    		 $('#totalpage').val(totalpage);
783	    		 $('.loading-show').hide();
784	    	 }else{
785	    		 console.log(response.data.message);
786	    	 }
787	     },function(response){
788	         //失败时执行 
789	         console.log(response.data.message);
790	     });
791	 }
792});
793
794app.controller('j-user-modify', function($scope, $http) {
795	var userId = $('#userId').val();
796	//页面第一次加载
797	setTimeout(function() { 
798		$scope.findUserInfo();
799	});
800	
801	//重置时获取个人信息
802	$scope.resetUserInfo = function(){
803		$scope.findUserInfo();
804		$('.userphoto').attr("src",$scope.userInfo.imagePath);
805		$('#imagePath').val($scope.userInfo.imagePath);
806	}
807	
808	//获取个人信息
809	$scope.findUserInfo = function(){
810		if(!isNull(userId)){
811			$http({
812				 method:'post',
813		         url:local_host +"user/user-info-data",
814		         params:{'userId':userId}
815		     }).then(function(response){
816		    	 //成功时执行
817		    	 if(response.data.result == 'success'){
818		    		 $scope.userInfo = response.data.data;
819		    		 if(isNull($scope.userInfo.sex)){
820		    			 $scope.userInfo.sex = 0;
821		    		 }
822		    		 $scope.phone = $scope.userInfo.phone;
823		    	 }else{
824		    		 console.log(response.data.message);
825		    	 }
826		     },function(response){
827		         //失败时执行 
828		         console.log(response.data.message);
829		     });
830		}
831	}
832	
833	//保存个人信息
834	$scope.modifyUserInfo = function(){
835		//如手机号未做修改
836		var imagePath = $('#imagePath').val();
837		if($scope.userInfo.phone == $scope.phone){
838			$http({
839				 method:'post',
840		        url:local_host +"user/user-modify",
841		        params:{'id':userId,'realName':$scope.userInfo.realName,'realNameEn':$scope.userInfo.realNameEn,
842		       	 'sex':$scope.userInfo.sex,'birthday':$scope.userInfo.birthday,'country':$scope.userInfo.country,
843		       	 'province':$scope.userInfo.province,'institution':$scope.userInfo.institution,
844		       	 'email':$scope.userInfo.email,'phone':$scope.userInfo.phone,'imagePath':imagePath}
845		    }).then(function(response){
846		   	 //成功时执行
847		   	 if(response.data.result == 'success'){
848		   		alert("保存成功!");
849		   	 }else{
850		   		alert("系统异常,保存失败!");
851		   	 }
852		    },function(response){
853		        //失败时执行 
854		        console.log(response.data.message);
855		    });
856		}
857	}
858	
859	//修改密码
860	$scope.savePassword = function(){
861		var oldPassword = $("input[name='oldPassword']").val();
862		var newPassword1 = $("input[name='newPassword1']").val();
863		var newPassword2 = $("input[name='newPassword2']").val();
864		if(!isNull(oldPassword) && !isNull(newPassword1) && newPassword1 == newPassword2){
865			$('#errorTwoPassword').hide();
866			$http({
867				 method:'post',
868		        url:local_host +"user/save-password",
869		        params:{'userId':userId,'oldPassword':oldPassword,'newPassword':newPassword1}
870		    }).then(function(response){
871		   	 //成功时执行
872		   	 if(response.data.result == 'success'){
873		   		$("input[name='oldPassword']").val("");
874				$("input[name='newPassword1']").val("");
875				$("input[name='newPassword2']").val("");
876		   		alert("修改成功!");
877		   	 }else{
878		   		alert("旧密码错误,修改失败!");
879		   	 }
880		    },function(response){
881		        //失败时执行 
882		        console.log(response.data.message);
883		    });
884		}else{
885			$('#errorTwoPassword').show();
886		}
887	}
888	
889	//重置密码
890	$scope.resetPassword = function(){
891		$("input[name='oldPassword']").val("");
892		$("input[name='newPassword1']").val("");
893		$("input[name='newPassword2']").val("");
894	}
895	
896	//上传图片
897	$scope.uploadImg = function(){
898		var file = document.querySelector("input[name='imagePath']").files[0];
899		if(isNull(file)){
900			alert("请上传文件");
901			return false;
902		}
903		var userId = $("input[name='userId']").val();
904		var fd = new FormData();
905	    //var file = document.querySelector('input[type=file]').files[0];
906	    fd.append('file', file);
907	    fd.append('userId', userId);
908    	$http({
909    		method:'POST',
910            url:local_host +"user/upload-user-file",
911            data:fd,
912            headers: {'Content-Type':undefined},
913            transformRequest: angular.identity
914        }).then(function(response){
915        	if(response.data.result == "success"){
916        		$scope.file = response.data.data;
917        		$('.userphoto').attr("src",$scope.file.filePath);
918        		$('#imagePath').val($scope.file.filePath);
919        		alert("上传成功!");
920	        }else{
921	        	alert("系统异常!");
922	        }
923        },function(response){
924        	alert("系统异常");
925        });
926	}
927});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.