-
Notifications
You must be signed in to change notification settings - Fork 12
/
index.php
156 lines (131 loc) · 5.39 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<?php
require_once "../wechashare/head.php";
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>麻将大厅</title>
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
</head>
<body>
<div id="app">
loading.....
</div>
<!-- built files will be auto injected -->
<input type="hidden" id="wecha_id" value="<?php echo $userinfos['openid']; ?>">
<input type="hidden" id="room_id" value="<?php echo empty($_GET['roomId'])?'0':$_GET['roomId']; ?>">
<input type="hidden" value=" <?php echo $userinfos['headimgurl']; ?>" id='wecha_pic'>
<input type="hidden" value="<?php echo $userinfos['nickname']; ?>" id='nick_name'>
<!--<script id="fiboDataSDK" type="text/javascript" src="http://sdk.fibodata.com/data/datasdk.min.js?pfid=AIDPmspP&appid=<?php echo $activeappid; ?>"></script>-->
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script>
wx.config({
debug: false,
appId: '<?php echo $signPackage["appId"];?>',
timestamp: <?php echo $signPackage["timestamp"];?>,
nonceStr: '<?php echo $signPackage["nonceStr"];?>',
signature: '<?php echo $signPackage["signature"];?>',
jsApiList: [
// 所有要调用的 API 都要加到这个列表中
'checkJsApi',
'onMenuShareTimeline',
'onMenuShareAppMessage',
'onMenuShareQQ',
'onMenuShareWeibo',
'openLocation',
'getLocation',
'addCard',
'chooseCard',
'openCard',
'hideMenuItems',
'previewImage',
'startRecord',
'stopRecord',
'onVoiceRecordEnd',
'playVoice',
'pauseVoice',
'stopVoice',
'onVoicePlayEnd',
'uploadVoice',
'downloadVoice'
]
});
wx.ready(function () {
// 在这里调用 API
var LINK = 'http://s.h5taotao.com/h5/majhong1/index.php?actId=1002&token=gaqugj1495770696'
if(localStorage.getItem('roomId')){
LINK = 'http://s.h5taotao.com/h5/majhong1/index.php?actId=1002&token=gaqugj1495770696&roomId='+localStorage.getItem('roomId')
}
wx.onMenuShareAppMessage({
title: '<?php echo $activeinfo['sharetitle'];?>', // 分享标题
desc: '<?php echo $activeinfo['sharedesc'];?>', // 分享描述
//link: '<?php echo $activeinfo['activeUrl'];?>', // 分享链接
link: LINK, // 分享链接
imgUrl: '<?php echo $activeinfo['shareimg'];?>', // 分享图标
type: '', // 分享类型,music、video或link,不填默认为link
dataUrl: '', // 如果type是music或video,则要提供数据链接,默认为空
success: function () {
dataSDK.share('friend');
// 用户确认分享后执行的回调函数
},
cancel: function () {
// 用户取消分享后执行的回调函数
}
});
wx.onMenuShareTimeline({
title: '<?php echo $activeinfo['sharetitle'];?>', // 分享标题
//link: '<?php echo $activeinfo['activeUrl'];?>', // 分享链接
link: LINK, // 分享链接
imgUrl: '<?php echo $activeinfo['shareimg'];?>', // 分享图标
success: function () {
dataSDK.share('timeline');
// 用户确认分享后执行的回调函数
},
cancel: function () {
// 用户取消分享后执行的回调函数
}
});
});
window.doShare = function () {
wx.ready(function () {
// 在这里调用 API
var LINK = 'http://s.h5taotao.com/h5/majhong1/index.php?actId=1002&token=gaqugj1495770696'
if(localStorage.getItem('roomId')){
LINK = 'http://s.h5taotao.com/h5/majhong1/index.php?actId=1002&token=gaqugj1495770696&roomId='+localStorage.getItem('roomId')
}
wx.onMenuShareAppMessage({
title: '<?php echo $activeinfo['sharetitle'];?>', // 分享标题
desc: '<?php echo $activeinfo['sharedesc'];?>', // 分享描述
//link: '<?php echo $activeinfo['activeUrl'];?>', // 分享链接
link: LINK, // 分享链接
imgUrl: '<?php echo $activeinfo['shareimg'];?>', // 分享图标
type: '', // 分享类型,music、video或link,不填默认为link
dataUrl: '', // 如果type是music或video,则要提供数据链接,默认为空
success: function () {
dataSDK.share('friend');
// 用户确认分享后执行的回调函数
},
cancel: function () {
// 用户取消分享后执行的回调函数
}
});
wx.onMenuShareTimeline({
title: '<?php echo $activeinfo['sharetitle'];?>', // 分享标题
//link: '<?php echo $activeinfo['activeUrl'];?>', // 分享链接
link: LINK, // 分享链接
imgUrl: '<?php echo $activeinfo['shareimg'];?>', // 分享图标
success: function () {
dataSDK.share('timeline');
// 用户确认分享后执行的回调函数
},
cancel: function () {
// 用户取消分享后执行的回调函数
}
});
});
}
</script>
</body>
</html>