Explorar el Código

专家关注页面,ios兼容问题

xuchunyang %!s(int64=8) %!d(string=hace) años
padre
commit
7f8bd4e11d
Se han modificado 2 ficheros con 68 adiciones y 19 borrados
  1. 30 7
      app/html/attentions.html
  2. 38 12
      app/js/attentions.js

+ 30 - 7
app/html/attentions.html

@ -25,18 +25,41 @@
25 25
				<li index="1" class="mui-col-xs-6">资源</li>
26 26
			</ul>
27 27
		</div>
28
		<div class="alllist" id="pullrefresh">
29
	        <div  class="mui-card-content conblock childlist " style="display: block;"><!--当前x显示列表   'childlist'的显示隐藏-->
30
		      	<ul class="mui-table-view protable list ">
31
			            
32
			    </ul>
33
			</div>
34
			<div class="mui-card-content conblock childlist " >
28
		<div class="mui-content alllist mui-scroll-wrapper" id="pullrefresh" style="margin-top: 35px;">
29
			<div class="mui-scroll"> 
30
		        <div  class="mui-card-content conblock childlist " style="display: block;"><!--当前x显示列表   'childlist'的显示隐藏-->
31
			      	<ul class="mui-table-view protable list ">
32
				            
33
				    </ul>
34
				    <div class="nodatabox" style="display:none; background: #efeff4;margin: 0; " id="nodatabox1">
35
				        <div class="nodata">
36
				            <div class="picbox"><span class="defpic"></span></div>
37
				            <div class="txtbox">
38
				            	<p class="currword">抱歉!您还未关注过专家</p>
39
				                <p class="currtip">请重新修改搜索关键字、或筛选条件后再进行搜索</p>
40
				            </div>
41
				        </div>
42
				    </div>
43
				</div>
44
				
45
				<div class="mui-card-content conblock childlist ">
35 46
			    <ul class="mui-table-view protable list2 ">
36 47
			           
37 48
			    </ul>
49
			    <div class="nodatabox" style="display:none; background: #efeff4; margin: 0; " id="nodatabox2">
50
			        <div class="nodata">
51
			            <div class="picbox"><span class="defpic"></span></div>
52
			            <div class="txtbox">
53
			            	<p class="currword">抱歉!您还未关注过资源</p>
54
			                <p class="currtip">请重新修改搜索关键字、或筛选条件后再进行搜索</p>
55
			            </div>
56
			        </div>
57
			    </div>
38 58
			</div>
59
				<!-- 主界面具体展示内容 -->
60
    		</div>
39 61
		</div>
62
		
40 63
		<!--<a id="scrollToTop" class="backTop hide"> <span class="mui-icon mui-icon-arrowup"></span> </a>-->
41 64
    </div>
42 65
    <script src="../js/public/mui.min.js"></script>

+ 38 - 12
app/js/attentions.js

@ -1,10 +1,12 @@
1 1
//我的关注
2 2
var allPages = 1, // 总页数;
3 3
	pageSize = 0,
4
	pageNo = 1;
5
    checkedindex = 0
4
	pageNo = 1,
5
    checkedindex = 0;
6 6
var table = document.body.querySelector('.list');
7 7
var table1 = document.body.querySelector('.list2');
8
var nodatabox1 = document.getElementById("nodatabox1");
9
var nodatabox2 = document.getElementById("nodatabox2");
8 10

9 11
//mui('.mui-scroll-wrapper').scroll({});
10 12

@ -14,7 +16,7 @@ mui.init({
14 16
		up: {
15 17
			contentrefresh: '正在加载...',
16 18
			callback: pullupRefresh,
17
			//auto:true
19
		    //auto:true
18 20
		}
19 21
	}
20 22
});
@ -22,9 +24,12 @@ mui.init({
22 24
function pullupRefresh() {
23 25
	pageNo = ++pageNo;
24 26
	console.log(pageNo)
27
	console.log(checkedindex)
28
	
25 29
	setTimeout(function() {
26 30
		expert2(pageNo, 10)
27 31
	}, 1000);
32
	mui('#pullrefresh').pullRefresh().refresh(true);
28 33
}
29 34

30 35
if(mui.os.plus) {
@ -43,15 +48,20 @@ if(mui.os.plus) {
43 48
mui("#fixbtn").on("tap", "li", function() {
44 49
	window.scrollTo(0, 0);
45 50
	checkedindex = this.getAttribute("index");
51
	//alert(checkedindex);
46 52
	var checkedcontent_arr = document.getElementsByClassName("childlist");
47 53
	var libtn_arr = document.getElementById("fixbtn").getElementsByTagName("li");
48 54
	if(checkedindex == 0) {
55
		getOneExpert(1, 10);
56
		pageNo = 1;
49 57
		libtn_arr[0].classList.add("liactive");
50 58
		libtn_arr[1].classList.remove("liactive");
51 59
		checkedcontent_arr[1].style.display = 'none';
52 60
		checkedcontent_arr[0].style.display = 'block';
53 61
		mui('#pullrefresh').pullRefresh().refresh(true); //重置上拉加载
54 62
	} else {
63
		getOneResources(1, 10);
64
		pageNo = 1;
55 65
		libtn_arr[1].classList.add("liactive");
56 66
		libtn_arr[0].classList.remove("liactive");
57 67
		checkedcontent_arr[0].style.display = 'none';
@ -61,7 +71,6 @@ mui("#fixbtn").on("tap", "li", function() {
61 71
})
62 72

63 73
getOneExpert(1, 10);
64

65 74
getOneResources(1, 10);
66 75

67 76
mui.plusReady(function(){
@ -94,12 +103,19 @@ function getOneExpert(pageNo, pageSize) {
94 103
			//timeout: 10000,
95 104
			//async:false, 
96 105
			success: function(data) {
97
				console.log("1");
106
				table.innerHTML = '';
107
				mui('#pullrefresh').pullRefresh().refresh(true); //重置上拉加载
98 108
				if(data.success && data.data.data != "") {
99 109
					var datalist = data.data.data;
100 110
					datalistEach(datalist);
111
					mui('#pullrefresh').pullRefresh().refresh(true);
112
	                if(data.data.total<data.data.pageSize){
113
	                	mui('#pullrefresh').pullRefresh().disablePullupToRefresh(); //没有数据禁止上拉刷新	
114
	                }
115
				}else {
116
					mui('#pullrefresh').pullRefresh().disablePullupToRefresh(); //没有数据禁止上拉刷新
117
					nodatabox1.style.display = 'block';
101 118
				}
102
				mui('#pullrefresh').pullRefresh().refresh(true); //重置上拉加载
103 119
			},
104 120
			error: function() {
105 121
				plus.nativeUI.toast("服务器链接超时", toastStyle); 
@ -124,14 +140,21 @@ function getOneResources(pageNo, pageSize) {
124 140
			//timeout: 10000,
125 141
			//async:false,
126 142
			success: function(data) {
127
				console.log("2");
143
				table1.innerHTML = '';
144
				console.log(JSON.stringify(data.data.data.resource))
128 145
				plus.nativeUI.closeWaiting();
129 146
		        plus.webview.currentWebview().show("slide-in-right", 150);
130 147
				if(data.success && data.data.data != "") {
131 148
					var datalistd = data.data.data;
132 149
					resourcesEach2(datalistd);
150
					mui('#pullrefresh').pullRefresh().refresh(true);
151
	                if(data.data.total<data.data.pageSize){
152
	                	mui('#pullrefresh').pullRefresh().disablePullupToRefresh(); //没有数据禁止上拉刷新	
153
	                }
154
				}else {
155
					mui('#pullrefresh').pullRefresh().disablePullupToRefresh(); //没有数据禁止上拉刷新
156
					nodatabox2.style.display = 'block';
133 157
				}
134
				mui('#pullrefresh').pullRefresh().refresh(true); //重置上拉加载
135 158
			},
136 159
			error: function() {
137 160
				plus.nativeUI.toast("服务器链接超时", toastStyle);
@ -157,7 +180,7 @@ function expert2(pageNo, pageSize) {
157 180
				timeout: 10000,
158 181
				//async:false,
159 182
				success: function(data) {
160
					console.log(data.success)
183
					
161 184
					if(data.success && data.data.data != "") {
162 185
						plus.nativeUI.closeWaiting();
163 186
						mui('#pullrefresh').pullRefresh().enablePullupToRefresh(); //启用上拉刷新
@ -174,6 +197,7 @@ function expert2(pageNo, pageSize) {
174 197
							mui('#pullrefresh').pullRefresh().endPullupToRefresh(false); //能上拉
175 198
						} else {
176 199
							mui('#pullrefresh').pullRefresh().endPullupToRefresh(true); //不能上拉
200
							
177 201
						}
178 202

179 203
					}
@ -205,6 +229,7 @@ function expert2(pageNo, pageSize) {
205 229
						var dice1 = data.data.total; //总条数
206 230
						var dice2 = data.data.pageSize; //每页条数
207 231
						allPages = Math.ceil(dice1 / dice2);
232
						
208 233
						if(allPages == 1) { //下拉刷新需要先清空数据
209 234
							table.innerHTML = ''; // 在这里清空可以防止刷新时白屏
210 235
						}
@ -213,6 +238,7 @@ function expert2(pageNo, pageSize) {
213 238
						mui('#pullrefresh').pullRefresh().refresh(true); //重置上拉加载
214 239
						if(pageNo < allPages) {
215 240
							mui('#pullrefresh').pullRefresh().endPullupToRefresh(false); //能上拉
241
							console.log("3333333");
216 242
						} else {
217 243
							mui('#pullrefresh').pullRefresh().endPullupToRefresh(true); //不能上拉
218 244
						}
@ -231,9 +257,9 @@ function expert2(pageNo, pageSize) {
231 257
function datalistEach(datalist) {
232 258
	mui.each(datalist, function(index, item) {
233 259
		/*获取头像*/
234
		console.log(JSON.stringify(item));
260
		//console.log(JSON.stringify(item));
235 261
		if(item.professor.hasHeadImage == 1) {
236
			var img = baseUrl + "/images/head/" + item.professor.id + "_m.jpg";
262
			var img = baseUrl + "/images/head/" + item.professor.id + "_l.jpg";
237 263
		} else {
238 264
			var img = "../images/default-photo.jpg";
239 265
		}
@ -309,7 +335,7 @@ function datalistEach(datalist) {
309 335
/*资源数据遍历*/
310 336
function resourcesEach2(datalistd) {
311 337
	mui.each(datalistd, function(index, item) {
312

338
       
313 339
		/*获取头像*/
314 340
		if(item.resource.images.length) {
315 341
			var img = baseUrl + "/images/resource/" + item.resource.resourceId + ".jpg";