Browse Source

资源分享页面应用行业,学术领域,及图片样式修改

jack 8 years ago
parent
commit
9668c320f4
1 changed files with 148 additions and 129 deletions
  1. 148 129
      shareResinfor.html

+ 148 - 129
shareResinfor.html

@ -52,6 +52,7 @@
52 52
			background-color: #FF9900;
53 53
			border: 1px solid #FF9900;
54 54
		}
55
		
55 56
		.pull-right {
56 57
			float: right!important
57 58
		}
@ -63,10 +64,9 @@
63 64
		.alignCenter {
64 65
			text-align: center;
65 66
		}
66
		
67
		
68 67
		/*圆角*/
69 68
		/*头像、资源圆角*/
69
		
70 70
		.headRadius {
71 71
			border-radius: 4px;
72 72
		}
@ -389,7 +389,13 @@
389 389
			background: url(images/likemore.png) center center no-repeat;
390 390
		}
391 391
		
392
		.personblock{ position:absolute;right:1%;max-width: 40%;padding:0 3%; text-align: center;}    
392
		.personblock {
393
			position: absolute;
394
			right: 1%;
395
			max-width: 40%;
396
			padding: 0 3%;
397
			text-align: center;
398
		}
393 399
	</style>
394 400
395 401
	<body>
@ -404,7 +410,7 @@
404 410
							<img class="headRadius" style="width: 64px;" src="images/default-photo.jpg" id="proimg">
405 411
							<p class="listtit clearfix" style="max-width: 106px;margin: auto;"><span class="floatL" id="proname"></span><em class="authicon authicon-cu" style="margin:3px 0 0 0;" id="promodify"></em></p>
406 412
						</div>
407
							
413
408 414
						<!--<p class="listtit clearfix"><span class="floatL" id="proname"></span><em class="authicon authicon-cu" style="height: 16px; width:16px;margin:5px 0 0 2px;" id="promodify"></em></p>-->
409 415
						<p class="listtit2"><span id="protitle"></span> <span id="prooffice"></span></p>
410 416
						<p class="listtit3"><span id="proorgName"></span></p>
@ -492,8 +498,9 @@
492 498
		</div>
493 499
		<script type="text/javascript" src="js/jquery-1.11.1.js"></script>
494 500
		<script>
495
			$(document).ready(function() {	
496
				var resourceId= GetQueryString("resourceId");
501
			$(document).ready(function() {
502
				var resourceId = GetQueryString("resourceId");
503
497 504
				function GetQueryString(name) {
498 505
					var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
499 506
					var r = window.location.search.substr(1).match(reg);
@ -511,7 +518,7 @@
511 518
				var oproadress = document.getElementById("proadress"); //专家所在地
512 519
				var opromodify = document.getElementById("promodify"); //专家认证
513 520
				var oproimg = document.getElementById("proimg"); //专家头像
514
				
521
515 522
				var oresourceName = document.getElementById("resourceName"); //资源名称
516 523
				var oyongtu = document.getElementById("yongtu"); //应用用途
517 524
				var oziyuanimg = document.getElementById("ziyuanimg"); //资源图片
@ -524,148 +531,160 @@
524 531
				var oapplydiv = document.getElementById("applydiv"); //应用行业容器
525 532
				var odetaildiv = document.getElementById("detaildiv"); //详细描述容器
526 533
				var ohezuodiv = document.getElementById("hezuodiv"); //合作备注容器
527
				
528
				
529
				function ziyuaninfo(resourceId) {				
530
						$.ajax({
531
						    url:'/ajax/resource/resourceInfo', 
532
							data: {
533
								'resourceId': resourceId
534
							},
535
							dataType: 'json', //服务器返回json格式数据
536
							type: 'get', //HTTP请求类型
537
							timeout: 10000, //超时时间设置为10秒;
538
							success: function(data) {
539
								if(data.success) {
540
									console.log(JSON.stringify(data));
541
				
542
									var mydata = data.data;
543
									//资源名称
544
									professorId = mydata['professor']['id'];
545
									var userid = GetQueryString('userid');
546
									if(professorId==userid){
547
										document.getElementsByClassName("footbox")[0].style.display="none";
548
									}
549
									(mydata['resourceName']) ? oresourceName.innerHTML = mydata['resourceName']: oresourceName.innerHTML = '';
550
				
551
									//专家信息
552
									proId = mydata['professor']['id']; //专家id
553
									//专家名字
554
									(mydata['professor']["name"]) ? oproname.innerText = mydata['professor']["name"]: oproname.innerText = '';
555
									//职称
556
									(mydata['professor']["title"]) ? oprotitle.innerHTML = mydata['professor']["title"]: oprotitle.innerHTML = '';
557
									//职位
558
									if(mydata['professor']["office"] == null || mydata['professor']["office"] == undefined) {
559
										oprooffice.innerHTML = '';
560
									} else {
561
										if(mydata['professor']["title"]) {
562
											oprooffice.innerHTML = ',' + mydata['professor']["office"]; //职位
563
										}
564
										oprooffice.innerHTML = mydata['professor']["office"]; //职位
565
									};
566
									//所在机构
567
									(mydata['professor']["orgName"]) ? oproorgName.innerHTML = mydata['professor']["orgName"]: oproorgName.innerHTML = '';
568
									//所在地
569
									(mydata['professor']["address"]) ? oproadress.innerHTML = mydata['professor']["address"]: oproadress.innerHTML = '';
570
									/*是否认证*/
571
									//(mydata['professor']["authentication"] == true) ? opromodify.classList.add('authicon'): opromodify.classList.add('unauthicon');
572
									if(mydata['professor']["authType"]) {
573
										opromodify.classList.add('authicon')
574
										opromodify.classList.add('authicon-cu');
575
									} else {
576
										if(mydata['professor']["authStatus"]) {
577
											if(mydata['professor']["authentication"] == 1) {
578
												opromodify.classList.add('authicon2');
579
												opromodify.classList.add('authicon-mana');
580
											} else if(mydata['professor']["authentication"] == 2) {
581
												opromodify.classList.add('authicon2');
582
												opromodify.classList.add('authicon-staff');
583
											} else {
584
												opromodify.classList.add('authicon2');
585
												opromodify.classList.add('authicon-stu');
586
											}
587
										}
588
									}
589
									/*专家头像*/
590
									(mydata['professor']["hasHeadImage"] == 0) ? oproimg.setAttribute('src', '/images/default-photo.jpg'): oproimg.setAttribute('src', '/images/head/' + mydata['professor']['id'] + '_m.jpg');
591
									
592
									//资源基本信息
593
									//(mydata['images']['imageSrc']) ? oziyuanimg.setAttribute('src', mydata['images']['imageSrc']): oziyuanimg.setAttribute('src', '../images/default-resource.jpg'); //资源图片
594
				
595
									var imgRes = "/images/resource/" + mydata.resourceId + ".jpg";
596
									if(mydata['images'].length) {
597
										oziyuanimg.setAttribute('src', imgRes)
598
									} else {
599
										oziyuanimg.setAttribute('src', '../images/default-resource.jpg')
534
535
				function ziyuaninfo(resourceId) {
536
					$.ajax({
537
						url: '/ajax/resource/resourceInfo',
538
						data: {
539
							'resourceId': resourceId
540
						},
541
						dataType: 'json', //服务器返回json格式数据
542
						type: 'get', //HTTP请求类型
543
						timeout: 10000, //超时时间设置为10秒;
544
						success: function(data) {
545
							if(data.success) {
546
								console.log(JSON.stringify(data));
547
548
								var mydata = data.data;
549
								//资源名称
550
								professorId = mydata['professor']['id'];
551
								var userid = GetQueryString('userid');
552
								if(professorId == userid) {
553
									document.getElementsByClassName("footbox")[0].style.display = "none";
554
								}
555
								(mydata['resourceName']) ? oresourceName.innerHTML = mydata['resourceName']: oresourceName.innerHTML = '';
556
557
								//专家信息
558
								proId = mydata['professor']['id']; //专家id
559
								//专家名字
560
								(mydata['professor']["name"]) ? oproname.innerText = mydata['professor']["name"]: oproname.innerText = '';
561
								//职称
562
								(mydata['professor']["title"]) ? oprotitle.innerHTML = mydata['professor']["title"]: oprotitle.innerHTML = '';
563
								//职位
564
								if(mydata['professor']["office"] == null || mydata['professor']["office"] == undefined) {
565
									oprooffice.innerHTML = '';
566
								} else {
567
									if(mydata['professor']["title"]) {
568
										oprooffice.innerHTML = ',' + mydata['professor']["office"]; //职位
600 569
									}
601
									(mydata['supportedServices']) ? oyongtu.innerHTML = mydata['supportedServices']: oyongtu.innerHTML = ''; //应用用途
602
				
603
									//学术领域
604
									if(mydata['subject']) {
605
										if(mydata['subject'].indexOf(',') != -1) { //字符串是否包含,
606
											var fieldlist = mydata['subject'].split(",");
607
											console.log(fieldlist.length);
608
											for(var i = 0; i < fieldlist; i++) {
609
												var oli = document.createElement('li');
610
												oli.innerText = fieldlist[i];
611
												ofield.appendChild(oli);
612
											}
570
									oprooffice.innerHTML = mydata['professor']["office"]; //职位
571
								};
572
								//所在机构
573
								(mydata['professor']["orgName"]) ? oproorgName.innerHTML = mydata['professor']["orgName"]: oproorgName.innerHTML = '';
574
								//所在地
575
								(mydata['professor']["address"]) ? oproadress.innerHTML = mydata['professor']["address"]: oproadress.innerHTML = '';
576
								/*是否认证*/
577
								//(mydata['professor']["authentication"] == true) ? opromodify.classList.add('authicon'): opromodify.classList.add('unauthicon');
578
								if(mydata['professor']["authType"]) {
579
									opromodify.classList.add('authicon')
580
									opromodify.classList.add('authicon-cu');
581
								} else {
582
									if(mydata['professor']["authStatus"]) {
583
										if(mydata['professor']["authentication"] == 1) {
584
											opromodify.classList.add('authicon2');
585
											opromodify.classList.add('authicon-mana');
586
										} else if(mydata['professor']["authentication"] == 2) {
587
											opromodify.classList.add('authicon2');
588
											opromodify.classList.add('authicon-staff');
613 589
										} else {
590
											opromodify.classList.add('authicon2');
591
											opromodify.classList.add('authicon-stu');
592
										}
593
									}
594
								}
595
								/*专家头像*/
596
								(mydata['professor']["hasHeadImage"] == 0) ? oproimg.setAttribute('src', '/images/default-photo.jpg'): oproimg.setAttribute('src', '/images/head/' + mydata['professor']['id'] + '_m.jpg');
597
598
								//资源基本信息
599
								//(mydata['images']['imageSrc']) ? oziyuanimg.setAttribute('src', mydata['images']['imageSrc']): oziyuanimg.setAttribute('src', '../images/default-resource.jpg'); //资源图片
600
601
								var imgRes = "/images/resource/" + mydata.resourceId + ".jpg";
602
								if(mydata['images'].length) {
603
									oziyuanimg.setAttribute('src', imgRes)
604
								} else {
605
									oziyuanimg.setAttribute('src', '../images/default-resource.jpg')
606
								}
607
								(mydata['supportedServices']) ? oyongtu.innerHTML = mydata['supportedServices']: oyongtu.innerHTML = ''; //应用用途
608
609
								//学术领域
610
								if(mydata['subject']) {
611
									if(mydata['subject'].indexOf(',') != -1) { //字符串是否包含,
612
										var fieldlist = mydata['subject'].split(",");
613
										console.log(fieldlist.length);
614
										for(var i = 0; i < fieldlist.length; i++) {
614 615
											var oli = document.createElement('li');
615
											oli.innerText = mydata['subject'];
616
											oli.innerText = fieldlist[i];
616 617
											ofield.appendChild(oli);
617 618
										}
618
				
619 619
									} else {
620
										ofielddiv.style.display = 'none';
620
										var oli = document.createElement('li');
621
										oli.innerText = mydata['subject'];
622
										ofield.appendChild(oli);
621 623
									}
622
				
623
									//应用行业
624
									if(mydata['industry']) {
625
										if(mydata['industry'].indexOf(',') != -1) { //字符串是否包含,
626
											var applylist = mydata['industry'].split(",");
627
											console.log(applylist.length);
628
											for(var i = 0; i < applylist; i++) {
629
												var oli = document.createElement('li');
630
												oli.innerText = fieldlist[i];
631
												oapply.appendChild(oli);
632
											}
633
										} else {
624
625
								} else {
626
									ofielddiv.style.display = 'none';
627
								}
628
629
								//应用行业
630
								if(mydata['industry']) {
631
									if(mydata['industry'].indexOf(',') != -1) { //字符串是否包含,
632
										var applylist = mydata['industry'].split(",");
633
										console.log(applylist.length);
634
										for(var i = 0; i < applylist.length; i++) {
634 635
											var oli = document.createElement('li');
635
											oli.innerText = mydata['industry'];
636
											oli.innerText = fieldlist[i];
636 637
											oapply.appendChild(oli);
637 638
										}
638 639
									} else {
639
										oapplydiv.style.display = 'none';
640
									}
641
				
642
									//详细描述
643
									if(mydata['descp']) {
644
										odetail.innerHTML = mydata['descp']
645
									} else {
646
										odetaildiv.style.display = 'none';
640
										var oli = document.createElement('li');
641
										oli.innerText = mydata['industry'];
642
										oapply.appendChild(oli);
647 643
									}
648
				
649
									//合作备注
650
									if(mydata['cooperationNotes']) {
651
										ohezuo.innerHTML = mydata['cooperationNotes'];
652
									} else {
653
										ohezuodiv.style.display = 'none';
644
								} else {
645
									oapplydiv.style.display = 'none';
646
								}
647
648
								//详细描述
649
								if(mydata['descp']) {
650
									odetail.innerHTML = mydata['descp'];
651
									var pWidth = $("#detail").find("p").width();
652
									var leng = $("#detail").find("img").length;
653
									for(var i = 0; i < leng; i++) {
654
										(function(i) {
655
											$("#detail").find("img").eq(i).load(function() {
656
												var imgWidth = $("#detail").find("img").eq(i).width();
657
												if(imgWidth > pWidth) {
658
													$("#detail").find("img").eq(i).css({
659
														"width": "100%"
660
													})
661
												}
662
											})
663
										})(i);
654 664
									}
655
				
665
								} else {
666
									odetaildiv.style.display = 'none';
656 667
									
657 668
								}
658
							},
659
							error: function(e) {
660
								return;
669
670
								//合作备注
671
								if(mydata['cooperationNotes']) {
672
									ohezuo.innerHTML = mydata['cooperationNotes'];
673
								} else {
674
									ohezuodiv.style.display = 'none';
675
								}
676
661 677
							}
662
						});
678
						},
679
						error: function(e) {
680
							return;
681
						}
682
					});
663 683
				}
664 684
				//资源信息
665 685
				ziyuaninfo(resourceId);
666
				
686
667 687
			});
668
				
669 688
		</script>
670 689
671 690
	</body>