Browse Source

需求详情页面

luyanan 7 years ago
parent
commit
f72302fda6
3 changed files with 553 additions and 71 deletions
  1. 99 29
      app/html/needShow.html
  2. BIN
      app/images/article_button_guanbi_nor@3x.png
  3. 454 42
      app/js/needShow.js

+ 99 - 29
app/html/needShow.html

@ -1,50 +1,120 @@
1
<!doctype html>
1
<!DOCTYPE html>
2 2
<html>
3
3 4
	<head>
4 5
		<meta charset="UTF-8">
5
		<title>我的需求</title>
6
		<title>需求详情</title>
6 7
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
7 8
		<link href="../css/mui.min.css" rel="stylesheet" />
9
		<link href="../css/previewImage.css" rel="stylesheet" type="text/css" />
8 10
		<link href="../css/iconfont.css" rel="stylesheet" />
9 11
		<link href="../css/app.css" rel="stylesheet" />
10
		<style type="text/css">
11
			html,body{height: 100%;margin:0;padding:0px;overflow: hidden;background: #fff;}
12
			.mui-content{background: #fff;height:100%;overflow: auto;}
13
			.mui-table-view:before,.mui-table-view:after{background:#E6E6E6;}
14
			.coutopicbox{border-bottom:none;margin:0;padding:0;width:100%}
15
			.demandBtn .frmactive2{color:#FF0000}
16
			.demandBtn .frmactive2.mui-btn:enabled:active{color:#FF0000}
12
		<style>
13
			html,body{height: 100%;margin:0;padding:0px;overflow: hidden;background: #FFFFFF;}
14
			.mui-content{height:100%;overflow: auto;background: #FFFFFF;}
17 15
		</style>
18 16
	</head>
19 17
20 18
	<body>
19
		<div class="maskBlack" id="maskBlack"></div>
21 20
		<header class="mui-bar mui-bar-nav toptitbox">
22
		    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left topback"></a>
23
		    <h1 class="mui-title toptit">我的需求</h1>
21
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left topback"></a>
22
			<h1 class="mui-title toptit" id="needTit"></h1>
23
			<a class="mui-icon iconfont icon-moreandroid mui-pull-right button topmore displayNone" id="BtnMore"></a>
24
			<span class="mui-pull-right topsave displayNone" id="goUpdate">修改</span>
24 25
		</header>
25
		<div class="mui-content">
26
			<div class="conBody">
27
				<div class="contentInner demandBasic">
28
					<h3 id="demandTitle"></h3>
29
					<h5 class="coutopicbox">
30
						发布时间:<span id="poTime"></span>
31
						<em class="aimlabel" id="oDemandType"></em>
32
						<em class="aimlabel" id="oDemandAim"></em>
33
						<em class="status-1" id="oDemandStatus"></em>
34
						<!--<em class="status-5">已关闭</em>-->
35
					</h5>
36
				</div>
37
				<div class="demandCon contentInner" id="demandContent" style="word-wrap:break-word;">
38
	
39
				</div>
40
				<div class="contentInner demandBtn" id="closedDemand">
41
					<button class="mui-btn mui-btn-block frmbtn frmactive2">关闭该需求</button>
26
		<nav class="mui-bar mui-bar-tab footbox">
27
			<div class="mui-row artfoot notSelf displayNone">
28
				<div class="mui-col-xs-9">
29
					<div class="consultdiv notopen statusTip"></div>
30
				</div>
31
				<div class="mui-col-xs-2">
32
					<span class="mui-icon iconfontnew icon-shoucang" id="ifCollect"></span>
33
				</div>
34
				<div class="mui-col-xs-1 fenxBtn" id="shareOut">
35
					<span class="mui-icon iconfontnew icon-fenxiang"></span>
42 36
				</div>
43 37
			</div>
38
			<div class="mui-row artfoot mySelf displayNone">
39
				<div class="mui-col-xs-9">
40
					<div class="consultdiv notopen statusTip"></div>
41
				</div>
42
				<div class="mui-col-xs-2" id="closeBtn">
43
					<span class="mui-icon iconfontnew icon-guanbi"></span>
44
				</div>
45
				<div class="mui-col-xs-1 fenxBtn" id="shareOut2">
46
					<span class="mui-icon iconfontnew icon-fenxiang"></span>
47
				</div>
48
			</div>
49
			<div class="mui-row artfoot mySelf2 displayNone">
50
				<div class="mui-col-xs-12">
51
					<div class="consultdiv notopen statusTip" style="margin-right:-15px"></div>
52
				</div>
53
			</div>
54
		</nav>
55
		<div class="mui-content">
56
		    <div class="showDetail">
57
	    		<div class="h1Font hWeight" id="demandTit"></div>
58
	    		<div class="madiaBlock">
59
	    			<ul class="mui-table-view noactiveTab infoBlock">
60
				        <li class="mui-table-view-cell" id="personAL">
61
				            <div class="flexCenter mui-clearfix">
62
				                <div class="madiaHead cmpHead2">
63
				                	<div class="boxBlock"><img class="boxBlockimg" id="companyImg" src="../images/default-icon.jpg"></div>
64
				                </div>
65
								<div class="madiaInfo">
66
									<p class="mui-ellipsis"><span class="h1Font mui-ellipsis" id="cmpname"></span><em class="authicon " id="QauthFlag"></em></p>
67
									<p class="h3Font" id="oTime"></p>
68
								</div>
69
				            </div>
70
				        </li>
71
				    </ul>
72
	    		</div>
73
		    	<!--内容区-->
74
				<div class="showMain showMainP" style="margin-top: 0;">
75
					<ul>
76
						<li id="demandInfo">
77
							
78
						</li>
79
						<li>
80
							<div class="showTit">需求内容:</div>
81
							<div class="showCon" id="demandDesp">
82
								
83
							</div>
84
						</li>
85
					</ul>
86
				</div>
87
		    </div>
88
		</div>
89
		
90
		<div class="shareBlock" id="shareBlock">
91
			<h2 class="shareTit"><span>分享到</span></h2>
92
			<ul class="mui-table-view noactiveTab">
93
				<li class="mui-table-view-cell">
94
					<em class="wayicon wechaticon"></em>
95
					<span>微信好友</span>
96
				</li>
97
				<li class="mui-table-view-cell">
98
					<em class="wayicon friendstericon"></em>
99
					<span>微信朋友圈</span>
100
				</li>
101
				<li class="mui-table-view-cell">
102
					<em class="wayicon sinaicon"></em>
103
					<span>新浪微博</span>
104
				</li>
105
			</ul>
106
			<button type="button" class="mui-btn mui-btn-block" id="cancelShare">取消</button>
44 107
		</div>
45 108
		<script src="../js/public/mui.min.js"></script>
109
		<script src="../js/public/mui.zoom.js" type="text/javascript" charset="utf-8"></script>
110
		<script src="../js/public/mui.previewimage.js" type="text/javascript" charset="utf-8"></script>
46 111
		<script src="../js/public/base.js"></script>
112
		<script src="../js/public/jquery-1.11.1.js"></script>
47 113
		<script src="../js/needShow.js"></script>
114
		<script type="text/javascript"> 
115
			//处理iOS下弹出软键盘后头部会随页面的滚动条消失问题
116
		    iosheader();
117
		</script>
48 118
	</body>
49 119
50
</html>
120
</html>

BIN
app/images/article_button_guanbi_nor@3x.png


+ 454 - 42
app/js/needShow.js

@ -1,62 +1,474 @@
1 1
mui.ready(function() {
2 2
	mui.plusReady(function() {
3
		var consuId, demandTitle, demandContent;
3 4
		var userid = plus.storage.getItem('userid');
4 5
		var ws = plus.webview.currentWebview();
5
		if(ws.demandStatus1==0){
6
			document.getElementById("closedDemand").style.display="none";	
7
		}
8
		/*单个需求查询*/
9
		function demandAngle() {
10
			mui.ajax(baseUrl + '/ajax/demand/queryOne', {
11
				dataType: 'json', //数据格式类型
12
				type: 'GET', //http请求类型
13
				timeout: 10000, //超时设置
14
				data: {
15
					"demandId": ws.demanid
6
		var demandId = ws.demanid;
7
		var mySelf=document.getElementsByClassName("mySelf")[0];
8
		var mySelf2=document.getElementsByClassName("mySelf2")[0];
9
		var notSelf=document.getElementsByClassName("notSelf")[0];
10
		var BtnMore=document.getElementById("BtnMore");
11
		var goUpdate=document.getElementById("goUpdate");
12
		
13
		var shareOut=document.getElementById("shareOut");
14
		var shareOut2=document.getElementById("shareOut2");
15
	    var cancelShare=document.getElementById("cancelShare");
16
	    var maskBlack=document.getElementById("maskBlack");
17
	    var shareBlock=document.getElementById("shareBlock");
18
		 
19
		getDemandinfo();
20
		pageViewsVal();
21
		moreMes();//更多
22
		
23
		document.getElementById("personAL").addEventListener("tap", function() {//企业详情
24
			var cmpId=this.getAttribute("data-id");
25
			mui.openWindow({
26
				url: '../html/cmpInforShow.html',
27
				id: 'cmpInforShow.html',
28
				show: {
29
					autoShow: false,
30
					aniShow: "slide-in-right",
31
				},
32
				extras: {
33
					cmpId: cmpId
34
				}
35
			});
36
		})
37
		//收藏
38
		var oifCollect=document.getElementById("ifCollect");
39
		var ocollectBtn=document.getElementById("ifCollect").parentNode;
40
		ifcollectionAbout(demandId,oifCollect, 7);
41
		ocollectBtn.addEventListener('tap', function() {
42
			if(userid && userid != null && userid != "null") {
43
				if(oifCollect.className == 'mui-icon iconfontnew icon-yishoucang') {
44
					cancelCollectionAbout(demandId,oifCollect, 7)
45
				} else {
46
					collectionAbout(demandId,oifCollect, 7);
47
				}
48
			} else {
49
				isLogin();
50
			}
51
		});
52
		
53
		goUpdate.addEventListener('tap', function() {//修改
54
			mui.openWindow({
55
				url: '../html/demandModify.html',
56
				id: '../html/demandModify.html',
57
				show: {
58
					autoShow: false,
59
					aniShow: "slide-in-right",
16 60
				},
17
				success: function(data) {
61
				extras: {
62
					demandId: demandId
63
				}
64
			});
65
		});
66
		document.getElementById("closeBtn").addEventListener("tap", function() {//关闭
67
			var btn = ["确定", "取消"];
68
			mui.confirm("确认关闭该需求?", "提示", btn, function(e) {
69
				if(e.index == 0) {
70
					mui.ajax(baseUrl+"/ajax/demand/close",{
71
						"type": "POST",
72
						"async": false,
73
						"data":{
74
							"id":demandId,
75
							"uid":userid
76
						},
77
						"success": function(data) {
78
							if(data.success && data.data) {
79
								mySelf2.classList.remove("displayNone");
80
								mySelf.classList.add("displayNone");
81
								notSelf.classList.add("displayNone");
82
								mySelf2.querySelector(".statusTip").innerHTML="该需求 已关闭";
83
							}
84
						}
85
					});
86
				}
87
			})
88
		})
89
		 
90
	    shareOut.addEventListener("tap",function(){
91
	    	maskBlack.style.display="block";
92
	    	shareBlock.style.display="block";
93
	    })
94
	    shareOut2.addEventListener("tap",function(){
95
	    	maskBlack.style.display="block";
96
	    	shareBlock.style.display="block";
97
	    })
98
	    cancelShare.addEventListener("tap",function(){
99
	    	maskBlack.style.display="none";
100
	    	shareBlock.style.display="none";
101
	    })
102
	    maskBlack.addEventListener("tap",function(){
103
	    	this.style.display="none";
104
	    	shareBlock.style.display="none";
105
	    })
106
	    
107
		function getDemandinfo(){
108
			mui.ajax(baseUrl+"/ajax/demand/qo",{
109
				"type": "GET",
110
				"data": {
111
					"id": demandId
112
				 },
113
				"async": false,
114
				"dataType": "json",
115
				"success": function(data) {
116
					console.log(JSON.stringify(data));
18 117
					if(data.success) {
19
						var $data = data.data;
20
						var oDemandTitle = document.getElementById("demandTitle");
21
						var oDemandContent = document.getElementById("demandContent");
22
						var oDemandType = document.getElementById("oDemandType");
23
						var oDemandAim = document.getElementById("oDemandAim");
24
						var oDemandStatus = document.getElementById("oDemandStatus");
25
						var oCreateTime = document.getElementById("poTime");
26
						//						
27
						oCreateTime.innerText = $data.createTime.substr(4, 2) + "-" + $data.createTime.substr(6, 2)
28
						oDemandTitle.innerText = $data.demandTitle;
29
						oDemandContent.innerText = $data.demandContent;
30
						($data.demandStatus == 1) ? oDemandStatus.innerText = "发布中": (oDemandStatus.innerText = "已关闭",oDemandStatus.classList.remove('status-1'),oDemandStatus.classList.add('status-5'));
31
						($data.demandType == 1) ? oDemandType.innerText = "个人需求": oDemandType.innerText = "企业需求";
32
						($data.demandAim == 1) ? oDemandAim.innerText = "技术咨询": ($data.demandAim == 2) ? oDemandAim.innerText = "资源合作" : oDemandAim.innerText = "其他事务";
118
						var ws=plus.webview.currentWebview();
33 119
						plus.nativeUI.closeWaiting();
34 120
						ws.show("slide-in-right", 150);
121
						
122
						var $da=data.data;
123
						document.getElementById("needTit").innerHTML=$da.title; //名字
124
						document.getElementById("demandTit").innerHTML=$da.title; //名字
125
						document.getElementById("oTime").innerHTML=commenTime($da.createTime);
126
						document.getElementById("demandDesp").innerHTML=$da.descp; //内容
127
						
128
						var strCon="";
129
						if($da.city){ strCon+='<div class="showTit">所在城市:<span class="showCon">'+$da.city+'</span></div>' }
130
						if($da.duration!=0){ strCon+='<div class="showTit">预期时长:<span class="showCon">'+demandDuration[$da.duration]+'</span></div>' }
131
						if($da.cost!=0){ strCon+='<div class="showTit">费用预算:<span class="showCon">'+demandCost[$da.cost]+'</span></div>' }
132
						if($da.invalidDay){ strCon+='<div class="showTit">有效期至:<span class="showCon">'+TimeTr($da.invalidDay)+'</span></div>' }
133
						document.getElementById("demandInfo").innerHTML=strCon;
134
						
135
						if(userid==$da.creator){
136
							if($da.state==0){
137
								mySelf2.classList.add("displayNone");
138
								mySelf.classList.remove("displayNone");
139
								notSelf.classList.add("displayNone");
140
								goUpdate.classList.remove("displayNone");
141
								BtnMore.classList.add("displayNone");
142
								mySelf.querySelector(".statusTip").innerHTML="该需求 已过期";
143
							}else if($da.state==1){
144
								mySelf2.classList.add("displayNone");
145
								mySelf.classList.remove("displayNone");
146
								notSelf.classList.add("displayNone");
147
								goUpdate.classList.remove("displayNone");
148
								BtnMore.classList.add("displayNone");
149
								mySelf.querySelector(".statusTip").classList.remove("notopen");
150
								mySelf.querySelector(".statusTip").parentNode.setAttribute("id","overBtn")
151
								mySelf.querySelector(".statusTip").innerHTML="需求已完成";
152
								//完成
153
								document.getElementById("overBtn").addEventListener("tap", function() {
154
									overGo();
155
								})
156
							}else if($da.state==2){
157
								mySelf2.classList.remove("displayNone");
158
								mySelf.classList.add("displayNone");
159
								notSelf.classList.add("displayNone");
160
								mySelf2.querySelector(".statusTip").innerHTML="该需求 已完成";
161
							}else if($da.state==3){
162
								mySelf2.classList.remove("displayNone");
163
								mySelf.classList.add("displayNone");
164
								notSelf.classList.add("displayNone");
165
								mySelf2.querySelector(".statusTip").innerHTML="该需求 已关闭";
166
							}
167
						}else{
168
							goUpdate.classList.add("displayNone");
169
							BtnMore.classList.remove("displayNone");
170
							mySelf2.classList.add("displayNone");
171
							mySelf.classList.add("displayNone");
172
							notSelf.classList.remove("displayNone");
173
							if($da.state==1){
174
								notSelf.querySelector(".statusTip").classList.remove("notopen");
175
								notSelf.querySelector(".statusTip").parentNode.setAttribute("id","replayBtn")
176
								notSelf.querySelector(".statusTip").innerHTML="立即回复";
177
								//立即回复
178
								document.getElementById("replayBtn").addEventListener("tap", function() {
179
									replayGo();
180
								})
181
								
182
							}else{
183
								notSelf.querySelector(".statusTip").classList.add("notopen");
184
								if($da.state==0){
185
									notSelf.querySelector(".statusTip").innerHTML="该需求 已过期";
186
								}else if($da.state==2){
187
									notSelf.querySelector(".statusTip").innerHTML="该需求 已完成";
188
								}else if($da.state==3){
189
									notSelf.querySelector(".statusTip").innerHTML="该需求 已关闭";
190
								}
191
							}
192
						}
193
						cmpFun($da.orgId);
194
						
195
						consuId = $da.creator;
196
						demandTitle = $da.title;
197
						demandContent = $da.descp;
35 198
					}
36

199
				},
200
				error: function() {
201
					plus.nativeUI.toast("服务器链接超时", toastStyle);
202
					return;
203
				}
204
			});
205
			
206
		}
207
		//浏览量
208
		function pageViewsVal() {
209
			mui.ajax(baseUrl+"/ajax/demand/incPageViews",{
210
				"type": "POST",
211
				"dataType": "json",
212
				"data": {
213
					"id": demandId
214
				},
215
				"success": function(data) {
216
					if(data.success) {}
217
				},
218
				error: function() {
219
					plus.nativeUI.toast("服务器链接超时", toastStyle);
220
					return;
37 221
				}
38 222
			});
39 223
		}
40
		demandAngle();
41
		/*关闭单个需求*/
42
		document.getElementById("closedDemand").addEventListener("tap", function() {
43
			mui.ajax(baseUrl + '/ajax/demand/close', {
44
				dataType: 'json', //数据格式类型
45
				type: 'post', //http请求类型
46
				timeout: 10000, //超时设置
224
		/*企业用户信息*/
225
		function cmpFun(id) {
226
			mui.ajax(baseUrl+"/ajax/org/" + id,{
227
				"type": "get",
228
				"async": true,
229
				"success": function(data) {
230
					if(data.success && data.data) {
231
						if(data.data.forShort) {
232
							document.getElementById("cmpname").innerHTML=data.data.forShort;
233
						}else{
234
							document.getElementById("cmpname").innerHTML=data.data.name;
235
						}
236
						var img="../images/default-icon.jpg";
237
						if(data.data.hasOrgLogo==1){
238
							img=baseUrl+"/images/org/" + data.data.id + ".jpg";
239
						}
240
						document.getElementById("personAL").setAttribute("data-id",data.data.id);
241
						document.getElementById("companyImg").setAttribute("src",img);
242
						if(data.data.authStatus==3){
243
							document.getElementById("QauthFlag").classList.add("authicon-com-ok");
244
						}
245
					}
246
				},
247
				error: function() {
248
					plus.nativeUI.toast("服务器链接超时", toastStyle);
249
					return;
250
				}
251
			});
252
		}
253
		//判断是否登录,登录才可咨询,关注,收藏
254
		function isLogin() {
255
			var userid = plus.storage.getItem('userid');
256
			if(userid == null || userid == 'null' | userid == undefined | userid == 'undefined') {
257
				mui.openWindow({
258
					url: '../html/login.html',
259
					id: '../html/login.html',
260
					show: {
261
						aniShow: "slide-in-right"
262
					},
263
					extras: {
264
						ourl: self.id
265
					}
266
				});
267
				return 1;
268
			}
269
		};
270
		//点击完成按钮调用函数
271
		function overGo(){
272
			var btn = ["确定", "取消"];
273
			mui.confirm("确认该需求已解决?", "提示", btn, function(e) {
274
				if(e.index == 0) {
275
					mui.ajax(baseUrl+"/ajax/demand/over",{
276
						"type": "POST",
277
						"async": false,
278
						"data":{
279
							"id":demandId,
280
							"uid":userid
281
						},
282
						"success": function(data) {
283
							if(data.success && data.data) {
284
								mySelf2.classList.remove("displayNone");
285
								mySelf.classList.add("displayNone");
286
								notSelf.classList.add("displayNone");
287
								mySelf2.querySelector(".statusTip").innerHTML="该需求 已完成";
288
							}
289
						}
290
					});
291
				}
292
			})
293
		}
294
		//点击回复按钮调用函数
295
		function replayGo(){
296
			if(userid && userid != null && userid != "null") {
297
				mui.ajax(baseUrl+"/ajax/consult/byDemand",{
298
					"type": "GET",
299
					"async": false,
300
					"data":{
301
						"demandId":demandId,
302
						"professorId":userid
303
					},
304
					"success": function(data) {
305
						if(data.success) {
306
							console.log(JSON.stringify(data))
307
							if(data.data == null) {
308
								var btn = ["确定", "取消"];
309
								mui.confirm("确认回复该需求?", "提示", btn, function(e) {
310
									if(e.index == 0) {
311
										createConsult()
312
									}
313
								})
314
							}else{
315
								webviewShow = plus.webview.create("../html/chats.html", 'chats.html', {}, {
316
									'consultId': data.data,
317
									'consultantId': userid
318
								});
319
							}
320
						}
321
					}
322
				});
323
			}else{
324
				isLogin();
325
			}
326
		}
327
		//立即回复新建跳转咨询
328
		function createConsult() {
329
			mui.ajax(baseUrl+"/ajax/consult",{
330
				type: "POST",
331
				timeout: 10000,
47 332
				data: {
48
					"demandId": ws.demanid
333
					"consultType": "其他咨询",
334
					"consultTitle": demandTitle,
335
					"consultContant": demandContent,
336
					"professorId": userid,
337
					"consultantId": consuId,
338
					"demandId": demandId
49 339
				},
50
				success: function(data) {
51
					if(data.success) {
52
						plus.nativeUI.showWaiting();
53
						var web = plus.webview.getWebviewById("../html/needList.html");
54
						mui.fire(web, "newId");
55
						setTimeout(function(){mui.back()},1000);
340
				success: function($ifno) {
341
					if($ifno.success){
342
						webviewShow = plus.webview.create("../html/chats.html", 'chats.html', {}, {
343
							'consultId': $ifno.data,
344
							'consultantId': consuId
345
						});
56 346
					}
347
				},
348
				error: function() {
349
	
350
				}
351
			})
352
		}
57 353

354
		function moreMes() {
355
			document.getElementById("BtnMore").addEventListener("tap", function() {
356
				var oUrl = baseUrl + "/images/logo180.png";
357
				plus.nativeUI.showWaiting(); //显示原生等待框
358
				var webviewShow = plus.webview.create("../html/moreItem.html", 'moreItem.html', {}, {
359
					proid: demandId,
360
					name: "demand",
361
					data: {
362
						content: document.getElementById("demandDesp").innerHTML.substring(0, 40),
363
						title: document.getElementById("demandTit").innerHTML,
364
						href: baseUrl + "/e/l.html?id=" + demandId,
365
						thumbs: [oUrl]
366
					},
367
					weiboData: {
368
						content: document.getElementById("demandTit").innerHTML + baseUrl + "/e/l.html?id=" + demandId,
369
					}
370
				})
371
			})
372
		}
373
		
374
		/*微信及微信朋友圈分享专家*/
375
		var auths, shares;
376
		plus.oauth.getServices(function(services) {
377
			auths = {};
378
			for(var i in services) {
379
				var t = services[i];
380
				auths[t.id] = t;
381
	
382
			}
383
		}, function(e) {
384
			alert("获取登录服务列表失败:" + e.message + " - " + e.code);
385
		});
386
		plus.share.getServices(function(services) {
387
	
388
			shares = {};
389
			for(var i in services) {
390
	
391
				var t = services[i];
392
	
393
				shares[t.id] = t;
394
	
395
			}
396
		}, function(e) {
397
			alert("获取分享服务列表失败:" + e.message + " - " + e.code);
398
		});
399
		mui("#shareBlock").on("tap", "li", function() {
400
			document.getElementById("shareBlock").style.display = "none";
401
			document.getElementById("maskBlack").style.display = "none";
402
			var oFen = this.getElementsByTagName("span")[0].innerHTML;
403
	
404
			var oUrl = baseUrl + "/images/logo180.png";
405
	
406
			if(oFen == "微信好友") {
407
				var share = buildShareService("weixin");
408
				if(share) {
409
					shareMessage(share, "WXSceneSession", {
410
						content: document.getElementById("demandDesp").innerHTML.substring(0, 40),
411
						title: document.getElementById("demandTit").innerHTML,
412
						href: baseUrl + "/e/l.html?id=" + demandId,
413
						thumbs: [oUrl]
414
					});
58 415
				}
59
			});
416
			} else if(oFen == "微信朋友圈") {
417
				var share = buildShareService("weixin");
418
				if(share) {
419
					shareMessage(share, "WXSceneTimeline", {
420
						content: document.getElementById("demandDesp").innerHTML.substring(0, 40),
421
						title: document.getElementById("demandTit").innerHTML,
422
						href: baseUrl + "/e/l.html?id=" + demandId,
423
						thumbs: [oUrl]
424
					});
425
				}
426
			} else if(oFen == "新浪微博") {
427
				var share = buildShareService("sinaweibo");
428
				if(share) {
429
					shareMessage(share, "sinaweibo", {
430
						content: document.getElementById("demandTit").innerHTML + baseUrl + "/e/l.html?id=" + demandId,
431
					});
432
				}
433
			}
434
	
60 435
		})
436
	
437
		function buildShareService(ttt) {
438
			var share = shares[ttt];
439
			if(share) {
440
				if(share.authenticated) {
441
					console.log("---已授权---");
442
				} else {
443
					console.log("---未授权---");
444
					share.authorize(function() {
445
						console.log('授权成功...')
446
					}, function(e) {
447
						return null;
448
					});
449
				}
450
				return share;
451
			} else {
452
				alert("没有获取微信分享服务");
453
				return null;
454
			}
455
	
456
		}
457
	
458
		function shareMessage(share, ex, msg) {
459
			msg.extra = {
460
				scene: ex
461
			};
462
			share.send(msg, function() {
463
				plus.nativeUI.closeWaiting();
464
				plus.nativeUI.toast("成功分享需求信息", toastStyle);
465
			}, function(e) {
466
				plus.nativeUI.closeWaiting();
467
				if(e.code == -2) {
468
					
469
				}
470
			});
471
		}
472
	
61 473
	});
62 474
})