-
Notifications
You must be signed in to change notification settings - Fork 3
/
demo.html
130 lines (115 loc) · 3.04 KB
/
demo.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
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
11
<img src="img/hotpostimg/hot1.jpg" >
</body>
</html>
<script src="js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="https://res2.wx.qq.com/open/js/jweixin-1.4.0.js " type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
var data;
window.shareData={
imgUrl:"https://yun.neweasco.com/easco/vtour/img/hotpostimg/hot1.jpg",
title:"222",
content:"111",
};
// $.ajax({
// url: "https://yun.neweasco.com/jssdk.php?callback",
// dataType: "json",
// async: false,
// type: "GET",
// beforeSend: function() {
//
// },
// success: function(req) {
// }
// });
// var url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wxe08f06eed88a45d4&secret=b05776d45acd6e9234f517dda2c698d3";
// $.get('https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wxe08f06eed88a45d4&secret=b05776d45acd6e9234f517dda2c698d3?callback=?',function(req){
// console.log(req)
// },'jsonp');
//
// alert(location.href.split('#')[0])
$.get('https://yun.neweasco.com/jssdk.php?callback=?&url='+location.href.split('#')[0],function(req){
console.log(req)
console.log(wx)
data=req;
wx.config({
debug: false,
appId: "wxe08f06eed88a45d4",
timestamp: data.timestamp,
nonceStr: data.nonceStr ,
signature:data.signature,
jsApiList:["onMenuShareAppMessage","translateVoice"]
});
wx.ready(function(){
alert("isOK")
wx.onMenuShareAppMessage({
dataUrl: "",
type: "link",
title: window.shareData.title,
desc: window.shareData.content,
link:location.href.split('#')[0],
imgUrl:window.shareData.imgUrl ,
success: function (res,any) {
alert("OK")
// alert(2)
},
cancel: function (res, any) {
alert("NO")
/// alert(3)
}
});
});
},'jsonp');
/*
var data;
window.shareData={
imgUrl:"https://yun.neweasco.com/easco/vtour/img/hotpostimg/hot1.jpg",
title:"222",
content:"111",
};
$.ajax({
url: "https://yun.neweasco.com/jssdk.php",
dataType: "json",
async: true,
type: "GET",
beforeSend: function() {
},
success: function(req) {
console.log(req)
data=req;
wx.config({
debug: true,
appId: data.appId,
timestamp: data.timestamp,
nonceStr: data.nonceStr ,
signature:data.signature,
jsApiList:["onMenuShareAppMessage"]
});
wx.ready(function(){
alert(1)
wx.onMenuShareAppMessage({
dataUrl: "",
type: "link",
title: window.shareData.title,
desc: window.shareData.content,
link:"",
imgUrl:window.shareData.imgUrl ,
success: function (res,any) {
// alert(2)
},
cancel: function (res, any) {
/// alert(3)
}
});
});
}
});
*/
</script>