|
@ -30,6 +30,8 @@ mui.plusReady(function() {
|
30
|
30
|
resourceId = self.resourceId;
|
31
|
31
|
getRecourceMe();/*获取资源信息*/
|
32
|
32
|
relatedArticles();/*相关文章信息*/
|
|
33
|
interestingResources();
|
|
34
|
|
33
|
35
|
mui.ajax(baseUrl + '/ajax/resource/pageViews',{
|
34
|
36
|
"type": "POST",
|
35
|
37
|
"dataType": "json",
|
|
@ -37,7 +39,6 @@ mui.plusReady(function() {
|
37
|
39
|
"resourceId": resourceId
|
38
|
40
|
},
|
39
|
41
|
"success": function(data) {
|
40
|
|
console.log(data);
|
41
|
42
|
if(data.success) {}
|
42
|
43
|
},
|
43
|
44
|
"error": function() {
|
|
@ -143,11 +144,6 @@ mui.plusReady(function() {
|
143
|
144
|
}
|
144
|
145
|
if(mydata.subject) {
|
145
|
146
|
var oSub = mydata.subject.split(",");
|
146
|
|
if(mydata.resourceType==1) {
|
147
|
|
interestingResources(oSub,mydata.professorId,0);
|
148
|
|
}else{
|
149
|
|
interestingResources(oSub,mydata.orgId,1);
|
150
|
|
}
|
151
|
147
|
var oSt = "";
|
152
|
148
|
for(var i = 0; i < oSub.length; i++) {
|
153
|
149
|
oSt += '<li><span class="h2Font">' + oSub[i] + '</span></li>'
|
|
@ -202,32 +198,48 @@ mui.plusReady(function() {
|
202
|
198
|
})
|
203
|
199
|
/*资源里面相关文章*/
|
204
|
200
|
function relatedArticles() {
|
205
|
|
mui.ajax(baseUrl + '/ajax/resource/articles', {
|
|
201
|
mui.ajax(baseUrl + '/ajax/article/byAssResource', {
|
206
|
202
|
type: "GET",
|
|
203
|
data: {
|
|
204
|
"id": resourceId,
|
|
205
|
},
|
|
206
|
dataType: "json",
|
207
|
207
|
success: function(data) {
|
208
|
208
|
if(data.success) {
|
209
|
209
|
if(data.data.length == 0) {
|
210
|
|
document.getElementById("likeArtical").parentNode.style.display="none";
|
211
|
210
|
return;
|
212
|
211
|
}
|
|
212
|
document.getElementById("likeArtical").parentNode.classList.remove("displayNone");
|
213
|
213
|
var $html= data.data;
|
214
|
|
for(var i = 0; i < $html.length; i++) {
|
|
214
|
var lengthT;
|
|
215
|
if($html.length>5){
|
|
216
|
lengthT=5;
|
|
217
|
}else{
|
|
218
|
lengthT=$html.length
|
|
219
|
}
|
|
220
|
for(var i = 0; i < lengthT; i++) {
|
215
|
221
|
(function(n) {
|
216
|
222
|
var oURL;
|
217
|
|
if($html[i].article.articleType==1) {
|
218
|
|
oURL=baseUrl+"/ajax/professor/baseInfo/" + $html[i].article.professorId;
|
|
223
|
if($html[i].articleType==1) {
|
|
224
|
oURL=baseUrl+"/ajax/professor/baseInfo/" + $html[i].professorId;
|
219
|
225
|
}else{
|
220
|
|
oURL=baseUrl+"/ajax/org/" + $html[i].article.orgId;
|
|
226
|
oURL=baseUrl+"/ajax/org/" + $html[i].orgId;
|
221
|
227
|
}
|
222
|
228
|
mui.ajax(oURL, {
|
223
|
229
|
type: "GET",
|
224
|
230
|
dataType: "json",
|
225
|
231
|
success: function(data) {
|
226
|
232
|
if(data.success) {
|
|
233
|
var likeRUl = document.getElementById("likeArtical");
|
|
234
|
var likeRli = document.createElement("li");
|
|
235
|
likeRli.className = 'mui-table-view-cell';
|
|
236
|
likeRli.setAttribute("data-id", $html[n].articleId);
|
|
237
|
|
227
|
238
|
var comName="";
|
228
|
|
if($html[n].article.articleType==1) {
|
|
239
|
if($html[n].articleType==1) {
|
229
|
240
|
var stl = autho(data.data.authType, data.data.orgAuth, data.data.authStatus);
|
230
|
241
|
comName=data.data.name;
|
|
242
|
likeRli.setAttribute("data-type", 1);
|
231
|
243
|
}else {
|
232
|
244
|
var stl={};
|
233
|
245
|
stl.sty="";
|
|
@ -241,21 +253,18 @@ mui.plusReady(function() {
|
241
|
253
|
}else{
|
242
|
254
|
comName=data.data.name;
|
243
|
255
|
}
|
|
256
|
likeRli.setAttribute("data-type", 2);
|
244
|
257
|
}
|
245
|
|
var likeRUl = document.getElementById("likeArtical");
|
246
|
|
var likeRli = document.createElement("li");
|
247
|
|
likeRli.className = 'mui-table-view-cell';
|
248
|
|
likeRli.setAttribute("data-id", $html[n].article.articleId);
|
249
|
258
|
|
250
|
259
|
var str = ""
|
251
|
260
|
str+='<div class="flexCenter OflexCenter mui-clearfix">'
|
252
|
|
if($html[n].article.articleImg) {
|
253
|
|
str += '<div class="madiaHead artHead" style="background-image: url('+ baseUrl +'/data/article/' + $html[n].article.articleImg + ')"></div>'
|
|
261
|
if($html[n].articleImg) {
|
|
262
|
str += '<div class="madiaHead artHead" style="background-image: url('+ baseUrl +'/data/article/' + $html[n].articleImg + ')"></div>'
|
254
|
263
|
} else {
|
255
|
264
|
str += '<div class="madiaHead artHead"></div>'
|
256
|
265
|
}
|
257
|
266
|
str += '<div class="madiaInfo OmadiaInfo">'
|
258
|
|
str += '<p class="mui-ellipsis-2 h1Font">' + $html[n].article.articleTitle + '</p>'
|
|
267
|
str += '<p class="mui-ellipsis-2 h1Font">' + $html[n].articleTitle + '</p>'
|
259
|
268
|
str += '<p><span class="h2Font">' + comName + '</span><em class="authicon ' + stl.sty + '" title="' + stl.title + '"></em></p>'
|
260
|
269
|
str += '</div></div>'
|
261
|
270
|
likeRli.innerHTML = str;
|
|
@ -271,80 +280,84 @@ mui.plusReady(function() {
|
271
|
280
|
}
|
272
|
281
|
}
|
273
|
282
|
},
|
274
|
|
data: {
|
275
|
|
"resourceId": resourceId,
|
276
|
|
"rows": 5
|
277
|
|
},
|
278
|
|
dataType: "json",
|
279
|
283
|
error: function(xhr, type, errorThrown) {
|
280
|
284
|
plus.nativeUI.toast("服务器链接超时", toastStyle);
|
281
|
285
|
}
|
282
|
286
|
});
|
283
|
287
|
}
|
284
|
288
|
/*感兴趣的资源*/
|
285
|
|
function interestingResources(arry,oId,oNu) {
|
286
|
|
var oUrl;
|
287
|
|
var $in={};
|
288
|
|
$in.keys= arry;
|
289
|
|
$in.resourceId= resourceId;
|
290
|
|
|
291
|
|
if(oNu==0) {
|
292
|
|
$in.professorId= oId;
|
293
|
|
oUrl= baseUrl + "/ajax/resource/ralateRes";
|
294
|
|
}else {
|
295
|
|
$in.orgId= oId;
|
296
|
|
oUrl= baseUrl + '/ajax/resource/orgRalateRes';
|
297
|
|
}
|
298
|
|
mui.ajax(oUrl,{
|
299
|
|
data: $in,
|
|
289
|
function interestingResources() {
|
|
290
|
mui.ajax(baseUrl+"/ajax/resource/ralateResources",{
|
|
291
|
data: {"resourceId": resourceId},
|
300
|
292
|
dataType: "json",
|
301
|
293
|
traditional: true,
|
302
|
294
|
type: 'get', //HTTP请求类型
|
303
|
295
|
success: function(data) {
|
304
|
296
|
if(data.success) {
|
|
297
|
console.log(JSON.stringify(data))
|
305
|
298
|
if(data.data.length == 0) {
|
306
|
|
document.getElementById("likeResource").parentNode.style.display="none";
|
307
|
299
|
return;
|
308
|
300
|
}
|
|
301
|
document.getElementById("likeResource").parentNode.classList.remove("displayNone");
|
309
|
302
|
var $respond=data.data;
|
310
|
|
for(var i = 0; i < $respond.length; i++) {
|
311
|
|
if($respond[i].organization) {
|
312
|
|
var stl={};
|
313
|
|
stl.sty="";
|
314
|
|
stl.title="";
|
315
|
|
if($respond[i].organization.authStatus==3) {
|
316
|
|
stl.sty="authicon-com-ok";
|
317
|
|
stl.title="认证企业";
|
|
303
|
var lengthT;
|
|
304
|
if($respond.length>5){
|
|
305
|
lengthT=5;
|
|
306
|
}else{
|
|
307
|
lengthT=$respond.length
|
|
308
|
}
|
|
309
|
for(var i = 0; i < lengthT; i++) {
|
|
310
|
(function(n) {
|
|
311
|
var imgL="../images/default-resource.jpg";
|
|
312
|
if($respond[i].images.length){
|
|
313
|
imgL=baseUrl+'/data/resource/' + $respond[i].images[0].imageSrc
|
318
|
314
|
}
|
319
|
|
var name="";
|
320
|
|
if($respond[i].organization.forShort){
|
321
|
|
name= $respond[i].organization.forShort;
|
|
315
|
var oURL;
|
|
316
|
if($respond[i].resourceType==1) {
|
|
317
|
oURL="/ajax/professor/baseInfo/"+$respond[i].professorId;
|
322
|
318
|
}else{
|
323
|
|
name= $respond[i].organization.name;
|
|
319
|
oURL="/ajax/org/" + $respond[i].orgId;
|
324
|
320
|
}
|
325
|
|
}else {
|
326
|
|
var stl = autho($respond[i].editProfessor.authType, $respond[i].editProfessor.orgAuth, $respond[i].editProfessor.authStatus);
|
327
|
|
var name= $respond[i].editProfessor.name;
|
328
|
|
}
|
329
|
|
|
330
|
|
var likeRUl = document.getElementById("likeResource");
|
331
|
|
var likeRli = document.createElement("li");
|
332
|
|
likeRli.className = 'mui-table-view-cell';
|
333
|
|
likeRli.setAttribute("data-id", $respond[i].resourceId);
|
334
|
|
var oStr = '';
|
335
|
|
oStr +='<div class="flexCenter OflexCenter mui-clearfix">'
|
336
|
|
if($respond[i].images.length) {
|
337
|
|
oStr += '<div class="madiaHead resouseHead" style="background-image: url('+baseUrl+'/data/resource/'+$respond[i].images[0].imageSrc+')"></div>';
|
338
|
|
} else {
|
339
|
|
oStr += '<div class="madiaHead resouseHead"></div>'
|
340
|
|
}
|
341
|
|
oStr += '<div class="madiaInfo OmadiaInfo">'
|
342
|
|
oStr += '<p class="mui-ellipsis h1Font">' + $respond[i].resourceName + '</p>'
|
343
|
|
oStr += '<p class="mui-ellipsis h2Font">用途:' + $respond[i].supportedServices + '</p>'
|
344
|
|
oStr += '<p><span class="h2Font">' + name + '</span><em class="authicon ' + stl.sty + '" title="' + stl.title + '"></em></p>'
|
345
|
|
oStr += '</div></div>';
|
346
|
|
likeRli.innerHTML = oStr;
|
347
|
|
likeRUl.appendChild(likeRli,likeRUl.lastChild);
|
|
321
|
mui.ajax(baseUrl+oURL,{
|
|
322
|
"type": "GET",
|
|
323
|
'dataType': "json",
|
|
324
|
"success": function(data) {
|
|
325
|
if(data.success){
|
|
326
|
console.log(JSON.stringify(data))
|
|
327
|
var thisName,userType,thisAuth,thisTitle
|
|
328
|
if(data.data.forShort){
|
|
329
|
thisName=data.data.forShort;
|
|
330
|
}else{
|
|
331
|
thisName=data.data.name;
|
|
332
|
}
|
|
333
|
if($respond.resourceType==1) {
|
|
334
|
userType = autho(data.data.authType, data.data.orgAuth, data.data.authStatus);
|
|
335
|
thisTitle = userType.title;
|
|
336
|
thisAuth = userType.sty;
|
|
337
|
}else {
|
|
338
|
if(data.data.authStatus==3) {
|
|
339
|
thisTitle = "科袖认证企业";
|
|
340
|
thisAuth = "authicon-com-ok";
|
|
341
|
}
|
|
342
|
}
|
|
343
|
var add = document.createElement("li");
|
|
344
|
add.className = "mui-table-view-cell";
|
|
345
|
add.setAttribute("data-id",$respond[n].resourceId);
|
|
346
|
var itemlist = '<div class="flexCenter OflexCenter"><div class="madiaHead resourceHead" style="background-image:url('+imgL+')"></div>';
|
|
347
|
itemlist += '<div class="madiaInfo OmadiaInfo">';
|
|
348
|
itemlist += '<p class="mui-ellipsis h2Font" id="usertitle">'+$respond[n].resourceName+'</p>';
|
|
349
|
itemlist += '<p><span class="h1Font">'+thisName+'</span><em class="authicon '+thisAuth+'" title="'+thisTitle+'"></em></p>';
|
|
350
|
itemlist += '</div></div>';
|
|
351
|
|
|
352
|
add.innerHTML=itemlist;
|
|
353
|
document.getElementById("likeResource").appendChild(add);
|
|
354
|
}
|
|
355
|
},
|
|
356
|
'error': function(xhr, type, errorThrown) {
|
|
357
|
plus.nativeUI.toast("服务器链接超时", toastStyle);
|
|
358
|
}
|
|
359
|
});
|
|
360
|
})(i);
|
348
|
361
|
}
|
349
|
362
|
}
|
350
|
363
|
},
|
|
@ -389,12 +402,23 @@ mui.plusReady(function() {
|
389
|
402
|
//相关文章详情
|
390
|
403
|
mui('#likeArtical').on('tap', 'li', function() {
|
391
|
404
|
var artId = this.getAttribute("data-id");
|
392
|
|
var professorId = othisInfo.getAttribute("data-id");
|
393
|
|
plus.nativeUI.showWaiting();
|
394
|
|
plus.webview.create("../html/professorArticle.html", 'professorArticle.html', {}, {
|
395
|
|
articleId: artId,
|
396
|
|
ownerid: professorId
|
397
|
|
});
|
|
405
|
var ownId = othisInfo.getAttribute("data-id");
|
|
406
|
var typeN = this.getAttribute("data-type");
|
|
407
|
if(typeN==1){
|
|
408
|
plus.nativeUI.showWaiting();
|
|
409
|
plus.webview.create("../html/professorArticle.html", 'professorArticle.html', {}, {
|
|
410
|
articleId: artId,
|
|
411
|
ownerid: ownId
|
|
412
|
});
|
|
413
|
}else{
|
|
414
|
plus.nativeUI.showWaiting();
|
|
415
|
plus.webview.create("../html/professorArticle.html", 'professorArticle.html', {}, {
|
|
416
|
articleId: artId,
|
|
417
|
ownerid: ownId,
|
|
418
|
flag:1
|
|
419
|
});
|
|
420
|
}
|
|
421
|
|
398
|
422
|
});
|
399
|
423
|
//感兴趣的资源详情
|
400
|
424
|
mui('#likeResource').on('tap', 'li', function() {
|