jack 8 anni fa
parent
commit
fb6a36dec9
3 ha cambiato i file con 462 aggiunte e 260 eliminazioni
  1. 15 123
      app/html/invite_new.html
  2. 122 0
      app/html/invite_new1.html
  3. 325 137
      app/js/invite_new.js

+ 15 - 123
app/html/invite_new.html

@ -1,5 +1,6 @@
1 1
<!doctype html>
2 2
<html>
3
3 4
	<head>
4 5
		<meta charset="UTF-8">
5 6
		<title>邀请好友</title>
@ -8,135 +9,26 @@
8 9
		<link href="../css/iconfont.css" rel="stylesheet" />
9 10
		<link href="../css/app.css" rel="stylesheet" />
10 11
	</head>
11
	
12
12 13
	<body>
13 14
		<header class="mui-bar mui-bar-nav toptitbox">
14 15
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left topback"></a>
15
		    <h1 class="mui-title toptit">邀请好友</h1>
16
			<h1 class="mui-title toptit">邀请好友</h1>
16 17
		</header>
17
        <!--登陆状态-->
18
		<div class="mui-content bodyBg mui-scroll-wrapper">
19
			<div class="mui-scroll">	
20
				<!-- 主界面具体展示内容 -->
21
				<div class="mui-input-group">
22
					<div class="inviteBoxNew">
23
						<img src="../images/In-friends_img_banner_nor.png" width="100%" id="inviteBtnLink">
24
						<div class="mui-row inviteBtnNew bgRadius">
25
							<div class="mui-col-xs-6 inviteFont">
26
								<p class="inviteNum" id="inviteFraction">10分</p>
27
								<p style="font-size:16px;">已获得积分</p>
28
							</div>
29
							<div class="mui-col-xs-6 inviteBtnLink" id>
30
								<img src="../images/In-friends_button_yaoqing_nor.png" width="100%" />
31
							</div>
32
						</div>
33
					</div>
34
					<div class="mui-row inviteInfor">
35
						<div class="mui-col-xs-6">
36
							<div class="inviteFont">
37
								<p>已邀请好友</p>
38
								<p class="inviteNum" id="inviteFriends">10位</p>
39
							</div>
40
						</div>
41
						<div class="mui-col-xs-6">
42
							<div class="inviteFont">
43
								<p>好友邀请好友</p>
44
							<p class="inviteNum" id="friendInviteFriend">24位</p>
45
							</div>
46
						</div>
47
					</div>
48
				</div>
49
				<!--未邀请好友-->
50
				<div class="mui-card-content conblock displayNone">
51
					<div class="maintitboxNow">
52
						<img class="maintitNow" src="../images/In-friends_bg_wenti_nor@3x.png" />
53
					</div>
54
					<div class="maincontent">
55
						<ul class="mui-table-view faqBox">
56
							<li class="mui-table-view-cell faqItem">
57
						        <h5 class="h1Font">为什么要邀请好友?</h5>
58
						        <p class="h3Font">答:成功邀请好友注册「科袖」后,您将获得100个积分。您邀请的好友邀请了新用户,还能给您带来50个奖励积分。</p>
59
						        <p class="h3Font">「科袖」将陆续发布更多类似的积分奖励规则,如好友成为“科袖认证专家”或完成了一次咨询,您都能获得更多积分。</p>
60
					    	</li>
61
					   </ul>
62
					</div>
63
				</div>
64
				<!--邀请好友列表-->
65
				<div class="mui-card-content conblock">
66
					<div class="maintitboxNow">
67
						<img class="maintitNow" src="../images/In-friends_bg_biaoti_nor.png" />
68
					</div>
69
					<div class="maincontent">
70
						<ul class="mui-table-view" id="friendsList">
71
					        <!--<li class="mui-table-view-cell">
72
						        <div class="flexCenter">
73
						        	<div class="userImg userRadius">
74
						        		<img src="../images/default-photo.jpg"/>
75
						        	</div>
76
									<div class="userInfo">
77
										<p class="h1Font positionR"><span>用户姓名</span><em class="authicon authicon-pro"></em></p>
78
										<p class="h2Font">北京科技大学</p>
79
										<p class="h3Font mui-ellipsis">他邀请了 <span>3</span> 位好友,为您带来了 <span>1000</span> 分积分奖励!</p>
80
									</div>
81
						        </div>
82
					        </li>
83
					        <li class="mui-table-view-cell">
84
						        <div class="flexCenter">
85
						        	<div class="userImg userRadius">
86
						        		<img src="../images/default-photo.jpg"/>
87
						        	</div>
88
									<div class="userInfo">
89
										<p class="h1Font positionR"><span>用户姓名</span><em class="authicon authicon-pro"></em></p>
90
										<p class="h2Font">北京科技大学</p>
91
										<p class="h3Font mui-ellipsis">他还没有邀请好友!</p>
92
									</div>
93
						        </div>
94
					        </li>
95
					        <li class="mui-table-view-cell">
96
						        <div class="flexCenter">
97
						        	<div class="userImg userRadius">
98
						        		<img src="../images/default-photo.jpg"/>
99
						        	</div>
100
									<div class="userInfo">
101
										<p class="h1Font positionR"><span>用户姓名</span><em class="authicon authicon-pro"></em></p>
102
										<p class="h2Font">北京科技大学</p>
103
										<p class="h3Font mui-ellipsis">他邀请了 <span>3</span> 位好友,为您带来了 <span>1000</span> 分积分奖励!</p>
104
									</div>
105
						        </div>
106
					        </li>-->
107
					        
108
					    </ul>
109
					</div>
110
				</div>
111
			</div>
112
		</div>
113
		<!--点击邀请好友按钮弹出提示框-->
114
		<div class="promptBlock" id="inviteShow">
115
			<div class="promptImg"></div>
116
			<p class="h1Font">成功邀请好友注册「科袖」后,您将获得100个积分。您邀请的好友邀请了新用户,还能给您带来50个奖励积分。</p>
117
			<div class="promptBtn"><button class="mui-btn mui-btn-mini">朕知道了</button></div>
118
			<span class="mui-icon mui-icon-close promptClose"></span>
119
		</div>
120 18
		<script src="../js/public/mui.min.js"></script>
121
		<script src="../js/public/base.js"></script>
122
		<script type="text/javascript">
123
			var inviteBtnLink=document.getElementById("inviteBtnLink");
124
			var inviteShow=document.getElementById("inviteShow");
125
			var promptClose=document.getElementsByClassName("promptClose");
126
			var promptBtn=document.getElementsByClassName("promptBtn");
127
			inviteBtnLink.addEventListener("tap", function() {
128
				inviteShow.setAttribute("style","display:block");
129
				model.show();//显示遮罩
130
			})
131
			promptBtn[0].addEventListener("tap", function() {
132
				model.close();//关闭遮罩
133
			})
134
			promptClose[0].addEventListener("tap", function() {
135
				model.close();//关闭遮罩
136
			})
19
		<script>
20
			mui.init({
21
    subpages:[{
22
      url:'invite_new1.html',
23
      id:'invite_new1.htmll',
24
      styles:{
25
        top:'50px',//mui标题栏默认高度为45px;
26
        bottom:'0px'//默认为0px,可不定义;
27
      }
28
    }]
29
  });
30
			
137 31
		</script>
138
		<script type="text/javascript" src="../js/invite_new.js"></script>
139
		
140 32
	</body>
141 33
142 34
</html>

+ 122 - 0
app/html/invite_new1.html

@ -0,0 +1,122 @@
1
<!doctype html>
2
<html>
3
	<head>
4
		<meta charset="UTF-8">
5
		<title>邀请好友</title>
6
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
7
		<link href="../css/mui.min.css" rel="stylesheet" />
8
		<link href="../css/iconfont.css" rel="stylesheet" />
9
		<link href="../css/app.css" rel="stylesheet" />
10
	</head>
11
	
12
	<body>
13
        <!--登陆状态-->
14
		<div class="mui-content bodyBg mui-scroll-wrapper" id="pullrefresht">
15
			<div class="mui-scroll">	
16
				<!-- 主界面具体展示内容 -->
17
				<div class="mui-input-group">
18
					<div class="inviteBoxNew">
19
						<img src="../images/In-friends_img_banner_nor.png" width="100%" id="inviteBtnLink">
20
						<div class="mui-row inviteBtnNew bgRadius">
21
							<div class="mui-col-xs-6 inviteFont">
22
								<p class="inviteNum" id="inviteFraction"></p>
23
								<p style="font-size:16px;">已获得积分</p>
24
							</div>
25
							<div class="mui-col-xs-6 inviteBtnLink" id="invite">
26
								<img src="../images/In-friends_button_yaoqing_nor.png" width="100%" />
27
							</div>
28
						</div>
29
					</div>
30
					<div class="mui-row inviteInfor">
31
						<div class="mui-col-xs-6">
32
							<div class="inviteFont">
33
								<p>已邀请好友</p>
34
								<p class="inviteNum" id="inviteFriends"></p>
35
							</div>
36
						</div>
37
						<div class="mui-col-xs-6">
38
							<div class="inviteFont">
39
								<p>好友邀请好友</p>
40
							<p class="inviteNum" id="friendInviteFriend"></p>
41
							</div>
42
						</div>
43
					</div>
44
				</div>
45
				<!--未邀请好友-->
46
				<div class="mui-card-content conblock displayNone" id="nodatalist">
47
					<div class="maintitboxNow">
48
						<img class="maintitNow" src="../images/In-friends_bg_wenti_nor@3x.png" />
49
					</div>
50
					<div class="maincontent">
51
						<ul class="mui-table-view faqBox">
52
							<li class="mui-table-view-cell faqItem">
53
						        <h5 class="h1Font">为什么要邀请好友?</h5>
54
						        <p class="h3Font">答:成功邀请好友注册「科袖」后,您将获得100个积分。您邀请的好友邀请了新用户,还能给您带来50个奖励积分。</p>
55
						        <p class="h3Font">「科袖」将陆续发布更多类似的积分奖励规则,如好友成为“科袖认证专家”或完成了一次咨询,您都能获得更多积分。</p>
56
					    	</li>
57
					   </ul>
58
					</div>
59
				</div>
60
				<!--邀请好友列表-->
61
				<div class="mui-card-content conblock" id="datalist">
62
					<div class="maintitboxNow">
63
						<img class="maintitNow" src="../images/In-friends_bg_biaoti_nor.png" />
64
					</div>
65
					<div class="maincontent">
66
						<ul class="mui-table-view mui-table-view-chevron" id="friendsList">
67
					        <!--<li class="mui-table-view-cell">
68
						        <div class="flexCenter">
69
						        	<div class="userImg userRadius">
70
						        		<img src="../images/default-photo.jpg"/>
71
						        	</div>
72
									<div class="userInfo">
73
										<p class="h1Font positionR"><span>用户姓名</span><em class="authicon authicon-pro"></em></p>
74
										<p class="h2Font">北京科技大学</p>
75
										<p class="h3Font mui-ellipsis">他邀请了 <span>3</span> 位好友,为您带来了 <span>1000</span> 分积分奖励!</p>
76
									</div>
77
						        </div>
78
					        </li>
79
					        <li class="mui-table-view-cell">
80
						        <div class="flexCenter">
81
						        	<div class="userImg userRadius">
82
						        		<img src="../images/default-photo.jpg"/>
83
						        	</div>
84
									<div class="userInfo">
85
										<p class="h1Font positionR"><span>用户姓名</span><em class="authicon authicon-pro"></em></p>
86
										<p class="h2Font">北京科技大学</p>
87
										<p class="h3Font mui-ellipsis">他还没有邀请好友!</p>
88
									</div>
89
						        </div>
90
					        </li>
91
					        <li class="mui-table-view-cell">
92
						        <div class="flexCenter">
93
						        	<div class="userImg userRadius">
94
						        		<img src="../images/default-photo.jpg"/>
95
						        	</div>
96
									<div class="userInfo">
97
										<p class="h1Font positionR"><span>用户姓名</span><em class="authicon authicon-pro"></em></p>
98
										<p class="h2Font">北京科技大学</p>
99
										<p class="h3Font mui-ellipsis">他邀请了 <span>3</span> 位好友,为您带来了 <span>1000</span> 分积分奖励!</p>
100
									</div>
101
						        </div>
102
					        </li>-->
103
					        
104
					    </ul>
105
					</div>
106
				</div>
107
			</div>
108
		</div>
109
		<!--点击邀请好友按钮弹出提示框-->
110
		<div class="promptBlock" id="inviteShow">
111
			<div class="promptImg"></div>
112
			<p class="h1Font">成功邀请好友注册「科袖」后,您将获得100个积分。您邀请的好友邀请了新用户,还能给您带来50个奖励积分。</p>
113
			<div class="promptBtn"><button class="mui-btn mui-btn-mini">朕知道了</button></div>
114
			<span class="mui-icon mui-icon-close promptClose"></span>
115
		</div>
116
		<script src="../js/public/mui.min.js"></script>
117
		<script src="../js/public/base.js"></script>
118
		<script type="text/javascript" src="../js/invite_new.js"></script>
119
		
120
	</body>
121
122
</html>

+ 325 - 137
app/js/invite_new.js

@ -1,152 +1,171 @@
1
mui.ready(function() {
2
	mui.plusReady(function() {
3
		var userId = plus.storage.getItem('userid');
4
		var ws = plus.webview.currentWebview();
5
		plus.nativeUI.closeWaiting(); //新webview的载入完毕后关闭等待框
6
		ws.show("slide-in-right", 150);
7
		/*获得好友积分*/
8
		var person = {
9
			/*获得积分*/
10
			inviteIntegral: function() {
11
				mui.ajax(baseUrl + "/ajax/growth/queryScore", {
12
					dataType: 'json', //数据格式类型
13
					type: 'GET', //http请求类型
14
					data: {
15
						"professorId": userId
16
					},
17
					timeout: 10000, //超时设置
18
					success: function(data) {
19
						if(data.success) {
20
							var $info = data.data;
21
							document.getElementById("inviteFraction").innerHTML = $info.inviteScore + $info.myScore;
22
						}
23
					},
24
					error: function() {
25
						plus.nativeUI.toast("服务器链接超时", toastStyle);
26
						return;
1
var orderKey, professorName; //加载数据的传给后台的值
2
mui.init({
3
	pullRefresh: {
4
		container: '#pullrefresht',
5
		up: {
6
			height: 50,
7
			contentrefresh: '正在加载...',
8
			callback: pullupRefresh
9
		}
10
	}
11
});
12

13
function pullupRefresh() {
14
	setTimeout(function() {
15
		person.invitefriendsList(orderKey)
16
	}, 1000);
17
}
18
var person = {
19
	/*获得积分*/
20
	inviteIntegral: function() {
21
		mui.plusReady(function() {
22
			var userId = plus.storage.getItem('userid');
23
			mui.ajax(baseUrl + "/ajax/growth/queryScore", {
24
				dataType: 'json', //数据格式类型
25
				type: 'GET', //http请求类型
26
				data: {
27
					"professorId": userId
28
				},
29
				timeout: 10000, //超时设置
30
				success: function(data) {
31
					if(data.success) {
32
						var $info = data.data;
33
						document.getElementById("inviteFraction").innerHTML = $info.inviteScore + $info.myScore + "分";
27 34
					}
28
				});
29
			},
30
			/*邀请好友的位数*/
31
			inviteFriendsTotal: function() {
32
				mui.ajax(baseUrl + "/ajax/growth/inviterCount", {
33
					dataType: 'json', //数据格式类型
34
					type: 'GET', //http请求类型
35
					data: {
36
						"professorId": userId
37
					},
38
					timeout: 10000, //超时设置
39
					success: function(data) {
40
						if(data.success) {
41
							var $info = data.data;
42
							document.getElementById("inviteFriends").innerHTML = $info;
43
						}
44
					},
45
					error: function() {
46
						plus.nativeUI.toast("服务器链接超时", toastStyle);
47
						return;
35
				},
36
				error: function() {
37
					plus.nativeUI.toast("服务器链接超时", toastStyle);
38
					return;
39
				}
40
			});
41
		})
42
	},
43
	/*邀请好友的位数*/
44
	inviteFriendsTotal: function() {
45
		mui.plusReady(function() {
46
			var userId = plus.storage.getItem('userid');
47
			mui.ajax(baseUrl + "/ajax/growth/inviterCount", {
48
				dataType: 'json', //数据格式类型
49
				type: 'GET', //http请求类型
50
				data: {
51
					"professorId": userId
52
				},
53
				timeout: 10000, //超时设置
54
				success: function(data) {
55
					if(data.success) {
56
						var $info = data.data;
57
						document.getElementById("inviteFriends").innerHTML = $info + "位";
48 58
					}
49
				});
50
			},
51
			/*邀请的好友列表*/
52
			invitefriendsList: function() {
53
				mui.ajax(baseUrl + "/ajax/growth/qlInviter", {
54
					dataType: 'json', //数据格式类型
55
					type: 'GET', //http请求类型
56
					data: {
57
						"professorId": userId
58
					},
59
					timeout: 10000, //超时设置
60
					success: function(data) {
61
						console.log(JSON.stringify(data))
62
						if(data.success) {
63
							var $info = data.data,
64
								i = 0;
65
							for(i in $info) {
66
								person.professorBaseMess($info[i]);
59
				},
60
				error: function() {
61
					plus.nativeUI.toast("服务器链接超时", toastStyle);
62
					return;
63
				}
64
			});
65
		})
66
	},
67
	/*邀请的好友列表*/
68
	invitefriendsList: function(pro) {
69
		mui.plusReady(function() {
70
			var userId = plus.storage.getItem('userid');
71
			$ta = {
72
				professorId: userId,
73
				"rows": 20
74
			}
75
			if(pro) {
76
				$ta.createTime = orderKey;
77
			}
78
			mui.ajax(baseUrl + "/ajax/growth/qlInviter", {
79
				dataType: 'json', //数据格式类型
80
				type: 'GET', //http请求类型
81
				data: $ta,
82
				timeout: 10000, //超时设置
83
				success: function(data) {
84
					if(data.success) {
85
						var $info = data.data,
86
							i = 0;
87
						if(!pro) {
88
							var ws = plus.webview.getWebviewById("invite_new.html");
89
							plus.nativeUI.closeWaiting(); //新webview的载入完毕后关闭等待框
90
							ws.show("slide-in-right", 150);
91
							professorName = ws.proName;
92
						}
93
						if($info.length == 0) {
94
							if(!pro) {
95
								document.getElementById("nodatalist").style.display = "block";
96
								document.getElementById("datalist").style.display = "none";
97
								mui('#pullrefresht').pullRefresh().disablePullupToRefresh(true);
98
								return;
99
							} else {
100
								mui('#pullrefresht').pullRefresh().endPullupToRefresh(true); /*不能上拉*/
101
								return;
67 102
							}
68 103
						}
69
					},
70
					error: function() {
71
						plus.nativeUI.toast("服务器链接超时", toastStyle);
72
						return;
73
					}
74
				});
75
			},
76
			/*查询专家基本信息*/
77
			professorBaseMess: function(proId) {
78
				mui.ajax(baseUrl + "/ajax/professor/baseInfo/" + proId, {
79
					dataType: 'json', //数据格式类型
80
					type: 'GET', //http请求类型
81
					timeout: 10000, //超时设置
82
					success: function(data) {
83
						if(data.success) {
84
							var $info = data.data;
85
							mui.ajax(baseUrl + "/ajax/growth/inviterCount", {
86
								dataType: 'json', //数据格式类型
87
								type: 'GET', //http请求类型
88
								async: false,
89
								data: {
90
									"professorId": userId
91
								},
92
								timeout: 10000, //超时设置
93
								success: function(data) {
94
									if(data.success) {
95
										var $data = data.data;
96
										var oSty = autho($info.authType, $info.orgAuth, $info.authStatus)
97
										var img;
98
										var inviNum
99
										if($data == 0) {
100
											inviNum = "他还没有邀请好友!"
101
										} else {
102
											inviNum = "他邀请了 <span>" + $data + "</span> 位好友,为您带来了 <span>" + $data * 50 + "</span> 分积分奖励!"
103
										}
104
										($info.hasHeadImage == 1) ? img = baseUrl + "/images/head/" + $info.id + "_l.jpg": img = "../images/default-photo.jpg";
105
										var li = document.createElement("li");
106
										li.className = "mui-table-view-cell";
107
										var oString = '<div class="flexCenter">'
108
										oString += '<div class="userImg userRadius">';
109
										oString += '<img src="' + img + '"/>'
110
										oString += '</div>'
111
										oString += '<div class="userInfo">'
112
										oString += '<p class="h1Font positionR"><span>' + $info.name + '</span><em class="authicon ' + oSty.sty + '"></em></p>'
113
										oString += '<p class="h2Font">' + $info.orgName + '</p>'
114
										oString += '<p class="h3Font mui-ellipsis">' + inviNum + '</p>'
115
										oString += '</div>'
116
										oString += '</div>'
117
										li.innerHTML = oString;
118
										document.getElementById("friendsList").appendChild(li);
119
									}
120
								},
121
								error: function() {
122
									plus.nativeUI.toast("服务器链接超时", toastStyle);
123
									return;
124
								}
125
							});
126 104

105
						orderKey = $info[$info.length - 1].createTime;
106
						if(data.data.length == 20) {
107
							mui('#pullrefresht').pullRefresh().endPullupToRefresh(false); /*能上拉*/
108
						} else {
109
							mui('#pullrefresht').pullRefresh().disablePullupToRefresh();
110
						}
111
						for(i in $info) {
112
							person.professorBaseMess($info[i].id);
127 113
						}
128
					},
129
					error: function() {
130
						plus.nativeUI.toast("服务器链接超时", toastStyle);
131
						return;
132 114
					}
133
				});
134
			},
135
			/*好友邀请好友得总数*/
136
			frinedInviteFriends: function() {
137
				alert(11);
138
						mui.ajax(baseUrl + "/ajax/growth/countByInviter", {
115
				},
116
				error: function() {
117
					plus.nativeUI.toast("服务器链接超时", toastStyle);
118
					mui('#pullrefresht').pullRefresh().endPullupToRefresh(true);
119
					return;
120
				}
121
			});
122
		})
123
	},
124
	/*查询专家基本信息*/
125
	professorBaseMess: function(proId) {
126
		mui.plusReady(function() {
127
			var userId = plus.storage.getItem('userid');
128
			mui.ajax(baseUrl + "/ajax/professor/baseInfo/" + proId, {
129
				dataType: 'json', //数据格式类型
130
				type: 'GET', //http请求类型
131
				timeout: 10000, //超时设置
132
				success: function(data) {
133
					if(data.success) {
134
						var $info = data.data;
135
						mui.ajax(baseUrl + "/ajax/growth/inviterCount", {
139 136
							dataType: 'json', //数据格式类型
140 137
							type: 'GET', //http请求类型
138
							async: false,
141 139
							data: {
142
								"professorId": userId
140
								"professorId": proId
143 141
							},
144 142
							timeout: 10000, //超时设置
145 143
							success: function(data) {
146 144
								if(data.success) {
147
									var $info = data.data;
148
									console.log($info)
149
									document.getElementById("friendInviteFriend").innerHTML = $info;
145
									var $data = data.data;
146
									var oSty = autho($info.authType, $info.orgAuth, $info.authStatus)
147
									var img;
148
									var inviNum
149
									if($data == 0) {
150
										inviNum = "他还没有邀请好友!"
151
									} else {
152
										inviNum = "他邀请了 <span>" + $data + "</span> 位好友,为您带来了 <span>" + $data * 50 + "</span> 分积分奖励!"
153
									}
154
									($info.hasHeadImage == 1) ? img = baseUrl + "/images/head/" + $info.id + "_l.jpg": img = "../images/default-photo.jpg";
155
									var li = document.createElement("li");
156
									li.className = "mui-table-view-cell";
157
									var oString = '<div class="flexCenter">'
158
									oString += '<div class="userImg userRadius">';
159
									oString += '<img src="' + img + '"/>'
160
									oString += '</div>'
161
									oString += '<div class="userInfo">'
162
									oString += '<p class="h1Font positionR"><span>' + $info.name + '</span><em class="authicon ' + oSty.sty + '"></em></p>'
163
									oString += '<p class="h2Font">' + $info.orgName + '</p>'
164
									oString += '<p class="h3Font mui-ellipsis">' + inviNum + '</p>'
165
									oString += '</div>'
166
									oString += '</div>'
167
									li.innerHTML = oString;
168
									document.getElementById("friendsList").appendChild(li);
150 169
								}
151 170
							},
152 171
							error: function() {
@ -154,11 +173,180 @@ mui.ready(function() {
154 173
								return;
155 174
							}
156 175
						});
157
					},
158
		}
176

177
					}
178
				},
179
				error: function() {
180
					plus.nativeUI.toast("服务器链接超时", toastStyle);
181
					return;
182
				}
183
			});
184
		})
185
	},
186
	/*好友邀请好友得总数*/
187
	frinedInviteFriends: function() {
188
		mui.plusReady(function() {
189
			var userId = plus.storage.getItem('userid');
190
			mui.ajax(baseUrl + "/ajax/growth/countByInviter", {
191
				dataType: 'json', //数据格式类型
192
				type: 'GET', //http请求类型
193
				data: {
194
					"professorId": userId
195
				},
196
				timeout: 10000, //超时设置
197
				success: function(data) {
198
					if(data.success) {
199
						var $info = data.data;
200
						document.getElementById("friendInviteFriend").innerHTML = $info + "位";
201
					}
202
				},
203
				error: function() {
204
					plus.nativeUI.toast("服务器链接超时", toastStyle);
205
					return;
206
				}
207
			});
208
		})
209
	},
210
}
211
mui.ready(function() {
212
	mui.plusReady(function() {
213
		var userId = plus.storage.getItem('userid');
159 214
		person.inviteIntegral();
160 215
		person.inviteFriendsTotal();
161 216
		person.invitefriendsList();
162 217
		person.frinedInviteFriends();
218
		var inviteBtnLink = document.getElementById("inviteBtnLink");
219
		var inviteShow = document.getElementById("inviteShow");
220
		var promptClose = document.getElementsByClassName("promptClose");
221
		var promptBtn = document.getElementsByClassName("promptBtn");
222
		inviteBtnLink.addEventListener("tap", function() {
223
			inviteShow.setAttribute("style", "display:block");
224
			model.show(); //显示遮罩
225
		})
226
		promptBtn[0].addEventListener("tap", function() {
227
			model.close(); //关闭遮罩
228
		})
229
		promptClose[0].addEventListener("tap", function() {
230
			model.close(); //关闭遮罩
231
		})
232
		var invite = document.getElementById("invite");
233
		/*微信及微信朋友圈分享专家*/
234
		var auths, shares;
235
		invite.addEventListener("tap", function() {
236
			shareShow()
237
		});
238
		plus.oauth.getServices(function(services) {
239
			auths = {};
240
			for(var i in services) {
241
				var t = services[i];
242
				auths[t.id] = t;
243
			}
244
		}, function(e) {
245
			alert("获取登录服务列表失败:" + e.message + " - " + e.code);
246
		});
247
		plus.share.getServices(function(services) {
248

249
			shares = {};
250
			for(var i in services) {
251

252
				var t = services[i];
253

254
				shares[t.id] = t;
255

256
			}
257
		}, function(e) {
258
			alert("获取分享服务列表失败:" + e.message + " - " + e.code);
259
		})
260

261
		function shareShow() {
262
			var shareBts = [];
263
			// 更新分享列表
264
			var ss = shares['weixin'];
265
			if(navigator.userAgent.indexOf('StreamApp') < 0 && navigator.userAgent.indexOf('qihoo') < 0) { //在360流应用中微信不支持分享图片
266
				ss && ss.nativeClient && (shareBts.push({
267
						title: '微信好友',
268
						s: ss,
269
						x: 'WXSceneSession'
270
					}),
271
					shareBts.push({
272
						title: '微信朋友圈',
273
						s: ss,
274
						x: 'WXSceneTimeline'
275
					}));
276
			}
277
			//				// 弹出分享列表
278
			shareBts.length > 0 ? plus.nativeUI.actionSheet({
279
				title: '分享',
280
				cancel: '取消',
281
				buttons: shareBts
282
			}, function(e) {
283
				if(e.index == 1) {
284
					var share = buildShareService();
285
					if(share) {
286
						shareMessage(share, "WXSceneSession", {
287
							content: "科袖网,搭建企业与专家的桥梁。",
288
							title: professorName + "邀请您加入【科袖】",
289
							href: baseUrl + "/ekexiu/Invitation.html?professorId=" + userId + "&professorName=" + encodeURI(professorName),
290
							thumbs: [baseUrl + "/images/logo180.png"]
291
						});
292
					}
293
				} else if(e.index == 2) {
294
					var share = buildShareService();
295
					if(share) {
296
						shareMessage(share, "WXSceneTimeline", {
297
							content: professorName,
298
							title: "【科袖名片",
299
							href: baseUrl + "/ekexiu/Invitation.html?professorId=" + userId + "&professorName=" + encodeURI(professorName),
300
							thumbs: [baseUrl + "/images/logo180.png"]
301
						});
302
					}
303
				}
304

305
			}) : plus.nativeUI.alert('当前环境无法支持分享操作!');
306

307
		}
308

309
		function buildShareService() {
310
			var share = shares["weixin"];
311
			if(share) {
312
				if(share.authenticated) {
313
					console.log("---已授权---");
314
				} else {
315
					console.log("---未授权---");
316
					share.authorize(function() {
317
						console.log('授权成功...')
318
					}, function(e) {
319
						alert("认证授权失败:" + e.code + " - " + e.message);
320
						return null;
321
					});
322
				}
323
				return share;
324
			} else {
325
				alert("没有获取微信分享服务");
326
				return null;
327
			}
328

329
		}
330

331
		function shareMessage(share, ex, msg) {
332
			msg.extra = {
333
				scene: ex
334
			};
335
			share.send(msg, function() {
336
				plus.nativeUI.closeWaiting();
337
				var strtmp = "分享到\"" + share.description + "\"成功! ";
338
				console.log(strtmp);
339
				plus.nativeUI.toast(strtmp, {
340
					verticalAlign: 'center'
341
				});
342
			}, function(e) {
343
				plus.nativeUI.closeWaiting();
344
				if(e.code == -2) {
345
					plus.nativeUI.toast('已取消分享', {
346
						verticalAlign: 'center'
347
					});
348
				}
349
			});
350
		}
163 351
	});
164 352
})