Browse Source

资源详情页面及搜索资源专家标志

jack 8 years ago
parent
commit
e7527536d3
3 changed files with 117 additions and 104 deletions
  1. 7 7
      app/html/resinforbrow.html
  2. 102 88
      app/js/resinforbrow.js
  3. 8 9
      app/js/searchhome.js

+ 7 - 7
app/html/resinforbrow.html

@ -106,27 +106,27 @@
106 106
					</li>
107 107
				</ul>
108 108
			</div>
109
			<div class="mui-input-group mainbox resouinfoword marginbox " id="detaildiv">
109
			<div class="mui-input-group mainbox resouinfoword marginbox " id="hezuodiv">
110 110
				<ul class="resouinfobox">
111 111
					<li>
112
						<div class="infocontit">详细描述</div>
112
						<div class="infocontit">合作备注</div>
113 113
						<div class="infocon">
114
							<p class="listtit3 mutlinebox" id="detail"></p>
114
							<p class="listtit3 mutlinebox" id="hezuo"></p>
115 115
						</div>
116 116
					</li>
117 117
				</ul>
118 118
			</div>
119
			<div class="mui-input-group mainbox resouinfoword marginbox " id="hezuodiv">
119
			<div class="mui-input-group mainbox resouinfoword marginbox " id="detaildiv">
120 120
				<ul class="resouinfobox">
121 121
					<li>
122
						<div class="infocontit">合作备注</div>
122
						<div class="infocontit">详细描述</div>
123 123
						<div class="infocon">
124
							<p class="listtit3 mutlinebox" id="hezuo"></p>
124
							<p class="listtit3 mutlinebox" id="detail"></p>
125 125
						</div>
126 126
					</li>
127 127
				</ul>
128 128
			</div>
129
129
		
130 130
		</div>
131 131
132 132
		<script src="../js/public/mui.min.js"></script>

+ 102 - 88
app/js/resinforbrow.js

@ -46,10 +46,10 @@ function ziyuaninfo(resourceId) {
46 46
					//资源名称
47 47
					professorId = mydata['professor']['id'];
48 48
					var userid = plus.storage.getItem('userid');
49
					if(professorId==userid){
50
						document.getElementsByClassName("footbox")[0].style.display="none";
49
					if(professorId == userid) {
50
						document.getElementsByClassName("footbox")[0].style.display = "none";
51 51
					}
52
					resourceName=mydata['resourceName'];
52
					resourceName = mydata['resourceName'];
53 53
					(mydata['resourceName']) ? oresorcename.innerHTML = mydata['resourceName']: oresorcename.innerHTML = '';
54 54
					(mydata['resourceName']) ? oresourceName.innerHTML = mydata['resourceName']: oresourceName.innerHTML = '';
55 55
@ -77,20 +77,28 @@ function ziyuaninfo(resourceId) {
77 77
					if(mydata['professor']["authType"]) {
78 78
						opromodify.classList.add('icon-vip');
79 79
						opromodify.classList.add('authicon-cu');
80
						opromodify.style.float = "left";
80 81
					} else {
81 82
						if(mydata['professor']["authStatus"]) {
82
							if(mydata['professor']["authentication"]  == 1) {
83
							if(mydata['professor']["authentication"] == 1) {
83 84
								opromodify.classList.add('icon-renzheng');
84 85
								opromodify.classList.add('authicon-mana');
85
							} else if(mydata['professor']["authentication"]  == 2) {
86
								opromodify.style.position = "static";
87
								opromodify.style.margin = "3px 0 0 0";
88
							} else if(mydata['professor']["authentication"] == 2) {
86 89
								opromodify.classList.add('icon-renzheng');
87 90
								opromodify.classList.add('authicon-staff');
91
								opromodify.style.position = "static";
92
								opromodify.style.margin = "3px 0 0 0";
88 93
							} else {
89 94
								opromodify.classList.add('icon-renzheng');
90 95
								opromodify.classList.add('authicon-stu');
96
								opromodify.style.position = "static";
97
								opromodify.style.margin = "3px 0 0 0";
91 98
							}
92 99
						}
93 100
					}
101
94 102
					/*专家头像*/
95 103
					(mydata['professor']["hasHeadImage"] == 0) ? oproimg.setAttribute('src', '../images/default-photo.jpg'): oproimg.setAttribute('src', baseUrl + '/images/head/' + mydata['professor']['id'] + '_m.jpg');
96 104
@ -111,7 +119,7 @@ function ziyuaninfo(resourceId) {
111 119
						if(mydata['subject'].indexOf(',') != -1) { //字符串是否包含,
112 120
							var fieldlist = mydata['subject'].split(",");
113 121
							console.log(fieldlist.length);
114
							for(var i = 0; i < fieldlist; i++) {
122
							for(var i = 0; i < fieldlist.length; i++) {
115 123
								var oli = document.createElement('li');
116 124
								oli.innerText = fieldlist[i];
117 125
								ofield.appendChild(oli);
@ -131,7 +139,7 @@ function ziyuaninfo(resourceId) {
131 139
						if(mydata['industry'].indexOf(',') != -1) { //字符串是否包含,
132 140
							var applylist = mydata['industry'].split(",");
133 141
							console.log(applylist.length);
134
							for(var i = 0; i < applylist; i++) {
142
							for(var i = 0; i < applylist.length; i++) {
135 143
								var oli = document.createElement('li');
136 144
								oli.innerText = fieldlist[i];
137 145
								oapply.appendChild(oli);
@ -147,7 +155,14 @@ function ziyuaninfo(resourceId) {
147 155
148 156
					//详细描述
149 157
					if(mydata['descp']) {
150
						odetail.innerHTML = mydata['descp']
158
						odetail.innerHTML = mydata['descp'];
159
						var oImg = document.getElementById("detail").getElementsByTagName("img");
160
						for(var i = 0; i < oImg.length; i++) {
161
							(function(n) {
162
								var att = oImg[n].src.substr(7);
163
								oImg[n].setAttribute("src", baseUrl + att);
164
							})(i);
165
						}
151 166
					} else {
152 167
						odetaildiv.style.display = 'none';
153 168
					}
@ -181,72 +196,72 @@ mui.plusReady(function() {
181 196
		judge()
182 197
	})
183 198
	var judge = function() {
184
		mui.ajax(baseUrl + "/ajax/professor/editBaseInfo/" + professorId, {
185
			dataType: 'json', //数据格式类型
186
			type: 'GET', //http请求类型
187
			timeout: 10000, //超时设置
188
			async: false,
189
			success: function(data) {
199
			mui.ajax(baseUrl + "/ajax/professor/editBaseInfo/" + professorId, {
200
				dataType: 'json', //数据格式类型
201
				type: 'GET', //http请求类型
202
				timeout: 10000, //超时设置
203
				async: false,
204
				success: function(data) {
205
206
					var $info = data.data || {}
207
208
					if(data.success && data.data) {
209
						if($info.authentication == 1) {
210
							mui.openWindow({
211
								url: '../html/proinforbrow.html',
212
								id: 'html/proinforbrow.html',
213
								show: {
214
									autoShow: false,
215
									aniShow: "slide-in-left"
216
								},
217
								extras: {
218
									proid: professorId
219
								},
220
							});
221
						} else if($info.authentication == 2) {
222
							mui.openWindow({
223
								url: '../html/companybrowse.html',
224
								id: 'html/companybrowse.html',
225
								show: {
226
									autoShow: false,
227
									aniShow: "slide-in-left"
228
								},
229
								extras: {
230
									proid: professorId
231
								},
232
							});
233
						} else if($info.authentication == 3) {
234
							mui.openWindow({
235
								url: '../html/studentbrowse.html',
236
								id: 'html/studentbrowse.html',
237
								show: {
238
									autoShow: false,
239
									aniShow: "slide-in-left"
240
								},
241
								extras: {
242
									proid: professorId
243
								},
244
							});
245
						}
190 246
191
				var $info = data.data || {}
192
193
				if(data.success && data.data) {
194
					if($info.authentication == 1) {
195
						mui.openWindow({
196
							url: '../html/proinforbrow.html',
197
							id: 'html/proinforbrow.html',
198
							show: {
199
								autoShow: false,
200
								aniShow: "slide-in-left"
201
							},
202
							extras: {
203
								proid: professorId
204
							},
205
						});
206
					} else if($info.authentication == 2) {
207
						mui.openWindow({
208
							url: '../html/companybrowse.html',
209
							id: 'html/companybrowse.html',
210
							show: {
211
								autoShow: false,
212
								aniShow: "slide-in-left"
213
							},
214
							extras: {
215
								proid: professorId
216
							},
217
						});
218
					} else if($info.authentication == 3) {
219
						mui.openWindow({
220
							url: '../html/studentbrowse.html',
221
							id: 'html/studentbrowse.html',
222
							show: {
223
								autoShow: false,
224
								aniShow: "slide-in-left"
225
							},
226
							extras: {
227
								proid: professorId
228
							},
229
						});
230 247
					}
231
248
				},
249
				error: function() {
250
					plus.nativeUI.toast("服务器链接超时", toastStyle);
251
					return;
232 252
				}
233
			},
234
			error: function() {
235
				plus.nativeUI.toast("服务器链接超时", toastStyle);
236
				return;
237
			}
238
		});
239
	}
240
	//console.log("资源id==" + resourceId);
241
	//资源信息
253
			});
254
		}
255
		//console.log("资源id==" + resourceId);
256
		//资源信息
242 257
	ziyuaninfo(resourceId);
243 258
	/*点击咨询*/
244 259
	//判断是否登录,登录才可咨询,否则登录
245
	function isLogin(){
260
	function isLogin() {
246 261
		var userid = plus.storage.getItem('userid');
247
	
248
		if(userid && userid != null && userid != 'null' && userid != undefined && userid != 'undefined'){
249
			
262
263
		if(userid && userid != null && userid != 'null' && userid != undefined && userid != 'undefined') {
264
250 265
			var flag = 'ziyuan';
251 266
			var consulttitle = oresorcename.innerHTML;
252 267
			var nwaiting = plus.nativeUI.showWaiting(); //显示原生等待框
@ -259,20 +274,19 @@ mui.plusReady(function() {
259 274
			webviewShow.addEventListener("loaded", function() {
260 275
261 276
			}, false);
262
			
263
		}else {
277
278
		} else {
264 279
			mui.openWindow({
265
			    url:'../html/login.html',
266
			    id:'login.html'
280
				url: '../html/login.html',
281
				id: 'login.html'
267 282
			})
268
				
283
269 284
		}
270 285
	};
271 286
	oconsult.addEventListener('tap', function() {
272 287
		isLogin();
273 288
	});
274
	
275
 
289
276 290
	/*咨询成功,返回资源信息*/
277 291
	window.addEventListener('backziyuaninfo', function(event) {
278 292
@ -285,7 +299,7 @@ mui.plusReady(function() {
285 299
		if(userid && userid != null && userid != "null") {
286 300
			collectionExpert($this);
287 301
		} else {
288
//			plus.nativeUI.toast("请先登录");
302
			//			plus.nativeUI.toast("请先登录");
289 303
			isLogin();
290 304
		}
291 305
	});
@ -377,7 +391,7 @@ mui.plusReady(function() {
377 391
		});
378 392
379 393
	}
380
	
394
381 395
	/*微信及微信朋友圈分享专家*/
382 396
	var auths, shares;
383 397
	document.getElementById("shareBtn").addEventListener("tap", function() {
@ -423,7 +437,7 @@ mui.plusReady(function() {
423 437
					x: 'WXSceneTimeline'
424 438
				}));
425 439
		}
426
		
440
427 441
		//// 弹出分享列表
428 442
		shareBts.length > 0 ? plus.nativeUI.actionSheet({
429 443
			title: '分享',
@ -431,17 +445,17 @@ mui.plusReady(function() {
431 445
			buttons: shareBts
432 446
		}, function(e) {
433 447
			var str;
434
			if(supportedServices) {
435
				str = "应用用途:" + supportedServices
448
			if(supportedServices) {
449
				str = "应用用途:" + supportedServices
436 450
			}
437 451
			if(e.index == 1) {
438 452
				var share = buildShareService();
439 453
				if(share) {
440 454
					shareMessage(share, "WXSceneSession", {
441 455
						content: str,
442
						title: "【科袖资源】" + resourceName + "" ,
443
						href: baseUrl+"/shareResinfor.html?resourceId=" + resourceId,
444
						thumbs: [baseUrl+"/images/resource/" + resourceId + ".jpg"]
456
						title: "【科袖资源】" + resourceName + "",
457
						href: baseUrl + "/shareResinfor.html?resourceId=" + resourceId,
458
						thumbs: [baseUrl + "/images/resource/" + resourceId + ".jpg"]
445 459
					});
446 460
				}
447 461
			} else if(e.index == 2) {
@ -449,9 +463,9 @@ mui.plusReady(function() {
449 463
				if(share) {
450 464
					shareMessage(share, "WXSceneTimeline", {
451 465
						content: str,
452
						title: "【科袖资源】" + resourceName + " " ,
453
						href: baseUrl+"/shareResinfor.html?resourceId=" + resourceId,
454
						thumbs: [baseUrl+"/images/resource/" + resourceId + ".jpg"]
466
						title: "【科袖资源】" + resourceName + " ",
467
						href: baseUrl + "/shareResinfor.html?resourceId=" + resourceId,
468
						thumbs: [baseUrl + "/images/resource/" + resourceId + ".jpg"]
455 469
					});
456 470
				}
457 471
			}
@ -481,7 +495,7 @@ mui.plusReady(function() {
481 495
		}
482 496
483 497
	}
484
	
498
485 499
	function shareMessage(share, ex, msg) {
486 500
		msg.extra = {
487 501
			scene: ex
@ -502,7 +516,7 @@ mui.plusReady(function() {
502 516
			}
503 517
		});
504 518
	}
505
	
506
/*图像预览*/
519
520
	/*图像预览*/
507 521
	mui.previewImage();
508 522
});

+ 8 - 9
app/js/searchhome.js

@ -487,17 +487,17 @@ function resourcesEach(datalist) {
487 487
		}
488 488

489 489
		/*判断用户是否认证*/
490
		var icon = '';
491
		if(item.authType) {
490
		var icon = '';		
491
		if(item.professor.authType) {			
492 492
			icon='<em class="mui-icon iconfont icon-vip authicon-cu"> </em>';
493 493
		} else {
494
			if(item.authStatus) {
495
				if(item.authentication == 1) {
496
					icon='<em class="mui-icon iconfont icon-renzheng authicon-mana"><span>科研</span></em>';
497
				} else if(item.authentication == 2) {
498
					icon='<em class="mui-icon iconfont icon-renzheng authicon-staff"><span>企业</span></em>';
494
			if(item.professor.authStatus) {
495
				if(item.professor.authentication == 1) {					
496
					icon='<em class="mui-icon iconfont "></em>';
497
				} else if(item.professor.authentication == 2) {					
498
					icon='<em class="mui-icon iconfont icon-renzheng authicon-staff"></em>';
499 499
				} else {
500
					icon='<em class="mui-icon iconfont icon-renzheng authicon-stu"><span>学生</span></em>';
500
					icon='<em class="mui-icon iconfont icon-renzheng authicon-stu"></em>';
501 501
				}
502 502
			}
503 503
		}
@ -519,7 +519,6 @@ function resourcesEach(datalist) {
519 519
		if(address != "") {
520 520
			address = " | " + address;
521 521
		}
522

523 522
		var li = document.createElement('li');
524 523
		li.className = 'mui-table-view-cell mui-media';
525 524