Browse Source

文章相关

luyanan 6 years ago
parent
commit
584fa9da44

BIN
app/images/default-plat.jpg


+ 45 - 20
app/js/articleShow.js

@ -55,11 +55,15 @@ mui.plusReady(function() {
55 55
			plus.webview.currentWebview().show("slide-in-right", 150);
56 56
			console.log(JSON.stringify($data));
57 57
			document.getElementById("articleName").innerHTML = $data.articleTitle;
58
			if($data.articleType=='2'){
58
			if($data.articleType=='1'){
59 59
				oArticleModule.oFlag = 1;
60
				oArticleModule.oWner=$data.onergId;
61
			}else{
62
				oArticleModule.oWner=$data.professorId;
60
				oArticleModule.oWner=$data.ownenerId;
61
			}else if($data.articleType=='2') {
62
				oArticleModule.oFlag = 2;
63
				oArticleModule.oWner=$data.ownerId;
64
			}else if($data.articleType=='3') {
65
				oArticleModule.oFlag = 3;
66
				oArticleModule.oWner=$data.ownerId;
63 67
			}
64 68
			if($data.articleImg){
65 69
				stt = $data.articleImg.substring(0, 9);
@ -85,14 +89,21 @@ mui.plusReady(function() {
85 89
				}
86 90
			}
87 91
			document.getElementById("snum").innerHTML = $data.articleAgree;
88
			if($data.articleType == 1) {
92
			if($data.articleType == '1') {
89 93
				oArticleModule.oAjaxGet(baseUrl + "/ajax/article/ralateArticles", {
90 94
					"keys": arr,
91 95
					"professorId": oArticleModule.oWner,
92 96
					"articleId": oArticleModule.articleId,
93 97
					"rows": 5
94 98
				}, "get", oArticleModule.correlationArticle);
95
			} else {
99
			} else if($data.articleType == '2') {
100
				oArticleModule.oAjaxGet(baseUrl + "/ajax/article/ralateArticles", {
101
					"keys": arr,
102
					"orgId": oArticleModule.oWner,
103
					"articleId": oArticleModule.articleId,
104
					"rows": 5
105
				}, "get", oArticleModule.correlationArticle);
106
			} else if($data.articleType == '3') {
96 107
				oArticleModule.oAjaxGet(baseUrl + "/ajax/article/ralateArticles", {
97 108
					"keys": arr,
98 109
					"orgId": oArticleModule.oWner,
@ -104,16 +115,6 @@ mui.plusReady(function() {
104 115
			document.getElementById("oTime").innerHTML = commenTime($data.publishTime);
105 116
			
106 117
			if(oArticleModule.oFlag == 1) {
107
				/*企业发布文章信息*/
108
				oArticleModule.oAjaxGet(baseUrl + "/ajax/org/" + oArticleModule.oWner, "", "get", oArticleModule.business);
109
				//document.getElementById('attBtn').style.display = "none";
110
				companylist();
111
				if(oCurren.userid)
112
				oArticleModule.oAjaxGet(baseUrl + "/ajax/watch/hasWatch", {
113
					"watchObject": oArticleModule.oWner,
114
					'professorId': oCurren.userid
115
				}, "get", oArticleModule.attentionGetExpert);
116
			} else {
117 118
				if(plus.storage.getItem('userid') == oArticleModule.oWner) {
118 119
					document.getElementById('attBtn').style.display = "none";
119 120
				}
@ -132,6 +133,19 @@ mui.plusReady(function() {
132 133
				}, "get", oArticleModule.attentionGetExpert);
133 134
				/*个人发布文章信息*/
134 135
				oArticleModule.oAjaxGet(baseUrl + "/ajax/professor/editBaseInfo/" + oArticleModule.oWner, "", "get", oArticleModule.professorMess);
136
			} else if(oArticleModule.oFlag == 2) {
137
				/*企业发布文章信息*/
138
				oArticleModule.oAjaxGet(baseUrl + "/ajax/org/" + oArticleModule.oWner, "", "get", oArticleModule.business);
139
				//document.getElementById('attBtn').style.display = "none";
140
				companylist();
141
				if(oCurren.userid)
142
				oArticleModule.oAjaxGet(baseUrl + "/ajax/watch/hasWatch", {
143
					"watchObject": oArticleModule.oWner,
144
					'professorId': oCurren.userid
145
				}, "get", oArticleModule.attentionGetExpert);
146
			} else if(oArticleModule.oFlag == 3){
147
				document.getElementById('attBtn').style.display = "none";
148
				oArticleModule.oAjaxGet(baseUrl + "/ajax/platform/info", {id:oArticleModule.oWner}, "get", oArticleModule.platform);
135 149
			}
136 150
			
137 151
		},
@ -173,6 +187,15 @@ mui.plusReady(function() {
173 187
				});
174 188
			})
175 189
		},
190
		platform: function($data) {
191
			console.log(JSON.stringify($data));
192
			document.getElementById('name').innerHTML = $data.name;
193
			document.getElementById("messImg").classList.add("cmpHead2");
194
			document.getElementById("messImg").innerHTML='<div class="boxBlock"><img class="boxBlockimg" id="platImg" src="../images/default-icon.jpg"></div>'
195
			if($data.logo) {
196
				document.getElementById("platImg").src= baseUrl + "/data/platform" + $data.logo;
197
			}
198
		},
176 199
		correlationExpert: function($data) {
177 200
			if($data.length == 0) {
178 201
				return;
@ -337,10 +360,12 @@ mui.plusReady(function() {
337 360
			
338 361
			for(var i = 0; i < $data.length; i++) {
339 362
				var ourl, of ;
340
				if($data[i].articleType == 1) {
341
					ourl = baseUrl + "/ajax/professor/editBaseInfo/" + $data[i].professorId; of = 1;
342
				} else {
343
					ourl = baseUrl + "/ajax/org/" + $data[i].onergId; of = 2;
363
				if($data[i].articleType == '1') {
364
					ourl = baseUrl + "/ajax/professor/editBaseInfo/" + $data[i].ownerId; of = 1;
365
				} else if($data[i].articleType == '2'){
366
					ourl = baseUrl + "/ajax/org/" + $data[i].ownenerId; of = 2;
367
				} else if($data[i].articleType == '3'){
368
					ourl = baseUrl + "/ajax/platform/info"; of = 3;
344 369
				}
345 370
				var arImg = "../images/default-artical.jpg";
346 371
				if($data[i].articleImg) {

+ 12 - 2
app/js/attentedList.js

@ -309,9 +309,11 @@ mui.ready(function() {
309 309
						var $itemlist = $(li);
310 310
						document.getElementById(obj).appendChild(li);
311 311
						if(dataItem.articleType=="1"){
312
							proSigInfo(dataItem.professorId,$itemlist)
312
							proSigInfo(dataItem.ownerId,$itemlist)
313 313
						}else if(dataItem.articleType=="2"){
314
							orgSigInfo(dataItem.onergId,$itemlist)
314
							orgSigInfo(dataItem.ownenerId,$itemlist)
315
						}else if(dataItem.articleType=="3"){
316
							platSigInfo(dataItem.ownerId,$itemlist)
315 317
						}
316 318
					}
317 319
				});
@ -404,6 +406,14 @@ mui.ready(function() {
404 406
					}
405 407
				});
406 408
			},
409
			platSigInfo=function(id,$list){
410
				oAjax("/ajax/platform/info",{
411
					id:id
412
				}, "get", function(data){
413
					var name=data.data.name;
414
					$list.find(".ownerName").html(name)
415
				});
416
			},
407 417
			tabToFun=function($this){
408 418
				var htm=$this.getAttribute("href")
409 419
				var type=$this.getAttribute("rel");

+ 16 - 7
app/js/cmpInforShow.js

@ -388,14 +388,20 @@ mui.ready(function() {
388 388
								if(StrData[i].articleImg) {
389 389
									imgL = baseUrl + '/data/article/' + StrData[i].articleImg
390 390
								}
391
								var oURL;
392
								if(StrData[i].articleType == 1) {
393
									oURL = "/ajax/professor/baseInfo/" + StrData[i].professorId;
394
								} else {
395
									oURL = "/ajax/org/" + StrData[i].onergId;
391
								var oURL,oData='';
392
								if(StrData[i].articleType=='1') {
393
									oURL="/ajax/professor/baseInfo/"+StrData[i].ownerId;
394
								}else if(StrData[i].articleType=='2'){
395
									oURL="/ajax/org/" + StrData[i].ownenerId;
396
								}else if(StrData[i].articleType=='3'){
397
									oURL="/ajax/platform/info";
398
									oData={
399
										id: StrData[i].ownerId 
400
									}
396 401
								}
397 402
								mui.ajax(baseUrl + oURL, {
398 403
									"type": "GET",
404
									"data": oData,
399 405
									'dataType': "json",
400 406
									"success": function(data) {
401 407
										if(data.success) {
@ -409,12 +415,15 @@ mui.ready(function() {
409 415
											} else {
410 416
												thisName = data.data.name;
411 417
											}
412
											if(StrData[n].articleType == 1) {
418
											if(StrData[n].articleType == '1') {
413 419
												add.setAttribute("owner-id", data.data.id);
414 420
												add.setAttribute("data-type", 1);
415
											} else {
421
											} else if(StrData[n].articleType == '2'){
416 422
												add.setAttribute("owner-id", data.data.id);
417 423
												add.setAttribute("data-type", 2);
424
											} else if(StrData[n].articleType == '3'){
425
												add.setAttribute("owner-id", data.data.id);
426
												add.setAttribute("data-type", 3);
418 427
											}
419 428

420 429
											var itemlist = '<div class="flexCenter OflexCenter mui-clearfix"><div class="madiaHead artHead" style="background-image:url(' + imgL + ')"></div>';

+ 0 - 349
app/js/discover.js

@ -1,349 +0,0 @@
1
//发现模块
2
var pageIndex = 1; // 页数
3
var allPages = 1; // 总页数
4
var discoverBox = document.body.querySelector('#discoverBox');
5

6
/*点击列表*/
7
mui('#discoverBox').on('tap', '.newsurl', function() {
8
	var id = $(this).attr("data-id");
9
	var datatype = $(this).attr("data-type");
10
	var ownerid = $(this).attr("owner-id");
11
	if(datatype == 1) {
12
		mui.openWindow({
13
			url: '../html/professorArticle.html',
14
			id: 'html/professorArticle.html',
15
			show: {
16
				autoShow: false,
17
				aniShow: "slide-in-right",
18
			},
19
			extras: {
20
				articleId: id,
21
				ownerid: ownerid,
22
			}
23
		});
24
	}else if(datatype == 2){
25
		mui.openWindow({
26
			url: '../html/professorArticle.html',
27
			id: 'html/professorArticle.html',
28
			show: {
29
				autoShow: false,
30
				aniShow: "slide-in-right",
31
			},
32
			extras: {
33
				articleId: id,
34
				ownerid: ownerid,
35
				oFlag:1
36
			}
37
		});
38
	} else if(datatype == 3) {
39
		mui.openWindow({
40
			url: '../html/resourceShow.html',
41
			id: 'html/resourceShow.html',
42
			show: {
43
				autoShow: false,
44
				aniShow: "slide-in-right",
45
			},
46
			extras: {
47
				resourceId: id,
48
			}
49
		});
50
	}else if(datatype == 4) {
51
		mui.openWindow({
52
			url: '../html/resourceShow.html',
53
			id: 'html/resourceShow.html',
54
			show: {
55
				autoShow: false,
56
				aniShow: "slide-in-right",
57
			},
58
			extras: {
59
				resourceId: id,
60
			}
61
		});
62
	}
63
});
64

65
/*点击头像*/
66
mui('#discoverBox').on('tap', '.gouserurl', function() {
67
	var id = $(this).parents(".mui-table-view-cell").find(".userurl").attr("data-id");
68
	var datatype = $(this).parents(".mui-table-view-cell").find(".newsurl").attr("data-type");
69
	var iftauth = $(this).parents(".mui-table-view-cell").find(".userurl").attr("data-iftauth");
70
	//alert(datatype)
71
	if(datatype == 1 || datatype == 3) {
72
		mui.openWindow({
73
			url: '../html/userInforShow.html',
74
			id: 'html/userInforShow.html',
75
			show: {
76
				autoShow: false,
77
				aniShow: "slide-in-right",
78
			},
79
			extras: {
80
				proid: id,
81
			}
82
		});
83
	} else if(datatype == 2 || datatype == 4) {
84
		mui.openWindow({
85
			url: '../html/cmpInforShow.html',
86
			id: 'cmpInforShow.html',
87
			show: {
88
				autoShow: false,
89
				aniShow: "slide-in-right",
90
			},
91
			extras: {
92
				cmpId: id,
93
			}
94
		});
95
	}
96
});
97

98
/*页面数据初始化*/
99
getOnePase();
100

101
/*var u = navigator.userAgent;
102
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
103
var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
104
if(isAndroid) {
105
	//父子页面,下拉刷新
106
	mui.init({
107
		pullRefresh: {
108
			container: '#pullrefresh2',
109
			down: {
110
				callback: pulldownRefresh,
111
				height:50
112
			},
113
			up: {
114
				contentrefresh: '正在加载...',
115
				callback: pullupRefresh
116
			}
117
		}
118
	});
119
}
120
if(isiOS) {
121
	//父子页面,下拉刷新
122
	mui.init({
123
		pullRefresh: {
124
			container: '#pullrefresh2',
125
			down: {
126
				callback: pulldownRefresh,
127
			},
128
			up: {
129
				contentrefresh: '正在加载...',
130
				//auto:true,
131
				//height:100, 
132
				callback: pullupRefresh
133
			}
134
		}
135
	});
136
}*/
137

138
mui.init({
139
	pullRefresh: {
140
		container: '#pullrefresh2',
141
		down: {
142
			callback: pulldownRefresh,
143
			//height:50
144
		},
145
		up: {
146
			contentrefresh: '正在加载...',
147
			callback: pullupRefresh
148
		}
149
	}
150
});
151

152
function pullupRefresh() {
153
	pageIndex = ++pageIndex;
154
	setTimeout(function() {
155
		getaData()
156
	}, 1000);
157
}
158
function pulldownRefresh() {
159
	pageIndex=1;
160
	setTimeout(function() {
161
		getOnePase();
162
		mui('#pullrefresh2').pullRefresh().endPulldownToRefresh();
163
	}, 1000);
164
}
165

166

167
/*获取上拉加载更多数据*/
168
function getaData() {
169
	mui.plusReady(function() {
170
		mui.ajax(baseUrl + '/ajax/article/findHot', {
171
			data: {
172
				"pageNo": pageIndex,
173
				"pageSize": 20,
174
			},
175
			dataType: 'json', //数据格式类型
176
			type: 'GET', //http请求类型
177
			timeout: 10000,
178
			async: false,
179
			success: function(data) {
180
				if(data.success) {
181
					var dice1 = data.data.total; //总条数
182
					var dice2 = data.data.pageSize; //每页条数
183
					var result = '';
184
					if(pageIndex == 1) { //下拉刷新需要先清空数据
185
						table.innerHTML = ''; // 在这里清空可以防止刷新时白屏
186
					}
187
					allPages = dice1 / dice2;
188
					var datalist = data.data.data;
189
					datalistEach(datalist);
190
					if(pageIndex < allPages) {
191
						mui('#pullrefresh2').pullRefresh().endPullupToRefresh(false); /*能上拉*/
192
					} else {
193
						mui('#pullrefresh2').pullRefresh().endPullupToRefresh(true); /*不能上拉*/
194
					}
195
				}
196
			},
197
			error: function() {
198
				plus.nativeUI.toast("服务器链接超时", toastStyle);
199
				mui('#pullrefresh2').pullRefresh().endPullupToRefresh(true);
200
			}
201
		});
202
	});
203
}
204

205
/*获取第一页数据*/
206
function getOnePase() {
207
	mui.plusReady(function() {
208
		mui.ajax(baseUrl + '/ajax/article/findHot', {
209
			data: {
210
				"pageNo": 1,
211
				"pageSize": 20,
212
			},
213
			dataType: 'json', //数据格式类型
214
			type: 'GET', //http请求类型
215
			timeout: 10000,
216
			async: false,
217
			success: function(data) {
218
				discoverBox.innerHTML = "";
219
				if(data.success && data.data) {
220
					plus.nativeUI.closeWaiting();
221
					var datalist = data.data.data;
222
					datalistEach(datalist);
223
				}
224
			},
225
			error: function() {
226
				plus.nativeUI.toast("服务器链接超时", toastStyle);
227
			}
228
		});
229
	});
230
}
231

232
/*数据遍历*/
233
function datalistEach(datalist) {
234
	mui.each(datalist, function(index, item) {
235
		var itemlist = '';
236
		var itemlist = '<li class="mui-table-view-cell">';
237
		itemlist += '<div class="table-item-media mui-clearfix userurl" >';
238
		itemlist += '<div class="table-item-logo gouserurl" id="userimg"></div>';
239
		itemlist += '<div class="table-item-name mui-clearfix positionR"><span id="nameSpan" class="gouserurl"></span><em class="authicon"></em></div>';
240
		itemlist += '</div><div class="flexCenter table-item-cell newsurl">';
241
		itemlist += '<div class="table-item-img artical-default" id="newsimg"></div>';
242
		itemlist += '<div class="table-item-body"><p class="listtit mui-ellipsis-2" id="centent"></p></div>';
243
		itemlist += '</div><div><em class="cmpLable" id="newstype"></em>';
244
		itemlist += '<span class="timeLabel" id="time"></span></div></li>';
245
		$itemlist = $(itemlist);
246
		$("#discoverBox").append($itemlist);
247
		var type = item.type;
248
		$itemlist.find("#centent").text(item.name);
249
		$itemlist.find("#time").text(commenTime(item.createTime));
250
		$itemlist.find(".newsurl").attr("data-id", item.id);
251
		$itemlist.find(".newsurl").attr("data-type", item.type);
252
		$itemlist.find(".newsurl").attr("owner-id", item.owner);
253
		if(type == 1) { //专家文章
254
			$itemlist.find("#newstype").text("文章");
255
			$itemlist.find("#newstype").addClass("articalLabel");
256
			$itemlist.find("#newsimg").addClass("artical-default");
257
			$itemlist.find("#userimg").addClass("userhead");
258
			if(item.image) {
259
				$itemlist.find("#newsimg").attr("style", "background-image: url(" + baseUrl + "/data/article/" + item.image + ");");
260
			}
261
			userFun(item.owner, $itemlist);
262
		} else if(type == 2) { //企业文章
263
			$itemlist.find("#newstype").text("文章");
264
			$itemlist.find("#newstype").addClass("articalLabel");
265
			$itemlist.find("#newsimg").addClass("artical-default");
266
			$itemlist.find("#userimg").addClass("cmplogo");
267
			$itemlist.find("#userimg").html('<div class="boxBlock"><img class="boxBlockimg companyImg" src="../images/default-icon.jpg"></div>');
268
			if(item.image) {
269
				$itemlist.find("#newsimg").attr("style", "background-image: url(" + baseUrl + "/data/article/" + item.image + ");");
270
			}
271
			cmpFun(item.owner, $itemlist)
272
		} else if(type == 3) { //专家资源
273
			$itemlist.find("#newstype").text("资源");
274
			$itemlist.find("#newstype").addClass("resourceLabel");
275
			$itemlist.find("#newsimg").addClass("resource-default");
276
			$itemlist.find("#userimg").addClass("userhead");
277
			if(item.image) {
278
				$itemlist.find("#newsimg").attr("style", "background-image: url(" + baseUrl + "/data/resource/" + item.image + ");");
279
			}
280
			userFun(item.owner, $itemlist);
281
		}else if(type == 4) { //企业资源
282
			$itemlist.find("#newstype").text("资源");
283
			$itemlist.find("#newstype").addClass("resourceLabel");
284
			$itemlist.find("#newsimg").addClass("resource-default");
285
			$itemlist.find("#userimg").addClass("cmplogo");
286
			$itemlist.find("#userimg").html('<div class="boxBlock"><img class="boxBlockimg companyImg" src="../images/default-icon.jpg"></div>');
287
			if(item.image) {
288
				$itemlist.find("#newsimg").attr("style", "background-image: url(" + baseUrl + "/data/resource/" + item.image + ");");
289
			}
290
			cmpFun(item.owner, $itemlist);
291
		}
292

293
	});
294

295
}
296

297
/*用户信息*/
298
function userFun(id, $itemlist) {
299
	mui.ajax(baseUrl + '/ajax/professor/baseInfo/' + id, {
300
		"type": "get",
301
		"async": true,
302
		"success": function(data) {
303
			if(data.success && data.data) {
304
				$itemlist.find("#nameSpan").text(data.data.name);
305
				if(data.data.hasHeadImage == 1) {
306
					$itemlist.find("#userimg").attr("style", "background-image: url(" + baseUrl + "/images/head/" + data.data.id + "_m.jpg);");
307
				}
308
				$itemlist.find(".userurl").attr("data-id", data.data.id);
309
				var userType = autho(data.data.authType, data.data.orgAuth, data.data.authStatus);
310
				$itemlist.find(".authicon").attr("title", userType.title);
311
				$itemlist.find(".authicon").addClass(userType.sty);
312

313
			}
314
		},
315
		"error": function() {
316
			plus.nativeUI.toast("服务器链接超时", toastStyle);
317
		}
318
	});
319
}
320

321
/*企业用户信息*/
322
function cmpFun(id, $itemlist) {
323
	mui.ajax(baseUrl + '/ajax/org/' + id, {
324
		"type": "get",
325
		"async": true,
326
		"success": function(data) {
327
			if(data.success && data.data) {
328
				if(data.data.forShort) {
329
					$itemlist.find("#nameSpan").text(data.data.forShort);
330
				} else {
331
					$itemlist.find("#nameSpan").text(data.data.name);
332
				}
333
				if(data.data.hasOrgLogo) {
334
					$itemlist.find(".companyImg").attr("src",baseUrl + "/images/org/" + data.data.id + ".jpg");
335
				}
336
				$itemlist.find(".userurl").attr("data-id", data.data.id);
337
				$itemlist.find(".userurl").attr("data-iftauth", data.data.authStatus);
338
				if(data.data.authStatus==3){
339
					$itemlist.find(".authicon").addClass("authicon-com-ok").attr("title", "认证企业");;	
340
				}/*else{
341
					$itemlist.find(".authicon").addClass("authicon-com-no").attr("title", "未认证企业");;
342
				}*/
343
			}
344
		},
345
		"error": function() {
346
			plus.nativeUI.toast("服务器链接超时", toastStyle);
347
		}
348
	});
349
}

+ 7 - 35
app/js/discoverNew.js

@ -314,18 +314,10 @@
314 314
						var id = this.getAttribute("data-id");
315 315
						var datatype = this.getAttribute("data-type");
316 316
						var ownerid = this.getAttribute("owner-id");
317
						if(datatype == 1) {
317
						if(datatype == 1 || datatype == 2 || datatype == 4) {
318 318
							plus.nativeUI.showWaiting();
319 319
							plus.webview.create("../html/professorArticle.html", '../html/professorArticle.html', {}, {
320
								articleId: id,
321
								ownerid: ownerid,
322
							});
323
						} else if(datatype == 2) {
324
							plus.nativeUI.showWaiting();
325
							plus.webview.create("../html/professorArticle.html", '../html/professorArticle.html', {}, {
326
								articleId: id,
327
								ownerid: ownerid,
328
								oFlag: 1
320
								articleId: id
329 321
							});
330 322
						} else if(datatype == 3){
331 323
                            plus.nativeUI.showWaiting();
@ -653,7 +645,7 @@
653 645
                                    $D({
654 646
                                        data: {id:$data[i].uid},
655 647
                                        fun: ob.platformName,
656
                                        url: "/ajax/platform/info" + $data[i].uid,
648
                                        url: "/ajax/platform/info",
657 649
                                        sele: li.getElementsByClassName("nameSpan")[0]
658 650
                                    });
659 651
								}else{
@ -662,7 +654,7 @@
662 654
                                    $D({
663 655
                                        data: {id:$data[i].ownerId},
664 656
                                        fun: ob.platformName,
665
                                        url: "/ajax/platform/info" + $data[i].ownerId,
657
                                        url: "/ajax/platform/info",
666 658
                                        sele: li.getElementsByClassName("nameSpan")[0]
667 659
                                    });
668 660
								}
@ -939,29 +931,9 @@
939 931
					async: true,
940 932
					success: function(data) {
941 933
						if(data.success) {
942
							var ownerid;
943
							if(data.data.articleType == 1) {
944
								ownerid = data.data.ownerId;
945
								plus.webview.create("../html/professorArticle.html", '../html/professorArticle.html', {}, {
946
									articleId: id,
947
									ownerid: ownerid,
948
									oFlag:1
949
								});
950
							} else if(data.data.articleType == 2){
951
								ownerid = data.data.ownerid;
952
								plus.webview.create("../html/professorArticle.html", '../html/professorArticle.html', {}, {
953
									articleId: id,
954
									ownerid: ownerid,
955
									oFlag: 2
956
								});
957
							} else if(data.data.articleType == 3){
958
								ownerid = data.data.ownerId;
959
								plus.webview.create("../html/professorArticle.html", '../html/professorArticle.html', {}, {
960
									articleId: id,
961
									ownerid: ownerid,
962
									oFlag: 3
963
								});
964
							}
934
							plus.webview.create("../html/professorArticle.html", '../html/professorArticle.html', {}, {
935
								articleId: id
936
							});
965 937
						}
966 938
967 939
					},

+ 0 - 559
app/js/professorArticle.js

@ -1,559 +0,0 @@
1
mui.plusReady(function() {
2
	var userid = plus.storage.getItem('userid');
3
	var self = plus.webview.currentWebview();
4
	var proId = self.articleId;
5
	var ownerid = self.ownerid;
6
	var oFlag = self.oFlag;
7
	var proticleName = "";
8
	var oImgShare = ""
9
	if(oFlag == 1) {
10
        personMess();
11
        document.getElementById("proInfor").addEventListener("tap", function() {
12
            plus.nativeUI.showWaiting(); //显示原生等待框
13
            webviewShow = plus.webview.create("../html/userInforShow.html", 'userInforShow.html', {}, {
14
                proid: ownerid
15
            }); //后台创建webview并打开show.html
16
        })
17
	} else if(oFlag == 2) {
18
        comBro();
19
        mui.ajax(baseUrl + "/ajax/org/authStatus", {
20
            dataType: 'json', //数据格式类型
21
            type: 'GET', //http请求类型
22
            timeout: 10000, //超时设置
23
            data: {
24
                "id": ownerid
25
            },
26
            success: function(data) {
27
                if(data.success) {
28
                    document.getElementById("proInfor").addEventListener("tap", function() {
29
                        mui.openWindow({
30
                            url: '../html/cmpInforShow.html',
31
                            id: 'cmpInforShow.html',
32
                            show: {
33
                                autoShow: false,
34
                                aniShow: "slide-in-right",
35
                            },
36
                            extras: {
37
                                cmpId: ownerid,
38
                            }
39
                        })
40
                    })
41
                }
42
            },
43
            error: function(XMLHttpRequest) {
44
                console.log(XMLHttpRequest)
45
            }
46
        });
47
	}else if(oFlag == 3){
48
        platfrom();
49
    }
50

51
	function proInfoMain() {
52
		mui.ajax(baseUrl + "/ajax/article/query", {
53
			dataType: 'json', //数据格式类型
54
			type: 'GET', //http请求类型
55
			data: {
56
				"articleId": proId
57
			},
58
			timeout: 10000, //超时设置
59
			success: function(data) {
60
				var $info = data.data || {};
61
				if(data.success && data.data) {
62
					
63
					plus.nativeUI.closeWaiting();
64
					plus.webview.currentWebview().show("slide-in-right", 150);
65
					var articleImg = document.getElementById("articleImg");
66
					var artical_topic = document.getElementById("artical_topic");
67
					var main_content = document.getElementById("main_content");
68
					document.getElementById("numerCount").innerHTML=$info.articleAgree;
69
					if(data.data.createTime) {
70
						var oTime = timeGeshi(data.data.createTime);
71
						document.getElementById("proRlist").innerText = oTime;
72
					}
73
					if($info.articleImg) {
74
						articleImg.style.backgroundImage = 'url(' + baseUrl + '/data/article/' + $info.articleImg + ')';
75
					}
76
					artical_topic.innerText = $info.articleTitle;
77
					proticleName = $info.articleTitle;
78
					if($info.articleContent) {
79
						main_content.innerHTML = $info.articleContent;
80
						oImgShare = main_content.innerText;
81
						var oImg = main_content.getElementsByTagName("img");
82
						for(var i = 0; i < oImg.length; i++) {
83
							(function(n) {
84
								if(oImg[n].src.substring(0,4)=='file') {
85
								var att = oImg[n].src.substr(7);
86
								oImg[n].setAttribute("src", baseUrl + att);
87
								}
88
							})(i);
89
						}
90
					}
91
				}
92
			},
93
			error: function() {
94
				plus.nativeUI.toast("服务器链接超时", toastStyle);
95
				return;
96
			}
97
		});
98
	}
99
	/*个人信息*/
100
	function personMess() {
101
		mui.ajax(baseUrl + "/ajax/professor/editBaseInfo/" + ownerid, {
102
			dataType: 'json', //数据格式类型
103
			type: 'GET', //http请求类型
104
			timeout: 10000, //超时设置
105
			success: function(data) {
106
				if(data.success && data.data) {
107
					var $profesor = data.data;
108
					if($profesor.hasHeadImage) {
109
						document.getElementById('proHead').src = baseUrl + "/images/head/" + $profesor.id + "_l.jpg";
110
					} else {
111
						document.getElementById('proHead').src = "../images/default-photo.jpg";
112
					}
113
					var proName = document.getElementById("proName");
114
					proName.innerText = $profesor.name;
115
					
116
					var oSty = autho($profesor.authType, $profesor.orgAuth, $profesor.authStatus);
117
				    document.getElementById("flSta").classList.add(oSty.sty);
118
				}
119
			},
120
			error: function(XMLHttpRequest) {
121
				console.log(XMLHttpRequest)
122
			}
123
		});
124
	}
125
	/*平台信息*/
126
	function platfrom() {
127
		mui.ajax(baseUrl + "/ajax/platform/info", {
128
			dataType: 'json', //数据格式类型
129
			type: 'GET', //http请求类型
130
			data:{id: ownerid},
131
			timeout: 10000, //超时设置
132
			success: function(data) {
133
				if(data.success && data.data) {
134
					var $platform = data.data;
135
					if($platform.hasHeadImage) {
136
						document.getElementById('proHead').src = baseUrl + "/data/platform" + data.data.logo;
137
					} else {
138
						document.getElementById('proHead').src = "../images/default-plat.jpg";
139
					}
140
					var proName = document.getElementById("proName");
141
					proName.innerText = $platform.name;
142
				}
143
			},
144
			error: function(XMLHttpRequest) {
145
				console.log(XMLHttpRequest)
146
			}
147
		});
148
	}
149
	/*企业信息*/
150
	function comBro() {
151
		mui.ajax(baseUrl + "/ajax/org/" + ownerid, {
152
			type: "GET",
153
			timeout: 10000,
154
			dataType: "json",
155
			beforeSend: function() {},
156
			success: function(data, textState) {
157
				if(data.success) {
158
					var $data = data.data;
159
					var proName = document.getElementById("proName");
160
					proName.innerText = $data.name;
161
					
162
					if($data.authStatus == 3) {
163
						document.getElementById("flSta").className = "authicon authicon-com-ok";
164
					} else {
165
						document.getElementById("flSta").className = "authicon";
166
					}
167
					if($data.hasOrgLogo) {
168
						document.getElementById('proHead').src = baseUrl + "/images/org/" + $data.id + ".jpg";
169
					} else {
170
						document.getElementById('proHead').src = "images/default-icon.jpg";
171
					}
172

173
				} else {}
174
			},
175
			error: function(XMLHttpRequest, textStats, errorThrown) {
176
				console.log(JSON.stringify(data));
177
			}
178
		})
179
	}
180
	proInfoMain();
181
	/*时间格式*/
182
	/*时间格式转换*/
183
	function timeGeshi(otm) {
184
		var otme = otm.substring(0, 4) + "年" + otm.substring(4, 6) + "月" + otm.substring(6, 8) + "日";
185
		return otme;
186
	}
187
	/*进入留言*/
188
	document.getElementById("leaveWord").addEventListener("tap", function() {
189
			var userid = plus.storage.getItem('userid');
190
			if(!userid) {
191
				mui.openWindow({
192
			url: '../html/login.html',
193
			id: '../html/login.html',
194
			show: {
195
				aniShow: "slide-in-bottom"
196
			},
197
			extras: {
198
				flag: 1
199
			}
200
		});
201
				return;
202
			}
203
			var nwaiting = plus.nativeUI.showWaiting();
204
			var web = plus.webview.create("../html/articalMessage.html", "articalMessage.html", {}, {
205
				articleId: proId
206
			}); //后台创建webview并打开show.html   	    	
207
		})
208
		/*点赞文章*/
209
		/*企业信息*/
210
		var oThumsflag;
211
	function thums(dataUrl) {
212
		var userid = plus.storage.getItem('userid');
213
		mui.ajax(baseUrl + dataUrl, {
214
			type: "POST",
215
			timeout: 10000,
216
			dataType: "json",
217
			data:{
218
				operateId:userid,
219
				articleId:proId,
220
			},
221
			beforeSend: function() {},
222
			success: function(data, textState) {
223
				if(data.success) {
224
					console.log(JSON.stringify(data));
225
					var oNumber=document.getElementById("numerCount");
226
					if(oThumsflag==0){
227
						document.getElementById("appreciate").classList.remove("icon-appreciate");
228
						document.getElementById("appreciate").classList.add("icon-appreciatefill");
229
						document.getElementById("thumbsUp").style.color="#ff9900";
230
						oNumber.innerHTML=Number(oNumber.innerHTML)+1;
231
						document.getElementById("thumbsUp").setAttribute("oThumsflag","1");
232
					}else if(oThumsflag==1){
233
						document.getElementById("appreciate").classList.add("icon-appreciate");
234
						document.getElementById("appreciate").classList.remove("icon-appreciatefill");
235
						document.getElementById("thumbsUp").style.color="#929292";
236
						oNumber.innerHTML=Number(oNumber.innerHTML)-1;
237
						document.getElementById("thumbsUp").setAttribute("oThumsflag","0");
238
					}
239
					
240
				}
241
			},
242
			error: function(XMLHttpRequest, textStats, errorThrown) {
243
				console.log(JSON.stringify(XMLHttpRequest));
244
			}
245
		})
246
	}
247
	document.getElementById("thumbsUp").addEventListener("tap", function() {
248
	var userid = plus.storage.getItem('userid');
249
	var oUrl;
250
	oThumsflag = this.getAttribute("oThumsflag");
251
	console.log(oThumsflag)
252
	if(!userid) {
253
		mui.openWindow({
254
			url: '../html/login.html',
255
			id: '../html/login.html',
256
			show: {
257
				aniShow: "slide-in-bottom"
258
			},
259
			extras: {
260
				flag: 1
261
			}
262
		});
263
		return;
264
	}
265
	(oThumsflag == 0) ? oUrl = "/ajax/article/agree": oUrl = "/ajax/article/unAgree";
266
	console.log(oUrl);
267
	thums(oUrl);
268
})
269
		isAgreeArticle();
270
		/*查询登录者是否为这篇文章点过赞*/
271
		function isAgreeArticle(){
272
			var userid = plus.storage.getItem('userid');
273
			if(!userid){
274
				return;
275
			}
276
			mui.ajax(baseUrl + "/ajax/article/isAgree", {
277
				type: "GET",
278
				timeout: 10000,
279
				dataType: "json",
280
				data: {
281
					"operateId": userid,
282
					"articleId": proId
283
				},
284
				success: function(data) {
285
					if(data.success) {
286
						if(data.data==null){
287
							document.getElementById("appreciate").classList.add("icon-appreciate");
288
							document.getElementById("appreciate").classList.remove("icon-appreciatefill");
289
							document.getElementById("thumbsUp").style.color="#929292";
290
							document.getElementById("thumbsUp").setAttribute("oThumsflag","0");
291
						}else{
292
						document.getElementById("appreciate").classList.remove("icon-appreciate");
293
							document.getElementById("appreciate").classList.add("icon-appreciatefill");
294
							document.getElementById("thumbsUp").style.color="#ff9900";
295
							document.getElementById("thumbsUp").setAttribute("oThumsflag","1");
296
						}
297
					}
298
				},
299
				error: function(XMLHttpRequest, textStats, errorThrown) {
300
					console.log(JSON.stringify(XMLHttpRequest));
301
				}
302
			})
303
		}
304
		/*收藏文章*/
305
		var oCollectFlag;
306

307
	function collect() {
308
		var userid = plus.storage.getItem('userid');
309
		if(oCollectFlag == 0) {
310
			mui.ajax(baseUrl + "/ajax/watch", {
311
				type: "POST",
312
				timeout: 10000,
313
				dataType: "json",
314
				data: {
315
					"professorId": userid,
316
					"watchObject": proId,
317
					"watchType": 3,
318
					"uname": plus.storage.getItem('name')
319
				},
320
				beforeSend: function() {},
321
				success: function(data, textState) {
322
					if(data.success) {
323
						plus.nativeUI.toast("收藏成功", toastStyle);
324
						document.getElementById("collect").setAttribute("collectFlag","1");
325
						document.getElementById("collect").style.color="#F6DC00";
326
						document.getElementById("yesExpert").classList.remove("icon-favor");
327
						document.getElementById("yesExpert").classList.add("icon-favorfill");
328
					}
329
				},
330
				error: function(XMLHttpRequest, textStats, errorThrown) {
331
					console.log(JSON.stringify(XMLHttpRequest));
332
				}
333
			})
334
		} else {
335
			mui.ajax(baseUrl + "/ajax/watch/delete", {
336
				"type": "POST",
337
				"data": {
338
					"professorId": userid,
339
					"watchObject": proId,
340
				},
341
				"success": function(data) {
342
					if(data.success) {
343
						if(data.success) {
344
							plus.nativeUI.toast("已取消收藏", toastStyle);
345
							document.getElementById("collect").setAttribute("collectFlag","0");
346
							document.getElementById("collect").style.color="#929292";
347
							document.getElementById("yesExpert").classList.add("icon-favor");
348
						    document.getElementById("yesExpert").classList.remove("icon-favorfill");
349
						} 
350
					}
351
				},
352
				"error": function() {
353
					plus.nativeUI.toast("服务器链接超时", toastStyle);
354
					return;
355
				}
356
			});
357
		}
358
	}
359
		document.getElementById("collect").addEventListener("tap", function() {
360
	var userid = plus.storage.getItem('userid');
361
	oCollectFlag = this.getAttribute("collectFlag");
362
	if(!userid) {
363
		mui.openWindow({
364
			url: '../html/login.html',
365
			id: '../html/login.html',
366
			show: {
367
				aniShow: "slide-in-bottom"
368
			},
369
			extras: {
370
				flag: 1
371
			}
372
		});
373
		return;
374
	}
375
	collect();
376
})
377
		/*进入文章浏览页面判断是否收藏文章*/
378
		attentionArticle();
379
		function attentionArticle(){
380
			var userid = plus.storage.getItem('userid');
381
			if(!userid){
382
				return;
383
			}
384
			mui.ajax(baseUrl + "/ajax/watch/hasWatch", {
385
				type: "GET",
386
				timeout: 10000,
387
				dataType: "json",
388
				data: {
389
					"professorId": userid,
390
					"watchObject": proId
391
				},
392
				success: function(data) {
393
					if(data.success) {
394
						if(data.data==null){
395
							document.getElementById("collect").setAttribute("collectFlag","0");
396
							document.getElementById("collect").style.color="#929292";
397
							document.getElementById("yesExpert").classList.add("icon-favor");
398
							document.getElementById("yesExpert").classList.remove("icon-favorfill");
399
						}else{
400
						document.getElementById("collect").setAttribute("collectFlag","1");
401
						document.getElementById("collect").style.color="#F6DC00";
402
						document.getElementById("yesExpert").classList.remove("icon-favor");
403
						document.getElementById("yesExpert").classList.add("icon-favorfill");
404
						}
405
					}
406
				},
407
				error: function(XMLHttpRequest, textStats, errorThrown) {
408
					console.log(JSON.stringify(XMLHttpRequest));
409
				}
410
			})
411
		}
412
		/*文章留言总数*/
413
		function leaveWord(){
414
			mui.ajax(baseUrl + "/ajax/leavemsg/count", {
415
				type: "GET",
416
				timeout: 10000,
417
				dataType: "json",
418
				data: {
419
					sid:proId,
420
					stype:4
421
				},
422
				success: function(data) {
423
					if(data.success) {
424
						document.getElementById('leaveWord').innerHTML="留言"+"("+data.data+")";
425
					}
426
				},
427
				error: function(XMLHttpRequest, textStats, errorThrown) {
428
					plus.nativeUI.toast("服务器链接超时", toastStyle);
429
					return;
430
				}
431
			})
432
		}
433
		leaveWord();
434
		window.addEventListener("newId", function(event) {
435
			var fl = event.detail.rd;
436
			if(fl==1){
437
				leaveWord();
438
			}else{
439
			attentionArticle();
440
			isAgreeArticle();
441
			}
442
			
443
		})
444
		/*微信及微信朋友圈分享专家*/
445
	var auths, shares;
446
	document.getElementById("shareBtn").addEventListener("tap", function() {
447
		shareShow()
448
	})
449
	plus.oauth.getServices(function(services) {
450
		auths = {};
451
		for(var i in services) {
452
			var t = services[i];
453
			auths[t.id] = t;
454

455
		}
456
	}, function(e) {
457
		alert("获取登录服务列表失败:" + e.message + " - " + e.code);
458
	});
459
	plus.share.getServices(function(services) {
460

461
		shares = {};
462
		for(var i in services) {
463

464
			var t = services[i];
465

466
			shares[t.id] = t;
467

468
		}
469
	}, function(e) {
470
		alert("获取分享服务列表失败:" + e.message + " - " + e.code);
471
	})
472

473
	function shareShow() {
474
		var shareBts = [];
475
		// 更新分享列表
476
		var ss = shares['weixin'];
477
		if(navigator.userAgent.indexOf('StreamApp') < 0 && navigator.userAgent.indexOf('qihoo') < 0) { //在360流应用中微信不支持分享图片
478
			ss && ss.nativeClient && (shareBts.push({
479
					title: '微信好友',
480
					s: ss,
481
					x: 'WXSceneSession'
482
				}),
483
				shareBts.push({
484
					title: '微信朋友圈',
485
					s: ss,
486
					x: 'WXSceneTimeline'
487
				}));
488
		}
489
		//				// 弹出分享列表
490
		shareBts.length > 0 ? plus.nativeUI.actionSheet({
491
			title: '分享',
492
			cancel: '取消',
493
			buttons: shareBts
494
		}, function(e) {
495
			if(e.index == 1) {
496
				var share = buildShareService();
497
				if(share) {
498
					shareMessage(share, "WXSceneSession", {
499
						content: oImgShare.substring(0,70),
500
						title: "【科袖文章】" + proticleName,
501
						href: baseUrl + "/ekexiu/shareArticalinfor.html?articleId=" + proId,
502
						thumbs: [baseUrl + "/images/logo180.png"]
503
					});
504
				}
505
			} else if(e.index == 2) {
506
				var share = buildShareService();
507
				if(share) {
508
					shareMessage(share, "WXSceneTimeline", {
509
						content: oImgShare.substring(0,70),
510
						title: "【科袖文章】" + proticleName,
511
						href: baseUrl + "/ekexiu/shareArticalinfor.html?articleId=" + proId,
512
						thumbs: [baseUrl + "/images/logo180.png"]
513
					});
514
				}
515
			}
516

517
		}) : plus.nativeUI.alert('当前环境无法支持分享操作!');
518

519
	}
520

521
	function buildShareService() {
522
		var share = shares["weixin"];
523
		if(share) {
524
			if(share.authenticated) {
525
				console.log("---已授权---");
526
			} else {
527
				console.log("---未授权---");
528
				share.authorize(function() {
529
					console.log('授权成功...')
530
				}, function(e) {
531
					alert("认证授权失败:" + e.code + " - " + e.message);
532
					return null;
533
				});
534
			}
535
			return share;
536
		} else {
537
			alert("没有获取微信分享服务");
538
			return null;
539
		}
540

541
	}
542

543
	function shareMessage(share, ex, msg) {
544
		msg.extra = {
545
			scene: ex
546
		};
547
		share.send(msg, function() {
548
			plus.nativeUI.closeWaiting();
549
			shareAddIntegral(3);
550
		}, function(e) {
551
			plus.nativeUI.closeWaiting();
552
			if(e.code == -2) {
553
				plus.nativeUI.toast('已取消分享', {
554
					verticalAlign: 'center'
555
				});
556
			}
557
		});
558
	}
559
});

+ 16 - 7
app/js/resourceShow.js

@ -216,14 +216,20 @@ mui.plusReady(function() {
216 216
					}
217 217
					for(var i = 0; i < lengthT; i++) {
218 218
						(function(n) {
219
							var oURL;
220
							if($html[i].articleType==1) {
221
								oURL=baseUrl+"/ajax/professor/baseInfo/" + $html[i].professorId;
222
							}else{
223
								oURL=baseUrl+"/ajax/org/" + $html[i].onergId;
219
							var oURL,oData='';
220
							if($html[i].articleType=='1') {
221
								oURL=baseUrl+"/ajax/professor/baseInfo/" + $html[i].ownerId;
222
							}else if($html[i].articleType=='2') {
223
								oURL=baseUrl+"/ajax/org/" + $html[i].ownenerId;
224
							}else if($html[i].articleType=='3') {
225
								oURL=baseUrl+"/ajax/platform/info";
226
								oData={
227
									id:$html[i].ownerId
228
								}
224 229
							}
225 230
							mui.ajax(oURL, {
226 231
								type: "GET",
232
								data:oData,
227 233
								dataType: "json",
228 234
								success: function(data) {
229 235
									if(data.success) {
@ -233,16 +239,19 @@ mui.plusReady(function() {
233 239
										likeRli.setAttribute("data-id", $html[n].articleId);
234 240
										
235 241
										var comName="";
236
										if($html[n].articleType==1) {
242
										if($html[n].articleType=='1') {
237 243
											comName=data.data.name;
238 244
											likeRli.setAttribute("data-type", 1);
239
										}else {
245
										}else if($html[n].articleType=='2'){
240 246
											if(data.data.forShort){
241 247
												comName=data.data.forShort;
242 248
											}else{
243 249
												comName=data.data.name;
244 250
											}
245 251
											likeRli.setAttribute("data-type", 2);
252
										} else if($html[n].articleType=='3'){
253
											comName=data.data.name;
254
											likeRli.setAttribute("data-type", 3);
246 255
										}
247 256
										
248 257
										var str = '<div class="flexCenter OflexCenter">'

+ 0 - 530
app/js/searchListNew.js

@ -1,530 +0,0 @@
1
var subject = "",
2
	industry = "",
3
	address = "",
4
	pageSize = 20,
5
	pageNo = 1,
6
	authType = 1,
7
	flag = 1,
8
	qiFlag = 1,
9
	inputValue;
10
mui.init({
11
	pullRefresh: {
12
		container: '#pullrefresh',
13
		up: {
14
			height:50,
15
			contentrefresh: '正在加载...',
16
			callback: pullupRefresh
17
		}
18
	}
19
});
20

21
function pullupRefresh() {
22
	setTimeout(function() {
23
		pageNo++;
24
		console.log(pageNo)
25
		if(qiFlag == 1) {
26
			search.oAjaxGet(baseUrl + "/ajax/professor/pqAPP", {
27
				"key": inputValue,
28
				"subject": subject,
29
				"industry": industry,
30
				"address": address,
31
				"authType": authType,
32
				"pageSize": pageSize,
33
				"pageNo": pageNo
34
			}, "get", search.oExeprt);
35
		} else if(qiFlag == 2) {
36
			search.oAjaxGet(baseUrl + "/ajax/resource/firstpq", {
37
				"key": inputValue,
38
				"pageSize": pageSize,
39
				"pageNo": pageNo
40
			}, "get", search.resource);
41
		} else if(qiFlag == 3) {
42
			search.oAjaxGet(baseUrl + "/ajax/article/firstpq", {
43
				"key": inputValue,
44
				"pageSize": pageSize,
45
				"pageNo": pageNo
46
			}, "get", search.article);
47
		}
48
	}, 1000);
49

50
}
51
var search = {
52
	oAjaxGet: function(url, obj, oType, oFun) {
53
		mui.plusReady(function() {
54
			mui.ajax(url, {
55
				data: obj,
56
				dataType: 'json', //服务器返回json格式数据
57
				type: oType, //HTTP请求类型
58
				timeout: 10000, //超时时间设置为10秒;
59
				traditional: true,
60
				async:false,
61
				success: function(data) {
62
					//console.log(JSON.stringify(data))
63
					if(data.success) {
64
						oFun(data.data);
65
					}
66
				},
67
				error: function(xhr, type, errorThrown) {
68
					//异常处理;
69
					plus.nativeUI.toast("服务器链接超时", toastStyle);
70
				}
71
			});
72
		})
73

74
	},
75
	oExeprt: function(data) {
76
		console.log(JSON.stringify(data))
77
		plus.nativeUI.closeWaiting();
78
		plus.webview.currentWebview().show("slide-in-right", 150);
79
		document.getElementById('noSearch').style.display = "none"
80
		if(flag == 1) {
81
			document.getElementById("list").innerHTML = ""
82
			mui('#pullrefresh').pullRefresh().scrollTo(0,0,100);
83
			if(data.data.length == 0) {
84
				mui('#pullrefresh').pullRefresh().disablePullupToRefresh(true);
85
				document.getElementById('noSearch').style.display = "block";
86
				return;
87
			}
88
			if(pageNo < Math.ceil(data.total / data.pageSize)) {
89
				mui('#pullrefresh').pullRefresh().endPullupToRefresh(false)
90

91
			} else {
92
				mui('#pullrefresh').pullRefresh().disablePullupToRefresh(true);
93
			}
94
			flag = 2;
95
		} else {
96
			if(data.data.length == 0) {
97
				mui('#pullrefresh').pullRefresh().endPullupToRefresh(true);
98
				return;
99
			}
100
			if(pageNo < Math.ceil(data.total / data.pageSize)) {
101
				mui('#pullrefresh').pullRefresh().endPullupToRefresh(false)
102

103
			} else {
104
				mui('#pullrefresh').pullRefresh().endPullupToRefresh(true);
105

106
			}
107
		}
108
		console.log(pageNo);
109
		console.log(Math.ceil(data.total / data.pageSize));
110

111
		for(var i = 0; i < data.data.length; i++) {
112
			var li = document.createElement("li");
113
			var userType = autho(data.data[i].authType, data.data[i].orgAuth, data.data[i].authStatus);
114
			var os = "";
115
			if(data.data[i].title) {
116
				if(data.data[i].orgName) {
117
					os = data.data[i].title + "," + data.data[i].orgName;
118
				} else {
119
					os = data.data[i].title;
120
				}
121
			} else {
122
				if(data.data[i].office) {
123
					if(data.data[i].orgName) {
124
						os = data.data[i].office + "," + data.data[i].orgName;
125
					} else {
126
						os = data.data[i].office;
127
					}
128
				} else {
129
					if(data.data[i].orgName) {
130
						os = data.data[i].orgName;
131
					}
132
				}
133
			}
134
			var baImg = "../images/default-photo.jpg";
135
			if(data.data[i].hasHeadImage == 1) {
136
				baImg = baseUrl + "/images/head/" + data.data[i].id + "_l.jpg";
137
			}
138
			var oSub = "";
139
			if(data.data[i].researchAreas.length) {
140
				var arr = [];
141
				for(var n = 0; n < data.data[i].researchAreas.length; n++) {
142
					arr[n] = data.data[i].researchAreas[n].caption;
143
				}
144
				oSub = "研究方向:" + arr.join(",");
145
			}
146
			li.setAttribute("data-id", data.data[i].id);
147
			li.setAttribute("data-flag", 1);
148
			li.className = "mui-table-view-cell";
149
			li.innerHTML = '<div class="flexCenter mui-clearfix">' +
150
				' <div class="madiaHead useHead" style="background-image:url(' + baImg + ')"></div>' +
151
				'<div class="madiaInfo">' +
152
				'<p><span class="h1Font">' + data.data[i].name + '</span><em class="authicon ' + userType.sty + '" title="科袖认证专家"></em></p>' +
153
				'<p class="mui-ellipsis h2Font">' + os + '</p>' +
154
				'<p class="mui-ellipsis h2Font">' + oSub + '</p>' +
155
				'</div>' +
156
				'</div>'
157
			document.getElementById("list").appendChild(li);
158
		}
159
	},
160
	createWin: function() {
161
		mui.openWindow({
162
			url: '../html/searchFilters.html',
163
			id: '../html/searchFilters.html',
164
			show: {
165
				autoShow: false,
166
				aniShow: "fade-in",
167
			},
168
			extras:{
169
				subject 	:subject,
170
				industry :industry,
171
				address :address
172
			}
173
		});
174
	},
175
	resource: function(data) {
176
		console.log(JSON.stringify(data));
177
		plus.nativeUI.closeWaiting();
178
		plus.webview.currentWebview().show("slide-in-right", 150);
179
		document.getElementById('noSearch').style.display = "none"
180
		var $da = data.data;
181
		if(flag == 1) {
182
			document.getElementById("list").innerHTML = ""
183
			mui('#pullrefresh').pullRefresh().scrollTo(0,0,100)
184
			if(data.data.length == 0) {
185
				mui('#pullrefresh').pullRefresh().disablePullupToRefresh(true);
186
				document.getElementById('noSearch').style.display = "block";
187
				return;
188
			}
189
			if(pageNo < Math.ceil(data.total / data.pageSize)) {
190
				mui('#pullrefresh').pullRefresh().endPullupToRefresh(false)
191

192
			} else {
193
				mui('#pullrefresh').pullRefresh().disablePullupToRefresh(true);
194

195
			}
196
			flag = 2;
197
		} else {
198
			if(data.data.length == 0) {
199
				document.getElementById('noSearch').style.display = "block";
200
				mui('#pullrefresh').pullRefresh().endPullupToRefresh(true);
201
				return;
202
			}
203
			if(pageNo < Math.ceil(data.total / data.pageSize)) {
204
				mui('#pullrefresh').pullRefresh().endPullupToRefresh(false)
205

206
			} else {
207
				mui('#pullrefresh').pullRefresh().endPullupToRefresh(true);
208

209
			}
210
		}
211
		for(var i = 0; i < $da.length; i++) {
212
			var $data = $da[i];
213
			var namepo, userType;
214
			if($data.resourceType == 1) {
215
				namepo = $data.editProfessor.name;
216
				userType = autho($data.editProfessor.authType, $data.editProfessor.orgAuth, $data.editProfessor.authStatus);
217
			} else {
218
				userType = {};
219
				namepo = $data.organization.name;
220
				if($data.organization.authStatus == 3) {
221
					userType.sty = "authicon-com-ok"
222
				} else {
223
					userType.sty = "e"
224
				}
225
			}
226
			var rImg = "../images/default-resource.jpg";
227
			if($data.images.length) {
228
				rImg = baseUrl + "/data/resource/" + $data.images[0].imageSrc;
229
			}
230
			var li = document.createElement("li");
231
			li.setAttribute("data-id", $data.resourceId);
232
			li.setAttribute("data-flag", 2);
233
			li.className = "mui-table-view-cell";
234
			li.innerHTML = '<div class="flexCenter OflexCenter mui-clearfix">' +
235
				' <div class="madiaHead resouseHead" style="background-image:url(' + rImg + ')"></div>' +
236
				'<div class="madiaInfo OmadiaInfo">' +
237
				'<p class="mui-ellipsis h1Font">' + $data.resourceName + '</p>' +
238
				'<p class="mui-ellipsis h2Font">用途:' + $data.supportedServices + '</p>' +
239
				'<p><span class="h2Font">' + namepo + '</span><em class="authicon ' + userType.sty + '" title="科袖认证专家"></em></p>' +
240
				'</div>' +
241
				'</div>'
242
			document.getElementById("list").appendChild(li);
243
		}
244

245
	},
246
	article: function(data) {
247
		plus.nativeUI.closeWaiting();
248
		plus.webview.currentWebview().show("slide-in-right", 150);
249
		console.log(JSON.stringify(data))
250
		document.getElementById('noSearch').style.display = "none"
251
		var $data = data.data;
252
		if(flag == 1) {
253
			document.getElementById("list").innerHTML = ""
254
			mui('#pullrefresh').pullRefresh().scrollTo(0,0,100)
255
			if(data.data.length == 0) {
256
				mui('#pullrefresh').pullRefresh().disablePullupToRefresh(true);
257
				document.getElementById('noSearch').style.display = "block";
258
				return;
259
			}
260
			if(pageNo < Math.ceil(data.total / data.pageSize)) {
261
				mui('#pullrefresh').pullRefresh().endPullupToRefresh(false)
262

263
			} else {
264
				mui('#pullrefresh').pullRefresh().disablePullupToRefresh(true);
265

266
			}
267
			flag = 2;
268
		} else {
269
			if(data.data.length == 0) {
270
				document.getElementById('noSearch').style.display = "block";
271
				mui('#pullrefresh').pullRefresh().endPullupToRefresh(true);
272
				return;
273
			}
274
			if(pageNo < Math.ceil(data.total / data.pageSize)) {
275
				mui('#pullrefresh').pullRefresh().endPullupToRefresh(false)
276

277
			} else {
278
				mui('#pullrefresh').pullRefresh().endPullupToRefresh(true);
279

280
			}
281
		}
282
		for(var i = 0; i < $data.length; i++) {
283
			var of ;
284
			if($data[i].articleType == 1) { of = 1;
285
			} else { of = 2;
286
			}
287
			var arImg = "../images/default-artical.jpg";
288
			if($data[i].articleImg) {
289
				arImg = baseUrl + "/data/article/" + $data[i].articleImg
290
			}
291
			var title = $data[i].articleTitle;
292
			var name = ""
293
			var li = document.createElement("li");
294
			if( of == 1) {
295
				var userType = autho($data[i].professor.authType, $data[i].professor.orgAuth, $data[i].professor.authStatus);
296
				li.setAttribute("owner-id", $data[i].professor.id);
297
				li.setAttribute("data-type", 1);
298
				name = $data[i].professor.name;
299
			} else {
300
				var userType = {};
301
				if($data[i].editOrganization.authStatus == 3) {
302
					userType.sty = 'authicon-com-ok'
303
				} else {
304
					userType.sty = "e"
305
				}
306
				li.setAttribute("owner-id", $data[i].editOrganization.id);
307
				li.setAttribute("data-type", 2);
308
				name = $data[i].editOrganization.name;
309
			}
310
			li.setAttribute("data-id", $data[i].articleId);
311
			li.setAttribute("data-flag", 3);
312
			li.className = "mui-table-view-cell";
313
			li.innerHTML = '<div class="flexCenter OflexCenter mui-clearfix">' +
314
				'<div class="madiaHead artHead" style="background-image:url(' + arImg + ')"></div>' +
315
				'<div class="madiaInfo OmadiaInfo">' +
316
				'<p class="mui-ellipsis-2 h1Font">' + title + '</p>' +
317
				'<p><span class="h2Font">' + name + '</span><em class="authicon ' + userType.sty + '" title="科袖认证专家"></em></p>' +
318
				'</div>' +
319
				'</div>'
320
			document.getElementById("list").appendChild(li);
321

322
		}
323
	},
324
}
325

326
mui.plusReady(function() {
327
	/*webvie窗口值*/
328
	var windowModule = {
329
		self: plus.webview.currentWebview().key,
330
		flag:plus.webview.currentWebview().qiFlag,
331
	}
332
	document.getElementById("searchval").value = windowModule.self;
333
	inputValue = windowModule.self;
334
	if(windowModule.flag==1) {
335
		document.getElementById("searchval").setAttribute("placeholder","请输入专家姓名、机构、研究方向");
336
		qiFlag=1;
337
		search.oAjaxGet(baseUrl + "/ajax/professor/pqAPP", {
338
		"key": document.getElementById("searchval").value,
339
		"subject": subject,
340
		"industry": industry,
341
		"address": address,
342
		"authType": authType,
343
		"pageSize": pageSize,
344
		"pageNo": pageNo
345
	}, "get", search.oExeprt);
346
	}else if(windowModule.flag==2) {
347
		document.getElementById("searchval").setAttribute("placeholder","请输入资源名称、用途、机构");
348
		qiFlag=2;
349
		document.getElementById("sele").style.display = "none";
350
		document.getElementsByClassName("fixbtnNew")[0].getElementsByTagName("li")[1].classList.add("liactive");
351
		for(var i = 0; i < siblings(document.getElementsByClassName("fixbtnNew")[0].getElementsByTagName("li")[1]).length; i++) {
352
			siblings(document.getElementsByClassName("fixbtnNew")[0].getElementsByTagName("li")[1])[i].classList.remove("liactive")
353
		}
354
		search.oAjaxGet(baseUrl + "/ajax/resource/firstpq", {
355
				"key": document.getElementById("searchval").value,
356
				"pageSize": pageSize,
357
				"pageNo": pageNo
358
			}, "get", search.resource);
359
	}else {
360
		qiFlag=3;
361
		document.getElementById("searchval").setAttribute("placeholder","请输入文章标题、作者");
362
		document.getElementById("sele").style.display = "none";
363
		document.getElementsByClassName("fixbtnNew")[0].getElementsByTagName("li")[2].classList.add("liactive");
364
		for(var i = 0; i < siblings(document.getElementsByClassName("fixbtnNew")[0].getElementsByTagName("li")[2]).length; i++) {
365
			siblings(document.getElementsByClassName("fixbtnNew")[0].getElementsByTagName("li")[2])[i].classList.remove("liactive")
366
		}
367
		search.oAjaxGet(baseUrl + "/ajax/article/firstpq", {
368
				"key": document.getElementById("searchval").value,
369
				"pageSize": pageSize,
370
				"pageNo": pageNo
371
			}, "get", search.article);
372
	}
373
	
374
	document.getElementById("sele").addEventListener("tap", function() {
375
		search.createWin();
376
	})
377
	/*自定义事件*/
378
	window.addEventListener("newId", function(event) {
379
		var arry = event.detail.arry;
380
		subject = arry[1],
381
			industry = arry[2],
382
			address = arry[0],
383
			pageNo = 1,
384
			flag = 1;
385
		mui('#pullrefresh').pullRefresh().refresh(true);
386
		search.oAjaxGet(baseUrl + "/ajax/professor/pqAPP", {
387
			"key": document.getElementById("searchval").value,
388
			"subject": subject,
389
			"industry": industry,
390
			"address": address,
391
			"authType": authType,
392
			"pageSize": pageSize,
393
			"pageNo": pageNo
394
		}, "get", search.oExeprt);
395
	})
396
	mui(".fixbtnNew").on("tap", "li", function() {
397
		var $this=this
398
		setTimeout(function(){
399
			
400
		
401
		inputValue = document.getElementById("searchval").value;
402
		$this.classList.add("liactive");
403
		for(var i = 0; i < siblings($this).length; i++) {
404
			siblings($this)[i].classList.remove("liactive")
405
		}
406
		flag = 1;
407
		pageNo = 1;
408
		mui('#pullrefresh').pullRefresh().enablePullupToRefresh();
409
		if($this.innerHTML == "找资源") {
410
			document.getElementById("searchval").setAttribute("placeholder","请输入资源名称、用途、机构");
411
			document.getElementById("sele").style.display = "none";
412
			document.getElementById("searB").classList.remove("searchboxNewT");
413
			qiFlag = 2;
414
			search.oAjaxGet(baseUrl + "/ajax/resource/firstpq", {
415
				"key": document.getElementById("searchval").value,
416
				"pageSize": pageSize,
417
				"pageNo": pageNo
418
			}, "get", search.resource);
419
		} else if($this.innerHTML == "找专家") {
420
			document.getElementById("searchval").setAttribute("placeholder","请输入专家姓名、机构、研究方向");
421
			document.getElementById("sele").style.display = "block";
422
			document.getElementById("searB").classList.add("searchboxNewT");
423
			qiFlag = 1;
424
			search.oAjaxGet(baseUrl + "/ajax/professor/pqAPP", {
425
				"key": document.getElementById("searchval").value,
426
				"subject": subject,
427
				"industry": industry,
428
				"address": address,
429
				"authType": authType,
430
				"pageSize": pageSize,
431
				"pageNo": pageNo
432
			}, "get", search.oExeprt);
433
		} else if($this.innerHTML == "找文章") {
434
			document.getElementById("searchval").setAttribute("placeholder","请输入文章标题、作者");
435
			document.getElementById("sele").style.display = "none";
436
			document.getElementById("searB").classList.remove("searchboxNewT");
437
			qiFlag = 3;
438
			search.oAjaxGet(baseUrl + "/ajax/article/firstpq", {
439
				"key": document.getElementById("searchval").value,
440
				"pageSize": pageSize,
441
				"pageNo": pageNo
442
			}, "get", search.article);
443
		}
444
		},1100)
445
	})
446

447
	function siblings(elm) {
448
		var a = [];
449
		var p = elm.parentNode.children;
450
		for(var i = 0, pl = p.length; i < pl; i++) {
451
			if(p[i] !== elm) a.push(p[i]);
452
		}
453
		return a;
454
	}
455
	/*按键字搜索*/
456
	document.getElementById("searchval").addEventListener("keyup", function() {
457
		var e = event || window.event || arguments.caller.arguments[0];
458
		if(e.keyCode == 13) {
459
			flag = 1;
460
			pageNo = 1;
461
			inputValue = document.getElementById("searchval").value;
462
			mui('#pullrefresh').pullRefresh().refresh(true);
463
			var c = document.getElementsByClassName("liactive")[0].innerHTML;
464
			if(c == "找资源") {
465
				document.getElementById("sele").style.display = "none";
466
				qiFlag = 2;
467
				search.oAjaxGet(baseUrl + "/ajax/resource/firstpq", {
468
					"key": document.getElementById("searchval").value,
469
					"pageSize": pageSize,
470
					"pageNo": pageNo
471
				}, "get", search.resource);
472
			} else if(c == "找专家") {
473
				document.getElementById("sele").style.display = "block";
474
				qiFlag = 1;
475
				search.oAjaxGet(baseUrl + "/ajax/professor/pqAPP", {
476
					"key": document.getElementById("searchval").value,
477
					"subject": subject,
478
					"industry": industry,
479
					"address": address,
480
					"authType": authType,
481
					"pageSize": pageSize,
482
					"pageNo": pageNo
483
				}, "get", search.oExeprt);
484
			} else if(c == "找文章") {
485
				document.getElementById("sele").style.display = "none";
486
				qiFlag = 3;
487
				search.oAjaxGet(baseUrl + "/ajax/article/firstpq", {
488
					"key": document.getElementById("searchval").value,
489
					"pageSize": pageSize,
490
					"pageNo": pageNo
491
				}, "get", search.article);
492
			}
493
		}
494
	})
495
	/*跳转*/
496
	mui("#list").on("tap", "li", function() {
497
		var tFl = this.getAttribute("data-flag");
498
		if(tFl == 1) {
499
			var id = this.getAttribute("data-id");
500
			plus.nativeUI.showWaiting(); //显示原生等待框
501
			plus.webview.create("../html/proinforbrow.html", 'proinforbrow.html', {}, {
502
				proid: id
503
			});
504
		} else if(tFl == 2) {
505
			var resouId = this.getAttribute("data-id");
506
			plus.nativeUI.showWaiting();
507
			plus.webview.create("../html/resourceShow.html", 'resourceShow.html', {}, {
508
			resourceId: resouId
509
			});
510
		} else if(tFl == 3) {
511
			var id = this.getAttribute("data-id");
512
			var datatype = this.getAttribute("data-type");
513
			var ownerid = this.getAttribute("owner-id");
514
			if(datatype == 1) {
515
				plus.nativeUI.showWaiting();
516
			plus.webview.create("../html/professorArticle.html", '../html/professorArticle.html', {}, {
517
				articleId: id,
518
				ownerid: ownerid,
519
			});
520
			} else if(datatype == 2) {
521
				plus.nativeUI.showWaiting();
522
			plus.webview.create("../html/professorArticle.html", '../html/professorArticle.html', {}, {
523
				articleId: id,
524
				ownerid: ownerid,
525
				oFlag: 1
526
			});
527
			}
528
		}
529
	})
530
})

+ 7 - 4
app/js/searchListNew2.js

@ -500,11 +500,14 @@ for(var n=0;n<6;n++) {
500 500
							name = $data[i].editOrganization.name;
501 501
						}
502 502
					} else if( of == 3){
503
						li.setAttribute("owner-id", $data[i].editOrganization.id);
504 503
						li.setAttribute("data-type", 3);
505
						search.oAjaxGet(baseUrl + "/ajax/platform/info",{id:$data[i].ownerId},"get",function (platform) {
506
                            name = platform.name;
507
                        })
504
						(function(n,li){
505
							search.oAjaxGet(baseUrl + "/ajax/platform/info",{id:$data[n].ownerId},"get",function (platform) {
506
	                            console.log(JSON.stringify(platform));
507
	                            li.getElementsByClassName("nameSpan")[0].innerHTML=platform.data.name;
508
	                            li.setAttribute("owner-id", platform.data.id);
509
	                        })
510
						}(i,li))
508 511
					}
509 512
					li.setAttribute("data-id", $data[i].articleId);
510 513
					li.setAttribute("data-flag", 3);

+ 37 - 4
app/js/serviceShow.js

@ -203,6 +203,36 @@ mui.plusReady(function() {
203 203
				}
204 204
			})
205 205
		},
206
		serviceAuthorPlat: function(pId, p1, p2) {
207
			var self = this;
208
			self.ajaxRequest({
209
				url: "/ajax/platform/info",
210
				data: pId,
211
				type: "get",
212
				parameter: {},
213
				fn: function(data) {
214
					var $data = data.data;
215
					if(p1 == 1) {
216
						p2.querySelector(".pName").innerHTML = $data.name;
217
						return;
218
					} else if(p1 == 2) {
219
						p2.querySelector(".pName").innerHTML = $data.name;
220
					}
221
					self.authorProperty.setAttribute("data-id", $data.id);
222
					self.authorProperty.setAttribute("data-type", 3);
223
					self.ownerId = $data.id;
224
					if($data.industry) {
225
						self.authorIndustry.innerHTML = ($data.industry).replace(/,/, " | ");
226
					}
227
					self.authorHeadImage.classList.add("cmpHead2");
228
					self.authorHeadImage.innerHTML = '<div class="boxBlock"><img class="boxBlockimg" id="platImg" src="../images/default-plat.jpg"></div>'
229
					if($data.logo) {
230
						document.getElementById("platImg").src = baseUrl + "/data/platform/" + $data.logo;
231
					}
232
					
233
				}
234
			})
235
		},
206 236
		relatedArticles: function() {
207 237
			var self = this;
208 238
			self.ajaxRequest({
@ -237,12 +267,15 @@ mui.plusReady(function() {
237 267
						str += '</div></div>'
238 268
						li.innerHTML = str;
239 269
						articleList.appendChild(li);
240
						if($data[i].articleType == 1) {
270
						if($data[i].articleType == '1') {
241 271
							li.setAttribute("data-type", 1);
242
							self.serviceAuthorPersonal($data[i].professorId, 1, li);
243
						} else {
272
							self.serviceAuthorPersonal($data[i].ownerId, 1, li);
273
						} else if($data[i].articleType == '2'){
244 274
							li.setAttribute("data-type", 2);
245
							self.serviceAuthorCompany($data[i].onergId, 1, li);
275
							self.serviceAuthorCompany($data[i].ownenerId, 1, li);
276
						} else if($data[i].articleType == '3'){
277
							li.setAttribute("data-type", 3);
278
							self.serviceAuthorPlat($data[i].ownerId, 1, li);
246 279
						}
247 280
					}
248 281
				}

+ 11 - 5
app/js/userInforShow.js

@ -880,14 +880,20 @@ mui.plusReady(function() {
880 880
							if(StrData[i].articleImg){
881 881
								imgL=baseUrl+'/data/article/' + StrData[i].articleImg 
882 882
							}
883
							var oURL;
884
							if(StrData[i].articleType==1) {
885
								oURL="/ajax/professor/baseInfo/"+StrData[i].professorId;
886
							}else{
887
								oURL="/ajax/org/" + StrData[i].onergId;
883
							var oURL,oData='';
884
							if(StrData[i].articleType=='1') {
885
								oURL="/ajax/professor/baseInfo/"+StrData[i].ownerId;
886
							}else if(StrData[i].articleType=='2'){
887
								oURL="/ajax/org/" + StrData[i].ownenerId;
888
							}else if(StrData[i].articleType=='3'){
889
								oURL="/ajax/platform/info";
890
								oData={
891
									id: StrData[i].ownerId 
892
								}
888 893
							}
889 894
							mui.ajax(baseUrl + oURL, {
890 895
								"type": "GET",
896
								"data": oData,
891 897
								'dataType': "json",
892 898
								"success": function(data) {
893 899
									if(data.success) {