Quellcode durchsuchen

判断头像和机构是否存在,不存在时显示默认图片

luyanan vor 8 Jahren
Ursprung
Commit
aeff26cabb

+ 11 - 5
src/main/webapp/account-set.html

14
<script type="text/javascript" src="js/jquery-1.11.1.js"></script>
14
<script type="text/javascript" src="js/jquery-1.11.1.js"></script>
15
<!-- <script type="text/javascript" src="js/form.js"></script> -->
15
<!-- <script type="text/javascript" src="js/form.js"></script> -->
16
<script type="text/javascript" src="js/index.js"></script>
16
<script type="text/javascript" src="js/index.js"></script>
17
<script type="text/javascript" src="/js/jquery.cookie.js"></script>
18
<script type="text/javascript" src="/js/common.js"></script>
17
<script type="text/javascript" src="js/jquery.cookie.js"></script>
18
<script type="text/javascript" src="js/common.js"></script>
19
<!-- <script type="text/javascript" src="js/account-set.js"></script> -->
19
<!-- <script type="text/javascript" src="js/account-set.js"></script> -->
20
<script type="text/javascript" src="js/jquery.similar.msgbox.js"></script>
20
<script type="text/javascript" src="js/jquery.similar.msgbox.js"></script>
21
<script type="text/javascript" >
21
<script type="text/javascript" >
24
		var servPath = "http://121.42.53.174:81";
24
		var servPath = "http://121.42.53.174:81";
25
		var userid = $.cookie("userid");
25
		var userid = $.cookie("userid");
26
	 	if(userid){
26
	 	if(userid){
27
	 		$(".head-portrait").css("background","url("+servPath+"/images/head/"+userid+"_m.jpg)");
28
	 		$(".head-portrait").show();
27
			$(".head-portrait").show();
29
			$(".unlogin").hide();
28
			$(".unlogin").hide();
30
				}
29
	 		$(".portrait-p").attr("src",servPath+"/images/head/"+userid+"_m.jpg");
30
			$(".portrait-p").load(function(){									
31
			})
32
			.error(function(){
33
				$(".portrait-p").attr("src",servPath+"/images/default-photo.jpg");
34
			});
35
		}
31
		valUser();
36
		valUser();
32
		$("#hsearch").on("click",function (){
37
		$("#hsearch").on("click",function (){
33
	   		var searchContent = $("#hsearchContent").val();
38
	   		var searchContent = $("#hsearchContent").val();
354
    <a href="login-invite-code.html"><div class="unlogin">特邀专家登录</div></a>
359
    <a href="login-invite-code.html"><div class="unlogin">特邀专家登录</div></a>
355
    <!--已登录-->
360
    <!--已登录-->
356
    <div class="head-portrait">
361
    <div class="head-portrait">
362
    	<img class="portrait-p" />
357
        <div class="personal-infor">
363
        <div class="personal-infor">
358
            <div class="triangleB"></div>
364
            <div class="triangleB"></div>
359
            <div class="personal-box">
365
            <div class="personal-box">

+ 3 - 2
src/main/webapp/css/index.css

15
/*未登录*/
15
/*未登录*/
16
.unlogin{ width:130px; height:35px; border:1px #fff solid; border-radius:10px;font:14px/35px \5FAE\8F6F\96C5\9ED1,"Microsoft YaHei"; color:#fff; text-align:center; float:right; margin-right:80px; margin-top:10px; cursor:pointer; }
16
.unlogin{ width:130px; height:35px; border:1px #fff solid; border-radius:10px;font:14px/35px \5FAE\8F6F\96C5\9ED1,"Microsoft YaHei"; color:#fff; text-align:center; float:right; margin-right:80px; margin-top:10px; cursor:pointer; }
17
/*已登录*/
17
/*已登录*/
18
.head-portrait{ display:none; width:50px; height:50px; border-radius:50%; background:url(../images/default-photo.jpg) no-repeat center center;background-size:100% 100%;-moz-background-size:100% 100%; float:right; margin-right:80px; margin-top:5px; cursor:pointer; border:1px solid #f8f8f8; }
18
.head-portrait{ display:none; width:50px; height:50px; border-radius:50%;background-size:100% 100%;-moz-background-size:100% 100%; float:right; margin-right:80px; margin-top:5px; cursor:pointer; border:1px solid #f8f8f8; overflow:hidden; }
19
.portrait-p{ width:100%;}
19
.personal-infor{width:202px; height:179px; position:absolute; top:42px; right:80px; display:none;}
20
.personal-infor{width:202px; height:179px; position:absolute; top:42px; right:80px; display:none;}
20
.triangleB{ display:block; width:0; height:0; border:8px solid transparent; border-bottom-color:#f3a36c; float:right; margin-right:20px; margin-top:15px;}
21
.triangleB{ display:block; width:0; height:0; border:8px solid transparent; border-bottom-color:#f3a36c; float:right; margin-right:20px; margin-top:15px;}
21
.personal-box{ width:202px; /*height:160px;*/ border-radius:10px; background:#f3a36c; clear:both; overflow:hidden;}
22
.personal-box{ width:202px; /*height:160px;*/ border-radius:10px; background:#f3a36c; clear:both; overflow:hidden;}
113
.about-in{ width:920px; max-height:850px; height:auto; margin:auto; margin-top:10px;}
114
.about-in{ width:920px; max-height:850px; height:auto; margin:auto; margin-top:10px;}
114
.item{ width:100%;overflow: hidden; border:1px #ffa544 solid;box-shadow:1px 1px 1px #ff8400 inset; border-radius:10px; margin-top:18px; }
115
.item{ width:100%;overflow: hidden; border:1px #ffa544 solid;box-shadow:1px 1px 1px #ff8400 inset; border-radius:10px; margin-top:18px; }
115
/*.photo{ width:132px; height:132px; border-radius:50%; border:2px #fca72d solid; margin:20px; background:url(../images/pic1.jpg) no-repeat center center; float:left;}*/ 	
116
/*.photo{ width:132px; height:132px; border-radius:50%; border:2px #fca72d solid; margin:20px; background:url(../images/pic1.jpg) no-repeat center center; float:left;}*/ 	
116
.photo1{width:132px;height:132px;border-radius:50%;border:1px #fca72d solid;margin:20px;float:left;/*background:url(../images/default-photo.jpg)  no-repeat center center;*/background-size:100% 100%;-moz-background-size:100% 100%;}
117
.photo1{width:132px;height:132px;border-radius:50%;border:1px #fca72d solid;margin:20px;float:left;/*background:url(../images/default-photo.jpg)  no-repeat center center;*/background-size:100% 100%;-moz-background-size:100% 100%; overflow:hidden;}
117

118

118
.synopsis{ float:left; padding:20px 0;color:#000; width:720px;}
119
.synopsis{ float:left; padding:20px 0;color:#000; width:720px;}
119
.named{display:block;font:24px/34px \5FAE\8F6F\96C5\9ED1,"Microsoft YaHei"; color:#000; float:left;}
120
.named{display:block;font:24px/34px \5FAE\8F6F\96C5\9ED1,"Microsoft YaHei"; color:#000; float:left;}

+ 15 - 2
src/main/webapp/index.html

14
<script type="text/javascript" src="js/jquery-1.11.1.js"></script>
14
<script type="text/javascript" src="js/jquery-1.11.1.js"></script>
15
<script type="text/javascript" src="js/index.js"></script>
15
<script type="text/javascript" src="js/index.js"></script>
16
<script type="text/javascript" src="/js/jquery.cookie.js"></script>
16
<script type="text/javascript" src="/js/jquery.cookie.js"></script>
17
<script type="text/javascript" src="/js/common.js"></script>
17
<script type="text/javascript" src="js/common.js"></script>
18
<script type="text/javascript">
18
<script type="text/javascript">
19
	$(function(){  
19
	$(function(){  
20
		loginStatus();
20
		loginStatus();
21

21
		var servPath = "http://121.42.53.174:81";
22
		//var userid = $.cookie("userid");
23
	 	if(userid && userid != "null" && userid!=null){
24
			$(".head-portrait").show();
25
			$(".unlogin").hide();
26
	 		$(".portrait-p").attr("src",servPath+"/images/head/"+userid+"_m.jpg");
27
			$(".portrait-p").load(function(){									
28
			})
29
			.error(function(){
30
				$(".portrait-p").attr("src",servPath+"/images/default-photo.jpg");
31
			});
32
		}
33
		
22
	   $("#search").on("click",function (){
34
	   $("#search").on("click",function (){
23
	   		var searchContent = $("#searchContent").val();
35
	   		var searchContent = $("#searchContent").val();
24
	   		location.href = "search.html?searchContent="+encodeURI(searchContent);
36
	   		location.href = "search.html?searchContent="+encodeURI(searchContent);
52
        <a href="login-invite-code.html"><div class="unlogin">特邀专家登录</div></a>
64
        <a href="login-invite-code.html"><div class="unlogin">特邀专家登录</div></a>
53
        <!--已登录-->
65
        <!--已登录-->
54
        <div class="head-portrait">
66
        <div class="head-portrait">
67
        	<img class="portrait-p" />
55
            <div class="personal-infor">
68
            <div class="personal-infor">
56
                <div class="triangleB"></div>
69
                <div class="triangleB"></div>
57
                <div class="personal-box">
70
                <div class="personal-box">

+ 28 - 5
src/main/webapp/information-brow.html

32
	 	var userid = $.cookie("userid");
32
	 	var userid = $.cookie("userid");
33
	 	var professorId = GetQueryString("professorId");
33
	 	var professorId = GetQueryString("professorId");
34
	 	if(professorId){
34
	 	if(professorId){
35
	 		$(".head-portrait").css("background","url("+servPath+"/images/head/"+userid+"_m.jpg");
35
	 		$(".portrait-p").attr("src",servPath+"/images/head/"+userid+"_m.jpg");
36
			$(".portrait-p").load(function(){									
37
			})
38
			.error(function(){
39
				$(".portrait-p").attr("src",servPath+"/images/default-photo.jpg");
40
			});
36
         
41
         
37
	 		var subjectShow = function (data){
42
	 		var subjectShow = function (data){
38

43

200
						}
205
						}
201
						var isAgree = $.inArray(userid, $photos);
206
						var isAgree = $.inArray(userid, $photos);
202

207

203
						var showDiv= "<div class='listbox listbox-browse clear'><div class='list-browse'><span class='like'>"+$data.count+"</span>"+$data.caption+"</div><span  class='plus' data-pid='"+$data.professorId+"' data-caption='"+$data.caption+"' data-isagree='"+isAgree+"'></span><div class='like-num'>";
208
						var showDiv= "<div class='listbox listbox-browse clear'><div class='list-browse'><span class='like'>"+$data.count+"</span>"+$data.caption+"</div><span class='plus' data-pid='"+$data.professorId+"' data-caption='"+$data.caption+"' data-isagree='"+isAgree+"'></span><div class='like-num'>";
204
						if($photos.length>10){
209
						if($photos.length>10){
205
							showDiv += "<div class='triangleR'></div>";
210
							showDiv += "<div class='triangleR'></div>";
206
						}
211
						}
207
						
212
						
208
						if($photos.length>0){
213
						if($photos.length>0){
209
							for(var j =0 ; j< $photos.length;++j){
214
							for(var j =0 ; j< $photos.length;++j){
210
								showDiv += "<span class='like-people'><img src='"+servPath+"/images/head/"+$photos[j]+"_s.jpg'></span>";
215
								showDiv += "<span class='like-people'><img class='like-h' src='"+servPath+"/images/head/"+$photos[j]+"_s.jpg'></span>";
216
								
211
							} 
217
							} 
212
						}
218
						}
213
						showDiv += "</div></div>";
219
						showDiv += "</div></div>";
214
						$("#researchAreaShow").append(showDiv);
220
						$("#researchAreaShow").append(showDiv);
215
				
221
						
222
						$(".like-h").load(function(){								
223
						})
224
						.error(function(){
225
							$(this).attr("src",servPath+"/images/default-photo.jpg");
226
						});	
227
							
216
					}
228
					}
217
				}			
229
				}			
218
			}
230
			}
258
							$("#titleS").text($info.title);
270
							$("#titleS").text($info.title);
259
							$("#orgNameS").text($info.orgName);
271
							$("#orgNameS").text($info.orgName);
260
							$("#headImage").attr("src",servPath+"/images/head/"+professorId+"_l.jpg");
272
							$("#headImage").attr("src",servPath+"/images/head/"+professorId+"_l.jpg");
261
							$("#orgImage").attr("src","/images/org/"+$info.orgId+".jpg");
273
								$("#headImage").load(function(){									
274
								})
275
								.error(function(){
276
									$("#headImage").attr("src",servPath+"/images/default-photo.jpg");
277
								});
278
							$("#orgImage").attr("src",servPath+"/images/org/"+$info.orgId+".jpg");
279
								$("#orgImage").load(function(){									
280
								})
281
								.error(function(){
282
									$("#orgImage").attr("src",servPath+"/images/default-icon.jpg");
283
								});
262
							$("#descpS").text($info.descp);
284
							$("#descpS").text($info.descp);
263
							//显示专家信息到保存数据
285
							//显示专家信息到保存数据
264
							$("#name").val($info.name);
286
							$("#name").val($info.name);
333
	<a href="login-invite-code.html"><div class="unlogin">特邀专家登录</div></a>
355
	<a href="login-invite-code.html"><div class="unlogin">特邀专家登录</div></a>
334
	<!--已登录-->
356
	<!--已登录-->
335
	<div class="head-portrait">
357
	<div class="head-portrait">
358
    	<img class="portrait-p" />
336
		<div class="personal-infor">
359
		<div class="personal-infor">
337
			<div class="triangleB"></div>
360
			<div class="triangleB"></div>
338
			<div class="personal-box">
361
			<div class="personal-box">

+ 20 - 2
src/main/webapp/information.html

33
		var servPath = "http://121.42.53.174:81";
33
		var servPath = "http://121.42.53.174:81";
34
	 	var userid = $.cookie("userid");
34
	 	var userid = $.cookie("userid");
35
	 	if(userid){
35
	 	if(userid){
36
	 		$(".head-portrait").css("background","url("+servPath+"/images/head/"+userid+"_m.jpg)");
37
	 		$(".head-portrait").show();
36
	 		
37
			$(".head-portrait").show();
38
			$(".unlogin").hide();
39
	 		$(".portrait-p").attr("src",servPath+"/images/head/"+userid+"_m.jpg");
40
			$(".portrait-p").load(function(){									
41
			})
42
			.error(function(){
43
				$(".portrait-p").attr("src",servPath+"/images/default-photo.jpg");
44
			});
45
			
38
	 		var subjectShow = function (data){
46
	 		var subjectShow = function (data){
39

47

40
				if(data != undefined &&  data.length != 0 ){
48
				if(data != undefined &&  data.length != 0 ){
210
							$("#titleS").text($info.title);
218
							$("#titleS").text($info.title);
211
							$("#orgNameS").text($info.orgName);
219
							$("#orgNameS").text($info.orgName);
212
							$("#headImage").attr("src",servPath+"/images/head/"+userid+"_l.jpg");
220
							$("#headImage").attr("src",servPath+"/images/head/"+userid+"_l.jpg");
221
								$("#headImage").load(function(){									
222
								})
223
								.error(function(){
224
									$("#headImage").attr("src",servPath+"/images/default-photo.jpg");
225
								});
213
							$("#orgImage").attr("src",servPath+"/images/org/"+$info.orgId+".jpg");
226
							$("#orgImage").attr("src",servPath+"/images/org/"+$info.orgId+".jpg");
227
								$("#orgImage").load(function(){									
228
								})
229
								.error(function(){
230
									$("#orgImage").attr("src",servPath+"/images/default-icon.jpg");
231
								});
214
							$("#descpS").text($info.descp);
232
							$("#descpS").text($info.descp);
215
							//显示专家信息到保存数据
233
							//显示专家信息到保存数据
216
							$("#name").val($info.name);
234
							$("#name").val($info.name);

+ 21 - 15
src/main/webapp/search.html

36
		var servPath = "http://121.42.53.174:81";
36
		var servPath = "http://121.42.53.174:81";
37
		var userid = $.cookie("userid");
37
		var userid = $.cookie("userid");
38
	 	if(userid){
38
	 	if(userid){
39
	 		$(".head-portrait").css("background","url("+servPath+"/images/head/"+userid+"_m.jpg)");
40
	 		$(".head-portrait").show();
39
			$(".head-portrait").show();
41
			$(".unlogin").hide();
40
			$(".unlogin").hide();
41
	 		$(".portrait-p").attr("src",servPath+"/images/head/"+userid+"_m.jpg");
42
			$(".portrait-p").load(function(){									
43
			})
44
			.error(function(){
45
				$(".portrait-p").attr("src",servPath+"/images/default-photo.jpg");
46
			});
42
		}
47
		}
43

48

44
		$("#searchContent").val(GetQueryString("searchContent")); 
49
		$("#searchContent").val(GetQueryString("searchContent")); 
53
						"success" : function($data) {
58
						"success" : function($data) {
54
							if ($data.success) {
59
							if ($data.success) {
55
								for(var i = 0 ; i < $data.data.data.length ; i++){
60
								for(var i = 0 ; i < $data.data.data.length ; i++){
56
									   
61
									//创建HTML标签  
57
									var dataHtml = "<div class='item'>";
62
									var dataHtml = "<div class='item'>";
58
									
63
									
59
									dataHtml += "<a  id='infoi'  href='information-brow.html?professorId="+$data.data.data[i].id+"' ><div class='photo1'><img class='images' style='width:100%;'  src='images/head/"+$data.data.data[i].id+"_l.jpg'/></div></a>";
60
								
61
									$(".images").eq(i).load(function(){
62
										
63
										})
64
									.error(function(){
65
										
66
										$(this).attr("src","images/default-photo.jpg");
67
									  });
68
									
69
									
70
									
64
									dataHtml += "<a  id='infoi'  href='information-brow.html?professorId="+$data.data.data[i].id+"' ><div class='photo1'><img class='images' style='width:100%;'  src='"+servPath+"/images/head/"+$data.data.data[i].id+"_l.jpg'/></div></a>";
65

66

71
									dataHtml += "<div class='synopsis'>";
67
									dataHtml += "<div class='synopsis'>";
72
									dataHtml += "<a href='information-brow.html?professorId="+$data.data.data[i].id+"' class='named'>";
68
									dataHtml += "<a href='information-brow.html?professorId="+$data.data.data[i].id+"' class='named'>";
73
									if(typeof($data.data.data[i].name) !== "undefined"){
69
									if(typeof($data.data.data[i].name) !== "undefined"){
108

104

109
									$("#professorList").append(dataHtml);
105
									$("#professorList").append(dataHtml);
110
									
106
									
107
									
108
									//获取头像		
109
									$(".images").load(function(){								
110
									})
111
									.error(function(){
112
										$(this).attr("src",servPath+"/images/default-photo.jpg");
113
									});	
114
									
115
									//点击查看当前信息
111
									(function(i){
116
									(function(i){
112
										$('.photo1').click(function()
117
										$('.photo1').click(function()
113
									{
118
									{
201
	<a href="login-invite-code.html"><div class="unlogin">特邀专家登录</div></a>
206
	<a href="login-invite-code.html"><div class="unlogin">特邀专家登录</div></a>
202
	<!--已登录-->
207
	<!--已登录-->
203
	<div class="head-portrait">
208
	<div class="head-portrait">
209
    	<img class="portrait-p" />
204
		<div class="personal-infor">
210
		<div class="personal-infor">
205
			<div class="triangleB"></div>
211
			<div class="triangleB"></div>
206
			<div class="personal-box">
212
			<div class="personal-box">