Przeglądaj źródła

关注与收藏板块

jack 8 lat temu
rodzic
commit
b12aa4c6bf

+ 37 - 0
app/html/attentions-list3.html

@ -0,0 +1,37 @@
1
<!DOCTYPE html>
2
<html>
3
<head>
4
    <meta charset="utf-8">
5
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
6
    <title></title>
7

8
    <link href="../css/mui.min.css" rel="stylesheet"/>
9
    <link href="../css/iconfont.css" rel="stylesheet" />
10
    <link href="../css/app.css" rel="stylesheet"/>
11
</head>
12
<body>
13
	
14
	<div class="mui-content mui-scroll-wrapper" id="pullrefresh" >
15
		<div class="mui-scroll"> 
16
	        <div  class="mui-card-content conblock">
17
		      	<ul class="mui-table-view protable list">
18
			           
19
			    </ul>
20
			    <div class="nodatabox" style="display:none; background: #f4f6f8;margin: 0; " id="nodatabox1">
21
			        <div class="nodata">
22
			            <div class="picbox"><span class="defpic" style="background-position:-10px 28px"></span></div>
23
			            <div class="txtbox">
24
			            	<p class="currword">抱歉!您还未关注过任何资源</p>
25
			                
26
			            </div>
27
			        </div>
28
			    </div>
29
			</div>
30
		</div>
31
	</div>
32
	
33
    <script src="../js/public/mui.min.js"></script>
34
	<script src="../js/public/base.js"></script>
35
	<script src="../js/attentions3.js"></script>
36
</body>
37
</html>

+ 50 - 9
app/html/attentions.html

@ -20,8 +20,9 @@
20 20
    	<!-- 主界面具体展示内容 -->
21 21
		<div class="fixbox">
22 22
			<ul class="fixbtn" id="fixbtn">
23
				<li index="0" class="mui-col-xs-6 liactive">专家</li><!--当前选中状态    'liactive'-->
24
				<li index="1" class="mui-col-xs-6">资源</li>
23
				<li index="0" class="mui-col-xs-4 liactive">专家</li><!--当前选中状态    'liactive'-->
24
				<li index="1" class="mui-col-xs-4">资源</li>
25
				<li index="2" class="mui-col-xs-4">文章</li>
25 26
			</ul>
26 27
		</div>
27 28
    </div>
@ -35,12 +36,13 @@
35 36
			var libtn_arr = document.getElementById("fixbtn").getElementsByTagName("li");
36 37
			if(checkedindex == 0) {
37 38
				var list1 = plus.webview.getWebviewById('attentions-list2.html');
38
				console.log(list1)
39
				if(list1==null){
39
				var list3 = plus.webview.getWebviewById('attentions-list3.html');
40
				if(list1==null&&list3){
40 41
					return;
41 42
				}
42 43
				libtn_arr[0].classList.add("liactive");
43 44
				libtn_arr[1].classList.remove("liactive");
45
				libtn_arr[2].classList.remove("liactive");
44 46
				mui.openWindow({
45 47
					url: 'attentions-list.html',
46 48
					id: 'attentions-list.html',
@ -53,16 +55,22 @@
53 55
						bottom: '0px',
54 56
					}
55 57
				});
58
				if(list1){
59
					list1.close()
60
				}
61
				if(list3){
62
					list3.close();
63
				}
56 64
				
57
				list1.close();
58
			} else {
65
			} else if(checkedindex==1){
59 66
				var list2 = plus.webview.getWebviewById('attentions-list.html');
60
				if(list2==null){
67
				var list3 = plus.webview.getWebviewById('attentions-list3.html');
68
				if(list2==null&&list3==null){
61 69
					return;
62 70
				}
63 71
				libtn_arr[1].classList.add("liactive");
64 72
				libtn_arr[0].classList.remove("liactive");
65
			
73
				libtn_arr[2].classList.remove("liactive");
66 74
				mui.openWindow({
67 75
					url: 'attentions-list2.html',
68 76
					id: 'attentions-list2.html',
@ -75,8 +83,41 @@
75 83
						bottom: '0px',
76 84
					}
77 85
				});
86
				if(list2){
87
					list2.close();
88
				}
89
				if(list3){
90
					list3.close();
91
				}
92
				
93
			}else if(checkedindex==2){
94
				var list1 = plus.webview.getWebviewById('attentions-list2.html');
95
				var list2 = plus.webview.getWebviewById('attentions-list.html');
96
				if(list1==null&&list2==null){
97
					return;
98
				}
99
				libtn_arr[1].classList.remove("liactive");
100
				libtn_arr[0].classList.remove("liactive");
101
				libtn_arr[2].classList.add("liactive");
102
				mui.openWindow({
103
					url: 'attentions-list3.html',
104
					id: 'attentions-list3.html',
105
					show: {
106
						aniShow: "slide-in",
107
						autoShow: false
108
					},
109
					styles:{
110
						top: '85px',
111
						bottom: '0px',
112
					}
113
				});
114
				if(list2){
115
					list2.close();
116
				}
117
				if(list1){
118
					list1.close();
119
				}
78 120
				
79
				list2.close();
80 121
			}
81 122
		})
82 123
	    mui.init({

+ 1 - 4
app/js/attentions.js

@ -116,11 +116,8 @@ function expert2(pageNo, pageSize) {
116 116
						var datalist = data.data.data;
117 117
						datalistEach(datalist);
118 118
						mui('#pullrefresh').pullRefresh().refresh(true); //重置上拉加载
119
						if(pageNo < allPages) {
119
						if(pageNo >= allPages) {
120 120
							mui('#pullrefresh').pullRefresh().endPullupToRefresh(false); //能上拉
121
						} else {
122
							mui('#pullrefresh').pullRefresh().endPullupToRefresh(true); //不能上拉
123
							
124 121
						}
125 122

126 123
					}

+ 3 - 5
app/js/attentions2.js

@ -118,17 +118,15 @@ function expert2(pageNo, pageSize) {
118 118
						var datalist = data.data.data;
119 119
						datalistEach(datalist);
120 120
						mui('#pullrefresh').pullRefresh().refresh(true); //重置上拉加载
121
						if(pageNo < allPages) {
121
						if(pageNo >= allPages) {
122 122
							mui('#pullrefresh').pullRefresh().disablePullupToRefresh(); //没有数据禁止上拉刷新	
123
						} else {
124
							mui('#pullrefresh').pullRefresh().endPullupToRefresh(true); //不能上拉
125
							
126
						}
123
						} 
127 124

128 125
					}
129 126
				},
130 127
				error: function() {
131 128
					plus.nativeUI.toast("服务器链接超时", toastStyle);
129
					
132 130
				}
133 131
			});
134 132
		});

+ 193 - 0
app/js/attentions3.js

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

8
mui.init({
9
	pullRefresh: {
10
		container: '#pullrefresh',
11
		/*down: {
12
				callback: pulldownRefresh
13
			  },*/
14
		up: {
15
			contentrefresh: '正在加载...',
16
			callback: pullupRefresh,
17
		    //auto:true
18
		}
19
	}
20
});
21

22
function pullupRefresh() {
23
	pageNo = ++pageNo;
24
	setTimeout(function() {
25
		expert2(pageNo, 20)
26
	}, 1000);
27
	mui('#pullrefresh').pullRefresh().refresh(true);
28
}
29

30
/*function pulldownRefresh() {
31
	setTimeout(function() {
32
		getOneExpert(1, 10);	
33
	    mui('#pullrefresh').pullRefresh().endPulldownToRefresh();
34
	}, 1000);
35
}*/
36

37

38

39

40

41
mui.plusReady(function(){
42
	mui('.list').on('tap','a',function(){
43
		var id=this.getAttribute("data-id");
44
		var datatype = this.getAttribute("data-type");
45
	var ownerid = this.getAttribute("owner-id");
46
	if(datatype == 1) {
47
		mui.openWindow({
48
			url: '../html/professorArticle.html',
49
			id: 'html/professorArticle.html',
50
			show: {
51
				autoShow: false,
52
				aniShow: "slide-in-right",
53
			},
54
			extras: {
55
				articleId: id,
56
				ownerid: ownerid,
57
			}
58
		});
59
	}else if(datatype == 2){
60
		mui.openWindow({
61
			url: '../html/professorArticle.html',
62
			id: 'html/professorArticle.html',
63
			show: {
64
				autoShow: false,
65
				aniShow: "slide-in-right",
66
			},
67
			extras: {
68
				articleId: id,
69
				ownerid: ownerid,
70
				oFlag:1
71
			}
72
		});
73
	} 
74
	})
75
})
76

77
getOneExpert(1, 20);	
78

79
/*获取第一页资源数据*/
80
function getOneExpert(pageNo, pageSize) {
81
	mui.plusReady(function() {
82
		var userId = plus.storage.getItem('userid');
83
		mui.ajax(baseUrl + '/ajax/watch/qaPro', {
84
			data: {
85
				"professorId": userId,
86
				"watchType": 3,
87
				"pageNo": pageNo,
88
				"pageSize": pageSize
89
			},
90
			dataType: 'json', //数据格式类型
91
			type: 'GET', //http请求类型
92
			//timeout: 10000,
93
			//async:false, 
94
			success: function(data) {
95
				plus.nativeUI.closeWaiting();
96
				plus.webview.currentWebview().show("fade-in", 150);
97
				table.innerHTML = '';
98
				//mui('#pullrefresh').pullRefresh().refresh(true); //重置上拉加载
99
				if(data.success && data.data.data != "") {
100
					var datalist = data.data.data;
101
					datalistEach(datalist);
102
					mui('#pullrefresh').pullRefresh().refresh(true);
103
					
104
	                if(data.data.total<data.data.pageSize){
105
	                	mui('#pullrefresh').pullRefresh().disablePullupToRefresh(); //没有数据禁止上拉刷新	
106
	                }
107
				}else {
108
					nodatabox1.style.display = 'block';
109
					mui('#pullrefresh').pullRefresh().disablePullupToRefresh(); //没有数据禁止上拉刷新
110
				}
111
			},
112
			error: function() {
113
				plus.nativeUI.toast("服务器链接超时", toastStyle); 
114
			}
115
		});
116
	});
117
}
118

119
/*上拉刷新数据*/
120
function expert2(pageNo, pageSize) {
121
	mui.plusReady(function() {
122
			var userId = plus.storage.getItem('userid');
123
			mui.ajax(baseUrl + '/ajax/watch/qaPro', {
124
				data: {
125
					"professorId": userId,
126
					"watchType": 3,
127
					"pageNo": pageNo,
128
					"pageSize": pageSize
129
				},
130
				dataType: 'json', //数据格式类型
131
				type: 'GET', //http请求类型
132
				timeout: 10000,
133
				//async:false,
134
				success: function(data) {
135
					
136
					if(data.success && data.data.data != "") {
137
						plus.nativeUI.closeWaiting();
138
						mui('#pullrefresh').pullRefresh().enablePullupToRefresh(); //启用上拉刷新
139
						var dice1 = data.data.total; //总条数
140
						var dice2 = data.data.pageSize; //每页条数
141
						allPages = Math.ceil(dice1 / dice2);
142
						if(allPages == 1) { //下拉刷新需要先清空数据
143
							table.innerHTML = ''; // 在这里清空可以防止刷新时白屏
144
						}
145
						var datalist = data.data.data;
146
						datalistEach(datalist);
147
						 mui('#pullrefresh').pullRefresh().endPullupToRefresh(false);
148
						if(pageNo >= allPages) {
149
							mui('#pullrefresh').pullRefresh().disablePullupToRefresh(); //没有数据禁止上拉刷新	
150
						}
151

152
					}
153
				},
154
				error: function() {
155
					plus.nativeUI.toast("服务器链接超时", toastStyle);
156
				}
157
			});
158
		});
159
}
160

161
/*资源数据遍历*/
162
function datalistEach(datalistd) {
163
	mui.each(datalistd, function(index, item) {
164
		/*获取头像*/ 
165
		if(item.article.articleImg) {
166
			var img = baseUrl + "/data/article/"+ item.article.articleImg;
167
		} else {
168
			var img = "../images/default-artical.jpg";
169
		}
170
		var puId,oName,icont = '';
171
		if(item.article.articleType==1){
172
			puId=item.article.professorId;
173
			oName=item.article.professor.name;
174
			icont='<em class="mui-icon iconfont icon-vip authicon-cu"> </em>';
175
		}else{
176
			puId=item.article.orgId;
177
			oName=item.article.organization.name;
178
			if(item.article.organization.authStatus==3){
179
				icont='<em class="mui-icon iconfont authicon authicon-com-ok"></em>';
180
			}
181
		}
182
		var li = document.createElement('li');
183
		li.className = 'mui-table-view-cell mui-media'; 
184
		li.innerHTML = '<a class="proinfor"  owner-id="'+puId+'" data-type="'+item.article.articleType+'" data-id="' + item.article.articleId + '">' +
185
			'<p><div class="mui-media-object mui-pull-left ResImgBox"><img class="resImg" src="' + img + '"></div></p>' +
186
			'<div class="mui-media-body">' +
187
			'<div class="listtit">' + item.article.articleTitle + '</div>' +
188
			'<span class="listtit">' + oName + icont + '</span>' +
189
			'</div></a></li>';
190
		table.appendChild(li, table.firstChild)
191
		
192
	});
193
}