|
@ -8,10 +8,9 @@ mui('.mui-scroll-wrapper').scroll({
|
8
|
8
|
var key1 = [],
|
9
|
9
|
key2 = [1, 1, 1, 1, 1],
|
10
|
10
|
ifkong=[1, 1, 1, 1, 1],
|
|
11
|
pageNo=1,
|
11
|
12
|
rows=2,
|
12
|
|
pageSize=2,
|
13
|
|
pageNo=1;
|
14
|
|
|
|
13
|
pageSize=2;
|
15
|
14
|
mui.ready(function() {
|
16
|
15
|
mui.plusReady(function() {
|
17
|
16
|
var userid = plus.storage.getItem('userid');
|
|
@ -27,14 +26,14 @@ mui.ready(function() {
|
27
|
26
|
async: false,
|
28
|
27
|
success: function(res) {
|
29
|
28
|
if(res.success) {
|
30
|
|
console.log(JSON.stringify(res))
|
|
29
|
//console.log(JSON.stringify(res))
|
31
|
30
|
oFun(res);
|
32
|
31
|
}
|
33
|
32
|
}
|
34
|
33
|
});
|
35
|
34
|
})
|
36
|
35
|
},
|
37
|
|
dataO:{time:"",id:""},
|
|
36
|
dataO:{time:"",id:"",type:"",url:""},
|
38
|
37
|
listData: [{
|
39
|
38
|
type:1,
|
40
|
39
|
aimid:"myQ",
|
|
@ -68,46 +67,18 @@ mui.ready(function() {
|
68
|
67
|
],
|
69
|
68
|
comPull:function(dataStr,$_index,reStr){
|
70
|
69
|
var that=search,
|
71
|
|
type=that.listData[$_index].type,
|
72
|
|
url=that.listData[$_index].url,
|
73
|
70
|
aimId=that.listData[$_index].aimid,
|
74
|
71
|
newStr=that.listData[$_index].notip;
|
75
|
|
if(dataStr.length>0){
|
76
|
|
that.dataO.time = dataStr[dataStr.length-1].createTime;
|
77
|
|
that.dataO.id = dataStr[dataStr.length-1].id;
|
78
|
|
if(!ifkong[$_index]){
|
79
|
|
that.removeAfter(aimId)
|
80
|
|
}
|
81
|
|
for(var i = 0; i < dataStr.length; i++) {
|
82
|
|
var liStr = document.createElement("li");
|
83
|
|
document.getElementById(aimId).appendChild(liStr);
|
84
|
|
if(type==1 || type==4){
|
85
|
|
that.questionModule(dataStr[i], liStr);
|
86
|
|
}else if(type==2 || type==5){
|
87
|
|
that.answerModule(dataStr[i], liStr);
|
88
|
|
}else if(type==3){
|
89
|
|
that.proModule(dataStr[i], liStr);
|
90
|
|
}
|
91
|
|
}
|
92
|
|
if(type==3){
|
93
|
|
if(pageNo < Math.ceil(reStr.total / reStr.pageSize)) {
|
94
|
|
key1[$_index].endPullUpToRefresh(false);
|
95
|
|
} else {
|
96
|
|
key1[$_index].endPullUpToRefresh(true);
|
97
|
|
}
|
98
|
|
}else{
|
99
|
|
if(dataStr.length<rows){
|
100
|
|
key1[$_index].endPullUpToRefresh(true);
|
101
|
|
}
|
102
|
|
}
|
103
|
|
}else{
|
104
|
|
if(ifkong[$_index]){
|
105
|
|
that.insertAfter(newStr,aimId);
|
106
|
|
ifkong[$_index]=0
|
107
|
|
}
|
108
|
|
key1[$_index].endPullUpToRefresh(true);
|
109
|
|
return;
|
|
72
|
|
|
73
|
that.dataO.type=that.listData[$_index].type;
|
|
74
|
that.dataO.url=that.listData[$_index].url;
|
|
75
|
|
|
76
|
if(!ifkong[$_index]){that.removeAfter(aimId)}
|
|
77
|
if(dataStr.length==0&&ifkong[$_index] && key2[$_index] ){
|
|
78
|
that.insertAfter(newStr,aimId);
|
|
79
|
ifkong[$_index]=0
|
110
|
80
|
}
|
|
81
|
|
111
|
82
|
if(key2[$_index]) {
|
112
|
83
|
plus.nativeUI.closeWaiting();
|
113
|
84
|
plus.webview.currentWebview().show("slide-in-right", 150);
|
|
@ -115,41 +86,39 @@ mui.ready(function() {
|
115
|
86
|
key1[$_index] =mui(pullRefreshEl).pullToRefresh({
|
116
|
87
|
up: {
|
117
|
88
|
callback: function() {
|
118
|
|
var self = this;
|
119
|
|
setTimeout(function() {
|
120
|
|
var ul = self.element.querySelector('.mui-table-view');
|
121
|
|
|
122
|
|
if(type==3){
|
123
|
|
alert(222)
|
124
|
|
console.log(pageNo)
|
|
89
|
if(that.dataO.type==3){
|
|
90
|
var self=this;
|
|
91
|
setTimeout(function() {
|
125
|
92
|
var rs={
|
126
|
93
|
"professorId": userid,
|
127
|
94
|
"watchType":1,
|
128
|
95
|
"pageSize":pageSize,
|
129
|
96
|
"pageNo":++pageNo
|
130
|
97
|
};
|
131
|
|
search.oAjaxGet(url, rs, "get",that.oWatchPro,self);
|
132
|
|
}else{
|
133
|
|
alert(888)
|
|
98
|
search.oAjaxGet(that.dataO.url, rs, "get",that.oWatchPro);
|
|
99
|
self.endPullUpToRefresh()
|
|
100
|
}, 1000);
|
|
101
|
}else{
|
|
102
|
var self=this;
|
|
103
|
setTimeout(function() {
|
134
|
104
|
var rs={
|
135
|
105
|
"uid": userid,
|
136
|
106
|
"rows":rows,
|
137
|
107
|
"time":that.dataO.time,
|
138
|
108
|
"id":that.dataO.id
|
139
|
109
|
};
|
140
|
|
|
141
|
|
if(type==1){
|
142
|
|
search.oAjaxGet(url, rs, "get",that.oMyQ,self);
|
143
|
|
}else if(type==2){
|
144
|
|
search.oAjaxGet(url, rs, "get",that.oMyA,self);
|
145
|
|
}else if(type==4){
|
146
|
|
search.oAjaxGet(url, rs, "get",that.oWatchQ,self);
|
147
|
|
}else if(type==5){
|
148
|
|
search.oAjaxGet(url, rs, "get",that.oWatchA,self);
|
|
110
|
if(that.dataO.type==1){
|
|
111
|
search.oAjaxGet(that.dataO.url, rs, "get",that.oMyQ);
|
|
112
|
}else if(that.dataO.type==2){
|
|
113
|
search.oAjaxGet(that.dataO.url, rs, "get",that.oMyA);
|
|
114
|
}else if(that.dataO.type==4){
|
|
115
|
search.oAjaxGet(that.dataO.url, rs, "get",that.oWatchQ);
|
|
116
|
}else if(that.dataO.type==5){
|
|
117
|
search.oAjaxGet(that.dataO.url, rs, "get",that.oWatchA);
|
149
|
118
|
}
|
150
|
|
}
|
151
|
|
self.endPullUpToRefresh();
|
152
|
|
}, 1000);
|
|
119
|
self.endPullUpToRefresh()
|
|
120
|
}, 1000);
|
|
121
|
}
|
153
|
122
|
}
|
154
|
123
|
}
|
155
|
124
|
});
|
|
@ -157,27 +126,56 @@ mui.ready(function() {
|
157
|
126
|
key1[$_index].endPullUpToRefresh(false);
|
158
|
127
|
key2[$_index] = 0;
|
159
|
128
|
}
|
|
129
|
if(dataStr.length>0){
|
|
130
|
that.dataO.time = dataStr[dataStr.length-1].createTime;
|
|
131
|
that.dataO.id = dataStr[dataStr.length-1].id;
|
|
132
|
|
|
133
|
for(var i = 0; i < dataStr.length; i++) {
|
|
134
|
var liStr = document.createElement("li");
|
|
135
|
document.getElementById(aimId).appendChild(liStr);
|
|
136
|
if(that.dataO.type==1 || that.dataO.type==4){
|
|
137
|
that.questionModule(dataStr[i], liStr);
|
|
138
|
}else if(that.dataO.type==2 || that.dataO.type==5){
|
|
139
|
that.answerModule(dataStr[i], liStr);
|
|
140
|
}else if(that.dataO.type==3){
|
|
141
|
that.proModule(dataStr[i], liStr);
|
|
142
|
}
|
|
143
|
}
|
|
144
|
if(that.dataO.type==3){
|
|
145
|
if(pageNo < Math.ceil(reStr.total / reStr.pageSize)) {
|
|
146
|
key1[$_index].endPullUpToRefresh(false);
|
|
147
|
} else {
|
|
148
|
key1[$_index].endPullUpToRefresh(true);
|
|
149
|
}
|
|
150
|
}else{
|
|
151
|
if(dataStr.length>rows){
|
|
152
|
key1[$_index].endPullUpToRefresh(false);
|
|
153
|
}
|
|
154
|
}
|
|
155
|
}else{
|
|
156
|
key1[$_index].endPullUpToRefresh(true);
|
|
157
|
return;
|
|
158
|
}
|
|
159
|
if(dataStr.length==0){
|
|
160
|
key1[$_index].endPullUpToRefresh(true);
|
|
161
|
return;
|
|
162
|
}
|
160
|
163
|
|
161
|
164
|
},
|
162
|
165
|
oMyQ: function(res) {
|
163
|
|
var that=search,$_index=0;
|
164
|
|
that.comPull(res.data,$_index);
|
|
166
|
search.comPull(res.data,0);
|
165
|
167
|
},
|
166
|
168
|
oMyA: function(res) {
|
167
|
|
var that=search,$_index=1;
|
168
|
|
that.comPull(res.data,$_index);
|
|
169
|
search.comPull(res.data,1);
|
169
|
170
|
},
|
170
|
171
|
oWatchPro: function(res) {
|
171
|
|
var that=search,$_index=2;
|
172
|
|
that.comPull(res.data.data,$_index,res.data);
|
|
172
|
search.comPull(res.data.data,2,res.data);
|
173
|
173
|
},
|
174
|
174
|
oWatchQ: function(res) {
|
175
|
|
var that=search,$_index=3;
|
176
|
|
that.comPull(res.data,$_index);
|
|
175
|
search.comPull(res.data,3);
|
177
|
176
|
},
|
178
|
177
|
oWatchA: function(res) {
|
179
|
|
var that=search,$_index=4;
|
180
|
|
that.comPull(res.data,$_index);
|
|
178
|
search.comPull(res.data,4);
|
181
|
179
|
},
|
182
|
180
|
proModule:function(dataStr, liStr){
|
183
|
181
|
var dataStr=dataStr.professor
|
|
@ -243,53 +241,28 @@ mui.ready(function() {
|
243
|
241
|
'</div></div>'
|
244
|
242
|
},
|
245
|
243
|
answerModule: function(dataStr, liStr) {
|
246
|
|
var baImg = "../images/default-photo.jpg";
|
247
|
|
var userType = autho(dataStr.authType, dataStr.orgAuth, dataStr.authStatus);
|
248
|
|
var os = "";
|
249
|
|
if(dataStr.title) {
|
250
|
|
if(dataStr.orgName) {
|
251
|
|
os = dataStr.title + "," + dataStr.orgName;
|
252
|
|
} else {
|
253
|
|
os = dataStr.title;
|
254
|
|
}
|
255
|
|
} else {
|
256
|
|
if(dataStr.office) {
|
257
|
|
if(dataStr.orgName) {
|
258
|
|
os = dataStr.office + "," + dataStr.orgName;
|
259
|
|
} else {
|
260
|
|
os = dataStr.office;
|
261
|
|
}
|
262
|
|
} else {
|
263
|
|
if(dataStr.orgName) {
|
264
|
|
os = dataStr.orgName;
|
265
|
|
}
|
266
|
|
}
|
267
|
|
}
|
268
|
|
var baImg = "../images/default-photo.jpg";
|
269
|
|
if(dataStr.hasHeadImage == 1) {
|
270
|
|
baImg = baseUrl + "/images/head/" + dataStr.id + "_l.jpg";
|
|
244
|
var hd = "",hl="";
|
|
245
|
if(dataStr.agree > 0) {
|
|
246
|
hd = '<span>'+dataStr.agree+' 赞</span>'
|
271
|
247
|
}
|
272
|
|
var hd = "";
|
273
|
|
if(dataStr.replyCount > 0) {
|
274
|
|
hd = '<span>' + dataStr.replyCount + ' 回答</span>'
|
|
248
|
if(dataStr.ballot > 0){
|
|
249
|
hl='<span>'+dataStr.ballot+' 留言</span>'
|
275
|
250
|
}
|
276
|
251
|
liStr.setAttribute("data-id", dataStr.id);
|
277
|
252
|
liStr.className = "mui-table-view-cell";
|
278
|
|
liStr.innerHTML = '<div class="madiaInfo">'+
|
279
|
|
'<p class="h1Font mui-ellipsis-2">'+dataStr.title+'</p>'+
|
280
|
|
'<div class="flexCenter qa-owner">'+
|
281
|
|
'<div class="owner-head useHead"></div>'+
|
282
|
|
'<div class="owner-info">'+
|
283
|
|
'<div class="owner-name"><span class="h1Font">张某某</span><em class="authicon authicon-pro" title="科袖认证专家"></em></div>'+
|
284
|
|
'<div class="owner-tit mui-ellipsis h2Font">职称/职位,所在机构职称/职位,所在机构职称/职位,所在机构</div>'+
|
285
|
|
'</div>'+
|
286
|
|
'</div>'+
|
287
|
|
'<p class="qa-con mui-ellipsis-5">'+dataStr.cnt+'</p>'+
|
288
|
|
'<div class="showli mui-ellipsis">'+
|
289
|
|
'<span>5月8日 18:00</span><span>N 赞</span><span>N 留言</span>'+
|
290
|
|
'</div>'+
|
291
|
|
'</div>'
|
292
|
|
|
|
253
|
var str = '<div class="madiaInfo">'+
|
|
254
|
'<p class="h1Font mui-ellipsis-2 qa-question"></p>'+
|
|
255
|
'<div class="flexCenter qa-owner"></div>'+
|
|
256
|
'<p class="qa-con mui-ellipsis-5">'+dataStr.cnt+'</p>'+
|
|
257
|
'<div class="showli mui-ellipsis">'+
|
|
258
|
'<span>'+commenTime(dataStr.createTime)+'</span>'+ hd + hl+
|
|
259
|
'</div>'+
|
|
260
|
'</div>'
|
|
261
|
var $str=$(str)
|
|
262
|
$str.appendTo(liStr);
|
|
263
|
search.questioninfo(dataStr.qid,$str);
|
|
264
|
search.proinfo(dataStr.uid,$str);
|
|
265
|
|
293
|
266
|
},
|
294
|
267
|
insertAfter:function(newStr, targetE){
|
295
|
268
|
var parent = document.getElementById(targetE).parentNode;
|
|
@ -312,6 +285,13 @@ mui.ready(function() {
|
312
|
285
|
}
|
313
|
286
|
},
|
314
|
287
|
slideFun:function($type){
|
|
288
|
search.dataO={time:"",id:"",type:"",url:""},
|
|
289
|
pageNo=1,
|
|
290
|
// key1=[],
|
|
291
|
key2 = [1, 1, 1, 1, 1];
|
|
292
|
// if(key1[$type-1] instanceof Object){
|
|
293
|
// key1[$type-1].endPullUpToRefresh(false);
|
|
294
|
// }
|
315
|
295
|
if($type == "1") {
|
316
|
296
|
document.getElementById("myQ").innerHTML="";
|
317
|
297
|
search.oAjaxGet("/ajax/question/my", {
|
|
@ -326,7 +306,6 @@ mui.ready(function() {
|
326
|
306
|
}, "get", search.oMyA);
|
327
|
307
|
} else if($type == "3") {
|
328
|
308
|
document.getElementById("watchPro").innerHTML="";
|
329
|
|
pageNo=1
|
330
|
309
|
search.oAjaxGet("/ajax/watch/qaPro", {
|
331
|
310
|
"professorId": userid,
|
332
|
311
|
"watchType":1,
|
|
@ -360,7 +339,50 @@ mui.ready(function() {
|
360
|
339
|
})
|
361
|
340
|
|
362
|
341
|
},
|
363
|
|
|
|
342
|
proinfo:function(pid,$str){
|
|
343
|
search.oAjaxGet("/ajax/professor/baseInfo/"+pid, {}, "get", function(res){
|
|
344
|
var dataStr=res.data
|
|
345
|
var baImg = "../images/default-photo.jpg";
|
|
346
|
if(dataStr.hasHeadImage == 1) {
|
|
347
|
baImg = baseUrl + "/images/head/" + dataStr.id + "_l.jpg";
|
|
348
|
}
|
|
349
|
var userType = autho(dataStr.authType, dataStr.orgAuth, dataStr.authStatus);
|
|
350
|
var os = "";
|
|
351
|
if(dataStr.title) {
|
|
352
|
if(dataStr.orgName) {
|
|
353
|
os = dataStr.title + "," + dataStr.orgName;
|
|
354
|
} else {
|
|
355
|
os = dataStr.title;
|
|
356
|
}
|
|
357
|
} else {
|
|
358
|
if(dataStr.office) {
|
|
359
|
if(dataStr.orgName) {
|
|
360
|
os = dataStr.office + "," + dataStr.orgName;
|
|
361
|
} else {
|
|
362
|
os = dataStr.office;
|
|
363
|
}
|
|
364
|
} else {
|
|
365
|
if(dataStr.orgName) {
|
|
366
|
os = dataStr.orgName;
|
|
367
|
}
|
|
368
|
}
|
|
369
|
}
|
|
370
|
var str='<div class="owner-head useHead" style="background:url('+baImg+')"></div>'+
|
|
371
|
'<div class="owner-info">'+
|
|
372
|
'<div class="owner-name"><span class="h1Font">'+dataStr.name+'</span><em class="authicon '+userType.sty+'" title="'+userType.title+'"></em></div>'+
|
|
373
|
'<div class="owner-tit mui-ellipsis h2Font">'+os+'</div>'+
|
|
374
|
'</div>'
|
|
375
|
$str.find(".qa-owner").html(str)
|
|
376
|
});
|
|
377
|
},
|
|
378
|
questioninfo:function(qid,$str){
|
|
379
|
search.oAjaxGet("/ajax/question/qo", {
|
|
380
|
"id": qid,
|
|
381
|
}, "get", function(res){
|
|
382
|
$str.find(".qa-question").html(res.data.title);
|
|
383
|
});
|
|
384
|
|
|
385
|
}
|
364
|
386
|
}
|
365
|
387
|
|
366
|
388
|
search.allAgreeNum();//总赞同数
|