luyanan 7 years ago
parent
commit
0425a41d6e
1 changed files with 576 additions and 529 deletions
  1. 576 529
      cmp-portal/js/cmpInformation.js

+ 576 - 529
cmp-portal/js/cmpInformation.js

@ -1,570 +1,617 @@
1 1
$(function() {
2
	var orgId =$.cookie("orgId");
3
	var oName = "";
4
	var watchType=0;
5
	var pageSize=10;
6

7
	if(orgId) {
8
		getCmpInfo(orgId); //获取详细信息
9
		getResource(1, true); //获取发布的资源
10
		getArticle(1, true); //获取发布的文章
11
		getDemands(1,true)//获取发布的需求
12
		attentMy();
13
		
14
		$(".navconBox").on("click","li",function(){
15
			$(this).addClass("liNow").siblings().removeClass("liNow");
16
			$(".leftconBox .leftconItem").eq($(".navconBox li").index(this)).show().siblings().hide();
17
		})
18
		$(".navconBox>.mainNavUl").on("click","li:not('.rightbtn')",function(){
19
			$(".moreNav").hide();
20
		})
21
		$(".navconBox>.mainNavUl").on("click","li.rightbtn",function(){
22
			$(".moreNav").show();
23
		})
24
		$(".moreNavUl").on("click","li",function(){//获取关注对象类型标志
25
			watchType=$(this).attr("data-num");
26
			$("#item7user>.coninfobox").show();
27
			attentMy()
28
		})
29
		$("#attendmyGo").on("click",function(){
30
			$(".mainNavUl li.rightbtn").addClass("liNow").siblings().removeClass("liNow");
31
			$(".navconBox .moreNav").show();
32
			$("#item7user").show().siblings().hide();
33
			$(".moreNavUl li.attendMy").addClass("liNow").siblings().removeClass("liNow");
34
			$("#item7user>.coninfobox").eq(7).show().siblings().hide();
35
			attentMy();
36
		})
37

38
		//点击查看全部资源
39
		$(".coninfobox").on("click", "#seeMoreR", function() {
40
			document.body.scrollTop = document.documentElement.scrollTop = 0;
41
			$(".navconBox ul>li").eq(1).addClass("liNow").siblings().removeClass("liNow");
42
			$("#item1user").hide();
43
			$("#item2user").show();
44
		})
45
		//点击查看全部文章
46
		$(".coninfobox").on("click", "#seeMoreA", function() {
47
			document.body.scrollTop = document.documentElement.scrollTop = 0;
48
			$(".navconBox ul>li").eq(2).addClass("liNow").siblings().removeClass("liNow");
49
			$("#item1user").hide();
50
			$("#item3user").show();
51
		})
52
	}
53

54
	function subjectShow(data) {
55
		console.log(data)
56
		if(data != undefined && data.length != 0) {
57
			var subs=strToAry(data)
58
			if(subs.length > 0) {
59
				for(var i = 0; i < subs.length; i++) {
60
					$("#subjectShow").append("<li>" + subs[i] + "</li>");
61
				};
62
			}
63
		}
64
	}
65

66
	function qualificationShow(data) {
67
		if(data != undefined && data.length != 0) {
68
			var subs=strToAry(data)
69
			if(subs.length > 0) {
70
				for(var i = 0; i < subs.length; i++) {
71
					$("#qualification").append("<li><div class='h4tit'>" + subs[i] + "</div></li>");
72
				};
73
			}
74
		}
75
	}
2
	var orgId = $.cookie("orgId");
3
	var rows = 20,
4
		dataO = {
5
			artPublishTime:"",
6
			artShareId:"",
7
			
8
			resPublishTime:"",
9
			resShareId:"",
10
			
11
			serModifyTime: "",
12
			serId: "",
13
		},
14
		watchO={
15
			beiTime:"",
16
			beiProId:"",
17
		};
18
	var oAjax = function(url, dataS, otype, oFun,beforeFun,completeFun) {
19
			$.ajax({
20
				url:url,
21
				dataType: 'json',
22
				type: otype,
23
				data: dataS,
24
				traditional: true,
25
				beforeSend: beforeFun,
26
				success: function(res) {
27
					if(res.success) {
28
						oFun(res)
29
					}
30
				},
31
				complete:completeFun
32
	            
33
			});
34
		},	
35
		insertNodata = function (targetE,newStr) {
36
            var parent = document.getElementById(targetE).parentNode;
37
            var kong = document.createElement("div");
38
            kong.className = "con-kong";
39
            kong.innerHTML ='<div class="picbox picNull"></div>'+
40
			            '<div class="txtbox">暂时没有符合该搜索条件的内容</div>'
41
            if(newStr){
42
            	kong.querySelector(".txtbox").innerHTML = newStr;
43
            }
44
            if (parent.firstChild.className == "con-kong") {
45
                return
46
            } else {
47
                parent.insertBefore(kong,parent.firstChild);
48
            }
76 49

77
	//企业详细信息
78
	function getCmpInfo(orgId) {
79
		$.ajax({
80
			type: "get",
81
			url: "/ajax/org/" + orgId,
82
			async: false,
83
			success: function(data) {
50
        },
51
        removeNodata = function (targetE) {
52
            var parent = document.getElementById(targetE).parentNode;
53
            if (parent.firstChild.className == "con-kong") {
54
                parent.removeChild(parent.firstChild);
55
            } else {
56
                return
57
            }
58
        },
59
       	getCmpInfo=function() {
60
       		oAjax("/ajax/org/" + orgId,{}, "get", function(data){
61
       			console.log(data)
84 62
				var $info = data.data;
85
				//console.log($info)
86
				if(data.success) {
87
					if($info.hasOrgLogo) {
88
						$("#proHead").attr("src", "/images/org/" + $info.id + ".jpg");
89
					}else{
90
						$("#proHead").attr("src", "/images/default-icon.jpg");
91
					}
92
					if($info.forShort) {
93
						$("#proName").text($info.forShort);
94
					} else {
95
						$("#proName").text($info.name);
96
					}
97
					oName = $info.name;
98
					if($info.authStatus == "3") {
99
						$("#proAuth").addClass("authicon-com-ok");
100
						$("#proAuth").attr("title", "科袖认证企业");
101
					}
102
					if($info.city) {
103
						$("#proAddress").html($info.city + "<span style='margin-right:10px;'></span>");
104
					}
105
					var proOther = "";
106
					if($info.industry) {
107
						proOther = $info.industry.replace(/,/gi, " | ");
63
				if($info.resMgr){
64
					resourceListVal(true);
65
					serviceListVal(true);
66
					$(".establishments").show()
67
				}
68
				$.cookie("colMgr",$info.colMgr);
69
				$.cookie("resMgr",$info.resMgr);
70
				//主页浏览量
71
				$("#viewNums").text($info.pageViews);
72
				if($info.hasOrgLogo) {
73
					$("#proHead").attr("src", "/images/org/" + $info.id + ".jpg");
74
				}else{
75
					$("#proHead").attr("src", "/images/default-icon.jpg");
76
				}
77
				if($info.forShort) {
78
					$("#proName").text($info.forShort);
79
				} else {
80
					$("#proName").text($info.name);
81
				}
82
				commerceInfo($info.name);//工商信息
83
				if($info.authStatus == "3") {
84
					$("#proAuth").addClass("authicon-com-ok");
85
					$("#proAuth").attr("title", "科袖认证企业");
86
				}
87
				if($info.city) {
88
					$("#proAddress").html($info.city + "<span style='margin-right:10px;'></span>");
89
				}
90
				var proOther = "";
91
				if($info.industry) {
92
					proOther = $info.industry.replace(/,/gi, " | ");
93
				}
94
				$("#proOther").text(proOther);
95
				if($info.orgType == "2") {
96
					$("#proTit").html(orgTypeShow[$info.orgType] + "<span style='margin-right:10px;'></span>");
97
				}
98
				var llqtitle = $info.name + "-" + proOther + "科袖网"; //修改浏览器title信息
99
				document.title = llqtitle;
100
				//简介
101
				if($info.descp) {
102
					$("#item1user>.nodatabox").addClass("displayNone");
103
					$("#descpS").parents(".coninfobox").removeClass("displayNone");
104
					$("#descpS").text($info.descp);
105
				} else {
106
					$("#descpS").parents(".coninfobox").addClass("displayNone");
107
				}
108
				//学术领域		
109
				if($info.subject) {
110
					$("#item1user>.nodatabox").addClass("displayNone");
111
					$("#subjectShow").parents(".coninfobox").removeClass("displayNone");
112
					
113
					var subs=strToAry($info.subject)
114
					if(subs.length > 0) {
115
						for(var i = 0; i < subs.length; i++) {
116
							$("#subjectShow").append("<li>" + subs[i] + "</li>");
117
						};
108 118
					}
109
					$("#proOther").text(proOther);
110
					if($info.orgType == "2") {
111
						$("#proTit").html(orgTypeShow[$info.orgType] + "<span style='margin-right:10px;'></span>");
119
				} else {
120
					$("#subjectShow").parents(".coninfobox").addClass("displayNone");
121
				}
122
				//企业资质
123
				if($info.qualification) {
124
					var subs=strToAry($info.qualification)
125
					if(subs.length > 0) {
126
						for(var i = 0; i < subs.length; i++) {
127
							$("#qualification").append("<li><div class='h4tit'>" + subs[i] + "</div></li>");
128
						};
112 129
					}
113
					var llqtitle =$("#proName").text() + "-" + proOther + "科袖网"; //修改浏览器title信息
114
					document.title = llqtitle;
115
					//主页浏览量
116
					$("#viewNums").text($info.pageViews);
117
					//简介
118
					if($info.descp) {
119
						$("#item1user>.nodatabox").addClass("displayNone");
120
						$("#descpS").parents(".coninfobox").removeClass("displayNone");
121
						$("#descpS").text($info.descp);
122
					} else {
123
						$("#descpS").parents(".coninfobox").addClass("displayNone");
130
				} else {
131
					$("#qualification").parents(".coninfobox").hide();
132
				}
133

134
				//企业详情
135
				$("#orgName").text($info.name);
136
				if($info.orgSize) {
137
					$("#orgSize").text(orgSizeShow[$info.orgSize]);
138
				} else {
139
					$("#orgSize").parent("li").hide();
140
				}
141
				if($info.industry) {
142
					$("#orgIndustry").text($info.industry);
143
				} else {
144
					$("#orgIndustry").parent("li").hide();
145
				}
146
				if($info.city) {
147
					$("#orgCity").text($info.city);
148
				} else {
149
					$("#orgCity").parent("li").hide();
150
				}
151
				if($info.orgType) {
152
					$("#orgType").text(orgTypeShow[$info.orgType]);
153
				} else {
154
					$("#orgType").parent("li").hide();
155
				}
156

157
				if($info.foundTime) {
158
					$("#foundTime").text(TimeTr($info.foundTime));
159
				} else {
160
					$("#foundTime").parent("li").hide();
161
				}
162
				if($info.orgUrl) {
163
					$("#orgUrl").text($info.orgUrl);
164
				} else {
165
					$("#orgUrl").parent("li").hide();
166
				}
167
				if($info.addr) {
168
					$("#cmpAddress").text($info.addr);
169
				} else {
170
					$("#cmpAddress").parent("li").hide();
171
				}
172

173
				var weibotitle = $info.name;
174
				var weibourl = window.location.href;
175
				var weibopic = "http://" + window.location.host + "/images/org/" + $info.id + ".jpg";
176
				$("#weibo").attr("href", "http://service.weibo.com/share/share.php?appkey=3677230589&title=" + encodeURIComponent(weibotitle) + "&url=" + encodeURIComponent(weibourl) + "&pic=" + encodeURIComponent(weibopic) + "&content=utf-8" + "&ralateUid=6242830109&searchPic=false&style=simple");
177
			});
178
		},
179
        commerceInfo=function(oName){
180
			oAjax("/ajax/org/regInfo",{
181
				"name": oName
182
			}, "get", function(data){
183
				if(data.data) {
184
					$("#comMes").parents(".coninfobox").show();
185
					var $data = data.data;
186
					var str = "";
187
					if($data.num) {
188
						str += "<li>工商注册号:" + $data.num + "</li>"
124 189
					}
125
					//学术领域		
126
					if($info.subject) {
127
						$("#item1user>.nodatabox").addClass("displayNone");
128
						$("#subjectShow").parents(".coninfobox").removeClass("displayNone");
129
						subjectShow($info.subject);
130
					} else {
131
						$("#subjectShow").parents(".coninfobox").addClass("displayNone");
190
					if($data.code) {
191
						str += "<li>组织机构代码:" + $data.code + "</li>"
132 192
					}
133
					//企业资质
134
					if($info.qualification) {
135
						qualificationShow($info.qualification);
136
					} else {
137
						$("#qualification").parents(".coninfobox").hide();
193
					if($data.creditCode) {
194
						str += "<li>统一信用代码:" + $data.creditCode + "</li>"
138 195
					}
139

140
					//企业详情
141
					$("#orgName").text($info.name);
142
					if($info.orgSize) {
143
						//console.log(typeof($info.orgSize),orgSizeShow[$info.orgSize])
144
						$("#orgSize").text(orgSizeShow[$info.orgSize]);
145
					} else {
146
						$("#orgSize").parent("li").hide();
196
					if($data.type) {
197
						str += "<li>企业类型:" + $data.type + "</li>"
147 198
					}
148
					if($info.industry) {
149
						$("#orgIndustry").text($info.industry);
150
					} else {
151
						$("#orgIndustry").parent("li").hide();
199
					if($data.industry) {
200
						str += "<li>行业:" + $data.industry + "</li>"
152 201
					}
153
					if($info.city) {
154
						$("#orgCity").text($info.city);
155
					} else {
156
						$("#orgCity").parent("li").hide();
202
					if($data.operatingPeriod) {
203
						str += "<li>营业期限:" + $data.operatingPeriod + "</li>"
157 204
					}
158
					if($info.orgType) {
159
						$("#orgType").text(orgTypeShow[$info.orgType]);
160
					} else {
161
						$("#orgType").parent("li").hide();
205
					if($data.dayOfApproval) {
206
						str += "<li>核准日期:" + $data.dayOfApproval + "</li>"
162 207
					}
163

164
					if($info.foundTime) {
165
						$("#foundTime").text(TimeTr($info.foundTime));
166
					} else {
167
						$("#foundTime").parent("li").hide();
208
					if($data.manager) {
209
						str += "<li>登记机关:" + $data.manager + "</li>"
168 210
					}
169
					if($info.orgUrl) {
170
						$("#orgUrl").text($info.orgUrl);
171
					} else {
172
						$("#orgUrl").parent("li").hide();
211
					if($data.addr) {
212
						str += "<li>注册地址:" + $data.addr + "</li>"
173 213
					}
174
					if($info.addr) {
175
						$("#cmpAddress").text($info.addr);
176
					} else {
177
						$("#cmpAddress").parent("li").hide();
214
					if($data.scopeOfBusiness) {
215
						str += "<li>经营范围:" + $data.scopeOfBusiness + "</li>"
178 216
					}
179

180
					var weibotitle = $info.name;
181
					var weibourl = window.location.href;
182
					var weibopic = "http://" + window.location.host + "/images/org/" + $info.id + ".jpg";
183
					$("#weibo").attr("href", "http://service.weibo.com/share/share.php?appkey=3677230589&title=" + encodeURIComponent(weibotitle) + "&url=" + encodeURIComponent(weibourl) + "&pic=" + encodeURIComponent(weibopic) + "&content=utf-8" + "&ralateUid=6242830109&searchPic=false&style=simple");
217
					$("#comMes").html(str);
184 218
				}
185
			},
186
			error: function() {
187
				$.MsgBox.Alert('提示', '链接服务器超时')
188
			}
189
		});
190
	}
191
	//获取资源
192
	function getResource( pageNo, isbind) {
193
		$.ajax({
194
			"url": "/ajax/resource/pqOrgPublish",
195
			"type": "get",
196
			"async": false,
197
			"data": {
198
				"orgId": orgId,
199
				"pageSize": pageSize,
200
				"pageNo": pageNo
201
			},
202
			beforeSend: function() {
203
				$(".resourcePageCode").addClass("active").attr("disabled",true)
204
            },
205
            complete:function () {
206
            	$(".resourcePageCode").removeClass("active").removeAttr("disabled")
207
            },
208
			"success": function(data) {
209
				if(data.success) {
210
					if(data.data.total>0){
211
						$("#resCount").html(data.data.total)
212
					}else if(data.data.total>99){
213
						$("#resCount").html("99+")
219
			});
220
		},
221
       	demandListVal=function(isbind) {
222
			oAjax("/ajax/demand/pq",{
223
				"state":'1',
224
				"oid":orgId,
225
				"pageSize":5
226
			}, "get", function(data){
227
				var $info = data.data.data;
228
				if($info.length > 0){
229
					$("#showDemand").parents(".coninfobox").removeClass("displayNone");
230
					$("#item1user>.nodatabox").addClass("displayNone");
231
					for(var i = 0; i < $info.length; i++) {
232
						var liStr=$("<li></li>").appendTo("#showDemand");
233
						var $data=$info[i];
234
						var sowU="";
235
						if($data.pageViews!=0){
236
							sowU='<li><span>浏览量 '+$data.pageViews +'</span></li>'
237
						}
238
						var strCon='';
239
							strCon+='<a class="" target="_blank" href="demandShow.html?demandId='+$data.id+'" class="madiaInfo">'
240
							strCon+='<p class="h1Font ellipsisSty">'+ $data.title +'</p>'
241
							strCon+='<ul class="showliTop h3Font clearfix">'
242
							strCon+='<li><span>发布于 '+TimeTr($data.createTime)+'</span></li>'
243
							strCon+= sowU
244
							strCon+='</ul>'
245
							strCon+='<p class="h2Font ellipsisSty-2">'+$data.descp+'</p>'
246
							strCon+='<ul class="showli clearfix h3Font">'
247
							
248
							if($data.city){ strCon+='<li>所在城市:'+$data.city+'</li>' }
249
							if($data.duration!=0){ strCon+='<li>预期时长:'+demandDuration[$data.duration]+'</li>' }
250
							if($data.cost!=0){ strCon+='<li>费用预算:'+demandCost[$data.cost]+'</li>' }
251
							if($data.invalidDay){ strCon+='<li>有效期至:'+TimeTr($data.invalidDay)+'</li>' }
252
							
253
							strCon+='</ul>'
254
							strCon+='</a>'
255
						$(strCon).appendTo(liStr);
214 256
					}
215
					if(data.data.data.length > 0) {
216
						$("#showResource").parents(".coninfobox").removeClass("displayNone");
217
						$("#item1user>.nodatabox").addClass("displayNone");
218
						for(var i = 0; i < data.data.data.length; i++) {
219
							var madiaHead = '';
220
							if(data.data.data[i].images.length) {
221
								madiaHead = '/data/resource/' + data.data.data[i].images[0].imageSrc;
222
							} else {
223
								madiaHead = '/images/default-resource.jpg';
224
							}
225
							var strAdd = '';
226
							strAdd += '<li><a href="../resourceShow.html?resourceId=' + data.data.data[i].resourceId + '" class="flexCenter urlgo">';
227
							strAdd += '<div class="madiaHead resouseHead" style="background-image:url(' + madiaHead + ')"></div>';
228
							strAdd += '<div class="madiaInfo"><p class="h1Font ellipsisSty-2">' + data.data.data[i].resourceName + '</p><p class="h2Font ellipsisSty">应用用途:' + data.data.data[i].supportedServices + '</p></div>';
229
							strAdd += '</a></li>';
230

231
							var $strAdd = $(strAdd);
232
							$("#proResource").append(strAdd);
233
							if(isbind==true && i==0){
234
								var $strAddO=$(strAdd);
235
								$("#showResource").html("");
236
								$("#showResource").append($strAddO);
237
							}
257
				}else{
258
					$("#showDemand").parents(".needinfobox").addClass("displayNone");
259
				}
260
			})
261
		},
262
        articalListVal=function(isbind){
263
			var aimId="proArticel",aimIdF="showArticle",newStr="企业尚未发布任何文章"
264
			oAjax("/ajax/article/publish",{
265
				"category": "2",
266
				"owner":orgId,
267
				"publishTime":dataO.artPublishTime,
268
				"shareId": dataO.artShareId,
269
				"rows": rows
270
			}, "get", function(res){
271
				var $info = res.data;
272
				if($info.length > 0) {
273
					$("#"+aimId).show()
274
					$("#"+aimIdF).parents(".coninfobox").removeClass("displayNone");
275
					dataO.artPublishTime = $info[$info.length - 1].publishTime;
276
					dataO.artShareId = $info[$info.length - 1].shareId;
277
			
278
					for(var i = 0; i < $info.length; i++) {
279
						var sowU="",hasImg="/images/default-artical.jpg"
280
						if($info[i].articleImg) {
281
							hasImg="/data/article/" + $info[i].articleImg
238 282
						}
239
						if(isbind){
240
							$(".resoucePageCode").on("click", function () {
241
								getResource(++pageNo,false);
242
                            });
283
						if($info[i].pageViews!=0){
284
							if($info[i].articleAgree!=0){
285
								sowU='<li><span>阅读量 '+$info[i].pageViews+'</span></li><li><span>赞 '+$info[i].articleAgree+'</span></li>'
286
							}else{
287
								sowU='<li><span>阅读量 '+$info[i].pageViews+'</span></li>'
288
							}
243 289
						}
244
						if (pageNo >= Math.ceil(data.data.total /pageSize)) {
245
                            $(".resoucePageCode").unbind("click");
246
                            $(".resoucePageCode").hide();
247
                        }
290
						var itemlist = '<li>';
291
							itemlist += '<a href="/'+pageUrl('a',$info[i])+'" class="flexCenter urlgo">';
292
							itemlist += '<div class="madiaHead artHead" style="background-image:url(' + hasImg + ')"></div>';
293
							itemlist += '<div class="madiaInfo">';
294
							itemlist += '<p class="h1Font ellipsisSty-2">'+$info[i].articleTitle+'</p>';
295
							itemlist += '<ul class="h2Font clearfix">';
296
							itemlist += '<li><span class="time">' + commenTime($info[i].publishTime) + '</span></li>';
297
							itemlist += sowU
298
							itemlist += '<li><span class="leaveMsgCount"></span></li>';
299
							itemlist += '</ul></div>';
300
							itemlist += '</a></li>';
301
						var $itemlist = $(itemlist);
302
						$("#"+aimId).append($itemlist)
303
						leaveMsgCount($info[i].articleId,1,$itemlist);
248 304
						
249
					} else {
250
						$(".resoucePageCode").hide();
251
						$("#item2user .nodatabox").show();
252
						$("#item2user .nodatabox").find(".noContip").text("企业尚未发布任何资源");
305
						if(isbind && i==0){
306
							var $itemlist = $(itemlist);
307
							$("#"+aimIdF).append($itemlist);
308
							leaveMsgCount($info[0].articleId,1,$itemlist);
309
						}
253 310
					}
254 311
				}
255
			},
256
			"error": function() {
257
				$.MsgBox.Alert("提示", "服务器连接超时")
258
			}
259
		});
260
	}
261
	//获取文章
262
	function getArticle(pageNo, isbind) {
263
		$.ajax({
264
			url: "/ajax/article/pqOrgPublish",
265
			dataType: 'json', //数据格式类型
266
			type: 'GET', //http请求类型
267
			data: {
268
				"orgId": orgId,
269
				"pageSize": pageSize,
270
				"pageNo": pageNo
271
			},
272
			timeout: 10000, //超时设置
273
			beforeSend: function() {
274
				$(".expertPageCode").addClass("active").attr("disabled",true)
275
            },
276
            complete:function () {
277
            	$(".expertPageCode").removeClass("active").removeAttr("disabled")
278
            },
279
			success: function(data) {
280
				if(data.success) {
281
					if(data.data.total>0){
282
						$("#artCount").html(data.data.total)
283
					}else if(data.data.total>99){
284
						$("#artCount").html("99+")
285
					}
286
					if(data.data.data.length > 0) {
287
						$("#showArticle").parents(".coninfobox").removeClass("displayNone");
288
						$("#item1user>.nodatabox").addClass("displayNone");
289
						for(var i = 0; i < data.data.data.length; i++) {
290
							var madiaHead = '/images/default-artical.jpg';
291
							if(data.data.data[i].articleImg) {
292
								madiaHead = '/data/article/' + data.data.data[i].articleImg;
293
							}
294
							var sowU='';
295
							if(data.data.data[i].pageViews!=0){
296
								if(data.data.data[i].articleAgree!=0){
297
									sowU='<li><span>阅读量 '+data.data.data[i].pageViews+'</span></li><li><span>赞 '+data.data.data[i].articleAgree+'</span></li>'
298
								}else{
299
									sowU='<li><span>阅读量 '+data.data.data[i].pageViews+'</span></li>'
300
								}
301
							}
302
							
303
							var strAdd = '';
304
							strAdd += '<li><a href="/' + pageUrl('a',data.data.data[i]) + '" class="flexCenter urlgo">';
305
							strAdd += '<div class="madiaHead artHead" style="background-image:url(' + madiaHead + ')"></div>';
306
							strAdd += '<div class="madiaInfo"><p class="h1Font ellipsisSty-2">' + data.data.data[i].articleTitle + '</p>';
307
							strAdd += '<ul class="h2Font clearfix">';
308
							strAdd += '<li><span class="time">' + commenTime(data.data.data[i].publishTime) + '</span></li>';
309
							strAdd += sowU
310
							strAdd += '<li><span class="leaveMsgCount"></span></li>';
311
							strAdd += '</ul></div>';
312
							strAdd += '</a></li>';
313

314
							var $strAdd = $(strAdd);
315
							$("#proArticel").append($strAdd);
316
							leaveMsgCount(data.data.data[i].articleId,1,$strAdd);
317
							if(isbind==true && i==0){
318
								var $strAddO = $(strAdd);
319
								$("#showArticle").append($strAddO);
320
								leaveMsgCount(data.data.data[0].articleId,1,$strAddO);
321
							}
322

312
				var liLen=document.getElementById(aimId).querySelectorAll("li").length;
313
                removeNodata(aimId);
314
                if($info.length == 0 && liLen == 0 ){
315
                	$("#"+aimId).hide()
316
                    insertNodata(aimId,newStr);
317
                }
318
                if(isbind){
319
                	$("#"+aimId).parent().find(".js-load-more").unbind("click").on("click",function(){
320
					 	articalListVal(false)
321
					})
322
                }
323
				if ($info.length < rows) {
324
                    $("#"+aimId).parent().find(".js-load-more").unbind("click");
325
                    $("#"+aimId).parent().find(".js-load-more").hide();
326
                }
327
			},function(){
328
				$("#"+aimId).parent().find(".js-load-more").attr("disabled",true);
329
	       		$("#"+aimId).parent().find(".js-load-more").addClass("active");
330
			},function(){
331
				$("#"+aimId).parent().find(".js-load-more").removeAttr("disabled");
332
	        	$("#"+aimId).parent().find(".js-load-more").removeClass("active");
333
			})
334
		},
335
		resourceListVal=function(isbind){
336
			var aimId="proResource",aimIdF="showResource",newStr="企业尚未发布任何资源"
337
			oAjax("/ajax/resource/publish",{
338
				"category": "2",
339
				"owner":orgId,
340
				"publishTime":dataO.resPublishTime,
341
				"shareId": dataO.resShareId,
342
				"rows": rows
343
			}, "get", function(res){
344
				var $info = res.data;
345
				if($info.length > 0) {
346
					$("#"+aimId).show()
347
					$("#"+aimIdF).parents(".form-item").removeClass("displayNone");
348
					$("#"+aimIdF).parents(".coninfobox").show();
349
					dataO.resPublishTime = $info[$info.length - 1].publishTime;
350
					dataO.resShareId = $info[$info.length - 1].shareId;
351
			
352
					for(var i = 0; i < $info.length; i++) {
353
						var hasImg='/images/default-resource.jpg'
354
						if($info[i].images.length) {
355
							hasImg="/data/resource/" + $info[i].images[0].imageSrc
323 356
						}
324
						if(isbind){
325
							$(".expertPageCode").on("click", function () {
326
								getArticle(++pageNo,false);
327
                            });
357
						
358
						var itemlist = '<li>';
359
							itemlist += '<a href="resourceShow.html?resourceId=' + $info[i].resourceId + '" class="flexCenter urlgo">';
360
							itemlist += '<div class="madiaHead resouseHead" style="background-image:url(' + hasImg + ')"></div>';
361
							itemlist += '<div class="madiaInfo"><p class="h1Font ellipsisSty-2">' + $info[i].resourceName + '</p><p class="h2Font ellipsisSty">应用用途:' + $info[i].supportedServices + '</p></div>';
362
							itemlist += '</a></li>';
363
						var $itemlist = $(itemlist);
364
						$("#"+aimId).append($itemlist)
365
						
366
						if(isbind && i==0){
367
							var $itemlist = $(itemlist);
368
							$("#"+aimIdF).append($itemlist);
328 369
						}
329
						if (pageNo >= Math.ceil(data.data.total / pageSize)) {
330
                            $(".expertPageCode").unbind("click");
331
                            $(".expertPageCode").hide();
332
                        }
333
					} else {
334
						$(".expertPageCode").hide();
335
						$("#item3user  .nodatabox").show();
336
						$("#item3user  .nodatabox").find(".noContip").text("企业尚未发布任何文章");
337
						var i = 0;
338
						$("#item1user").find('.coninfobox').each(function() {
339
							if($(this).css("display") == "none") {
340
								i++;
370
					}
371
				}
372
				var liLen=document.getElementById(aimId).querySelectorAll("li").length;
373
                removeNodata(aimId);
374
                if($info.length == 0 && liLen == 0 ){
375
                	$("#"+aimId).hide()
376
                    insertNodata(aimId,newStr);
377
                }
378
                if(isbind){
379
                	$("#"+aimId).parent().find(".js-load-more").unbind("click").on("click",function(){
380
					 	resourceListVal(false)
381
					})
382
                }
383
				if ($info.length < rows) {
384
                    $("#"+aimId).parent().find(".js-load-more").unbind("click");
385
                    $("#"+aimId).parent().find(".js-load-more").hide();
386
                }
387
			},function(){
388
				$("#"+aimId).parent().find(".js-load-more").attr("disabled",true);
389
	       		$("#"+aimId).parent().find(".js-load-more").addClass("active");
390
			},function(){
391
				$("#"+aimId).parent().find(".js-load-more").removeAttr("disabled");
392
	        	$("#"+aimId).parent().find(".js-load-more").removeClass("active");
393
			})
394
		},
395
		serviceListVal=function(isbind){
396
			var aimId="proService",aimIdF="showService",newStr="企业尚未发布任何服务"
397
			oAjax("/ajax/ware/publish",{
398
				"category":"2",
399
				"owner":orgId,
400
				"modifyTime":dataO.serModifyTime,
401
				"rows": rows
402
			}, "get", function(res){
403
				var $info = res.data;
404
				if($info.length > 0) {
405
					$("#"+aimId).show()
406
					$("#"+aimIdF).parents(".form-item").removeClass("displayNone");
407
					$("#"+aimIdF).parents(".coninfobox").show();
408
					dataO.serModifyTime = $info[$info.length - 1].modifyTime;
409
			
410
					for(var i = 0; i < $info.length; i++) {
411
						var cnt="", hasImg="../images/default-service.jpg"
412
						if($info[i].images) {
413
							var subs = strToAry($info[i].images)
414
							if(subs.length > 0) {
415
								hasImg="/data/ware" + subs[0]
341 416
							}
342
						})
343
						if(i == 4) {
344
							$("#item1user").hide();
345
							$(".navconBox ul>li").eq(3).addClass("liNow").siblings().removeClass("liNow");
346
							$("#item6user").show();
417
						}
418
						var itemlist = '<li>';
419
							itemlist += '<a href="serviceShow.html?serviceId=' + $info[i].id + '" class="flexCenter urlgo">';
420
							itemlist += '<div class="madiaHead resouseHead" style="background-image:url(' + hasImg + ')"></div>';
421
							itemlist += '<div class="madiaInfo"><p class="h1Font ellipsisSty-2">' + $info[i].name + '</p><p class="h2Font ellipsisSty">' + cnt+ '</p></div>';
422
							itemlist += '</a></li>';
423
						var $itemlist = $(itemlist);
424
						$("#"+aimId).append($itemlist)
425
						
426
						if(isbind && i==0){
427
							var $itemlist = $(itemlist);
428
							$("#"+aimIdF).append($itemlist);
347 429
						}
348 430
					}
349 431
				}
350
			},
351
			error: function() {
352
				return;
353
			}
354
		});
355

356
	}
357

358
	//关注企业数量
359
	function guanzhuNum() {
360
		$.ajax({
361
			"url": "/ajax/watch/countProfessor",
362
			"type": "GET",
363
			"dataType": "json",
364
			"async": true,
365
			"data": {
432
				var liLen=document.getElementById(aimId).querySelectorAll("li").length;
433
                removeNodata(aimId);
434
                if($info.length == 0 && liLen == 0 ){
435
                	$("#"+aimId).hide()
436
                    insertNodata(aimId,newStr);
437
                }
438
                if(isbind){
439
                	$("#"+aimId).parent().find(".js-load-more").unbind("click").on("click",function(){
440
					 	serviceListVal(false)
441
					})
442
                }
443
				if ($info.length < rows) {
444
                    $("#"+aimId).parent().find(".js-load-more").unbind("click");
445
                    $("#"+aimId).parent().find(".js-load-more").hide();
446
                }
447
			},function(){
448
				$("#"+aimId).parent().find(".js-load-more").attr("disabled",true);
449
	       		$("#"+aimId).parent().find(".js-load-more").addClass("active");
450
			},function(){
451
				$("#"+aimId).parent().find(".js-load-more").removeAttr("disabled");
452
	        	$("#"+aimId).parent().find(".js-load-more").removeClass("active");
453
			})
454
		},
455
		queryPubCount=function(){
456
			oAjax("/ajax/watch/countProfessor",{//关注企业数量
366 457
				"id": orgId,
367
				"type": 6
368
			},
369
			"success": function(data) {
370
				if(data.success) {
371
					$("#attenNum").text(data.data);
458
				"type":"6"
459
			}, "GET", function(data){
460
				$("#attenNum").text(data.data);
461
			});
462
			oAjax("/ajax/article/count/publish",{//文章总数
463
				"owner": orgId,
464
				"category":"2"
465
			}, "GET", function(data){
466
				if(data.data>0){
467
					$("#artCount").text(data.data);
372 468
				}
373
			},
374
			"error": function() {
375
				$.MsgBox.Alert('提示', '链接服务器超时')
376
			}
377
		});
378
	}
379
	guanzhuNum();
380
	function comNum() {
381
		$.ajax({
382
			"url": "/ajax/org/regInfo", 
383
			"type": "get",
384
			"dataType": "json",
385
			"data": {
386
				"name": oName
387
			},
388
			"success": function(data) {
389
				if(data.success) {
390
					if(data.data) {
391
						var $data = data.data;
392
						var str = "";
393
						if($data.num) {
394
							str += "<li>工商注册号:" + $data.num + "</li>"
395
						}
396
						if($data.code) {
397
							str += "<li>组织机构代码:" + $data.code + "</li>"
398
						}
399
						if($data.creditCode) {
400
							str += "<li>统一信用代码:" + $data.creditCode + "</li>"
401
						}
402
						if($data.type) {
403
							str += "<li>企业类型:" + $data.type + "</li>"
404
						}
405
						if($data.industry) {
406
							str += "<li>行业:" + $data.industry + "</li>"
407
						}
408
						if($data.operatingPeriod) {
409
							str += "<li>营业期限:" + $data.operatingPeriod + "</li>"
410
						}
411
						if($data.dayOfApproval) {
412
							str += "<li>核准日期:" + $data.dayOfApproval + "</li>"
413
						}
414
						if($data.manager) {
415
							str += "<li>登记机关:" + $data.manager + "</li>"
416
						}
417
						if($data.addr) {
418
							str += "<li>注册地址:" + $data.addr + "</li>"
419
						}
420
						if($data.scopeOfBusiness) {
421
							str += "<li>经营范围:" + $data.scopeOfBusiness + "</li>"
422
						}
423
						$("#comMes").html(str);
424
					}else {
425
						$("#comMes").parents(".coninfobox").hide();
426
					}
427
				}else{
428
					$("#comMes").parents(".coninfobox").hide();
469
				if(data.data>0 && data.data>99){
470
					$("#artCount").text("99+");
429 471
				}
430
			},
431
			"error": function() {
432
				$.MsgBox.Alert('提示', '链接服务器超时')
433
			}
434
		});
435
	}
436
	comNum();
437
	
438
	//获取需求
439
	function getDemands(pageNo,isbind) {
440
		$.ajax({
441
			url: "/ajax/demand/pq",
442
			type: "GET",
443
			timeout: 10000,
444
			dataType: "json",
445
			data: {
446
				"state":'1',
447
				"oid":orgId,
448
				"pageNo": pageNo,
449
				"pageSize":pageSize
450
			},
451
			beforeSend: function() {
452
				$("#showDemand").append('<img src="../images/loading.gif" class="loading" />');
453
			},
454
			success: function(data) {
455
				if(data.success) {
456
					$("#showDemand").html(" ");
457
					var $info = data.data.data;
458
					if($info.length > 0){
459
						$("#showDemand").parents(".needinfobox").removeClass("displayNone");
460
						$("#item1user>.nodatabox").addClass("displayNone");
461
						for(var i = 0; i < $info.length; i++) {
462
							var liStr=$("<li></li>").appendTo("#showDemand");
463
							demandHtml($info[i],liStr);
464
						}
465
					}else{
466
						$("#showDemand").parents(".needinfobox").addClass("displayNone");
467
					}
472
			});
473
			oAjax("/ajax/resource/count/publish",{//资源总数
474
				"owner": orgId,
475
				"category":"2"
476
			}, "GET", function(data){
477
				if(data.data>0){
478
					$("#resCount").text(data.data);
468 479
				}
469
				$(".loading").remove();
470
			},
471
			error: function() {
472
				$.MsgBox.Alert('提示', '链接服务器超时')
473
			}
474
		})
475
	}
476
	function demandHtml($data,liStr) {
477
		var sowU="";
478
		if($data.pageViews!=0){
479
			sowU='<li><span>浏览量 '+$data.pageViews +'</span></li>'
480
		}
481
		var strCon='';
482
			strCon+='<a class="" target="_blank" href="demandShow.html?demandId='+$data.id+'" class="madiaInfo">'
483
			strCon+='<p class="h1Font ellipsisSty">'+ $data.title +'</p>'
484
			strCon+='<ul class="showliTop h3Font clearfix">'
485
			strCon+='<li><span>发布于 '+TimeTr($data.createTime)+'</span></li>'
486
			strCon+= sowU
487
			strCon+='</ul>'
488
			strCon+='<p class="h2Font ellipsisSty-2">'+$data.descp+'</p>'
489
			strCon+='<ul class="showli clearfix h3Font">'
490
			
491
			if($data.city){ strCon+='<li>所在城市:'+$data.city+'</li>' }
492
			if($data.duration!=0){ strCon+='<li>预期时长:'+demandDuration[$data.duration]+'</li>' }
493
			if($data.cost!=0){ strCon+='<li>费用预算:'+demandCost[$data.cost]+'</li>' }
494
			if($data.invalidDay){ strCon+='<li>有效期至:'+TimeTr($data.invalidDay)+'</li>' }
495
			
496
			strCon+='</ul>'
497
			strCon+='</a>'
498
		$(strCon).appendTo(liStr);	
499
	}
500
	
501
	//收藏与关注
502
	function attentMy(){
503
		var num=watchType;
504
		$.ajax({
505
			url: "/ajax/watch/qaWatch",
506
			dataType: 'json', //数据格式类型
507
			type: 'GET', //http请求类型
508
			data: {
480
				if(data.data>0 && data.data>99){
481
					$("#resCount").text("99+");
482
				}
483
			});
484
			oAjax("/ajax/ware/count/publish",{//服务总数
485
				"owner": orgId,
486
				"category":"2"
487
			}, "GET", function(data){
488
				if(data.data>0){
489
					$("#serCount").text(data.data);
490
				}
491
				if(data.data>0 && data.data>99){
492
					$("#serCount").text("99+");
493
				}
494
			});
495
		},
496
		attentMyself=function(isbind){
497
			var aimId="attendMy",newStr="企业尚未被任何人关注"
498
			oAjax("/ajax/watch/watchList",{//关注我的列表
509 499
				"watchObject": orgId,
510
			},
511
			timeout: 10000, //超时设置
512
			success: function(data) {
513
				if(data.success) {
514
					document.getElementById("attendMy").innerHTML="";
515
					document.getElementById("attendMy").parentNode.querySelector(".nodatabox").classList.add("displayNone");
516
					if(data.data.length>0){
517
						var datalist = data.data;
518
						for(var i = 0; i < datalist.length; i++) {
519
							var liItem = document.createElement("li");
520
							liItem.className="mui-table-view-cell";
521
							document.getElementById("attendMy").appendChild(liItem);
522
							detailPro(datalist[i],liItem);
523
						}
524
					}else{
525
						document.getElementById("attendMy").parentNode.querySelector(".nodatabox").classList.remove("displayNone");
500
				"createTime": watchO.beiTime,
501
				"professorId":watchO.beiProId,
502
				"rows":rows
503
			}, "GET", function(res){
504
				var $info = res.data;
505
				if($info.length > 0) {
506
					$("#"+aimId).show()
507
					watchO.beiTime = $info[$info.length - 1].createTime;
508
					watchO.beiProId = $info[$info.length - 1].professorId;
509
					
510
					for(var i = 0; i < $info.length; i++) {
511
						var liItem = document.createElement("li");
512
						document.getElementById("attendMy").appendChild(liItem);
513
						detailPro($info[i].professorId,liItem);
526 514
					}
527 515
				}
528
			},
529
			error: function() {
530
				return;
531
			}
532
		});
533
	}
534
	function detailPro(datalist,liItem) {
535
		var userType = autho(datalist.professor.authType, datalist.professor.orgAuth, datalist.professor.authStatus);
536
		var os = "";
537
		if(datalist.professor.title) {
538
			if(datalist.professor.orgName) {
539
				os = datalist.professor.title + "," + datalist.professor.orgName;
540
			} else {
541
				os = datalist.professor.title;
542
			}
543
		} else {
544
			if(datalist.professor.office) {
545
				if(datalist.professor.orgName) {
546
					os = datalist.professor.office + "," + datalist.professor.orgName;
516
				var liLen=document.getElementById(aimId).querySelectorAll("li").length;
517
                removeNodata(aimId);
518
                if($info.length == 0 && liLen == 0 ){
519
                	$("#"+aimId).hide()
520
                    insertNodata(aimId,newStr);
521
                }
522
                if(isbind){
523
                	$("#"+aimId).parent().find(".js-load-more").unbind("click").on("click",function(){
524
					 	attentMyself(false)
525
					})
526
                }
527
				if ($info.length < rows) {
528
                    $("#"+aimId).parent().find(".js-load-more").unbind("click");
529
                    $("#"+aimId).parent().find(".js-load-more").hide();
530
                }
531
			},function(){
532
				$("#"+aimId).parent().find(".js-load-more").attr("disabled",true);
533
	       		$("#"+aimId).parent().find(".js-load-more").addClass("active");
534
			},function(){
535
				$("#"+aimId).parent().find(".js-load-more").removeAttr("disabled");
536
	        	$("#"+aimId).parent().find(".js-load-more").removeClass("active");
537
			})
538
		},
539
		detailPro=function(pid,liItem) {
540
			oAjax("/ajax/professor/baseInfo/" + pid,{},"get",function(data){
541
				var datalist=data.data;
542
				var userType = autho(datalist.authType, datalist.orgAuth, datalist.authStatus);
543
				var os = "";
544
				if(datalist.title) {
545
					if(datalist.orgName) {
546
						os = datalist.title + "," + datalist.orgName;
547
					} else {
548
						os = datalist.title;
549
					}
547 550
				} else {
548
					os = datalist.professor.office;
551
					if(datalist.office) {
552
						if(datalist.orgName) {
553
							os = datalist.office + "," + datalist.orgName;
554
						} else {
555
							os = datalist.office;
556
						}
557
					} else {
558
						if(datalist.orgName) {
559
							os = datalist.orgName;
560
						}
561
					}
549 562
				}
550
			} else {
551
				if(datalist.professor.orgName) {
552
					os = datalist.professor.orgName;
563
				var baImg = "../images/default-photo.jpg";
564
				if(datalist.hasHeadImage == 1) {
565
					baImg = "/images/head/" + datalist.id + "_l.jpg";
553 566
				}
554
			}
555
		}
556
		var baImg = "../images/default-photo.jpg";
557
		if(datalist.professor.hasHeadImage == 1) {
558
			baImg = "/images/head/" + datalist.professor.id + "_l.jpg";
567
				var strAdd = '';
568
					strAdd += '<a target="_blank" href="userInforShow.html?professorId='+ datalist.id +'" class="flexCenter urlgo">';
569
					strAdd += '<div class="madiaHead useHead" style="width: 80px;height: 80px;margin-top: -40px;background-image:url(' + baImg + ')"></div>';
570
					strAdd += '<div class="madiaInfo" style="padding-left:92px"><p class="h1Font ellipsisSty">' + datalist.name + '</span><em class="authicon ' + userType.sty + '" title="'+userType.title+'"></em></p>';
571
					strAdd += '<p class="h2Font ellipsisSty">' + os + '</p>';
572
					strAdd += '</div>';
573
					strAdd += '</a>';
574
				liItem.innerHTML = strAdd
575
			})
576
		},
577
		bindClickFun=function(){
578
			//点击查看全部服务
579
			$(".coninfobox").on("click", "#seeMoreS", function() {
580
				document.body.scrollTop = document.documentElement.scrollTop = 0;
581
				$("#tab9user").addClass("liNow").siblings().removeClass("liNow");
582
				$("#item1user").hide();
583
				$("#item9user").show();
584
			})
585
			//点击查看全部资源
586
			$(".coninfobox").on("click", "#seeMoreR", function() {
587
				document.body.scrollTop = document.documentElement.scrollTop = 0;
588
				$("#tab2user").addClass("liNow").siblings().removeClass("liNow");
589
				$("#item1user").hide();
590
				$("#item2user").show();
591
			})
592
			//点击查看全部文章
593
			$(".coninfobox").on("click", "#seeMoreA", function() {
594
				document.body.scrollTop = document.documentElement.scrollTop = 0;
595
				$("#tab3user").addClass("liNow").siblings().removeClass("liNow");
596
				$("#item1user").hide();
597
				$("#item3user").show();
598
			})
599
			
600
			$("#attendmyGo").on("click",function(){
601
				$(".mainNavUl li.rightbtn").addClass("liNow").siblings().removeClass("liNow");
602
				$("#item8more").show();
603
				$("#item8user").show().siblings().hide();
604
				$(".moreBuUl li.attendMy").addClass("liNow").siblings().removeClass("liNow");
605
				$("#item8drop1").show().siblings().hide();
606
			})
607
	
559 608
		}
560
		var strAdd = '';
561
			strAdd += '<a target="_blank" href="../userInforShow.html?professorId='+ datalist.professor.id +'" class="flexCenter urlgo">';
562
			strAdd += '<div class="madiaHead useHead" style="width: 80px;height: 80px;margin-top: -40px;background-image:url(' + baImg + ')"></div>';
563
			strAdd += '<div class="madiaInfo" style="padding-left:92px"><p class="h1Font ellipsisSty">' + datalist.professor.name + '</span><em class="authicon ' + userType.sty + '" title="科袖认证专家"></em></p>';
564
			strAdd += '<p class="h2Font ellipsisSty">' + os + '</p>';
565
			strAdd += '</div>';
566
			strAdd += '</a>';
567
		liItem.innerHTML = strAdd
568
	}
569 609
	
610
	queryPubCount();
611
	getCmpInfo(); //获取详细信息
612
	demandListVal(true);
613
	articalListVal(true);
614
	bindClickFun();
615
	
616
	attentMyself(true);
570 617
})