瀏覽代碼

需求浏览详情

luyanan 7 年之前
父節點
當前提交
ce4596d864
共有 2 個文件被更改,包括 388 次插入0 次删除
  1. 114 0
      demandShow.html
  2. 274 0
      js/demandShow.js

+ 114 - 0
demandShow.html

@ -0,0 +1,114 @@
1
 <!DOCTYPE html>
2
<html>
3
<head>
4
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
6
<meta http-equiv="X-UA-Compatible" content="IE=edge">
7
<title>浏览需求-科袖网</title>
8
<link rel="shortcut icon" type="image/x-icon" href="images/favicon.png" media="screen" />
9
<link href="css/bootstrap.min.css" rel="stylesheet">
10
<link type="text/css" href="css/common.css" rel="stylesheet">
11
<link type="text/css" href="css/genindex.css" rel="stylesheet">
12
<script type="text/javascript" src="js/jquery-1.11.1.js"></script>
13
<style type="text/css">
14
	#feedback{display: none;}
15
</style>
16
</head>
17

18
<body>
19
<header id="header">
20
	<script src="js/header.js"></script>
21
</header>
22
<div id="container">
23
	<div class="containerCon">
24
		<div class="contentCon clearfix conBlock">
25
			<div class="leftconBox floatL">
26
				<div class="showDetail">
27
					<div class="h1Font" id="demandTit"></div>
28
					<div class="operateBlock bottomShow" style="margin-top:10px;">
29
                		<ul class="clearfix" id="demandNum">
30
                			<li><span>收藏</span> <em class="operateicon operateicon2 icon-collect" id="collectBtn"></em></li>
31
							<li>
32
								<span>分享到</span>
33
								<a href="" id="weibo" target="_blank"><em class="operateicon operateicon2 icon-sina"></em></a>
34
								<em class="operateicon operateicon2 icon-wechat shareWeixin">
35
									<div class="shareCode clearfix">
36
										<div class="floatL" id="qrcode"></div>
37
										<div class="shareWord floatR">
38
											<p>打开微信“扫一扫”,<br/>打开网页后点击屏幕右上角“分享”按钮</p>
39
										</div>
40
									</div>
41
								</em>
42
							</li>
43
                		</ul>
44
                	</div>
45
					<!--详情区-->
46
					<div class="showMain">
47
						<div class="showCon" style="min-height: 60px;" id="demandDesp"></div>
48
						<ul class="showli clearfix h3Font" id="demandInf">
49
							
50
						</ul>
51
						<div class="showStatus">
52
							
53
						</div>
54
					</div>
55
				</div>
56
			</div>
57
			<div class="rightconBox floatR">
58
				<div class="conItem conItemG alignCenter" style="border:none;">
59
					<a href="" class="madiaHead cmpHead">
60
						<div class="boxBlock">
61
							<img class="boxBlockimg" src="" id="companyImg">
62
						</div>
63
					</a>
64
					<div class="proInfo h3Font clearfix">
65
						<a  class="h1Font qiyego" id="Qname"></a>
66
						<span class="authiconNew" id="QauthFlag"></span>
67
					</div>
68
					<div class="goSpan">
69
						<span class="attenSpan">关注</span>
70
					</div>
71
					<div class="form-item otherBlock currentBlock">
72
						<div class="aboutTit">联系人</div>
73
						<div class="form-result addexpertRe" style="margin-top:0">
74
							<ul class="addexpert" id="expertli">
75
								
76
							</ul>
77
						</div>
78
					</div>
79
				</div>
80
			</div>
81
		</div>
82
	</div>
83
</div>
84
<!--反馈建议-->
85
<script type="text/javascript" src="js/correctBack.js"></script>
86
<footer>
87
	<script type="text/javascript" src="js/footer.js"></script>
88
</footer>
89
<script type="text/javascript" src="js/jquery.cookie.js"></script>
90
<script type="text/javascript" src="js/jquery.similar.msgbox.js"></script>
91
<script type="text/javascript" src="js/weixinshare/qrcode.min.js"></script>
92
<script type="text/javascript" src="js/jquery.page.js"></script>
93
<script type="text/javascript" src="js/common.js"></script>
94
<script type="text/javascript" src="js/demandShow.js"></script>
95
<script type="text/javascript">
96
	//分享关注按钮
97
	$('.shareWeixin').hover(function(){$(this).find('.shareCode').stop(true,false).fadeToggle();});
98
	$('.goSpan').hover(function(){$(this).find('.shareCode').stop(true,false).fadeToggle();});
99
	
100
	//微信分享
101
	var qrcode = new QRCode(document.getElementById("qrcode"), {
102
		width : 100,
103
		height : 100
104
	});
105
	function makeCode(){
106
		var hurl = window.location.host;
107
		var demandId =  GetQueryString("demandId");
108
		var elurl = "http://" + hurl + "/e/z.html?id=" + demandId ; 
109
		qrcode.makeCode(elurl);
110
	}
111
	makeCode();
112
</script>
113
</body>
114
</html>

+ 274 - 0
js/demandShow.js

@ -0,0 +1,274 @@
1
$(document).ready(function() {
2
	loginStatus(); //判断个人是否登录
3
	var userid=$.cookie("userid");
4
	var demandId = GetQueryString("demandId");
5
	var consuId, demandTitle, demandContent;
6
	getDemandinfo();
7
	pageViewsVal();
8
	ifcollectionAbout(demandId,$("#collectBtn"), 7)
9
	$("#collectBtn").on("click",function() {
10
		if(userid && userid != "null" && userid != null) {
11
			if($(this).is('.icon-collected')) {
12
				cancelCollectionAbout(demandId,$(this), 7);
13
			} else {
14
				collectionAbout(demandId,$(this), 7);
15
			}
16
		} else {
17
			$.MsgBox.Alert('提示', "请先登录再进行收藏");
18
			$("#mb_btn_ok").val("去登录");
19
			var aele = document.createElement('a');
20
			$("#mb_btnbox").append(aele);
21
			$("#mb_btnbox a").css({
22
				'display': "block",
23
				'width': '100%',
24
				'height': '40px',
25
				'position': 'absolute',
26
				'bottom': '-6px',
27
				'left': '0'
28
			});
29
			aele.setAttribute('href', '../login.html');
30
		}
31
	})
32
	//点击关注按钮
33
	$(".goSpan").on('click',"span.attenSpan", function() {
34
		var pId=$(this).parent().siblings("a").attr("data-id");
35
		if(userid && userid != null && userid != "null") {
36
			if($(this).is('.attenedSpan')){
37
				cancelCollectionAbout(pId, $(this),1)
38
			} else {
39
				collectionAbout(pId, $(this),1);
40
			}
41
		}else{
42
			$.MsgBox.Alert("提示", "请先登录再进行关注");
43
			$("#mb_btn_ok").val("去登录");
44
			var aele = document.createElement('a');
45
			$("#mb_btnbox").append(aele);
46
			$("#mb_btnbox a").css({
47
				'display': "block",
48
				'width': '100%',
49
				'height': '40px',
50
				'position': 'absolute',
51
				'bottom': '-6px',
52
				'left': '0'
53
			});
54
			aele.setAttribute('href', '../login.html');
55
		}
56
	});
57
	$(".showStatus").on("click",".meSendBack",function(){
58
		if(userid=="null"||userid==undefined){
59
			location.href="login.html";
60
		}
61
		$.ajax({
62
			url: "/ajax/consult/byDemand",
63
			type: "GET",
64
			timeout: 10000,
65
			dataType: "json",
66
			data: {
67
				"demandId": demandId,
68
				"professorId": userid
69
			},
70
			success: function(data, textState) {
71
				if(data.success) {
72
					//console.log(data)
73
					if(data.data == null) {
74
						$.MsgBox.Confirm("消息", "确认回复该需求?", createConsult)
75
						$("#mb_msg").append('<span style="color:#999;font-size:12px;margin:20px;">确认后开始本次合作,将使用「我的工作台 - 咨询」功能与联系人进行沟通,由对方确认合作是否完成。</span>')
76
					} else {
77
						location.href="diloags.html?sendId="+userid+"&attrParams=professorId&consultId="+data.data+"&consultStatus=0&assessStatus=0&thanksStatus=0"
78
					}
79
				}
80
			},
81
			error: function() {
82

83
			}
84
		})
85
		
86
	})
87
	
88
	$("#expertli").on("click","li",function(){
89
		var dataId=$(this).attr("data-id");
90
		location.href="userInforShow.html?professorId="+dataId;
91
	})
92
		
93
	function getDemandinfo(){
94
		$.ajax({
95
			"url": "/ajax/demand/qo",
96
			"type": "GET",
97
			"data": {
98
				"id": demandId
99
			 },
100
			"dataType": "json",
101
			"success": function(data) {
102
				console.log(data);
103
				if(data.success) {
104
					var $da=data.data;
105
					$("#demandTit").text($da.title); //名字
106
					var thisNum="";
107
					thisNum+='<li><span>'+commenTime($da.createTime)+'</span></li>';
108
					if($da.pageViews!=0){
109
						thisNum+='<li><span>浏览量</span> <span>'+$da.pageViews+'</span></li>';
110
					}
111
					$("#demandNum").prepend(thisNum);
112
					$("#demandDesp").html($da.descp); //内容
113
					var weibopic = "http://" + window.location.host + "/images/default-paper.jpg"
114
					var weibotitle = $da.title;
115
					var weibourl = window.location.href;
116
					$("#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");
117
					var demandTit = $da.title + "-科袖网";
118
					document.title = demandTit;
119
					var strCon="";
120
					if($da.city){ strCon+='<li>所在城市:'+$da.city+'</li>' }
121
					if($da.duration!=0){ strCon+='<li>预期时长:'+demandDuration[$da.duration]+'</li>' }
122
					if($da.cost!=0){ strCon+='<li>费用预算:'+demandCost[$da.cost]+'</li>' }
123
					if($da.invalidDay){ strCon+='<li>有效期至:'+TimeTr($da.invalidDay)+'</li>' }
124
					$(strCon).appendTo($("#demandInf"));
125
					
126
					if($da.state==0){
127
						$(".showStatus").html('已过期');
128
					}else if($da.state==1){
129
						if(userid==$da.creator){
130
							$(".showStatus").html('发布中');
131
						}else{
132
							$(".showStatus").html('<input type="button" class="frmconbtn btnModel meSendBack" value="立即回复">')
133
						}
134
					}else if($da.state==2){
135
						$(".showStatus").html('已完成');
136
					}else if($da.state==3){
137
						$(".showStatus").html('已关闭');
138
					}
139
					cmpFun($da.orgId);
140
					userFun($da.creator);
141
					
142
					consuId = $da.creator;
143
					demandTitle = $da.title;
144
					demandContent = $da.descp;
145
				}
146
			},
147
			'error': function() {
148
				$.MsgBox.Alert('提示', '服务器连接超时!');
149
			}
150
		});
151
		
152
	}
153
	//浏览量
154
	function pageViewsVal() {
155
		$.ajax({
156
			"url": "/ajax/demand/incPageViews",
157
			"type": "POST",
158
			"dataType": "json",
159
			"data": {
160
				"id": demandId
161
			},
162
			"success": function(data) {
163
				console.log(data);
164
				if(data.success) {}
165
			},
166
			"error": function() {
167
				$.MsgBox.Alert('提示', '链接服务器超时')
168
			}
169
		});
170
	}
171
	
172
	/*企业用户信息*/
173
	function cmpFun(id) {
174
		$.ajax({
175
			"url": "/ajax/org/" + id,
176
			"type": "get",
177
			"async": true,
178
			"success": function(data) {
179
				if(data.success && data.data) {
180
					if(data.data.forShort) {
181
						$("#Qname").text(data.data.forShort);
182
					}else{
183
						$("#Qname").text(data.data.name);
184
					}
185
					var img="/images/default-icon.jpg";
186
					if(data.data.hasOrgLogo==1){
187
						img="/images/org/" + data.data.id + ".jpg";
188
					}
189
					$("#companyImg").attr("src",img);
190
					$("#companyImg").parents(".cmpHead").attr("href","cmpInforShow.html?orgId="+data.data.id);
191
					$("#companyImg").parents(".cmpHead").attr("data-id",data.data.id);
192
					if(data.data.authStatus==3){
193
						$("#QauthFlag").addClass("authicon-com-ok").attr("title","科袖认证企业")
194
					}
195
					if(userid){
196
						ifcollectionAbout(data.data.id,$(".goSpan").find(".attenSpan"), 6)
197
					}
198
				}
199
			},
200
			"error": function() {
201
				$.MsgBox.Alert('提示', '链接服务器超时')
202
			}
203
		});
204
	}
205
	function userFun(id) {
206
		$.ajax({
207
			"url": "/ajax/professor/editBaseInfo/" + id,
208
			"type": "get",
209
			"async": true,
210
			"datatype":"json",
211
			"success": function(data) {
212
				if(data.success && data.data) {
213
					console.log(data)
214
					var $data=data.data;
215
					var img;
216
					var oClass = autho($data.authType, $data.orgAuth, $data.authStatus);
217
					var oTitle = "";
218
					if($data.title) {
219
						oTitle = $data.title;
220
					} else {
221
						if($data.office) {
222
							oTitle = $data.office;
223
						}
224
					}
225
					if($data.hasHeadImage==1) {
226
						img = "/images/head/" + $data.id + "_l.jpg";
227
					} else {
228
						img = "../images/default-photo.jpg"
229
					}
230
					var oSt = '<li class="flexCenter" style="cursor:pointer" data-id="'+$data.id +'">'
231
					oSt += '<div class="madiaHead useHead" id="userimg" style="background-image: url(' + img + ');"></div>'
232
					oSt += '<div class = "madiaInfo" style="padding-right:0">'
233
					oSt += '<p class = "ellipsisSty">'
234
					oSt += '<span class = "h1Font" id="name">' + $data.name + '</span><em class="authiconNew ' + oClass.sty + '" title="' + oClass.title + '"></em >'
235
					oSt += '</p>'
236
					oSt += '<p class="h2Font ellipsisSty">' + oTitle + '</p>'
237
					oSt += '</div>'
238
					oSt += '</li>'
239
					var $oSt=$(oSt);
240
					$("#expertli").append($oSt);
241
				}
242
			},
243
			"error": function() {
244
				$.MsgBox.Alert('提示', '链接服务器超时')
245
			}
246
		});
247
		
248
	}
249
	
250
	function createConsult() {
251
		$.ajax({
252
			url: "/ajax/consult",
253
			type: "POST",
254
			timeout: 10000,
255
			data: {
256
				"consultType": "其他咨询",
257
				"consultTitle": demandTitle,
258
				"consultContant": demandContent,
259
				"professorId": userid,
260
				"consultantId": consuId,
261
				"demandId": demandId
262
			},
263
			success: function(data) {
264
				if(data.success) {
265
					console.log(data)
266
					location.href="diloags.html?sendId="+userid+"&attrParams=professorId&consultId="+data.data+"&consultStatus=0&assessStatus=0&thanksStatus=0"	
267
				}
268
			},
269
			error: function() {
270

271
			}
272
		})
273
	}
274
})