Browse Source

专家信息和资源信息中,判断是否登录,登录可咨询,未登录,跳转登录

wangaidan 8 years ago
parent
commit
18e5f529af
2 changed files with 39 additions and 34 deletions
  1. 20 16
      app/js/proinfobrow.js
  2. 19 18
      app/js/resinforbrow.js

+ 20 - 16
app/js/proinfobrow.js

10
	var proId = self.proid;
10
	var proId = self.proid;
11
	console.log(userid);
11
	console.log(userid);
12
	/*点击咨询*/
12
	/*点击咨询*/
13
	if(userid) {
14
		ozixun.addEventListener('tap', function() {
13
	//判断是否登录,登录才可咨询,否则登录
14
	function isLogin(){
15
		var userid = plus.storage.getItem('userid');
16
	
17
		if(userid && userid != null && userid != 'null' && userid != undefined && userid != 'undefined'){
18
			
15
			var flag = 'professor';
19
			var flag = 'professor';
16
			var nwaiting = plus.nativeUI.showWaiting(); //显示原生等待框
20
			var nwaiting = plus.nativeUI.showWaiting(); //显示原生等待框
17
			webviewShow = plus.webview.create("../html/consultapply.html", 'consultapply.html', {}, {
21
			webviewShow = plus.webview.create("../html/consultapply.html", 'consultapply.html', {}, {
22
			webviewShow.addEventListener("loaded", function() {
26
			webviewShow.addEventListener("loaded", function() {
23
27
24
			}, false);
28
			}, false);
25
		});
26
	} else if(userid == '' || userid == undefined) {
27
		ozixun.addEventListener('tap', function() {
28
			/*mui.alert('请登录', '' ,function(){
29
				mui.openWindow({
30
					url: '../html/login.html',
31
					id: 'html/login.html',
32
					show: {
33
						aniShow: "slide-in-left"
34
					}
35
				});
36
			});*/
37
			plus.nativeUI.toast("请先登录");
38
		});
29
			
30
		}else {
31
			mui.openWindow({
32
			    url:'../html/login.html',
33
			    id:'login.html'
34
			})
35
				
36
		}
39
	}
37
	}
38
	
39
	ozixun.addEventListener('tap', function() {
40
		isLogin();
41
	});
42
	
43
40
44
41
	//查询学术领域
45
	//查询学术领域
42
	var subjectShow = function(data) {
46
	var subjectShow = function(data) {

+ 19 - 18
app/js/resinforbrow.js

216
	//资源信息
216
	//资源信息
217
	ziyuaninfo(resourceId);
217
	ziyuaninfo(resourceId);
218
	/*点击咨询*/
218
	/*点击咨询*/
219
	if(userid) {
220
		oconsult.addEventListener('tap', function() {
219
	//判断是否登录,登录才可咨询,否则登录
220
	function isLogin(){
221
		var userid = plus.storage.getItem('userid');
222
	
223
		if(userid && userid != null && userid != 'null' && userid != undefined && userid != 'undefined'){
224
			
221
			var flag = 'ziyuan';
225
			var flag = 'ziyuan';
222
			var consulttitle = oresorcename.innerHTML;
226
			var consulttitle = oresorcename.innerHTML;
223
			var nwaiting = plus.nativeUI.showWaiting(); //显示原生等待框
227
			var nwaiting = plus.nativeUI.showWaiting(); //显示原生等待框
230
			webviewShow.addEventListener("loaded", function() {
234
			webviewShow.addEventListener("loaded", function() {
231
235
232
			}, false);
236
			}, false);
233
234
		});
235
	} else if(userid == '' || userid == undefined) {
236
		oconsult.addEventListener('tap', function() {
237
			/*mui.alert('请登录', '' ,function(){
238
				mui.openWindow({
239
					url: '../html/login.html',
240
					id: 'html/login.html',
241
					show: {
242
						aniShow: "slide-in-left"
243
					}
244
				});
245
			});*/
246
			plus.nativeUI.toast("请先登录");
247
		});
248
	}
237
			
238
		}else {
239
			mui.openWindow({
240
			    url:'../html/login.html',
241
			    id:'login.html'
242
			})
243
				
244
		}
245
	};
246
	oconsult.addEventListener('tap', function() {
247
		isLogin();
248
	});
249
	
249
250
250
	/*咨询成功,返回资源信息*/
251
	/*咨询成功,返回资源信息*/
251
	window.addEventListener('backziyuaninfo', function(event) {
252
	window.addEventListener('backziyuaninfo', function(event) {