浏览代码

需求详情,更多选项

luyanan 7 年之前
父节点
当前提交
bc4cc60c4d
共有 4 个文件被更改,包括 136 次插入115 次删除
  1. 3 2
      app/html/needShow.html
  2. 108 105
      app/js/moreItem.js
  3. 3 3
      app/js/needSearch.js
  4. 22 5
      app/js/needShow.js

+ 3 - 2
app/html/needShow.html

@ -57,8 +57,8 @@
57 57
	    		<div class="h1Font hWeight" id="demandTit"></div>
58 58
	    		<div class="madiaBlock">
59 59
	    			<ul class="mui-table-view noactiveTab infoBlock">
60
				        <li class="mui-table-view-cell" id="personAL">
61
				            <div class="flexCenter mui-clearfix">
60
				        <li class="mui-table-view-cell">
61
				            <div class="flexCenter mui-clearfix" style="padding-right: 62px;" id="personAL">
62 62
				                <div class="madiaHead cmpHead2">
63 63
				                	<div class="boxBlock"><img class="boxBlockimg" id="companyImg" src="../images/default-icon.jpg"></div>
64 64
				                </div>
@ -67,6 +67,7 @@
67 67
									<p class="h3Font" id="oTime"></p>
68 68
								</div>
69 69
				            </div>
70
				            <span class="mui-icon attenSpan" id="attBtn" style="display:block;">关注</span>
70 71
				        </li>
71 72
				    </ul>
72 73
	    		</div>

+ 108 - 105
app/js/moreItem.js

@ -5,120 +5,123 @@ mui.ready(function(){
5 5
		plus.webview.currentWebview().show("slide-in-right", 150);
6 6
		 
7 7
		/*微信及微信朋友圈分享专家*/
8
	var auths, shares;
9
	plus.oauth.getServices(function(services) {
10
		auths = {};
11
		for(var i in services) {
12
			var t = services[i];
13
			auths[t.id] = t;
14

15
		}
16
	}, function(e) {
17
		alert("获取登录服务列表失败:" + e.message + " - " + e.code);
18
	});
19
	plus.share.getServices(function(services) {
20

21
		shares = {};
22
		for(var i in services) {
23

24
			var t = services[i];
25

26
			shares[t.id] = t;
27

28
		}
29
	}, function(e) {
30
		alert("获取分享服务列表失败:" + e.message + " - " + e.code);
31
	});
32
	mui("#shareBlock").on("tap", "li", function() {
33
		document.getElementById("shareBlock").style.display = "none";
34
		document.getElementById("maskBlack").style.display = "none";
35
		var oFen = this.getElementsByTagName("span")[0].innerHTML;
36
		if(oFen == "微信好友") {
37
			var share = buildShareService("weixin");
38
			if(share) {
39
				shareMessage(share, "WXSceneSession", self.data);
8
		var auths, shares;
9
		plus.oauth.getServices(function(services) {
10
			auths = {};
11
			for(var i in services) {
12
				var t = services[i];
13
				auths[t.id] = t;
14
	
40 15
			}
41
		} else if(oFen == "微信朋友圈") {
42
			var share = buildShareService("weixin");
43
			if(share) {
44
				shareMessage(share, "WXSceneSession",  self.data);
16
		}, function(e) {
17
			alert("获取登录服务列表失败:" + e.message + " - " + e.code);
18
		});
19
		plus.share.getServices(function(services) {
20
	
21
			shares = {};
22
			for(var i in services) {
23
	
24
				var t = services[i];
25
	
26
				shares[t.id] = t;
27
	
45 28
			}
46
		} else if(oFen == "新浪微博") {
47
			var share = buildShareService("sinaweibo");
48
			if(share) {
49
				shareMessage(share, "sinaweibo", self.weiboData);
29
		}, function(e) {
30
			alert("获取分享服务列表失败:" + e.message + " - " + e.code);
31
		});
32
		mui("#shareBlock").on("tap", "li", function() {
33
			document.getElementById("shareBlock").style.display = "none";
34
			document.getElementById("maskBlack").style.display = "none";
35
			var oFen = this.getElementsByTagName("span")[0].innerHTML;
36
			if(oFen == "微信好友") {
37
				var share = buildShareService("weixin");
38
				if(share) {
39
					shareMessage(share, "WXSceneSession", self.data);
40
				}
41
			} else if(oFen == "微信朋友圈") {
42
				var share = buildShareService("weixin");
43
				if(share) {
44
					shareMessage(share, "WXSceneSession",  self.data);
45
				}
46
			} else if(oFen == "新浪微博") {
47
				var share = buildShareService("sinaweibo");
48
				if(share) {
49
					shareMessage(share, "sinaweibo", self.weiboData);
50
				}
50 51
			}
51
		}
52

53
	})
54

55
	function buildShareService(ttt) {
56
		var share = shares[ttt];
57
		if(share) {
58
			if(share.authenticated) {
59
				console.log("---已授权---");
52
	
53
		})
54
	
55
		function buildShareService(ttt) {
56
			var share = shares[ttt];
57
			if(share) {
58
				if(share.authenticated) {
59
					console.log("---已授权---");
60
				} else {
61
					console.log("---未授权---");
62
					share.authorize(function() {
63
						console.log('授权成功...')
64
					}, function(e) {
65
						//alert("认证授权失败:" + e.code + " - " + e.message);
66
						return null;
67
					});
68
				}
69
				return share;
60 70
			} else {
61
				console.log("---未授权---");
62
				share.authorize(function() {
63
					console.log('授权成功...')
64
				}, function(e) {
65
					//alert("认证授权失败:" + e.code + " - " + e.message);
66
					return null;
67
				});
71
				alert("没有获取微信分享服务");
72
				return null;
68 73
			}
69
			return share;
70
		} else {
71
			alert("没有获取微信分享服务");
72
			return null;
74
	
73 75
		}
74

75
	}
76

77
	function shareMessage(share, ex, msg) {
78
		msg.extra = {
79
			scene: ex
80
		};
81
		share.send(msg, function() {
82
			plus.nativeUI.closeWaiting();
83
			if(plus.storage.getItem('userid')) {
84
				if(self.name=="professor") {
85
					shareAddIntegral(1);
86
				}else if(self.name=="resource"){
87
					shareAddIntegral(2);
88
				}else if(self.name=="article"){
89
					shareAddIntegral(3);
90
				}else if(self.name=="org"){
91
					shareAddIntegral(4);
92
				}else if(self.name=="paper"){
93
					shareAddIntegral(6);
94
				}else if(self.name=="patent"){
95
					shareAddIntegral(5);
76
	
77
		function shareMessage(share, ex, msg) {
78
			msg.extra = {
79
				scene: ex
80
			};
81
			share.send(msg, function() {
82
				plus.nativeUI.closeWaiting();
83
				if(plus.storage.getItem('userid')) {
84
					if(self.name=="professor") {
85
						shareAddIntegral(1);
86
					}else if(self.name=="resource"){
87
						shareAddIntegral(2);
88
					}else if(self.name=="article"){
89
						shareAddIntegral(3);
90
					}else if(self.name=="org"){
91
						shareAddIntegral(4);
92
					}else if(self.name=="paper"){
93
						shareAddIntegral(6);
94
					}else if(self.name=="patent"){
95
						shareAddIntegral(5);
96
					}
97
				}
98
				if(self.name=="demand"){
99
				 	plus.nativeUI.toast("成功分享需求信息", toastStyle);
96 100
				}
97
			}
98

99
		}, function(e) {
100
			console.log(JSON.stringify(e))
101
			plus.nativeUI.closeWaiting();
102
			if(e.code == -2) {
103 101
				
104
			}
105
		});
106
	}
107
	document.getElementById("corrEssor").addEventListener('tap',function(){
108
		plus.nativeUI.showWaiting(); //显示原生等待框
109
		var webviewShow = plus.webview.create("../html/correctBack.html", 'correctBack.html', {}, {
110
			proid: self.proid,
111
			name:self.name,
102
			}, function(e) {
103
				console.log(JSON.stringify(e))
104
				plus.nativeUI.closeWaiting();
105
				if(e.code == -2) {
106
					
107
				}
108
			});
109
		}
110
		document.getElementById("corrEssor").addEventListener('tap',function(){
111
			plus.nativeUI.showWaiting(); //显示原生等待框
112
			var webviewShow = plus.webview.create("../html/correctBack.html", 'correctBack.html', {}, {
113
				proid: self.proid,
114
				name:self.name,
115
			})
112 116
		})
113
	})
114
	
115
	document.getElementsByClassName("topback")[0].addEventListener("tap",function(){
116
		if(self.name=="org") {
117
			var web = plus.webview.getWebviewById("cmpInforShow.html");
117
		
118
		document.getElementsByClassName("topback")[0].addEventListener("tap",function(){
119
			if(self.name=="org") {
120
				var web = plus.webview.getWebviewById("cmpInforShow.html");
118 121
				mui.fire(web, "newId",{
119
									rd: 1
120
								});
121
		}
122
	})
122
					rd: 1
123
				});
124
			}
125
		})
123 126
	})
124 127
})

+ 3 - 3
app/js/needSearch.js

@ -140,9 +140,9 @@ function demandHtml($data,liStr) {
140 140
		strCon+='<div class="showli mui-ellipsis">'
141 141
		
142 142
		if($data.city){ strCon+='<span>'+$data.city+'</span>' }
143
		if($data.duration!=0){ strCon+='<span>预期'+demandDuration[$data.duration]+'</span>' }
144
		if($data.cost!=0){ strCon+='<span>预算'+demandCost[$data.cost]+'</span>' }
145
		if($data.invalidDay){ strCon+='<span>有效期至'+TimeTr($data.invalidDay)+'</span>' }
143
		if($data.duration!=0){ strCon+='<span>预期 '+demandDuration[$data.duration]+'</span>' }
144
		if($data.cost!=0){ strCon+='<span>预算 '+demandCost[$data.cost]+'</span>' }
145
		if($data.invalidDay){ strCon+='<span>有效期至 '+TimeTr($data.invalidDay)+'</span>' }
146 146
		
147 147
		strCon+='</div></div>'
148 148
	liStr.innerHTML=strCon;

+ 22 - 5
app/js/needShow.js

@ -1,6 +1,6 @@
1 1
mui.ready(function() {
2 2
	mui.plusReady(function() {
3
		var consuId, demandTitle, demandContent;
3
		var consuId, demandTitle, demandContent,orgThis;
4 4
		var userid = plus.storage.getItem('userid');
5 5
		var ws = plus.webview.currentWebview();
6 6
		var demandId = ws.demanid;
@ -15,6 +15,7 @@ mui.ready(function() {
15 15
	    var cancelShare=document.getElementById("cancelShare");
16 16
	    var maskBlack=document.getElementById("maskBlack");
17 17
	    var shareBlock=document.getElementById("shareBlock");
18
	    var attBtn=document.getElementById("attBtn");
18 19
		 
19 20
		getDemandinfo();
20 21
		pageViewsVal();
@ -50,6 +51,21 @@ mui.ready(function() {
50 51
			}
51 52
		});
52 53
		
54
		if(userid){
55
			ifcollectionAbout(orgThis,attBtn, 6,1);
56
		}
57
		attBtn.addEventListener('tap', function() {
58
			if(userid && userid != null && userid != "null") {
59
				if(this.className=='mui-icon attenSpan attenedSpan') {
60
					cancelCollectionAbout(orgThis,this, 6,1)
61
				} else {
62
					collectionAbout(orgThis,this, 6,1);
63
				}
64
			} else {
65
				isLogin();
66
			}
67
		});
68
		
53 69
		goUpdate.addEventListener('tap', function() {//修改
54 70
			mui.openWindow({
55 71
				url: '../html/demandModify.html',
@ -192,6 +208,7 @@ mui.ready(function() {
192 208
						}
193 209
						cmpFun($da.orgId);
194 210
						
211
						orgThis=$da.orgId;
195 212
						consuId = $da.creator;
196 213
						demandTitle = $da.title;
197 214
						demandContent = $da.descp;
@ -361,7 +378,7 @@ mui.ready(function() {
361 378
					data: {
362 379
						content: document.getElementById("demandDesp").innerHTML.substring(0, 40),
363 380
						title: document.getElementById("demandTit").innerHTML,
364
						href: baseUrl + "/e/l.html?id=" + demandId,
381
						href: baseUrl + "/e/d.html?id=" + demandId,
365 382
						thumbs: [oUrl]
366 383
					},
367 384
					weiboData: {
@ -409,7 +426,7 @@ mui.ready(function() {
409 426
					shareMessage(share, "WXSceneSession", {
410 427
						content: document.getElementById("demandDesp").innerHTML.substring(0, 40),
411 428
						title: document.getElementById("demandTit").innerHTML,
412
						href: baseUrl + "/e/l.html?id=" + demandId,
429
						href: baseUrl + "/e/d.html?id=" + demandId,
413 430
						thumbs: [oUrl]
414 431
					});
415 432
				}
@ -419,7 +436,7 @@ mui.ready(function() {
419 436
					shareMessage(share, "WXSceneTimeline", {
420 437
						content: document.getElementById("demandDesp").innerHTML.substring(0, 40),
421 438
						title: document.getElementById("demandTit").innerHTML,
422
						href: baseUrl + "/e/l.html?id=" + demandId,
439
						href: baseUrl + "/e/d.html?id=" + demandId,
423 440
						thumbs: [oUrl]
424 441
					});
425 442
				}
@ -427,7 +444,7 @@ mui.ready(function() {
427 444
				var share = buildShareService("sinaweibo");
428 445
				if(share) {
429 446
					shareMessage(share, "sinaweibo", {
430
						content: document.getElementById("demandTit").innerHTML + baseUrl + "/e/l.html?id=" + demandId,
447
						content: document.getElementById("demandTit").innerHTML + baseUrl + "/e/d.html?id=" + demandId,
431 448
					});
432 449
				}
433 450
			}