Browse Source

修改专家头像显示问题,添加判断函数如果读取不到专家头像地址就采用默认头像

zzy.zhiyuan.foxmail 8 years ago
parent
commit
e6f4e9338a
1 changed files with 12 additions and 15 deletions
  1. 12 15
      src/main/webapp/search.html

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

@ -17,7 +17,6 @@
17 17
<script type="text/javascript" src="js/common.js"></script>
18 18
<script type="text/javascript" src="js/jquery.cookie.js"></script>
19 19
<script src="js/jquery.page.js"></script>
20
<script type="text/javascript" src="js/jquery.similar.msgbox.js"></script>
21 20
<script type="text/javascript">
22 21
var arr=[];
23 22
var arr1=[];
@ -32,14 +31,8 @@ $.get("/ajax/org/qa",function($da) {
32 31
	    });
33 32
						
34 33
	$(function(){
35
		/*loginStatus();*/
36
		var servPath = "http://121.42.53.174:81";
37
		var userid = $.cookie("userid");
38
	 	if(userid){
39
	 		$(".head-portrait").css("background","url("+servPath+"/images/head/"+userid+"_m.jpg)");
40
	 		$(".head-portrait").show();
41
			$(".unlogin").hide();
42
		}
34
		loginStatus();
35

43 36
		$("#searchContent").val(GetQueryString("searchContent")); 
44 37
		$("#hsearchContent").val(GetQueryString("searchContent")); 
45 38
		var servPath = "http://121.42.53.174:81";
@ -54,10 +47,14 @@ $.get("/ajax/org/qa",function($da) {
54 47
								for(var i = 0 ; i < $data.data.data.length ; i++){
55 48
									   
56 49
									var dataHtml = "<div class='item'>";
57
									dataHtml += "<a  id='infoi'href='information-brow.html?professorId="+$data.data.data[i].id+"' ><div class='photo1' style='background:url("+servPath+"/images/head/"+$data.data.data[i].id+"_l.jpg) no-repeat center center'></div></a>";
58 50
									
51
									dataHtml += "<a  id='infoi'href='information-brow.html?professorId="+$data.data.data[i].id+"' ><div class='photo1'><img id='images1' style='width:100%' src='"servPath+"/images/head/"+$data.data.data[i].id+"_l.jpg'/></div></a>";
52
									$("img#images1").load(function(){
53
									})
54
									.error(function(){
55
 									$("img#images1").attr("src","'servPath+'/images/default-photo.jpg");
56
									});
59 57
									
60
									  
61 58
									dataHtml += "<div class='synopsis'>";
62 59
									dataHtml += "<a href='information-brow.html?professorId="+$data.data.data[i].id+"' class='named'>";
63 60
									if(typeof($data.data.data[i].name) !== "undefined"){
@ -122,7 +119,7 @@ $.get("/ajax/org/qa",function($da) {
122 119
								}
123 120
								
124 121
							} else {
125
								$.MsgBox.Alert("消息",$data.msg);
122
								alert($data.msg);
126 123
							}
127 124
						}
128 125
					});
@ -137,7 +134,7 @@ $.get("/ajax/org/qa",function($da) {
137 134
    						break;
138 135
    				}
139 136
    			}else{
140
    				$.MsgBox.Alert("消息",data.msg);
137
    				alert(data.msg);
141 138
    			}
142 139
    		})
143 140
 		}
@ -150,7 +147,7 @@ $.get("/ajax/org/qa",function($da) {
150 147
    						break;
151 148
    				}
152 149
    			}else{
153
    				$.MsgBox.Alert("消息",data.msg);
150
    				alert(data.msg);
154 151
    			}
155 152
    		})
156 153
 		}
@ -197,7 +194,7 @@ $.get("/ajax/org/qa",function($da) {
197 194
				<!--<a href="index.html"><span class="icon icon1"></span>我的主页</a>-->
198 195
				<a href="information.html"><span class="icon icon2"></span>修改资料</a>
199 196
				<a href="account-set.html"><span class="icon icon3"></span>账户设置</a>
200
				<a href="#" onClick="exit()"><span class="icon icon4" ></span>退出登录</a>
197
				<a href="#" onclick="exit()"><span class="icon icon4" ></span>退出登录</a>
201 198
			</div>
202 199
		</div>
203 200
	</div>