Przeglądaj źródła

我的工作台:更新检查Ok(鹏涛)

xiaoai_123 8 lat temu
rodzic
commit
58b1fffabc
1 zmienionych plików z 156 dodań i 84 usunięć
  1. 156 84
      src/main/webapp/js/workindex.js

+ 156 - 84
src/main/webapp/js/workindex.js

3
	//获取专家的数据
3
	//获取专家的数据
4
	function getProfessorData(professorId){		
4
	function getProfessorData(professorId){		
5
		$.ajax({	
5
		$.ajax({	
6
		"url":"ajax/professor/"+professorId,
7
		"type":"get",
8
		"async": false,
9
		"success":function(data){
6
		"url":"/ajax/professor/editBaseInfo/"+professorId,
7
		"type":"get",		
8
		"async": true,
9
		"success":function(data) {
10
			if(data.success)
10
			if(data.success)
11
			{																				
11
			{					
12
			$("#nameS").text(data.data.name);
12
			$("#nameS").text(data.data.name);
13
			$("#title").text(data.data.title);
14
			$("#deparment").text(data.data.department);
15
			$("#organization").text(data.data.organization.name);
13
			$("#allConsultCount").text(data.data.consultCount);
14
			if(data.data.authentication){
15
				$(".modifyicon")[0].src="modifyicon"
16
			}
17
			else{
18
				$(".modifyicon").hide();
19
			}
20
			if(data.data.office) {
21
				$("#office").text(data.data.office+",");
22
			}
23
			if(data.data.title) {
24
				$("#title").text(data.data.title);
25
			}			
26
			if(data.data.department) {
27
				$("#department").text(data.data.department+",");
28
			}
29
			if(data.data.orgName) {
30
				$("#organization").text(data.data.orgName);
31
			}
32
			if(data.data.address) {
33
				$("#address").text(data.data.address);
34
			}			
35
			if(data.data.hasHeadImage) {
36
				$(".imgProfess").attr("src","/images/head/"+userid+"_l.jpg");
37
			}
38
			else 
39
			{
40
				$(".imgProfess").attr("src","/images/default-photo.jpg");
41
			}			
42
			var startLeval=parseInt(data.data.starLevel);			
43
			for(var i=0;i<startLeval;i++) {
44
				$(".evastar2").eq(i).addClass("startStyle");
45
			}
16
			}
46
			}
17
			else
47
			else
18
			{
48
			{
19
				$.MsgBox.Alert("消息","系统异常!");
49
				$.MsgBox.Alert("消息","获取专家数据失败!");
20
			}
50
			}
21
		},
51
		},
22
		"error":function(){$.MsgBox.Alert('message','failddd')}
52
		"error":function(){$.MsgBox.Alert('message','获取专家数据失败')}
23
		})	
53
		})	
24
	}
54
	}
25
	getProfessorData(userid);
55
	getProfessorData(userid);
26
	getRecentlyData();
56
	getRecentlyData();
27
	$("#allResource .worklinkbtn").on("click",function(){
57
	$("#allResource,#worklinkre").on("click",function(){
28
		$(".worksubmenu").eq(1).addClass("subcolor").siblings().removeClass("subcolor");
58
		$(".worksubmenu").eq(1).addClass("subcolor").siblings().removeClass("subcolor");
29
		$.ajax({
59
		$.ajax({
30
			"url":"sciresource.html",
60
			"url":"sciresource.html",
31
			"dataType":"html",
61
			"dataType":"html",
32
			"success":function(result){												
62
			"success":function(result){												
33
			$(".workcon").html(result);
63
			$(".workcon").html(result);
64
			if(reNO==false&&opNO)
65
			{				
66
				$(".workmysrc1").eq(1).show().siblings().hide();
67
				$(".worksamlltit").eq(1).addClass("worksamlltitnow").siblings().removeClass("worksamlltitnow");
68
			}
34
			}		
69
			}		
35
		})		
70
		})		
36
	})
71
	})
46
			if(data.success)
81
			if(data.success)
47
				{
82
				{
48
				$(".sharesrcbox11").html("");
83
				$(".sharesrcbox11").html("");
49
					//console.log(data);
84
					
50
					for(var i=0;i<data.data.data.length;i++)
85
					for(var i=0;i<data.data.data.length;i++)
51
					{
86
					{
52
						data.data.data[i].createTime=changeTime(data.data.data[i].createTime);					
87
						data.data.data[i].createTime=changeTime(data.data.data[i].createTime);					
61
						}						
96
						}						
62
	                    stringContent +='<div class="shareshow"><img src="" width="100%" height="184"class="resourceImage"></div>'
97
	                    stringContent +='<div class="shareshow"><img src="" width="100%" height="184"class="resourceImage"></div>'
63
	                    stringContent +='<p>资源名称:'+data.data.data[i].resource.resourceName+'</p>'
98
	                    stringContent +='<p>资源名称:'+data.data.data[i].resource.resourceName+'</p>'
64
	                    stringContent +='<p>简介:'+data.data.data[i].resource.supportedServices+'</p>'
99
	                    if(userid==data.data.data[i].professor.id)
100
	                    	{
101
	                    	 stringContent +='<p>合作对象:'+data.data.data[i].resource.professor.name+'</p>'
102
	                    	}
103
	                    else{
104
	                    	 stringContent +='<p>合作对象:'+data.data.data[i].professor.name+'</p>'
105
	                    }
65
		                stringContent +='<p>最新动态:</p>'
106
		                stringContent +='<p>最新动态:</p>'
66
		                stringContent +='<p class="statuswork"></p>'
107
		                stringContent +='<p class="statuswork"></p>'
67
		                stringContent +='</div>'
108
		                stringContent +='</div>'
68
		                $(".sharesrcbox11").append(stringContent);
69
	                    $(".resourceImage").eq(i).attr("src","/images/resource/"+data.data.data[i].resource.resourceId+".jpg");
70
						$(".resourceImage").eq(i).load(function(){
71
							
72
						}).error(function(){
73
								$(this).attr("src","/images/default-resource.jpg");
74
							});
109
		                var $stringContent=$(stringContent)
110
		                $(".sharesrcbox11").append($stringContent);
111
		                if(data.data.data[i].resource.images.length){
112
		                	$stringContent.find(".resourceImage").attr("src","/images/resource/"+data.data.data[i].resource.resourceId+".jpg");
113
		                }
114
		                else{
115
		                	$stringContent.find(".resourceImage").attr("src","/images/default-resource.jpg");
116
		                }
117
					
75
						//console.log(data.data.data[i].resource.supportedServices);
118
						//console.log(data.data.data[i].resource.supportedServices);
76
						if(userid==data.data.data[i].professor.id)
119
						if(userid==data.data.data[i].professor.id)
77
						{
120
						{
78
							switch(data.data.data[i].operationStatus)
121
							switch(data.data.data[i].operationStatus)
79
							{
122
							{
80
								case 1:
123
								case 1:
81
									var string='<span title="修改申请">申请已发送待'+data.data.data[i].resource.professor.name+'确认</span><br/>'								
124
									var string='<span title="修改申请">申请已发送待'+data.data.data[i].resource.professor.name+'确认</span><br/>'								
82
										$(".statuswork").eq(i).html(string);
125
										$(".statuswork").eq(i).html(string);
83
								  break;
126
								  break;
84
								case 2:
127
								case 2:
125
									$(".statuswork").eq(i).html(string);									
168
									$(".statuswork").eq(i).html(string);									
126
									break;									
169
									break;									
127
								case 3:										
170
								case 3:										
128
									var string='<span>'+data.data.data[i].professor.name+'发来报价合作进行中,查看详情</span><br/>'								  
171
									var string='<span>'+data.data.data[i].professor.name+'发来报价合作进行中,查看详情</span><br/>'								  
129
									$(".statuswork").eq(i).html(string);								
172
									$(".statuswork").eq(i).html(string);								
130
									break;									
173
									break;									
131
								case 4:										
174
								case 4:										
503
			"url":"/ajax/operation/"+operationId,
546
			"url":"/ajax/operation/"+operationId,
504
			"type":"get",
547
			"type":"get",
505
			"async": true,
548
			"async": true,
506

507
			"success":function(data){
549
			"success":function(data){
508
				if(data.success)
550
				if(data.success)
509
					{
510
					//console.log(data);
551
					{					
511
						$(".log").text(data.data.resource.resourceName);
552
						$(".log").text(data.data.resource.resourceName);
512
						$(".timelog").text(changeTime(data.data.createTime));
553
						$(".timelog").text(changeTime(data.data.createTime));
513
						$(".contration").text(data.data.operationId);
554
						$(".contration").text(data.data.operationId);
573
			"url":"/ajax/operation/"+operationId,
614
			"url":"/ajax/operation/"+operationId,
574
			"type":"get",
615
			"type":"get",
575
			"async": true,
616
			"async": true,
576

577
			"success":function(data){
617
			"success":function(data){
578
				if(data.success)
618
				if(data.success)
579
					{//console.log(data);
619
					{
580
						$(".log").text(data.data.resource.resourceName);
620
						$(".log").text(data.data.resource.resourceName);
581
						$(".timelog").text(changeTime(data.data.createTime));
621
						$(".timelog").text(changeTime(data.data.createTime));
582
						$(".contration").text(data.data.operationId);
622
						$(".contration").text(data.data.operationId);
725
	});
765
	});
726
	getConsultData(userid);
766
	getConsultData(userid);
727
	getReplyData(userid);
767
	getReplyData(userid);
728
	queryUnreadConsultFn(userid);
729
	allConsultFn(userid);
730
	
731
	function allConsultFn(professorId){
732
		var params = {"professorId":professorId};
733
		$.ajax({
734
			"url":"/ajax/consult/qaReceiveConsult",
735
			"type":"get",
736
			"async": false,
737
			"data":params,
738
			"success":function(response){
739
				$("#allConsultCount").html(response["data"]);
740
			},
741
			"error":function(){
742
				$.MsgBox.Alert('message','总的咨询条数请求失败');
743
			}
744
		});
745
		
746
	}
768
	queryUnreadConsultFn(userid);//未读咨询总数
747

769

748
	function queryUnreadConsultFn(professorId){
770

771
	function queryUnreadConsultFn(professorId){//未读咨询总数函数
749
		var params = {"professorId":professorId};
772
		var params = {"professorId":professorId};
750
		$.ajax({
773
		$.ajax({
751
			"url":"/ajax/consult/qaReadStatus",
774
			"url":"/ajax/consult/qaReadStatus",
752
			"type":"get",
775
			"type":"get",
753
			"async": false,
776
			"async": false,
754
			"data":params,
777
			"data":params,
755
			"success":function(response){
756
				console.log(response)
757
				$("#unreadConsult").html(response["data"]);
778
			"success":function(response){				
779
				$("#unreadConsult").html(response["data"]);				
758
			},
780
			},
759
			"error":function(){
781
			"error":function(){
760
				$.MsgBox.Alert('message','总的未读咨询条数请求失败');
782
				$.MsgBox.Alert('message','总的未读咨询条数请求失败');
765
	function getConsultData(professorId){
787
	function getConsultData(professorId){
766
		var params = {"professorId":professorId};
788
		var params = {"professorId":professorId};
767
		$.ajax({
789
		$.ajax({
768
			"url":"/ajax/consult/pqpro",
790
			"url":"/ajax/consult/qaNewConsult",
769
			"type":"get",
791
			"type":"get",
770
			"async": false,
792
			"async": false,
771
			"data":params,
793
			"data":params,
772
			"success":function(response){
773
				if(response["data"]["data"].length != 0){
774
					var newConsultData = response["data"]["data"][0];
775
					$("#myFlatConsultTime").attr("consultId",newConsultData["consultId"]);
776
					$("#myFlatProName").html(newConsultData["professor"]["name"]);
777
					$("#myFlatProTitle").html(newConsultData["professor"]["title"]);
778
					$("#myFlatProDepartment").html(newConsultData["professor"]["orgName"]);
779
					$("#myFlatConsultTime").html(newConsultData["createTime"].substr(0,4) + "-" + newConsultData["createTime"].substr(4,2) + "-" + newConsultData["createTime"].substr(6,2) + " "
780
							+ newConsultData["createTime"].substr(8,2)+ ":" +newConsultData["createTime"].substr(10,2));
781
					$("#myFlatConsultTitle").html(newConsultData["consultTitle"]);
782
					$("#myFlatConsultContent").html(newConsultData["consultContant"]);
783
				}else{
784
					return false;
794
			"success":function(response){				
795
				if(response.success) {
796
					if(response.data != null) {
797
						var newConsultData = response["data"];
798
						$("#myFlatConsultTime").attr("consultId",newConsultData["consultId"]);
799
						$("#myFlatProName").text(newConsultData["professor"]["name"]);	
800
						if(newConsultData["professor"]["office"]) {
801
							$("#myReplyProOffice").html(newConsultData["professor"]["office"]+",");
802
						}
803
						if(newConsultData["professor"]["title"]) {
804
							$("#myReplyProTitle").html(newConsultData["professor"]["title"]);
805
						}
806
						if(newConsultData["professor"]["department"]) {
807
							$("#myReplyProDepartment").html(newConsultData["professor"]["department"]+",");
808
						}
809
						if(newConsultData["professor"]["orgName"]) {
810
							$("#myReplyProOrgName").html(newConsultData["professor"]["orgName"]);
811
						}
812
						if(newConsultData["professor"]["address"]) {
813
							$("#myReplyAddress").html(newConsultData["professor"]["address"]);
814
						}										
815
						$("#myFlatConsultTime").html(newConsultData["createTime"].substr(0,4) + "-" + newConsultData["createTime"].substr(4,2) + "-" + newConsultData["createTime"].substr(6,2) + " "
816
								+ newConsultData["createTime"].substr(8,2)+ ":" +newConsultData["createTime"].substr(10,2));
817
						$("#myFlatConsultTitle").html(newConsultData["consultTitle"]);
818
						$("#myFlatConsultContent").html(newConsultData["consultContant"]);
819
					}
820
					else {
821
						$("#wbcon1").empty("");
822
						var height=$("#repalyf").height();												
823
						$("#wbcon1").append('<span id="wbcen">暂无最新咨询消息~~</span>').css("height",height);
824
						var oHeight=($("#wbcon1").height()-$("#wbcen").height())/2;
825
						var oWidth=($("#wbcon1").width()-$("#wbcen").width())/2;					
826
						$("#wbcen").css({"display":"inline-block","margin-top":oHeight,"margin-left":oWidth});						
827
					}
828
					
829
				}
830
				else {
831
					$.MsgBox.Alert("消息","最新咨询数据请求失败");
785
				}
832
				}
786
				
833
				
787
			},
834
			},
796
	function getReplyData(consultantId){
843
	function getReplyData(consultantId){
797
		var params = {"consultantId":consultantId};
844
		var params = {"consultantId":consultantId};
798
		$.ajax({
845
		$.ajax({
799
			"url":"/ajax/consult/pqcon",
846
			"url":"/ajax/tidings/qaNewReply",
800
			"type":"get",
847
			"type":"get",
801
			"async": false,
848
			"async": true,
802
			"data":params,
849
			"data":params,
803
			"success":function(response){
850
			"success":function(response){
804
//				console.log(response);
805
//				console.log(response["data"]["data"].length);
806
				if(response["data"]["data"].length != 0){
807
					var newReplyData = response["data"]["data"][0];
808
					$("#myFlatRelpyTime").attr("consultId",newReplyData["consultId"]);
809
					$("#myFlatReplyProName").html(newReplyData["professor"]["name"]);
810
					$("#myFlatReplyProTitle").html(newReplyData["professor"]["title"]);
811
					$("#myFlatReplyProDepartment").html(newReplyData["professor"]["orgName"]);
812
					$("#myFlatRelpyTime").html(newReplyData["createTime"].substr(0,4) + "-" + newReplyData["createTime"].substr(4,2) + "-" + newReplyData["createTime"].substr(6,2) + " "
813
							+ newReplyData["createTime"].substr(8,2)+ ":" +newReplyData["createTime"].substr(10,2));
814
					$("#myFlatRelpyTitle").html(newReplyData["consultTitle"]);
815
					$("#myFlatRelpyContent").html(newReplyData["consultContant"]);
816
				}else{
817
					return false;
851
				if(response.success) {					
852
					if(response["data"] != null) {
853
						var newReplyData = response["data"];
854
						$("#myFlatRelpyTime").attr("consultId",newReplyData["consult"]["consultId"]);
855
						$("#myFlatReplyProName").html(newReplyData["professor"]["name"]);
856
						if(newReplyData["professor"]["office"]) {
857
							$("#myProOffice").html(newReplyData["professor"]["office"]+",");
858
						}
859
						if(newReplyData["professor"]["title"]) {
860
							$("#myProTitle").html(newReplyData["professor"]["title"]);
861
						}
862
						if(newReplyData["professor"]["department"]) {
863
							$("#myProDepartment").html(newReplyData["professor"]["department"]+",");
864
						}
865
						if(newReplyData["professor"]["orgName"]) {
866
							$("#myProOrgName").html(newReplyData["professor"]["orgName"]);
867
						}
868
						if(newReplyData["professor"]["address"]) {
869
							$("#myAddress").html(newReplyData["professor"]["address"]);
870
						}											
871
						$("#myFlatRelpyTime").html(newReplyData["createTime"].substr(0,4) + "-" + newReplyData["createTime"].substr(4,2) + "-" + newReplyData["createTime"].substr(6,2) + " "
872
								+ newReplyData["createTime"].substr(8,2)+ ":" +newReplyData["createTime"].substr(10,2));					
873
						$("#myFlatRelpyTitle").html(newReplyData["consult"]["consultTitle"]);
874
						
875
						$("#myFlatRelpyContent").html(newReplyData["tidingsContant"]);
876
					}
877
					else {		$("#wbcon2").empty("")
878
							var height=$("#wbcon1").height();							
879
							$("#wbcon2").append('<span id="wbcent">暂无最新回复消息~~</span>').css("height",height);
880
							var oHeight=($("#wbcon2").height()+40-$("#wbcent").height())/2;
881
							var oWidth=($("#wbcon2").width()-$("#wbcent").width())/2;					
882
							$("#wbcent").css({"display":"inline-block","margin-top":oHeight,"margin-left":oWidth});
883
					}
884
					
885
				}
886
				else {
887
					$.MsgBox.Alert('message','最新回复数据请求失败');
818
				}
888
				}
819
				
889
				
820
				
890
				
839
		$.ajax({
909
		$.ajax({
840
			url:"/ajax/tidings",
910
			url:"/ajax/tidings",
841
			type:"post",
911
			type:"post",
842
//			async:false,
912
			async:true,
913
			"contentType" : "application/x-www-form-urlencoded",
843
			data:params,
914
			data:params,
844
			success:function(response){
915
			success:function(response){
845
				console.log(response);
916
				getConsultData(userid);
846
			},
917
			},
847
			error:function(error){
918
			error:function(error){
848
				
919
				
864
		$.ajax({
935
		$.ajax({
865
			url:"/ajax/tidings",
936
			url:"/ajax/tidings",
866
			type:"post",
937
			type:"post",
867
//			async:false,
938
			async:false,
939
			"contentType" : "application/x-www-form-urlencoded",
868
			data:params,
940
			data:params,
869
			success:function(response){
941
			success:function(response){
870
				console.log(response);
942
				getReplyData(userid);
871
			},
943
			},
872
			error:function(error){
944
			error:function(error){
873
				
945