Browse Source

修改名字,机构身份验证ok

jack 8 years ago
parent
commit
273bc91fbe
2 changed files with 83 additions and 6 deletions
  1. 1 1
      src/main/webapp/information.html
  2. 82 5
      src/main/webapp/js/information.js

+ 1 - 1
src/main/webapp/information.html

@ -69,7 +69,7 @@
69 69
	                       <div class="infor">
70 70
		                        <span class="txtType"><b class="required_star"></b><em class="emspace">姓</em>名</span>
71 71
								<input type="text" class="input-txt name" id="name">
72

72
								<span id="authSta" style="float:right;margin-right:70px;color:red;"></span>
73 73
							</div>
74 74
							<div class="infor" id="titleNone">
75 75
								<span><em class="emspace">职</em>称</span>

+ 82 - 5
src/main/webapp/js/information.js

@ -1,6 +1,8 @@
1 1
$(function(){
2 2
	//1获取数据
3
	
3
	var nameD;
4
	var orgD;
5
	var authSD
4 6
	loginStatus();
5 7
	 	var userid = $.cookie("userid");
6 8
	 	if(userid){
@ -509,6 +511,10 @@ $.get("/ajax/professor/info/" + userid, function($data) {
509 511
		if ($info) {			
510 512
			//展示专家的信息
511 513
			$("#nameS").text($info.name);
514
			nameD=$info.name;
515
			authSD=$info.authStatus;
516
			console.log($info.authStatus)
517
			 orgD=$info.orgName;
512 518
			if($info.authentication == 2){
513 519
				$("#orgUpdata").text("所在企业")
514 520
			}
@ -519,6 +525,12 @@ $.get("/ajax/professor/info/" + userid, function($data) {
519 525
				$("#office").hide()
520 526
				$("#titleS").hide();	
521 527
			}
528
			console.log($info.authType)
529
			if($info.authStatus){				
530
				$("#authSta").text("已认证");
531
			}else{				
532
				$("#authSta").text("未认证");
533
			}
522 534
			if($info.office) {
523 535
				if($info.title) {
524 536
					$("#office").text($info.office+",");
@ -685,7 +697,7 @@ else {
685 697
		return str.replace(/(^\s*)|(\s*$)/g, "");
686 698
	}
687 699
//头像旁保存
688
$("#saveProfessor").on("click",function () {
700
$("#saveProfessor").on("click",function () {	
689 701
	var length1=trim($("#name").val());
690 702
	console.log(length1)
691 703
	var length2=trim($("#orgName").val());
@ -698,7 +710,66 @@ $("#saveProfessor").on("click",function () {
698 710
	}else if(!length1&&!length2){
699 711
		$.MsgBox.Alert("消息提醒","姓名和所在机构不能为空");
700 712
		return;
713
	} 
714
	if(nameD!=length1&&orgD!=length2){
715
		if(authSD){
716
			$.MsgBox.Confirm("消息", "修改姓名&&和所在机构会导致身份验证失效?",personUpdata);
717
			
718
			return;
719
		}else{
720
			personUpdata();
721
		}
722
		
723
	}else if(nameD==length1&&orgD!=length2){
724
		if(authSD){
725
			$.MsgBox.Confirm("消息", "修改所在机构会导致身份验证失效?",personUpdata);			
726
			return;
727
		}else{
728
			personUpdata();
729
		}
730
		
731
	}else if(nameD!=length1&&orgD==length2){
732
		if(authSD){
733
			$.MsgBox.Confirm("消息", "修改姓名会导致身份验证失效?",personUpdata);			
734
			return;
735
		}else{
736
			personUpdata();
737
		}
738
		
739
	}else{
740
		personUpdata();
741
	}
742
	
743
});
744
//更新认证状态函数
745
var upStatus = function() {		
746
	$.ajax({
747
		url:"/ajax/professor/authStatus",
748
		dataType: 'json', //数据格式类型
749
		type: 'post', //http请求类型
750
		data: {
751
			authStatus: 0,
752
			id: userid
753
		},
754
		timeout: 10000, //超时设置				
755
		success: function(data) {
756
			if(data.success) {						
757
			}else{
758
				
759
			}
760
		}
761
	})
762
}
763
function personUpdata(){
764
	if(nameD==$("#name").val()&&orgD==$("#orgName").val()){
765
		
766
	}else{
767
		if(authSD){
768
			 upStatus();
769
		}
770
		
701 771
	}
772
	
702 773
	var $data = {};
703 774
	$data.name = $("#name").val();
704 775
	$data.orgId = $("#orgId").val();
@ -707,7 +778,6 @@ $("#saveProfessor").on("click",function () {
707 778
	$data.department = $("#department").val();
708 779
	$data.province = $("#Province input[name=cho_Province]").val();//省
709 780
	$data.address = $("#City input[name=cho_City]").val();//市
710
//	$data.address=$("#addressRevise").val();
711 781
	$data.office=$("#officeRevise").val();	
712 782
	var userid = $.cookie("userid");
713 783
	if (userid) {
@ -726,6 +796,14 @@ $("#saveProfessor").on("click",function () {
726 796
				  				//展示专家的信息
727 797
				  				$(".modifybox").css("display","none");
728 798
				  				$(".infor-browse").css("display","block");
799
				  				if($info.authType){
800
				  					$("#authSta").text("已认证");
801
				  				}else{
802
				  					$("#authSta").text("未认证");
803
				  				}
804
				  				nameD=$info.name;
805
				  				authSD=$info.authStatus;
806
				  				 orgD=$info.orgName;
729 807
				  							$("#nameS").text("");
730 808
				  							$("#office").text("");
731 809
				  							$("#titleS").text("");
@ -788,8 +866,7 @@ $("#saveProfessor").on("click",function () {
788 866
		"contentType" : userid ? "application/json": "application/x-www-form-urlencoded",
789 867
		dataType : "json"
790 868
	});
791
})
792

869
}
793 870
//上传图像的hover
794 871
$(".head-left").hover(function() {
795 872
	$(".replace-photo").animate({