Browse Source

文章接口变动

XMTT 6 years ago
parent
commit
5f473f6f4c
7 changed files with 150 additions and 49 deletions
  1. 40 13
      e/a.html
  2. 11 6
      e/c.html
  3. 23 18
      e/p.html
  4. 8 2
      e/r.html
  5. 14 5
      e/s.html
  6. 42 3
      js/public/cacheUtil.js
  7. 12 2
      js/search_h5.js

+ 40 - 13
e/a.html

@ -17,9 +17,9 @@
17 17
<script type="text/javascript" src="../js/public/shareLeaveWord.js"></script>	
18 18
<script type="text/javascript" src="../js/public/openApp.js"></script>	
19 19
<script type="text/javascript">
20
	addscript("ad_article_h5_a");
20
	addscript("ad_article_h5_a");
21 21
	addscript("ad_article_h5_b");
22
	addscript("ad_article_h5_c");
22
	addscript("ad_article_h5_c");
23 23
</script>
24 24
<style>
25 25
	html,body {background: #FFFFFF;}
@ -38,7 +38,7 @@
38 38
		<div class="h1Font hWeight" id="articleName"></div>
39 39
		<div class="madiaBlock">
40 40
			<ul class="mui-table-view noactiveTab">
41
				<li>
41
				<li class="plat">
42 42
					<div class="flexCenter clearfix">
43 43
						<a id="personAL">
44 44
							<div class="madiaHead useHead" id="messImg"></div>
@ -142,7 +142,7 @@
142 142
			if(reType=="1"){
143 143
				var proId=this.getAttribute("data-id");
144 144
				location.href="http://" + window.location.host + "/e/p.html?id=" + proId;
145
			}else{
145
			}else if(reType=="2"){
146 146
				var cmpId=this.getAttribute("data-id");
147 147
				location.href="http://" + window.location.host + "/e/c.html?id=" + cmpId;
148 148
			}
@ -228,17 +228,26 @@
228 228
						"articleId": oArticleModule.articleId,
229 229
						"rows": 5
230 230
					}, "get", oArticleModule.correlationArticle);
231
					document.getElementById("personAL").setAttribute("data-id",$data.professorId);
232
					oArticleModule.oAjaxGet("../ajax/professor/editBaseInfo/" + $data.professorId, "", "get", oArticleModule.professorMess);
233
				} else {
231
					document.getElementById("personAL").setAttribute("data-id",$data.ownerId);
232
					oArticleModule.oAjaxGet("../ajax/professor/editBaseInfo/" + $data.ownerId, "", "get", oArticleModule.professorMess);
233
				} else if($data.articleType == 2){
234 234
					oArticleModule.oAjaxGet("../ajax/article/ralateArticles", {
235 235
						"keys": arr,
236 236
						"orgId": oArticleModule.oWner,
237 237
						"articleId": oArticleModule.articleId,
238 238
						"rows": 5
239 239
					}, "get", oArticleModule.correlationArticle);
240
					document.getElementById("personAL").setAttribute("data-id",$data.onergId);
241
					oArticleModule.oAjaxGet("../ajax/org/" + $data.onergId, "", "get", oArticleModule.business);
240
					document.getElementById("personAL").setAttribute("data-id",$data.ownenerId);
241
					oArticleModule.oAjaxGet("../ajax/org/" + $data.ownenerId, "", "get", oArticleModule.business);
242
				}else if($data.articleType == 3){
243
					oArticleModule.oAjaxGet("../ajax/article/ralateArticles", {
244
						"keys": arr,
245
						"orgId": oArticleModule.oWner,
246
						"articleId": oArticleModule.articleId,
247
						"rows": 5
248
					}, "get", oArticleModule.correlationArticle);
249
					document.getElementById("personAL").setAttribute("data-id",$data.ownerId);
250
					oArticleModule.oAjaxGet("../ajax/platform/info", {id:$data.ownerId}, "get", oArticleModule.platform);
242 251
				}
243 252
				
244 253
			},
@ -268,6 +277,17 @@
268 277
					document.getElementById("auth").classList.add("authicon-com-ok");
269 278
				}
270 279
			},
280
			platform: function($data) {
281
				document.getElementById('name').innerHTML = $data.name;
282
				var mgimg="../images/default-icon.jpg";
283
				if($data.logo!=null) {
284
					mgimg="/data/platform" + $data.logo;
285
				}
286
                $(".plat").css("cursor","default");
287
                $(".goSpan").hide();
288
				document.getElementById("messImg").classList.add("cmpHead2");
289
				document.getElementById("messImg").innerHTML='<div class="boxBlock"><img class="boxBlockimg" id="companyImg" src="'+ mgimg+'"></div>'
290
			},
271 291
			correlationExpert: function($data) {
272 292
				if($data.length == 0) {
273 293
					return;
@ -429,9 +449,11 @@
429 449
				for(var i = 0; i < $data.length; i++) {
430 450
					var ourl, of ;
431 451
					if($data[i].articleType == 1) {
432
						ourl = "/ajax/professor/editBaseInfo/" + $data[i].professorId; of = 1;
433
					} else {
434
						ourl = "/ajax/org/" + $data[i].onergId; of = 2;
452
						ourl = "/ajax/professor/editBaseInfo/" + $data[i].ownerId; of = 1;
453
					} else if($data[i].articleType == 2) {
454
						ourl = "/ajax/org/" + $data[i].ownenerId; of = 2;
455
					} else if($data[i].articleType == 3) {
456
						ourl = "/ajax/platform/info"; of = 3;
435 457
					}
436 458
					var arImg = "../images/default-artical.jpg";
437 459
					if($data[i].articleImg) {
@ -440,6 +462,7 @@
440 462
					var title = $data[i].articleTitle;
441 463
					$.ajax({
442 464
						url:ourl,
465
						data:{id:$data[i].ownerId},
443 466
						dataType: 'json', //服务器返回json格式数据
444 467
						type: "get", //HTTP请求类型
445 468
						timeout: 10000, //超时时间设置为10秒;
@ -454,7 +477,7 @@
454 477
									var userType = autho(data.data.authType, data.data.orgAuth, data.data.authStatus);
455 478
									li.setAttribute("owner-id", data.data.id);
456 479
									li.setAttribute("data-type", 1);
457
								} else {
480
								} else if( of == 2){
458 481
									if(data.data.forShort){
459 482
										namepo = data.data.forShort;
460 483
									}else{
@ -468,6 +491,10 @@
468 491
									}
469 492
									li.setAttribute("owner-id", data.data.id);
470 493
									li.setAttribute("data-type", 2);
494
								}else if( of == 3){
495
									namepo = data.data.name;
496
									li.setAttribute("owner-id", data.data.id);
497
									li.setAttribute("data-type", 3);
471 498
								}
472 499
								li.setAttribute("data-id", $data[i].articleId);
473 500
								li.className = "mui-table-view-cell";

+ 11 - 6
e/c.html

@ -445,12 +445,15 @@ $(document).ready(function() {
445 445
							}
446 446
							var oURL;
447 447
							if(StrData[i].articleType==1) {
448
								oURL="/ajax/professor/baseInfo/"+StrData[i].professorId;
449
							}else{
450
								oURL="/ajax/org/" + StrData[i].onergId;
448
								oURL="/ajax/professor/baseInfo/"+StrData[i].ownerId;
449
							}else if(StrData[i].articleType==2){
450
								oURL="/ajax/org/" + StrData[i].ownenerId;
451
							}else if(StrData[i].articleType==3){
452
								oURL="/ajax/platform/info";
451 453
							}
452 454
							$.ajax({
453
								url:oURL, 
455
								url:oURL,
456
								"data": {id:StrData[i].ownerId},
454 457
								"type": "GET",
455 458
								'dataType': "json",
456 459
								"success": function(data) {
@ -470,15 +473,17 @@ $(document).ready(function() {
470 473
											thisAuth = userType.sty;
471 474
											add.setAttribute("owner-id", data.data.id);
472 475
											add.setAttribute("data-type", 1);
473
										}else {
476
										}else if(StrData[n].articleType==2){
474 477
											add.setAttribute("owner-id", data.data.id);
475 478
											add.setAttribute("data-type", 2);
476 479
											if(data.data.authStatus==3) {
477 480
												thisTitle = "科袖认证企业";
478 481
												thisAuth = "authicon-com-ok";
479 482
											}
483
										}else if(StrData[n].articleType==3){
484
											add.setAttribute("owner-id", data.data.id);
485
											add.setAttribute("data-type", 3);
480 486
										}
481
										
482 487
										var itemlist = '<div class="flexCenter OflexCenter clearfix"><div class="madiaHead artHead" style="background-image:url('+imgL+')"></div>';
483 488
											itemlist += '<div class="madiaInfo OmadiaInfo">';
484 489
											itemlist += '<p class="ellipsisSty-2 h1Font" id="usertitle">'+StrData[n].articleTitle+'</p>';

+ 23 - 18
e/p.html

@ -32,19 +32,19 @@
32 32
		<div class="mainbox displayNone">
33 33
			<div class="infocon madiaBlock needList" style="border:none">
34 34
				<ul class="mui-table-view" id="demandShow">
35
					<!--<li class="mui-table-view-cell">
36
						<div class="madiaInfo">
37
							<p class="h1Font ellipsisSty-2">需求主题寻求一名斯特林热机技术顾问需求主题寻求一名斯特林热机技术顾问需求主题寻求一名斯特林热机技术顾问</p>
38
							<p class="h2Font ellipsisSty-5">需求内容:我们是一家医疗器械公司,主要生产健康理疗类的电子产品,目前希望对护膝、护腰类的产品进行改进,
39
								想先找一位有资深设计经验的三维工业设计专家,通过三维建模的方式先设计出产品的三维模型,用于展示以及为后续生产做准备我们是一家医疗器械公司,主要生产健康理疗类的电子产品,目前希望对护膝、护腰类的产品进行改进,
40
								想先找一位有资深设计经验的三维工业设计专家,通过三维建模的方式先设计出</p>
41
							<div class="showli ellipsisSty">
42
								<span>北京市</span>
43
								<span>预期 1个月内</span>
44
								<span>预算 1万元以内</span>
45
								<span>有效期至 8月17日</span>
46
							</div>
47
						</div>
35
					<!--<li class="mui-table-view-cell">
36
						<div class="madiaInfo">
37
							<p class="h1Font ellipsisSty-2">需求主题寻求一名斯特林热机技术顾问需求主题寻求一名斯特林热机技术顾问需求主题寻求一名斯特林热机技术顾问</p>
38
							<p class="h2Font ellipsisSty-5">需求内容:我们是一家医疗器械公司,主要生产健康理疗类的电子产品,目前希望对护膝、护腰类的产品进行改进,
39
								想先找一位有资深设计经验的三维工业设计专家,通过三维建模的方式先设计出产品的三维模型,用于展示以及为后续生产做准备我们是一家医疗器械公司,主要生产健康理疗类的电子产品,目前希望对护膝、护腰类的产品进行改进,
40
								想先找一位有资深设计经验的三维工业设计专家,通过三维建模的方式先设计出</p>
41
							<div class="showli ellipsisSty">
42
								<span>北京市</span>
43
								<span>预期 1个月内</span>
44
								<span>预算 1万元以内</span>
45
								<span>有效期至 8月17日</span>
46
							</div>
47
						</div>
48 48
					</li>-->
49 49
				</ul>
50 50
			</div>
@ -790,7 +790,7 @@ $(document).ready(function() {
790 790
	//相关文章信息
791 791
	function relevantarticalList(){
792 792
		$.ajax({
793
			"url" : "/ajax/article/byAssProfessor",
793
				"url" : "/ajax/article/byAssProfessor",
794 794
			"type" :  "GET" ,
795 795
			"dataType" : "json",
796 796
			"data" :{"id":proId},
@ -816,12 +816,15 @@ $(document).ready(function() {
816 816
							}
817 817
							var oURL;
818 818
							if(StrData[i].articleType==1) {
819
								oURL="/ajax/professor/baseInfo/"+StrData[i].professorId;
820
							}else{
821
								oURL="/ajax/org/" + StrData[i].onergId;
819
								oURL="/ajax/professor/baseInfo/"+StrData[i].ownerId;
820
							}else if(StrData[i].articleType==2){
821
								oURL="/ajax/org/" + StrData[i].ownenerId;
822
							}else if(StrData[i].articleType==3){
823
								oURL="/ajax/platform/info";
822 824
							}
823 825
							$.ajax({
824 826
								"url":oURL,
827
								"data":{id:StrData[i].ownerId},
825 828
								"type": "GET",
826 829
								'dataType': "json",
827 830
								"success": function(data) {
@ -835,11 +838,13 @@ $(document).ready(function() {
835 838
										userType = autho(data.data.authType, data.data.orgAuth, data.data.authStatus);
836 839
										thisTitle = userType.title;
837 840
										thisAuth = userType.sty;
838
									}else {
841
									}else if(StrData[n].articleType==2){
839 842
										if(data.data.authStatus==3) {
840 843
											thisTitle = "科袖认证企业";
841 844
											thisAuth = "authicon-com-ok";
842 845
										}
846
									}else if(StrData[n].articleType==3){
847
843 848
									}
844 849
									var add = document.createElement("li");
845 850
									add.className = "mui-table-view-cell flexCenter OflexCenter"; 

+ 8 - 2
e/r.html

@ -143,7 +143,7 @@ $(document).ready(function() {
143 143
		if(reType=="1"){
144 144
			var proId=this.getAttribute("data-id");
145 145
			location.href="http://" + window.location.host + "/e/p.html?id=" + proId;
146
		}else{
146
		}else if(reType=="2"){
147 147
			var cmpId=this.getAttribute("data-id");
148 148
			location.href="http://" + window.location.host + "/e/c.html?id=" + cmpId;
149 149
		}
@ -329,7 +329,7 @@ $(document).ready(function() {
329 329
											var stl = autho(data.data.authType, data.data.orgAuth, data.data.authStatus);
330 330
											comName=data.data.name;
331 331
											likeRli.setAttribute("data-type", 1);
332
										}else {
332
										}else if($html[n].articleType==2){
333 333
											var stl={};
334 334
											stl.sty="";
335 335
											stl.title="";
@ -343,6 +343,12 @@ $(document).ready(function() {
343 343
												comName=data.data.name;
344 344
											}
345 345
											likeRli.setAttribute("data-type", 2);
346
										}else if($html[n].articleType==3){
347
											var stl={};
348
											stl.sty="";
349
											stl.title="";
350
											comName=data.data.name;
351
											likeRli.setAttribute("data-type", 3);
346 352
										}
347 353
										
348 354
										var str = ""

+ 14 - 5
e/s.html

@ -131,7 +131,7 @@
131 131
					if(reType == "1") {
132 132
						var proId = this.getAttribute("data-id");
133 133
						location.href = "http://" + window.location.host + "/e/p.html?id=" + proId;
134
					} else {
134
					} else if(reType == "2"){
135 135
						var cmpId = this.getAttribute("data-id");
136 136
						location.href = "http://" + window.location.host + "/e/c.html?id=" + cmpId;
137 137
					}
@ -371,12 +371,15 @@
371 371
									(function(n) {
372 372
										var oURL;
373 373
										if($html[i].articleType == 1) {
374
											oURL = "/ajax/professor/baseInfo/" + $html[i].professorId;
375
										} else {
376
											oURL = "/ajax/org/" + $html[i].onergId;
374
											oURL = "/ajax/professor/baseInfo/" + $html[i].ownerId;
375
										} else if($html[i].articleType == 2){
376
											oURL = "/ajax/org/" + $html[i].ownenerId;
377
										} else if($html[i].articleType == 3){
378
											oURL = "/ajax/platform/info" + $html[i].ownerId;
377 379
										}
378 380
										$.ajax({
379 381
											url: oURL,
382
											data:{id:$html[i].ownerId},
380 383
											type: "GET",
381 384
											dataType: "json",
382 385
											success: function(data) {
@ -391,7 +394,7 @@
391 394
														var stl = autho(data.data.authType, data.data.orgAuth, data.data.authStatus);
392 395
														comName = data.data.name;
393 396
														likeRli.setAttribute("data-type", 1);
394
													} else {
397
													} else if($html[n].articleType == 2) {
395 398
														var stl = {};
396 399
														stl.sty = "";
397 400
														stl.title = "";
@ -405,6 +408,12 @@
405 408
															comName = data.data.name;
406 409
														}
407 410
														likeRli.setAttribute("data-type", 2);
411
													} else if($html[n].articleType == 3) {
412
														var stl = {};
413
														stl.sty = "";
414
														stl.title = "";
415
														comName = data.data.name;
416
														likeRli.setAttribute("data-type", 3);
408 417
													}
409 418

410 419
													var str = ""

+ 42 - 3
js/public/cacheUtil.js

@ -1,6 +1,6 @@
1 1
(function(window) {
2
	var objCache={"professor":{},"company":{}};
3
	var objHCache={"professor":{},"company":{}};//队列(processing)
2
	var objCache={"professor":{},"company":{},"platform":{}};
3
	var objHCache={"professor":{},"company":{},"platform":{}};//队列(processing)
4 4

5 5
	var objCacheHandler={
6 6
		"professor":function(id){
@ -50,7 +50,32 @@
50 50
					ha[i](false);
51 51
				}
52 52
			});
53
		}
53
		},
54
		"platform":function (id) {
55
            jQuery.ajax({
56
                url:"/ajax/platform/info",
57
				data:{id:id},
58
                type:"GET",
59
                success:function(res){
60
                    var ha = objHCache.platform[id];//jilu
61
                    delete objHCache.platform[id];
62

63
                    if(res.success){
64
                        objCache.platform[id]=res.data;
65
                        for(var i = 0 ;i < ha.length;++i){
66
                            ha[i](true,res.data);
67
                        }
68
                    }else{
69
                        for(var i = 0 ;i < ha.length;++i){
70
                            ha[i](false);
71
                        }
72
                    }
73
                },
74
                error:function(dfd){
75
                    ha[i](false);
76
                }
77
            });
78
        }
54 79
	};
55 80
	
56 81
	var cacheModel={
@ -81,6 +106,20 @@
81 106
					objCacheHandler.company(id);
82 107
				}
83 108
			}
109
		},
110
		getPlatform:function(id,cb){
111
			var val =objCache.platform[id]
112
			if(val){
113
				cb(true,val);
114
			}else{
115
				if(objHCache.platform[id]){
116
					objHCache.platform[id].push(cb);
117
				}else{
118
					objHCache.platform[id]=[];
119
					objHCache.platform[id].push(cb);
120
					objCacheHandler.platform(id);
121
				}
122
			}
84 123
		}
85 124
	};
86 125
	window.cacheModel = cacheModel;

+ 12 - 2
js/search_h5.js

@ -437,7 +437,7 @@ $(function() {
437 437
							
438 438
						if($info[i].articleType=="1"){
439 439
							(function(mo){
440
								cacheModel.getProfessor($info[i].professorId,function(sc,value){
440
								cacheModel.getProfessor($info[i].ownerId,function(sc,value){
441 441
									if(sc){
442 442
										mo.find(".ownerName").html(value.name);
443 443
									}else{
@ -447,7 +447,7 @@ $(function() {
447 447
							})($itemlist);
448 448
						}else if($info[i].articleType=="2"){
449 449
							(function(mo){
450
								cacheModel.getCompany($info[i].onergId,function(sc, value){
450
								cacheModel.getCompany($info[i].ownenerId,function(sc, value){
451 451
									if(sc){
452 452
										if(value.forShort){
453 453
											mo.find(".ownerName").html(value.forShort)
@ -459,6 +459,16 @@ $(function() {
459 459
									}
460 460
								})
461 461
							})($itemlist);
462
						}else if($info[i].articleType=="3"){
463
							(function(mo){
464
								cacheModel.getPlatform($info[i].ownerId,function(sc, value){
465
									if(sc){
466
                                        mo.find(".ownerName").html(value.name);
467
									}else{
468
										console.log("error")
469
									}
470
								})
471
							})($itemlist);
462 472
						}
463 473
					}
464 474
				}