Преглед на файлове

研究方向头像丢失问题

jack преди 8 години
родител
ревизия
acd8d91410
променени са 1 файла, в които са добавени 186 реда и са изтрити 183 реда
  1. 186 183
      app/js/proinforupdate.js

+ 186 - 183
app/js/proinforupdate.js

@ -1,57 +1,57 @@
1
mui.ready(function() {		
1
mui.ready(function() {
2 2
	mui.plusReady(function() {
3 3
		var userid = plus.storage.getItem('userid');
4
		var oImg=document.getElementsByTagName("img")[0];
5
		var personalMaterial=document.getElementsByClassName('personalMaterial');
6
		var personSummary=document.getElementsByClassName("breifinfo")[0];
4
		var oImg = document.getElementsByTagName("img")[0];
5
		var personalMaterial = document.getElementsByClassName('personalMaterial');
6
		var personSummary = document.getElementsByClassName("breifinfo")[0];
7 7
		var fl;
8
		window.addEventListener("newId",function(event){
9
			fl=event.detail.rd;
8
		window.addEventListener("newId", function(event) {
9
			fl = event.detail.rd;
10 10
			personalMaterial[1].parentNode.style.display = "block";
11 11
			personalMaterial[2].parentNode.style.display = "block";
12 12
			personalMaterial[3].parentNode.style.display = "block";
13 13
			personalMaterial[4].parentNode.style.display = "block";
14
			personalMaterial[5].parentNode.style.display = "block";	
14
			personalMaterial[5].parentNode.style.display = "block";
15 15
			personalMaterial[6].parentNode.style.display = "block";
16
			personalMaterial[7].parentNode.style.display = "block";	
16
			personalMaterial[7].parentNode.style.display = "block";
17 17
			personalMessage();
18 18
		})
19
		
19

20 20
		//查询学术领域
21
		var subjectShow = function (data){
22
				if(data != undefined &&  data.length != 0 ){
23
					var subs = new Array();				
24
					if(data.indexOf(',')) {	
25
						subs = data.split(',');			
26
					}else {
21
		var subjectShow = function(data) {
22
				if(data != undefined && data.length != 0) {
23
					var subs = new Array();
24
					if(data.indexOf(',')) {
25
						subs = data.split(',');
26
					} else {
27 27
						subs[0] = data;
28 28
					}
29
					if(subs.length>0) {
29
					if(subs.length > 0) {
30 30
						var html = [];
31
						for (var i = 0; i < subs.length; i++) {
32
							html.push("<li>"+subs[i]+"</li>");														
31
						for(var i = 0; i < subs.length; i++) {
32
							html.push("<li>" + subs[i] + "</li>");
33 33
						};
34
						document.getElementsByClassName("infosubject")[0].innerHTML=html.join('');
35
					}	
36
				}			
34
						document.getElementsByClassName("infosubject")[0].innerHTML = html.join('');
35
					}
36
				}
37 37
			}
38
		//查询应用行业		
39
		var industryShow = function (data){
40
				if(data != undefined &&  data.length != 0 ){
41
					var subs = new Array();				
42
					if(data.indexOf(',')) {	
43
						subs = data.split(',');			
44
					}else {
38
			//查询应用行业		
39
		var industryShow = function(data) {
40
				if(data != undefined && data.length != 0) {
41
					var subs = new Array();
42
					if(data.indexOf(',')) {
43
						subs = data.split(',');
44
					} else {
45 45
						subs[0] = data;
46 46
					}
47
					if(subs.length>0) {   
47
					if(subs.length > 0) {
48 48
						var html = [];
49
						for (var i = 0; i < subs.length; i++) {
50
							html.push("<li>"+subs[i]+"</li>");														
49
						for(var i = 0; i < subs.length; i++) {
50
							html.push("<li>" + subs[i] + "</li>");
51 51
						};
52
						document.getElementsByClassName("infoapply")[0].innerHTML=html.join('');
53
					}	
54
				}			
52
						document.getElementsByClassName("infoapply")[0].innerHTML = html.join('');
53
					}
54
				}
55 55
			}
56 56
			//查询研究方向
57 57
		var getRecords = function($researchAreaLogs, caption) {
@ -88,17 +88,23 @@ mui.ready(function() {
88 88
					} else {
89 89
						var showDiv = "<div class='listbox'><div class='listbrowse mui-ellipsis'><span class='like'>" + $data.count + "</span>" + $data.caption + "</div><div class='likenum'>";
90 90
					}
91

92
					if($photos.length > 0) {
91
					
92
					if($photos.length < 4) {
93 93
						for(var j = 0; j < $photos.length; ++j) {
94
							if($photos[j].hasHeadImage) {
95
								showDiv += "<span class='likepeople headRadius'><img class='like-h' src='../images/head/" + $photos[j] + "_m.jpg'></span>";
94
							if($photos[j].img) {
95
								showDiv += "<span class='likepeople headRadius'><img class='like-h' src='" + baseUrl + "/images/head/" + $photos[j].id + "_m.jpg'></span>";
96
							} else {
97
								showDiv += "<span class='likepeople headRadius'><img class='like-h' src='../images/default-photo.jpg'></span>";
98
							}
99
						}
100
					} else {
101
						for(var j = $photos.length - 2; j < $photos.length; ++j) {
102
							if($photos[j].img) {
103
								showDiv += "<span class='likepeople headRadius'><img class='like-h' src='" + baseUrl + "/images/head/" + $photos[j].id + "_m.jpg'></span>";
96 104
							} else {
97 105
								showDiv += "<span class='likepeople headRadius'><img class='like-h' src='../images/default-photo.jpg'></span>";
98 106
							}
99 107
						}
100
					}
101
					if($photos.length >= 3) {
102 108
						showDiv += "<span class='mui-icon iconfont icon-more likepeople likemore headRadius'></span>";
103 109
					}
104 110
					showDiv += "</div></div></div>";
@ -115,59 +121,59 @@ mui.ready(function() {
115 121
				type: 'GET', //http请求类型
116 122
				timeout: 10000, //超时设置
117 123
				success: function(data) {
118
				console.log(JSON.stringify(data))
119
					if(!fl){
120
						plus.nativeUI.closeWaiting(); 
121
					plus.webview.currentWebview().show("slide-in-right", 150);
122
					}
123
					var $data = data.data;
124
					personalMaterial[0].innerText = $data.name;
125
					//头像					
126
					if($data.hasHeadImage) {	
127
						var mun = Math.round(Math.random()*99+1);
128
						oImg.src = baseUrl + "/images/head/" + $data.id + "_l.jpg?" + mun;						
129
					}
130
					//基本信息
131
//					if(!$data.authType) {						
132
//						document.getElementsByClassName('authword')[0].innerText = "未认证";
133
//						document.getElementsByClassName('authword')[0].style.backgroundColor = "#cccccc";
134
//					}
135
					if($data.title) {
136
						personalMaterial[1].innerText = $data.title;
137
					} else {
138
						personalMaterial[1].parentNode.style.display = "none";
139
					}
140
					if($data.office) {
141
						personalMaterial[2].innerText = $data.office;
142
					} else {
143
						personalMaterial[2].parentNode.style.display = "none";
144
					}
145
					if($data.department) {
146
						personalMaterial[3].innerText = $data.department;
147
					} else {
148
						personalMaterial[3].parentNode.style.display = "none";
149
					}
150
					if($data.orgName) {
151
						personalMaterial[4].innerText = $data.orgName;
152
					} else {
153
						personalMaterial[4].parentNode.style.display = "none";
154
					}
155
					if($data.address) {
156
						personalMaterial[5].innerText =$data.province+" "+$data.address;
157
					} else {
158
						personalMaterial[5].parentNode.style.display = "none";
159
					}
160
					if($data.phone) {
161
						personalMaterial[6].innerText = $data.phone;
162
					} else {
163
						personalMaterial[6].parentNode.style.display = "none";
164
					}
165
					if($data.email) {
166
						personalMaterial[7].innerText = $data.email;
167
					} else {
168
						personalMaterial[7].parentNode.style.display = "none";
169
					}
170
					//个人简介
124
					if(data.success) {
125
						plus.nativeUI.closeWaiting();
126
						if(!fl) {
127
							plus.webview.currentWebview().show("slide-in-right", 150);
128
						}
129
						var $data = data.data;
130
						personalMaterial[0].innerText = $data.name;
131
						//头像					
132
						if($data.hasHeadImage) {
133
							var mun = Math.round(Math.random() * 99 + 1);
134
							oImg.src = baseUrl + "/images/head/" + $data.id + "_l.jpg?" + mun;
135
						}
136
						//基本信息
137
						//					if(!$data.authType) {						
138
						//						document.getElementsByClassName('authword')[0].innerText = "未认证";
139
						//						document.getElementsByClassName('authword')[0].style.backgroundColor = "#cccccc";
140
						//					}
141
						if($data.title) {
142
							personalMaterial[1].innerText = $data.title;
143
						} else {
144
							personalMaterial[1].parentNode.style.display = "none";
145
						}
146
						if($data.office) {
147
							personalMaterial[2].innerText = $data.office;
148
						} else {
149
							personalMaterial[2].parentNode.style.display = "none";
150
						}
151
						if($data.department) {
152
							personalMaterial[3].innerText = $data.department;
153
						} else {
154
							personalMaterial[3].parentNode.style.display = "none";
155
						}
156
						if($data.orgName) {
157
							personalMaterial[4].innerText = $data.orgName;
158
						} else {
159
							personalMaterial[4].parentNode.style.display = "none";
160
						}
161
						if($data.address) {
162
							personalMaterial[5].innerText = $data.province + " " + $data.address;
163
						} else {
164
							personalMaterial[5].parentNode.style.display = "none";
165
						}
166
						if($data.phone) {
167
							personalMaterial[6].innerText = $data.phone;
168
						} else {
169
							personalMaterial[6].parentNode.style.display = "none";
170
						}
171
						if($data.email) {
172
							personalMaterial[7].innerText = $data.email;
173
						} else {
174
							personalMaterial[7].parentNode.style.display = "none";
175
						}
176
						//个人简介
171 177

172 178
						if($data.descp) {
173 179
							personSummary.innerHTML = $data.descp;
@ -186,18 +192,19 @@ mui.ready(function() {
186 192
						}
187 193
						//我的资源
188 194
						if($data.resources.length) {
189
						resource($data.resources, $data.resources.length);
190
						}else{
191
							document.getElementById("resouse").style.display="none";
195
							resource($data.resources, $data.resources.length);
196
						} else {
197
							document.getElementById("resouse").style.display = "none";
192 198
						}
193
					},
194
					error: function() {
195
						plus.nativeUI.toast("服务器链接超时", toastStyle);
196
						return;
197 199
					}
198
				});
199
			}
200
			//我的所有资源、
200
				},
201
				error: function() {
202
					plus.nativeUI.toast("服务器链接超时", toastStyle);
203
					return;
204
				}
205
			});
206
		}
207
		//我的所有资源、
201 208
		function resource(oDa, n) {
202 209
			var $data = oDa;
203 210
			var html = [];
@ -205,47 +212,39 @@ mui.ready(function() {
205 212
				var string = '<li class="mui-table-view-cell mui-media listitem" resouId=' + $data[i].resourceId + '>'
206 213
				string += '<a class="proinfor" href="resinforupdate.html"><div class="mui-media-object mui-pull-left ResImgBox ResImgBox2">'
207 214
				if($data[i].images.length) {
208
					string += '<img class="resImg headRadius" src="'+baseUrl+'/images/resource/' + $data[i].resourceId + '.jpg">'					
215
					string += '<img class="resImg headRadius" src="' + baseUrl + '/images/resource/' + $data[i].resourceId + '.jpg">'
209 216
				} else {
210 217

211
						string += '<img class="resImg headRadius" src="../images/default-resource.jpg">'
212
					}
213
					string += '</div><div class="mui-media-body" style="width:60%">'
214
					string += '<span class="listtit">' + $data[i].resourceName + '<div class="updatebox updatebox2" style="top:24px;"><em class="mui-icon mui-icon-compose updatebtn" style="display:none;"></em></div></span>'
215
					string += '<p class="listtit2">' + $data[i].supportedServices + '</p>'
216
//					string += '<p class="listtit3 resbrief">'
217
//					if($data[i].descp) {
218
//						string += $data[i].descp;
219
//					}
220
//					string += '</p>'
221
					string += '</div></a></li>'
222
					html.push(string);
218
					string += '<img class="resImg headRadius" src="../images/default-resource.jpg">'
223 219
				}
224
				document.getElementById("resourceList").innerHTML = html.join('');
225
			
220
				string += '</div><div class="mui-media-body" style="width:60%">'
221
				string += '<span class="listtit">' + $data[i].resourceName + '<div class="updatebox updatebox2" style="top:24px;"><em class="mui-icon mui-icon-compose updatebtn" style="display:none;"></em></div></span>'
222
				string += '<p class="listtit2">' + $data[i].supportedServices + '</p>'
223
					//					string += '<p class="listtit3 resbrief">'
224
					//					if($data[i].descp) {
225
					//						string += $data[i].descp;
226
					//					}
227
					//					string += '</p>'
228
				string += '</div></a></li>'
229
				html.push(string);
230
			}
231
			document.getElementById("resourceList").innerHTML = html.join('');
232

226 233
		}
227 234
		//个人信息修改
228 235
		document.getElementsByClassName("updatebox")[0].addEventListener("tap", function() {
229
			var nwaiting = plus.nativeUI.showWaiting(); //显示原生等待框  
230
			var arr = {
231
				name: personalMaterial[0].innerText,
232
				office: personalMaterial[1].innerText,
233
				title: personalMaterial[2].innerText,
234
				orgName: personalMaterial[3].innerText,
235
				department: personalMaterial[4].innerText,
236
				address: personalMaterial[5].innerText
237
			}
238
			webviewShow = plus.webview.create("../html/updateinfo1.html", "../html/updateinfo1.html", {}, arr); //后台创建webview并打开show.html   	    	
236
			var nwaiting = plus.nativeUI.showWaiting(); //显示原生等待框  			
237
			webviewShow = plus.webview.create("../html/updateinfo1.html", "../html/updateinfo1.html", {}, {flag:0}); //后台创建webview并打开show.html   	    	
239 238
			webviewShow.addEventListener("loaded", function() { //注册新webview的载入完成事件
240
//				nwaiting.close(); //新webview的载入完毕后关闭等待框
241
//				webviewShow.show("slide-in-right", 150); //把新webview窗体显示出来,显示动画效果为速度150毫秒的右侧移入动画         
239
				//				nwaiting.close(); //新webview的载入完毕后关闭等待框
240
				//				webviewShow.show("slide-in-right", 150); //把新webview窗体显示出来,显示动画效果为速度150毫秒的右侧移入动画         
242 241
			}, false);
243 242
		});
244 243
		document.getElementsByClassName("updatebox")[1].addEventListener("tap", function() {
245 244
			var nwaiting = plus.nativeUI.showWaiting(); //显示原生等待框  
246 245
			var arr = {
247 246
				descp: personSummary.innerText,
248
				flag:2
247
				flag: 2
249 248
			}
250 249
			webviewShow = plus.webview.create("../html/updateinfo2.html", "updateinfo2.html", {}, arr); //后台创建webview并打开show.html   	    	
251 250
			webviewShow.addEventListener("loaded", function() { //注册新webview的载入完成事件
@ -262,14 +261,16 @@ mui.ready(function() {
262 261
		});
263 262
		var page1 = mui.preload({
264 263
			url: "../html/updateinfo4.html",
265
			id: "updateinfo4.html"
264
			id: "updateinfo4.html",
265
			extras:{flag:0}
266 266
		})
267 267
		document.getElementsByClassName("updatebox")[3].addEventListener("tap", function() {
268 268
			page1.show("slide-in-right", 150);
269 269
		});
270 270
		var page2 = mui.preload({
271 271
			url: "../html/updateinfo5.html",
272
			id: "updateinfo5.html"
272
			id: "updateinfo5.html",
273
			extras:{flag: 2}//自定义扩展参数
273 274
		})
274 275
		document.getElementsByClassName("updatebox")[4].addEventListener("tap", function() {
275 276
			page2.show("slide-in-right", 150);
@ -277,7 +278,9 @@ mui.ready(function() {
277 278
		//添加我的资源
278 279
		document.getElementsByClassName("addinfobox")[0].addEventListener("tap", function() {
279 280
			var nwaiting = plus.nativeUI.showWaiting();
280
			var web = plus.webview.create("../html/updateinfo-res01.html", "updateinfo-res01.html",{},{reFlag:0}); //后台创建webview并打开show.html   	    	
281
			var web = plus.webview.create("../html/updateinfo-res01.html", "updateinfo-res01.html", {}, {
282
				reFlag: 0
283
			}); //后台创建webview并打开show.html   	    	
281 284
			web.addEventListener("loaded", function() {
282 285
				plus.nativeUI.closeWaiting();
283 286
				web.show("slide-in-right", 150);
@ -287,11 +290,13 @@ mui.ready(function() {
287 290
		mui("#resourceList").on("tap", "li", function() {
288 291
				var resouId = this.getAttribute("resouId");
289 292
				var nwaiting = plus.nativeUI.showWaiting();
290
				var web = plus.webview.create("../html/resinforbrow.html",'resinforbrow.html',{},{resourceId:resouId})
291
//				var web = plus.webview.create("../html/resinforupdate.html", "resinforupdate.html", {}, {
292
//					resourceId: resouId,
293
//					reFlag:0
294
//				}); //后台创建webview并打开show.html   	    	
293
				var web = plus.webview.create("../html/resinforbrow.html", 'resinforbrow.html', {}, {
294
						resourceId: resouId
295
					})
296
					//				var web = plus.webview.create("../html/resinforupdate.html", "resinforupdate.html", {}, {
297
					//					resourceId: resouId,
298
					//					reFlag:0
299
					//				}); //后台创建webview并打开show.html   	    	
295 300
				web.addEventListener("loaded", function() {
296 301

297 302
				}, false);
@ -304,52 +309,50 @@ mui.ready(function() {
304 309
		});
305 310
		personalMessage();
306 311
		/*专家文章*/
307
	mui.ajax(baseUrl + "/ajax/article/qaPro", {
308
		dataType: 'json', //数据格式类型
309
		type: 'GET', //http请求类型
310
		data: {
311
			"professorId": userid
312
		},
313
		timeout: 10000, //超时设置
314
		success: function(data) {
315
			console.log(JSON.stringify(data))
316
			if(data.success) {
317
				var $data = data.data;
318
				if($data.length==0){
319
					document.getElementById("professorArticleList").style.display="none";
320
					return;
321
				}
322
				var html = [];
323
				for(var i = 0; i < $data.length; i++) {					
324
					var string = '<li class="mui-table-view-cell mui-media listitem" articleId=' + $data[i].articleId + '>'
325
					string += '<a class="proinfor"><div class="mui-media-object mui-pull-left ResImgBox ResImgBox2">'
326
					if($data[i].articleImg){
327
						string += '<img class="resImg headRadius" src="'+baseUrl+'/data/article/'+$data[i].articleImg+'">'
328
					}else{
329
						string += '<img class="resImg headRadius" src="../images/default-artical.jpg">'
312
		mui.ajax(baseUrl + "/ajax/article/qaPro", {
313
			dataType: 'json', //数据格式类型
314
			type: 'GET', //http请求类型
315
			data: {
316
				"professorId": userid
317
			},
318
			timeout: 10000, //超时设置
319
			success: function(data) {
320
				console.log(JSON.stringify(data))
321
				if(data.success) {
322
					var $data = data.data;
323
					if($data.length == 0) {
324
						document.getElementById("professorArticleList").style.display = "none";
325
						return;
326
					}
327
					var html = [];
328
					for(var i = 0; i < $data.length; i++) {
329
						var string = '<li class="mui-table-view-cell mui-media listitem" articleId=' + $data[i].articleId + '>'
330
						string += '<a class="proinfor"><div class="mui-media-object mui-pull-left ResImgBox ResImgBox2">'
331
						if($data[i].articleImg) {
332
							string += '<img class="resImg headRadius" src="' + baseUrl + '/data/article/' + $data[i].articleImg + '">'
333
						} else {
334
							string += '<img class="resImg headRadius" src="../images/default-artical.jpg">'
335
						}
336
						string += '</div><div class="mui-media-body">'
337
						string += '<span class="listtit">' + $data[i].articleTitle + '</span>'
338
						string += '</div></a></li>'
339
						html.push(string);
330 340
					}
331
					string += '</div><div class="mui-media-body">'
332
					string += '<span class="listtit">' + $data[i].articleTitle + '</span>'
333
					string += '</div></a></li>'
334
					html.push(string);
341
					document.getElementById("articleList").innerHTML = html.join('');
335 342
				}
336
				document.getElementById("articleList").innerHTML = html.join('');
343
			},
344
			error: function() {
345
				plus.nativeUI.toast("服务器链接超时", toastStyle);
346
				return;
337 347
			}
338
		},
339
		error: function() {
340
			plus.nativeUI.toast("服务器链接超时", toastStyle);
341
			return;
342
		}
343
	});
344
	/*进入文章详细页面*/
345
	mui("#professorArticleList").on('tap', 'li', function() {
346
		var artId = this.getAttribute("articleId");
347
		plus.nativeUI.showWaiting();
348
		plus.webview.create("../html/professorArticle.html", 'professorArticle.html', {}, {
349
			articleId: artId
348
		});
349
		/*进入文章详细页面*/
350
		mui("#professorArticleList").on('tap', 'li', function() {
351
			var artId = this.getAttribute("articleId");
352
			plus.nativeUI.showWaiting();
353
			plus.webview.create("../html/professorArticle.html", 'professorArticle.html', {}, {
354
				articleId: artId
355
			});
350 356
		});
351 357
	});
352
	});
353
});
354

355
  
358
});