Browse Source

企业文章加上关联企业

jack 7 years ago
parent
commit
94bb3c01d9

+ 7 - 0
articalPreview.html

@ -52,6 +52,13 @@
52 52
							</ul>
53 53
						</div>
54 54
					</div>
55
					<div class="form-item otherShow displayNone">
56
						<div class="aboutTit">相关企业</div>
57
						<div class="form-result aboutRes">
58
							<ul id="busList">
59
							</ul>
60
						</div>
61
					</div>
55 62
				</div>
56 63
			</div>
57 64
			<div class="rightconBox floatR">

+ 8 - 1
articalShow.html

@ -50,7 +50,14 @@
50 50
								</ul>
51 51
							</div>
52 52
						</div>
53
						
53
						<div class="form-item otherShow displayNone">
54
							<div class="aboutTit">相关企业</div>
55
							<div class="form-result">
56
								<ul id="busList">
57
									
58
								</ul>
59
							</div>
60
						</div>
54 61
						<!--点赞模块-->
55 62
						<div class="thumbBlock">
56 63
							<span class="thumbBtn thunbgo">赞</span>

+ 14 - 0
cmp-portal/articalIssue.html

@ -149,6 +149,20 @@
149 149
						<div class="form-result">
150 150
							<ul class="addexpert" id="resources">
151 151
								
152
							</ul>
153
						</div>
154
					</div>
155
					<div class="form-item otherBlock">
156
						<div class="aboutTit">相关企业<span class="frmconmsg"></span></div>
157
						<input type="text" class="frmtype frmcontype" placeholder="请输入企业名称" id="company" value="" />
158
						<div class="form-drop displayNone">
159
							<ul class="expertlist" id="companylist">
160
								
161
							</ul>
162
						</div>
163
						<div class="form-result">
164
							<ul class="addexpert" id="companys">
165
								
152 166
							</ul>
153 167
						</div>
154 168
					</div>

+ 14 - 0
cmp-portal/articalModify.html

@ -151,6 +151,20 @@
151 151
						<div class="form-result">
152 152
							<ul class="addexpert" id="resources">
153 153
								
154
							</ul>
155
						</div>
156
					</div>
157
					<div class="form-item otherBlock">
158
						<div class="aboutTit">相关企业<span class="frmconmsg"></span></div>
159
						<input type="text" class="frmtype frmcontype" placeholder="请输入企业名称" id="company" value="" />
160
						<div class="form-drop displayNone">
161
							<ul class="expertlist" id="companylist">
162
								
163
							</ul>
164
						</div>
165
						<div class="form-result">
166
							<ul class="addexpert" id="companys">
167
								
154 168
							</ul>
155 169
						</div>
156 170
					</div>

+ 105 - 2
cmp-portal/js/articalIssue.js

@ -280,7 +280,7 @@ $(function() {
280 280
						var itemlist = '';
281 281
						$("#keydropList").html("");
282 282
						$(".keydrop").show();
283
						for(var i = 0; i < data.data.length; i++) {
283
						for(var i = 0; i < 5; i++) {
284 284
							var itemlist = '<li><p class="h2Font"></p></li>';
285 285
							$itemlist = $(itemlist);
286 286
							$("#keydropList").append($itemlist);
@ -385,12 +385,21 @@ $(function() {
385 385
			draftAdd(2);
386 386
		}
387 387
	})
388

388
function getAttrId() {
389
		var arr=[];
390
		this.each(function(){
391
			 arr.push( $(this).attr("data-id"));
392
		});
393
		return arr;
394
	}
389 395
	/*获取数据*/
390 396
	function getdata(publishTime) {
391 397
		expertli(); //相关专家
392 398
		resourcesli(); //相关咨询
393 399
		$data.orgId = orgId;
400
		if($("#companys li").length) {
401
			$data.orgs = getAttrId.call($("#companys li"));
402
		}
394 403
		$data.articleTitle = $("#newstitle").val();
395 404
		$data.subject = captiureSubInd("keyWordlist .delkeylist");
396 405
		$data.articleImg = $("#uploader").attr("data-id");
@ -543,4 +552,98 @@ $(function() {
543 552
			}
544 553
		})
545 554
	}
555
    relatCompanies("#company");
556
    /*添加相关企业*/
557
    function  relatCompanies(sel) {
558

559
	$(sel).bind({
560
		paste: function(e) {
561
			var pastedText;
562
			if (window.clipboardData  &&  window.clipboardData.getData)  {  // IE
563
				            
564
				pastedText  = $(this).val() +  window.clipboardData.getData('Text');          
565
566
			else  {            
567
				pastedText  = $(this).val() +  e.originalEvent.clipboardData.getData('Text'); //e.clipboardData.getData('text/plain');
568
				          
569
			}
570
			$(this).val(pastedText);
571
			e.preventDefault();
572
		},
573
		cut: function(e) {
574
			var $this = $(this);
575
		},
576
		blur: function() {
577
			var $this = $(this);
578
			setTimeout(function() {
579
				$this.siblings(".form-drop").hide();
580
			}, 500)
581
		},
582
		focus: function() {
583
			$(this).siblings(".form-drop").show();
584
		},
585
		keyup: function(e) {
586
			if($(this).val().trim()) {
587
				var lNum = $.trim($(this).val()).length;
588
				if(0 < lNum) {
589
					var $this = $(this)
590
					$("#companylist").parent().show();
591
					console.log($(this).val())
592
					$.ajax({
593
						"url": "/ajax/org/qr",
594
						"type": "GET",
595
						"data":{
596
							kw: $(this).val(),
597
							limit:3
598
						},
599
						"success": function(data) {
600
							console.log(data);
601
							if(data.success) {
602
								if(data.data.length == 0) {
603
									$this.siblings(".form-drop").addClass("displayNone");
604
									$this.siblings(".form-drop").find("ul").html("");
605
								} else {
606
									$this.siblings(".form-drop").removeClass("displayNone");
607
									var oSr = "";
608
									for(var i = 0; i < data.data.length; i++) {
609
										var busName=(data.data[i].forShort)?data.data[i].forShort:data.data[i].name;
610
										oSr += '<li style="min-height:40px;position:static;"data-id="'+data.data[i].id+'">' + busName + '</li>';
611
									}
612
									$this.siblings(".form-drop").find("ul").html(oSr);
613
								}
614
							} else {
615
								$this.siblings(".form-drop").addClass("displayNone");
616
								$this.siblings(".form-drop").find("ul").html("");
617
							}
618
						},
619
						dataType: "json",
620
						'error': function() {
621
							$.MsgBox.Alert('提示', '服务器连接超时!');
622
						}
623
					});
624
				}
625
			} else {
626
				$(this).siblings(".form-drop").addClass("displayNone");
627
				$(this).siblings(".form-drop").find("ul").html("");
628
			}
629
		}
630
	})
631
	$("#company").siblings(".form-drop").on("click", "li", function() {
632
		var oValue = $(this).text();
633
		var oJudge = $(this).parents(".form-drop").siblings(".form-result").find("ul li");
634
		for(var i = 0; i < oJudge.length; i++) {
635
			if(oValue == oJudge[i].innerText) {
636
				$.MsgBox.Alert('提示', '添加内容不能重复');
637
				return;
638
			}
639
		}
640
		$(this).parents(".form-drop").siblings(".form-result").find("ul").append('<li style="min-height:40px;" data-id="'+$(this).attr("data-id")+'">' + oValue + '<div class="deleteThis" style="right:0px;"></div></li>');
641
		$(this).parents(".form-drop").siblings("input").val("");
642
		if(oJudge.length == 4) {
643
			$(this).parents(".form-drop").siblings("input").val("");
644
			$("#company").hide();
645
		}
646
		$(this).parent("ul").html("")
647
	})
648
}
546 649
});

+ 147 - 1
cmp-portal/js/articalModify.js

@ -559,13 +559,23 @@ $(function() {
559 559
			})
560 560
		}
561 561
	})
562
	
562
	function getAttrId() {
563
		var arr=[];
564
		this.each(function(){
565
			 arr.push( $(this).attr("data-id"));
566
		});
567
		return arr;
568
	}
563 569
	/*获取数据*/
564 570
	function getdata(publishTime,settime) {
565 571
		expertli();//相关专家
566 572
		resourcesli();//相关咨询
567 573
	    $data.articleId = articleId;
568 574
		$data.orgId = orgId;
575
		if($("#companys li").length) {
576
			$data.orgs = getAttrId.call($("#companys li"));
577
		}
578
		
569 579
		$data.articleTitle = $("#newstitle").val();
570 580
		$data.subject = captiureSubInd("keyWordlist .delkeylist");
571 581
		$data.articleImg = $("#uploader").attr("data-id");
@ -717,5 +727,141 @@ $(function() {
717 727
		var otme = otm.substring(0, 4) + "-" + otm.substring(4, 6) + "-" + otm.substring(6, 8) + " " + otm.substring(8, 10)+ ":" + otm.substring(10, 12);
718 728
		return otme;
719 729
	}
730
 /*添加相关企业*/
731
relatCompanies("#company");
732
    /*添加相关企业*/
733
    function  relatCompanies(sel) {
720 734

735
	$(sel).bind({
736
		paste: function(e) {
737
			var pastedText;
738
			if (window.clipboardData  &&  window.clipboardData.getData)  {  // IE
739
				            
740
				pastedText  = $(this).val() +  window.clipboardData.getData('Text');          
741
742
			else  {            
743
				pastedText  = $(this).val() +  e.originalEvent.clipboardData.getData('Text'); //e.clipboardData.getData('text/plain');
744
				          
745
			}
746
			$(this).val(pastedText);
747
			e.preventDefault();
748
		},
749
		cut: function(e) {
750
			var $this = $(this);
751
		},
752
		blur: function() {
753
			var $this = $(this);
754
			setTimeout(function() {
755
				$this.siblings(".form-drop").hide();
756
			}, 500)
757
		},
758
		focus: function() {
759
			$(this).siblings(".form-drop").show();
760
		},
761
		keyup: function(e) {
762
			if($(this).val().trim()) {
763
				var lNum = $.trim($(this).val()).length;
764
				if(0 < lNum) {
765
					var $this = $(this)
766
					$("#companylist").parent().show();
767
					console.log($(this).val())
768
					$.ajax({
769
						"url": "/ajax/org/qr",
770
						"type": "GET",
771
						"data":{
772
							kw: $(this).val(),
773
							limit:3
774
						},
775
						"success": function(data) {
776
							console.log(data);
777
							if(data.success) {
778
								if(data.data.length == 0) {
779
									$this.siblings(".form-drop").addClass("displayNone");
780
									$this.siblings(".form-drop").find("ul").html("");
781
								} else {
782
									$this.siblings(".form-drop").removeClass("displayNone");
783
									var oSr = "";
784
									for(var i = 0; i < data.data.length; i++) {
785
										var busName=(data.data[i].forShort)?data.data[i].forShort:data.data[i].name;
786
										oSr += '<li style="min-height:40px;position:static;"data-id="'+data.data[i].id+'">' + busName + '</li>';
787
									}
788
									$this.siblings(".form-drop").find("ul").html(oSr);
789
								}
790
							} else {
791
								$this.siblings(".form-drop").addClass("displayNone");
792
								$this.siblings(".form-drop").find("ul").html("");
793
							}
794
						},
795
						dataType: "json",
796
						'error': function() {
797
							$.MsgBox.Alert('提示', '服务器连接超时!');
798
						}
799
					});
800
				}
801
			} else {
802
				$(this).siblings(".form-drop").addClass("displayNone");
803
				$(this).siblings(".form-drop").find("ul").html("");
804
			}
805
		}
806
	})
807
	$("#company").siblings(".form-drop").on("click", "li", function() {
808
		var oValue = $(this).text();
809
		var oJudge = $(this).parents(".form-drop").siblings(".form-result").find("ul li");
810
		for(var i = 0; i < oJudge.length; i++) {
811
			if(oValue == oJudge[i].innerText) {
812
				$.MsgBox.Alert('提示', '添加内容不能重复');
813
				return;
814
			}
815
		}
816
		$(this).parents(".form-drop").siblings(".form-result").find("ul").append('<li style="min-height:40px;" data-id="'+$(this).attr("data-id")+'">' + oValue + '<div class="deleteThis" style="right:0px;"></div></li>');
817
		$(this).parents(".form-drop").siblings("input").val("");
818
		if(oJudge.length == 4) {
819
			$(this).parents(".form-drop").siblings("input").val("");
820
			$("#company").hide();
821
		}
822
		$(this).parent("ul").html("")
823
	})
824
}
825
    companylist()
826
  //相关企业
827
	function companylist() {
828
		$.ajax({
829
		url:"/ajax/article/ralateOrg",
830
		dataType: 'json', //数据格式类型
831
		type: 'GET', //http请求类型
832
		data: {
833
			"articleId": articleId,
834
		},
835
		timeout: 10000, //超时设置
836
		success: function(data) {
837
			if(data.success) {
838
				var $data=data.data;
839
				for(var i=0;i<$data.length;i++) {
840
					angleBus.call($data[i])
841
				}
842
			}
843
		},
844
		error: function() {
845
			$.MsgBox.Alert('提示', '服务器请求失败')
846
		}
847
	});
848
	}
849
	function angleBus() {
850
		$.ajax({
851
			url: "/ajax/org/" +this.orgId,
852
			type: "GET",
853
			timeout: 10000,
854
			dataType: "json",
855
			context: $("#companys"),
856
			success: function(data) {
857
				if(data.success) {
858
					var oValue=data.data.forShort?data.data.forShort:data.data.name;
859
				this.append('<li style="min-height:40px;" data-id="'+data.data.id+'">' + oValue + '<div class="deleteThis" style="right:0px;"></div></li>')	
860
				}
861
			},
862
			error: function(XMLHttpRequest, textStats, errorThrown) {
863
				$.MsgBox.Alert('提示', '服务器请求失败')
864
			}
865
		})
866
	}
721 867
});

+ 81 - 0
js/articalPreview.js

@ -25,6 +25,7 @@ $(function() {
25 25
					if(data.data.articleType==2){
26 26
						$("#enterprise").removeClass("displayNone");
27 27
						cmpFun(data.data.orgId);
28
						companylist();
28 29
					}
29 30
				}
30 31
				var articletitle = data.data.articleTitle + "-科袖网";
@ -279,6 +280,86 @@ $(function() {
279 280
		}			
280 281
	}
281 282
	
283
	//相关企业
284
	function companylist() {
285
		$.ajax({
286
		url:"/ajax/article/ralateOrg",
287
		dataType: 'json', //数据格式类型
288
		type: 'GET', //http请求类型
289
		data: {
290
			"articleId": articleId,
291
		},
292
		timeout: 10000, //超时设置
293
		success: function(data) {
294
			if(data.success) {
295
				var $data=data.data;
296
				if($data.length) {
297
					$("#busList").parents(".form-item").show();
298
				}
299
				for(var i=0;i<$data.length;i++) {
300
					angleBus.call($data[i])
301
				}
302
			}
303
		},
304
		error: function() {
305
			$.MsgBox.Alert('提示', '服务器请求失败')
306
		}
307
	});
308
	}
309
	function angleBus() {
310
		$.ajax({
311
			url: "/ajax/org/" +this.orgId,
312
			type: "GET",
313
			timeout: 10000,
314
			dataType: "json",
315
			context: $("#busList"),
316
			success: function(data) {
317
				if(data.success) {
318
					busfil.call(this,data.data);
319
				}
320
			},
321
			error: function(XMLHttpRequest, textStats, errorThrown) {
322
				$.MsgBox.Alert('提示', '服务器请求失败')
323
			}
324
		})
325
	}
326
	function busfil($data) {
327
	var itemlist = '<li class="proinfor flexCenter">';
328
	itemlist += '<a target="_blank" href="" class="flexCenter urlgo">';
329
	itemlist += '<div class="headblock floatL ResImgBox" style="padding:0px;"><img class="boxBlockimg" src="" id="companyImg"></div>';
330
	itemlist += '<div style="margin-left:10px;line-height:25px;color:#333;">';
331
	itemlist += '<p class="h1font"><span id="orgName"></span><em class="authiconNew"></em></p>';
332
	itemlist += '<p class="h2font ellipsisSty"><span id="orgTit"></span> <span id="orgOther"></span></p>';
333
	itemlist += '</div></a></li>';
334
	$itemlist = $(itemlist);
335
	this.append($itemlist);
336
	var datalist = $data;
337
	var companyType = datalist.authStatus;
338
	if(datalist.forShort) {
339
		$itemlist.find("#orgName").text(datalist.forShort);
340
	} else {
341
		$itemlist.find("#orgName").text(datalist.name);
342
	}
343
	$itemlist.find(".urlgo").attr("href", "cmpInforShow.html?orgId=" + datalist.id);
344
	if(datalist.hasOrgLogo) {
345
		$itemlist.find("#companyImg").attr("src", "/images/org/" + datalist.id + ".jpg");
346
	} else {
347
		$itemlist.find("#companyImg").attr("src", "/images/default-icon.jpg");
348
	}
349
	if(companyType == 3) {
350
		$itemlist.find(".authiconNew").addClass("authicon-com-ok").attr("title", "科袖认证企业");;
351
	}
352
	var orgOther = "";
353
	if(datalist.industry) {
354
		orgOther = datalist.industry.replace(/,/gi, " | ");
355
	}
356
	$itemlist.find("#orgOther").text(orgOther);
357

358
	if(datalist.orgType == "2") {
359
		$("#orgTit").html(orgTypeShow[datalist.orgType] + "<span style='margin-right:10px;'></span>");
360
	}
361

362
}
282 363
});
283 364

284 365


+ 90 - 7
js/articalShow.js

@ -46,6 +46,7 @@ $(function() {
46 46
						$("#enterprise").removeClass("displayNone");
47 47
						relevantarticalList(data.data.orgId,2);
48 48
						cmpFun(data.data.orgId);
49
						companylist();
49 50
					}
50 51
					var weibotitle = data.data.articleTitle;
51 52
					var weibourl =window.location.href;
@ -180,21 +181,21 @@ $(function() {
180 181
						$itemlist = $(itemlist);
181 182
						$("#relevantExperts").append($itemlist);
182 183
						if(data.data.title) {
183
							if(data.data.department) {
184
								$itemlist.find("#usertitle").text(data.data.title +" , "+ data.data.department);
184
							if(data.data.orgName) {
185
								$itemlist.find("#usertitle").text(data.data.title +""+ data.data.orgName);
185 186
							}else{
186 187
								$itemlist.find("#usertitle").text(data.data.title);
187 188
							}
188 189
						}else{
189 190
							if(data.data.office) {
190
								if(data.data.department) {
191
									$itemlist.find("#usertitle").text(data.data.office +" , "+ data.data.department);
191
								if(data.data.orgName) {
192
									$itemlist.find("#usertitle").text(data.data.office +""+ data.data.orgName);
192 193
								}else{
193 194
									$itemlist.find("#usertitle").text(data.data.office);
194 195
								}
195 196
							}else{
196
								if(data.data.department) {
197
									$itemlist.find("#usertitle").text(data.data.department);
197
								if(data.data.orgName) {
198
									$itemlist.find("#usertitle").text(data.data.orgName);
198 199
								}
199 200
							}
200 201
						}
@ -318,7 +319,87 @@ $(function() {
318 319
		var tagText = $(this).find("p").text();
319 320
		location.href = "searchNew.html?searchContent=" + tagText + "&tagflag=3";
320 321
	})
321
	
322
	//相关企业
323
	function companylist() {
324
		$.ajax({
325
		url:"/ajax/article/ralateOrg",
326
		dataType: 'json', //数据格式类型
327
		type: 'GET', //http请求类型
328
		data: {
329
			"articleId": articleId,
330
		},
331
		timeout: 10000, //超时设置
332
		success: function(data) {
333
			if(data.success) {
334
				
335
				var $data=data.data;
336
				if($data.length) {
337
					$("#busList").parents(".form-item").show();
338
				}
339
				for(var i=0;i<$data.length;i++) {
340
					angleBus.call($data[i])
341
				}
342
			}
343
		},
344
		error: function() {
345
			$.MsgBox.Alert('提示', '服务器请求失败')
346
		}
347
	});
348
	}
349
	function angleBus() {
350
		$.ajax({
351
			url: "/ajax/org/" +this.orgId,
352
			type: "GET",
353
			timeout: 10000,
354
			dataType: "json",
355
			context: $("#busList"),
356
			success: function(data) {
357
				if(data.success) {
358
					busfil.call(this,data.data);
359
				}
360
			},
361
			error: function(XMLHttpRequest, textStats, errorThrown) {
362
				$.MsgBox.Alert('提示', '服务器请求失败')
363
			}
364
		})
365
	}
366
	function busfil($data) {
367
	var itemlist = '<li class="proinfor flexCenter">';
368
	itemlist += '<a target="_blank" href="" class="flexCenter urlgo">';
369
	itemlist += '<div class="headblock floatL ResImgBox" style="padding:0px;"><img class="boxBlockimg" src="" id="companyImg"></div>';
370
	itemlist += '<div style="margin-left:10px;line-height:25px;color:#333;">';
371
	itemlist += '<p class="h1font"><span id="orgName"></span><em class="authiconNew"></em></p>';
372
	itemlist += '<p class="h2font ellipsisSty"><span id="orgTit"></span> <span id="orgOther"></span></p>';
373
	itemlist += '</div></a></li>';
374
	$itemlist = $(itemlist);
375
	this.append($itemlist);
376
	var datalist = $data;
377
	var companyType = datalist.authStatus;
378
	if(datalist.forShort) {
379
		$itemlist.find("#orgName").text(datalist.forShort);
380
	} else {
381
		$itemlist.find("#orgName").text(datalist.name);
382
	}
383
	$itemlist.find(".urlgo").attr("href", "cmpInforShow.html?orgId=" + datalist.id);
384
	if(datalist.hasOrgLogo) {
385
		$itemlist.find("#companyImg").attr("src", "/images/org/" + datalist.id + ".jpg");
386
	} else {
387
		$itemlist.find("#companyImg").attr("src", "/images/default-icon.jpg");
388
	}
389
	if(companyType == 3) {
390
		$itemlist.find(".authiconNew").addClass("authicon-com-ok").attr("title", "科袖认证企业");;
391
	}
392
	var orgOther = "";
393
	if(datalist.industry) {
394
		orgOther = datalist.industry.replace(/,/gi, " | ");
395
	}
396
	$itemlist.find("#orgOther").text(orgOther);
397

398
	if(datalist.orgType == "2") {
399
		$("#orgTit").html(orgTypeShow[datalist.orgType] + "<span style='margin-right:10px;'></span>");
400
	}
401

402
}
322 403
	//相关文章信息
323 404
	function relevantarticalList(id,num){
324 405
	    keysli();
@ -897,4 +978,6 @@ $(".correctSubmit").on("click",function(){
897 978
			}
898 979
		});
899 980
	}
981
	
982
	
900 983
})