Ver Código Fonte

资源详情页面

jack 8 anos atrás
pai
commit
11085676b8
3 arquivos alterados com 180 adições e 75 exclusões
  1. 113 0
      js/resourceInfo.js
  2. 51 50
      js/search.js
  3. 16 25
      resourceInfo.html

+ 113 - 0
js/resourceInfo.js

@ -0,0 +1,113 @@
1
$(document).ready(function() {
2
	/*获取资源ID*/
3
	var resourceId = GetQueryString("resourceId");
4
	/*判断是否登录*/
5
	loginStatus();
6
	//填充学术领域
7
	var subjectShow = function(data) {
8
			if(data != undefined && data.length != 0) {
9
				var subs = new Array();
10
				if(data.indexOf(',')) {
11
					subs = data.split(',');
12
				} else {
13
					subs[0] = data;
14
				}
15
				if(subs.length > 0) {
16
					for(var i = 0; i < subs.length; i++) {
17
						$("#subjectList").append("<li>" + subs[i] + "</li>")
18
					};
19
				}
20
			}
21
		}
22
		//填充应用行业
23
	var industryShow = function(data) {
24

25
			if(data != undefined && data.length != 0) {
26
				var subs = new Array();
27
				if(data.indexOf(',')) {
28
					subs = data.split(',');
29
				} else {
30
					subs[0] = data;
31
				}
32
				if(subs.length > 0) {
33
					for(var i = 0; i < subs.length; i++) {
34
						$("#industryList").append("<li>" + subs[i] + "</li>")
35
					};
36
				}
37
			}
38
		}
39
		/*获取资源的数据的函数*/
40
	var resourceData = function() {
41
		$.ajax({
42
			"url": "/ajax/resource/resourceInfo",
43
			data: {
44
				'resourceId': resourceId
45
			},
46
			"type": "get",
47
			"async": true,
48
			"success": function(info) {
49
				if(info.success) {
50
					var $info = info.data;
51
					console.log(info);
52
					$(".h2Font").text($info.resourceName);
53
					$("#application").text($info.supportedServices);
54
					if($info.subject) {
55
						subjectShow($info.subject)
56
					}else{
57
						$("span:contains('学术领域')").hide();
58
					}
59
					if($info.industry) {
60
						industryShow($info.industry)
61
					}else{
62
						$("span:contains('应用行业')").hide();
63
					}
64
					if($info.cooperationNotes) {
65
						$("#cooperationNote").text($info.cooperationNotes);
66
					}else{
67
						$("span:contains('合作备注')").hide();
68
					}
69
					if(!$info.subject&&!$info.industry&&!$info.cooperationNotes){
70
						$(".resAbout").hide();
71
					}
72
					if($info.images) {
73
						$("#resouImg").attr("src", "/images/resource/" + $info.resourceId + ".jpg")
74
					}
75
					if($info.descp) {
76
						$(".resMore").html($info.descp)
77
					}
78
					$("#nameS").text($info.professor.name);
79
					if($info.professor.title) {
80
						if($info.professor.office) {
81
							$("#title").text($info.professor.title + ",");
82
						} else {
83
							$("#title").text($info.professor.title);
84
						}
85
					}
86
					if($info.professor.office) {
87

88
						$("#office").text($info.professor.office);
89
					}
90
					if($info.professor.department) {
91
						$("#department").text($info.professor.department);
92
					}
93
					if($info.professor.orgName) {
94
						$("#orgName").text($info.professor.orgName);
95
					}
96
					if($info.professor.address) {
97
						$("#address").text($info.professor.address);
98
					}
99
					if($info.professor.hasHeadImage) {
100
						$("#headImg").attr("src", "/images/head/" + $info.professorId + "_l.jpg")
101
					}
102
				} else {
103
					$.MsgBox.Alert('消息提醒', "系统异常!");
104
				}
105
			},
106
			"error": function() {
107
				$.MsgBox.Alert('message', 'failed')
108
			}
109
		});
110
	}
111
	resourceData();
112
	
113
})

+ 51 - 50
js/search.js

@ -214,7 +214,7 @@ $(function() {
214 214
						var $da = data.data.data;
215 215
						for(var i = 0; i < $da.length; i++) {
216 216
							var add = '<div class="item"><div class="remess" resourceId=' + $da[i].resourceId + '>'
217
							add += '<a class="resourcephoto headRadius" ><div class="ResImgBox" style="background:#ffffff;"><img class="resImg headRadius resourceImg" src="" /></div></a>'
217
							add += '<div class="clearfix"><a class="resourcephoto headRadius" ><div class="ResImgBox" style="background:#ffffff;"><img class="resImg headRadius resourceImg" src="" /></div></a>'
218 218
							add += '<div class="synopsis" style="width:66%;">'
219 219
							add += '<div class="cousultName"><a class="resouname" href="javascript:void();">' + $da[i].resourceName + '</a></div>'
220 220
							if($da[i].professor.name) {
@ -255,6 +255,7 @@ $(function() {
255 255
							if($da[i].supportedServices) {
256 256
								add += '<div class="ellipsisbox provideservice"><p>应用用途:' + $da[i].supportedServices + '</p></div></div>'
257 257
							}
258
							add+="</div>"
258 259
							if(userid==$da[i]["professor"]["id"]){
259 260
								add += '<div class="operbox"><span class="operbtn consultbtn" id="' + $da[i]["professor"]["id"] + '" style="display:none;">咨询</span><span style="display: none;" class="operbtn applybtn appl" resourceId=' + $da[i].resourceId + ' resourceName=' + $da[i].resourceName + ' professor=' + $da[i].professor.name + '>申请</span></div>'
260 261
							}else{
@ -302,8 +303,7 @@ $(function() {
302 303
303 304
					//资源中点击咨询
304 305
					//$(".consultbtn").bind("click",clickResouceConsultHandler);
305
					$(".about").on("click", '.consultbtn', function(e) {
306
306
					$(".about").on("click", '.consultbtn', function(e) {						
307 307
						e.stopPropagation(); //阻止事件冒泡,影响点击咨询
308 308
						e.cancelBubble = true; // ie下阻止冒泡
309 309
						clickResouceConsultHandler($(this), $(this).attr('id'));
@ -584,53 +584,54 @@ $(function() {
584 584
			'.remess',
585 585
			function() {
586 586
				var resourceID = $(this).attr("resourceId");
587
				ResourceMessage();
588
				$
589
					.ajax({
590
						"url": "/ajax/resource/" + resourceID,
591
						"type": "get",
592
						"async": true,
593
						"success": function(info) {
594
							if(info.success) {
595
								$("#resourceName").text(
596
									info.data.resourceName);
597
								$("#supportedServices")
598
									.text(
599
										info.data.supportedServices);
600
								$("#hopePayMethod").text(
601
									info.data.hopePayMethod);
602
								$("#cooperationNotes").text(
603
									info.data.cooperationNotes);
604
								$("#subject").text(
605
									info.data.subject);
606
								$("#industry").text(
607
									info.data.industry);
608
								$("#descp").text(info.data.descp);
609
								$("#professor").text(
610
									info.data.professor.name);
611
								$(".resouImage").attr(
612
									"src",
613
									"/images/resource/" +
614
									resourceID +
615
									".jpg");
616
								$(".resouImage")
617
									.load(function() {})
618
									.error(
619
										function() {
620
											$(this)
621
												.attr(
622
													"src",
623
													"/images/default-resource.jpg");
624
										});
625
								limitHeight();
626
							} else {
627
								$.MsgBox.Alert('消息提醒', "系统异常!");
628
							}
629
						},
630
						"error": function() {
631
							$.MsgBox.Alert('message', 'failed')
632
						}
633
					});
587
				location.href="resourceInfo.html?resourceId="+resourceID;
588
				//ResourceMessage();
589
//				$
590
//					.ajax({
591
//						"url": "/ajax/resource/" + resourceID,
592
//						"type": "get",
593
//						"async": true,
594
//						"success": function(info) {
595
//							if(info.success) {
596
//								$("#resourceName").text(
597
//									info.data.resourceName);
598
//								$("#supportedServices")
599
//									.text(
600
//										info.data.supportedServices);
601
//								$("#hopePayMethod").text(
602
//									info.data.hopePayMethod);
603
//								$("#cooperationNotes").text(
604
//									info.data.cooperationNotes);
605
//								$("#subject").text(
606
//									info.data.subject);
607
//								$("#industry").text(
608
//									info.data.industry);
609
//								$("#descp").text(info.data.descp);
610
//								$("#professor").text(
611
//									info.data.professor.name);
612
//								$(".resouImage").attr(
613
//									"src",
614
//									"/images/resource/" +
615
//									resourceID +
616
//									".jpg");
617
//								$(".resouImage")
618
//									.load(function() {})
619
//									.error(
620
//										function() {
621
//											$(this)
622
//												.attr(
623
//													"src",
624
//													"/images/default-resource.jpg");
625
//										});
626
//								limitHeight();
627
//							} else {
628
//								$.MsgBox.Alert('消息提醒', "系统异常!");
629
//							}
630
//						},
631
//						"error": function() {
632
//							$.MsgBox.Alert('message', 'failed')
633
//						}
634
//					});
634 635
			})
635 636
		// 资源申请
636 637
	function getIdentity(professorId) {

+ 16 - 25
resourceInfo.html

@ -54,35 +54,26 @@
54 54
		<div class="resouLeft floatL">
55 55
			<div class="resTop clearfix">
56 56
				<div class="ResImgBox beforMargin floatL" style="max-width: 300px;width:300px;height: 300px;">
57
					<img class="resImg headRadius" src="images/default-resource.jpg" />
57
					<img class="resImg headRadius" src="images/default-resource.jpg" id="resouImg"/>
58 58
				</div>
59 59
				<div class="resBrief floatR">
60
					<div class="h2Font">XXXXXXXXXXXXXXXXXXX(资源名称)</div>
61
					<div class="h3Font"><span class="subtit">应用用途 </span>  Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>
60
					<div class="h2Font"></div>
61
					<div class="h3Font"><span class="subtit">应用用途 </span> <span id="application"></span></div>
62 62
					<div class="resAbout">
63 63
						<div class="resUlbox clearfix">
64 64
							<span class="subtit floatL">学术领域</span>
65
							<ul class="resUl floatL">
66
								<li>XXXXX</li>
67
								<li>XXXXXXXXX</li>
68
								<li>XXXXXXXXXXXXXX</li>
69
								<li>XXXXX</li>
70
								<li>XXXXXXXXX</li>
65
							<ul class="resUl floatL" id="subjectList">
71 66
							</ul>
72 67
						</div>
73 68
						<div class="resUlbox clearfix">
74 69
							<span class="subtit floatL">应用行业</span>
75
							<ul class="resUl floatL">
76
								<li>XXXXX</li>
77
								<li>XXXXXXXXX</li>
78
								<li>XXX</li>
79
								<li>XXXXX</li>
70
							<ul class="resUl floatL" id="industryList">
80 71
							</ul>
81 72
						</div>
82 73
						<div class="resUlbox clearfix">
83 74
							<span class="subtit floatL">合作备注</span>
84
							<div class="resUl floatL" style="padding:4px 2px">
85
								Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean euismod bibendum laoreet. Proin gravida dolor sit amet lacus accumsan et viverra justo commodo. 
75
							<div class="resUl floatL" style="padding:4px 2px" id="cooperationNote">
76
								 
86 77
							</div>
87 78
						</div>
88 79
					</div>
@ -100,19 +91,19 @@
100 91
		</div>
101 92
		<div class="resouRight floatR">
102 93
			<div class="rightBlock">
103
				<a style="display: block;" href="information-brow.html">
94
				<a style="display: block;" >
104 95
					<div class="proImg">
105
						<img class=" headRadius" src="images/default-photo.jpg">
96
						<img class=" headRadius" src="images/default-photo.jpg" id="headImg" style="display:block;">
106 97
					</div>
107 98
					<div class="proInfo">
108 99
						<div class="h3Font clearfix">
109
							<span class="named" id="nameS">刘教授</span>
100
							<span class="named" id="nameS"></span>
110 101
							<span class="modifyicon authicon authicon-cu" style="margin-top:3px;" ></span>
111 102
						</div>
112
						<p class="h5Font"><span>职称</span><span>,职位</span></p>
113
						<p class="h5Font"><span>所属部门</span></p>
114
						<p class="h5Font"><span>所在机构</span></p>
115
						<p class="h6Font" style="margin: 0;"><span>所在城市</span></p>
103
						<p class="h5Font"><span id="title">职称</span><span id="office">,职位</span></p>
104
						<p class="h5Font"><span id="department">所属部门</span></p>
105
						<p class="h5Font"><span id="orgName">所在机构</span></p>
106
						<p class="h6Font" style="margin: 0;" id="address"><span>所在城市</span></p>
116 107
					</div>
117 108
				</a>
118 109
			</div>
@ -197,9 +188,9 @@
197 188
    </div>
198 189
</div>
199 190
<script type="text/javascript" src="js/jquery-1.11.1.js"></script>
200
<script type="text/javascript" src="js/common.js"></script>
201 191
<script type="text/javascript" src="/js/jquery.cookie.js"></script>
202 192
<script type="text/javascript" src="js/jquery.similar.msgbox.js"></script>
203
<script type="text/javascript" src="js/index.js"></script>
193
<script type="text/javascript" src="/js/common.js"></script>
194
<script type="text/javascript" src="/js/resourceInfo.js"></script>
204 195
</body>
205 196
</html>