-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgeneral.html
83 lines (83 loc) · 2.18 KB
/
general.html
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
<html>
<head>
<meta charset="UTF-8">
<title>wechat js api test - general - weAPI</title>
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no,minimal-ui" name="viewport" />
<script src="debug.js"></script>
<script src="weAPI.js?v=3"></script>
<script src="plugin/generalShare.js?v=3"></script>
<style type="text/css">
body{
font-size: 20px;
}
</style>
</head>
<body>
<br>
for ios wechat version >= 6
<br>
<a onclick="location.search='?'+(+new Date())">reload</a>
<br>
<a href="http://touch.qunar.com/">测试一下传说的链接跳转分享地址不对的bug</a>
</body>
<script>
function _log(msg) {
// alert(msg)
}
weAPI.ready(function() {
var list = [
[
"shareTimeline", "朋友圈",
{
title:"有趣的图片",
img_url: "http://file5.u148.net/2014/10/images/1412934017UEH.jpg",
link: "http://file5.u148.net/2014/10/images/1412934017UEH.jpg"
}
],
[
"sendAppMessage",
"微信好友",
{
title:"有趣的图片",
img_url: "http://file5.u148.net/2014/10/images/1412934017UEH.jpg",
link: "http://file5.u148.net/2014/10/images/1412934017UEH.jpg"
}
],
[
"shareWeibo",
"微博",
{
content: "有趣的图片",
url: "http://qunar.com/"
}
]
]
var name = "hehe"
weAPI.generalShare(list[0][2]).ready(function(data, argv) {
if(argv) {
name = argv.shareTo
_log(name + "ready")
var o = list[0][2]
switch(argv.shareTo) {
// case "shareTimeline":break;
case "sendAppMessage": o = list[1][2];break;
case "shareWeibo": o = list[2][2];break;
}
for(var i in o) {
data[i] = o[i]
}
}
}).cancel(function() {
_log(name + "cancle")
}).success(function() {
_log(name + "success")
}).fail(function() {
_log(name + "fail")
}).done(function(r) {
_log(name + "done" + (r ? "-" + JSON.stringify(r) : ""))
})
})
</script>
</html>