Przeglądaj źródła

咨询未登录时,不刷新

wangaidan 8 lat temu
rodzic
commit
252b0c2803
2 zmienionych plików z 25 dodań i 46 usunięć
  1. 0 13
      app/html/consultlist.html
  2. 25 33
      app/js/consult.js

+ 0 - 13
app/html/consultlist.html

391
	<script src="../js/public/base.js"></script>
391
	<script src="../js/public/base.js"></script>
392
	<script src="../js/consult.js"></script>
392
	<script src="../js/consult.js"></script>
393
   	<script type="text/javascript">
393
   	<script type="text/javascript">
394
	   	mui.plusReady(function() {
395
	   		var  content1 = document.getElementById('logined');
396
	      	var  content2 = document.getElementById('unlogin');
397
	   		var userid = plus.storage.getItem('userid');
398
	   		if(userid == null || userid == 'null'){
399
	   			content1.style.display = 'none';
400
	   			
401
	   		}else {
402
	   			content2.style.display = 'none';
403
	   		}
404
405
	   	});
406
	   	
407
	   	var box = document.getElementById("zixunpullrefresh");
394
	   	var box = document.getElementById("zixunpullrefresh");
408
		var u = navigator.userAgent;
395
		var u = navigator.userAgent;
409
		var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
396
		var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端

+ 25 - 33
app/js/consult.js

13
13
14
var ozixunpullrefresh = document.getElementById("zixunpullrefresh");//刷新容器,控制安卓和iOS容器到header距离不一样
14
var ozixunpullrefresh = document.getElementById("zixunpullrefresh");//刷新容器,控制安卓和iOS容器到header距离不一样
15
15
16
//显示数据还是登录
16
//判断是否登录,显示数据或登录页面
17
function islogin() {
17
function islogin() {
18
	mui.plusReady(function(){
18
	mui.plusReady(function(){
19
		var userid = plus.storage.getItem('userid');
19
		var userid = plus.storage.getItem('userid');
22
   			content1.style.display = 'none';
22
   			content1.style.display = 'none';
23
   		}else {
23
   		}else {
24
   			content2.style.display = 'none';
24
   			content2.style.display = 'none';
25
   			getOnePage();
25
   		}
26
   		}
26
   		
27
   		
27
   		if(plus.nativeUI.showWaiting()){
28
   		if(plus.nativeUI.showWaiting()){
28
			plus.nativeUI.closeWaiting();//关闭等待框
29
			plus.nativeUI.closeWaiting();//关闭等待框
30
			
29
		}
31
		}
30
		
32
		
31
	})
33
	})
32
}
34
}
33
35
islogin();
34
36
35
/*登陆*/
37
/*登陆*/
36
window.addEventListener('logined', function(event) {
38
window.addEventListener('logined', function(event) {
91
93
92
});
94
});
93
95
94
/*初始化数据*/
95
//initData();
96
97
//父子页面,下拉刷新
96
//父子页面,下拉刷新
98
mui.init({
99
	pullRefresh: {
100
		container: '#zixunpullrefresh',
101
		down: {
102
			height:50,
103
			callback: pulldownRefresh
104
			
105
		}
106
//		up: {
107
//			contentrefresh: '正在加载...',
108
//			callback: pullupRefresh
109
//		}
110
	}
97
mui.init({
98
	pullRefresh: {
99
		container: '#zixunpullrefresh',
100
		down: {
101
			height:50,
102
			callback: pulldownRefresh
103
			
104
		}
105
	}
111
});
106
});
112
113
 /* 父子页面,下拉刷新*/
107
 /* 父子页面,下拉刷新函数*/
114
function pulldownRefresh() {
108
function pulldownRefresh() {
115
    pageIndex = 1;
109
    pageIndex = 1;
116
    console.log('下拉刷新');
110
    console.log('下拉刷新');
119
       
113
       
120
    }, 1000);
114
    }, 1000);
121
};
115
};
116
//if(mui.os.plus) {
117
//	mui.plusReady(function() {
118
//		setTimeout(function() {
119
//			mui('#zixunpullrefresh').pullRefresh().pulldownLoading();
120
//		}, 500);	
121
//	});
122
//} else {
123
//	mui.ready(function() {
124
//		mui('#zixunpullrefresh').pullRefresh().pulldownLoading();
125
//	});
126
//}
122
127
123
128
124
//上拉加载
129
//上拉加载
131
}
136
}
132
137
133
138
134
if(mui.os.plus) {
135
	mui.plusReady(function() {
136
		setTimeout(function() {
137
			mui('#zixunpullrefresh').pullRefresh().pulldownLoading();
138
		}, 500);	
139
	});
140
} else {
141
	mui.ready(function() {
142
		mui('#zixunpullrefresh').pullRefresh().pulldownLoading();
143
	});
144
}
145
146
147
//初始化数据
139
//初始化数据
148
function initData(){
140
function initData(){
149
	mui.plusReady(function() { 
141
	mui.plusReady(function() {