Browse Source

添加收藏产品

luyanan 6 years ago
parent
commit
a5b686dd29
2 changed files with 60 additions and 10 deletions
  1. 10 0
      app/html/attentedList.html
  2. 50 10
      app/js/attentedList.js

+ 10 - 0
app/html/attentedList.html

@ -33,6 +33,7 @@
33 33
					<a class="mui-control-item" href="#item6mobile" rel="3">文章</a>
34 34
					<a class="mui-control-item" href="#item7mobile" rel="6">企业</a>
35 35
					<a class="mui-control-item" href="#item8mobile" rel="7">需求</a>
36
					<a class="mui-control-item" href="#item9mobile" rel="11">产品</a>
36 37
				</div>
37 38
			</div>
38 39
			<div class="mui-slider-group">
@ -97,6 +98,15 @@
97 98
						<div class="mui-scroll needList">
98 99
							<ul class="mui-table-view" id="likeDemand">
99 100
								
101
							</ul>
102
						</div>
103
					</div>
104
				</div>
105
				<div id="item9mobile" class="mui-slider-item mui-control-content">
106
					<div class="mui-scroll-wrapper">
107
						<div class="mui-scroll">
108
							<ul class="mui-table-view" id="likeProduct">
109
								
100 110
							</ul>
101 111
						</div>
102 112
					</div>

+ 50 - 10
app/js/attentedList.js

@ -110,6 +110,10 @@ mui.ready(function() {
110 110
						aimId="likeSer"
111 111
						newStr="您还未收藏任何服务"
112 112
						detailService(arr,aimId);
113
					}else if(type==11){
114
						aimId="likeProduct"
115
						newStr="您还未收藏任何产品"
116
						detailProduct(arr,aimId);
113 117
					}
114 118
					if (currentIndex != tabIndex) {
115 119
		                currentIndex = tabIndex;
@ -177,7 +181,6 @@ mui.ready(function() {
177 181
						
178 182
						var li = document.createElement("li");
179 183
						li.setAttribute("data-id", dataStr[i].id);
180
						li.setAttribute("data-flag", 1);
181 184
						li.className = "mui-table-view-cell flexCenter";
182 185
						li.innerHTML =
183 186
							' <div class="madiaHead useHead" style="background-image:url(' + baImg + ')"></div>' +
@ -266,7 +269,6 @@ mui.ready(function() {
266 269
						}
267 270
						var li = document.createElement("li");
268 271
						li.setAttribute("data-id", dataStr.resourceId);
269
						li.setAttribute("data-flag", 2);
270 272
						li.className = "mui-table-view-cell flexCenter OflexCenter";
271 273
						li.innerHTML =
272 274
							' <div class="madiaHead resouseHead" style="background-image:url(' + rImg + ')"></div>' +
@ -298,7 +300,6 @@ mui.ready(function() {
298 300
						}
299 301
						var li = document.createElement("li");
300 302
						li.setAttribute("data-id", dataItem.articleId);
301
						li.setAttribute("data-flag", 3);
302 303
						li.className = "mui-table-view-cell flexCenter OflexCenter";
303 304
						li.innerHTML = 
304 305
							'<div class="madiaHead artHead" style="background-image:url(' + arImg + ')"></div>' +
@ -344,7 +345,7 @@ mui.ready(function() {
344 345
					}
345 346
					
346 347
				});
347
			}
348
			},
348 349
			detailService=function(arr,obj) {
349 350
				oAjax("/ajax/ware/qm",{
350 351
					id:arr,
@ -364,8 +365,7 @@ mui.ready(function() {
364 365
							cnt="内容:"+dataStr.cnt
365 366
						}
366 367
						var li = document.createElement("li");
367
						li.setAttribute("data-id", dataStr.resourceId);
368
						li.setAttribute("data-flag", 2);
368
						li.setAttribute("data-id", dataStr.id);
369 369
						li.className = "mui-table-view-cell flexCenter OflexCenter";
370 370
						li.innerHTML =
371 371
							' <div class="madiaHead resouseHead" style="background-image:url(' + rImg + ')"></div>' +
@ -385,6 +385,39 @@ mui.ready(function() {
385 385
					}
386 386
				});
387 387
			},
388
			detailProduct=function(arr,obj) {
389
				oAjax("/ajax/product/qm",{
390
					id:arr,
391
				},"get",function(data){
392
					var dataItem=data.data;
393
					for(var i = 0; i < dataItem.length; i++) {
394
						var dataStr=dataItem[i]
395
						var cnt="", rImg = "../images/default-product.jpg";
396
						if(dataStr.images) {
397
							var subs = strToAry(dataStr.images)
398
							if(subs.length > 0) {
399
								rImg=baseUrl+"/data/product" + subs[0]
400
							}
401
						}
402
						if(dataStr.cnt){
403
							cnt="简介:"+dataStr.cnt
404
						}
405
						var li = document.createElement("li");
406
						li.setAttribute("data-id", dataStr.id);
407
						li.className = "mui-table-view-cell flexCenter OflexCenter";
408
						li.innerHTML =
409
							' <div class="madiaHead resouseHead" style="background-image:url(' + rImg + ')"></div>' +
410
							'<div class="madiaInfo OmadiaInfo">' +
411
							'<p class="mui-ellipsis h1Font">' + dataStr.name + '</p>' +
412
							'<p><span class="h2Font ownerName"></span><em class="authicon ownerSty"></em></p>' +
413
							'<p class="mui-ellipsis h2Font">'+ cnt+'</p>' +
414
							'</div>'
415
						var $itemlist = $(li);
416
						document.getElementById(obj).appendChild(li);
417
						orgSigInfo(dataStr.owner,$itemlist)
418
					}
419
				});
420
			},
388 421
			proSigInfo=function(id,$list){
389 422
				oAjax("/ajax/professor/baseInfo/"+id,{
390 423
				}, "get", function(data){
@ -453,28 +486,28 @@ mui.ready(function() {
453 486
					var id = this.getAttribute("data-id");
454 487
					plus.nativeUI.showWaiting(); //显示原生等待框
455 488
					plus.webview.create("../html/userInforShow.html", 'userInforShow.html', {}, {
456
						proid: id
489
						"proid": id
457 490
					});
458 491
				})
459 492
				mui("#likeSer").on("tap", "li", function() {
460 493
					var serviceId = this.getAttribute("data-id");
461 494
					plus.nativeUI.showWaiting();
462 495
					plus.webview.create("../html/serviceShow.html", 'serviceShow.html', {}, {
463
						serviceId: serviceId
496
						"serviceId": serviceId
464 497
					});
465 498
				})
466 499
				mui("#likeRes").on("tap", "li", function() {
467 500
					var resouId = this.getAttribute("data-id");
468 501
					plus.nativeUI.showWaiting();
469 502
					plus.webview.create("../html/resourceShow.html", 'resourceShow.html', {}, {
470
						resourceId: resouId
503
						"resourceId": resouId
471 504
					});
472 505
				})
473 506
				mui("#likeArt").on("tap", "li", function() {
474 507
					var id = this.getAttribute("data-id");
475 508
					plus.nativeUI.showWaiting();
476 509
					plus.webview.create("../html/professorArticle.html", '../html/professorArticle.html', {}, {
477
						articleId: id
510
						"articleId": id
478 511
					});
479 512
				})
480 513
				mui("#likePer").on("tap", "li", function() {
@ -505,6 +538,13 @@ mui.ready(function() {
505 538
						"demanid": id
506 539
					});
507 540
				})
541
				mui("#likeProduct").on("tap", "li", function() {
542
					var Id = this.getAttribute("data-id");
543
					plus.nativeUI.showWaiting();
544
					plus.webview.create("../html/productShow.html", 'productShow.html', {}, {
545
						"productId": Id
546
					});
547
				})
508 548
			}
509 549
		collectSorts(0,1)
510 550
		bindClickFun()