Browse Source

文章预览

li 7 years ago
parent
commit
49c8c48218
2 changed files with 88 additions and 0 deletions
  1. 8 0
      articalPreview.html
  2. 80 0
      js/articalPreview.js

+ 8 - 0
articalPreview.html

@ -43,6 +43,14 @@
43 43
							</ul>
44 44
						</div>
45 45
					</div>
46
					<!--相关服务-->
47
					<div class="form-item otherShow displayNone">
48
						<div class="aboutTit">相关服务</div>
49
						<div class="form-result aboutRes">
50
							<ul id="oService">
51
							</ul>
52
						</div>
53
					</div>
46 54
					<!--相关资源-->
47 55
					<div class="form-item otherShow displayNone">
48 56
						<div class="aboutTit">相关资源</div>

+ 80 - 0
js/articalPreview.js

@ -5,6 +5,86 @@ $(function() {
5 5
	articleshow();
6 6
	relevantExperts();
7 7
	relevantResources(); 
8
	relatedServices();
9
	/*相关服务*/
10
	function relatedServices() {
11
		$.ajax({
12
			"url": "/ajax/ware/byArticle",
13
			"type": "GET",
14
			"data": {
15
				"id": articleId,
16
				"rows":5
17
			},
18
			dataType: "json",
19
			"success": function(data) {
20
				console.log(data);
21
				if(data.success) {
22
					if(data.data.length> 0) {
23
						$("#oService").parents(".otherShow").removeClass("displayNone");
24
						var StrData = data.data
25
						var lengthT;
26
						if(StrData.length>5){
27
							lengthT=5;
28
						}else{
29
							lengthT=StrData.length
30
						}
31
						for(var i = 0; i < lengthT; i++) {
32
							var $html=StrData[i]
33
							var cnt="", img="../images/default-service.jpg"
34
							if($html.images) {
35
								var subs = strToAry($html.images)
36
								if(subs.length > 0) {
37
									img="/data/ware" + subs[0]
38
								}
39
							}
40
							if($html.cnt){
41
								cnt="内容:"+$html.cnt
42
							}
43
							var itemlist = '<li data-id="'+$html.id+'">'
44
								itemlist += '<a class="flexCenter OflexCenter"><div class="madiaHead resourceHead" style="background-image:url('+img+')"></div>';
45
								itemlist += '<div class="madiaInfo OmadiaInfo">';
46
								itemlist += '<p class="ellipsisSty h1Font" id="usertitle">'+$html.name+'</p>';
47
								itemlist += '<p><span class="h2Font ownerName"></span><em class="ownerSty authiconNew"></em></p>';
48
								itemlist += '<p class="ellipsisSty-2 h2Font">'+cnt+'</p>';
49
								itemlist += '</div></a></li>';
50
							var $itemlist = $(itemlist);
51
							$("#oService").append($itemlist)
52
							if($html.category=="1"){
53
								(function(mo){
54
									cacheModel.getProfessor($html.owner,function(sc,value){
55
										if(sc){
56
											mo.find(".ownerName").html(value.name)
57
											var userType = autho(value.authType, value.orgAuth, value.authStatus);
58
											mo.find(".ownerSty").addClass(userType.sty).attr("title",userType.title)
59
										}else{
60
											console.log("error")
61
										}
62
									})
63
								})($itemlist);
64
							}else if($html.category=="2"){
65
								(function(mo){
66
									cacheModel.getCompany($html.owner,function(sc,value){
67
										if(sc){
68
											if(value.forShort){
69
												mo.find(".ownerName").html(value.forShort)
70
											}else{
71
												mo.find(".ownerName").html(value.name)
72
											}
73
											if(value.authStatus==3) {
74
												mo.find(".ownerSty").addClass("authicon-com-ok").attr("title","科袖认证企业")
75
											}
76
										}else{
77
											console.log("error")
78
										}
79
									})
80
								})($itemlist);
81
							}
82
						}
83
					}
84
				}
85
			}
86
		});
87
	}
8 88
	//文章内容
9 89
	function articleshow(){
10 90
		$.ajax({