55 lines
2.0 KiB
HTML
55 lines
2.0 KiB
HTML
|
|
<!DOCTYPE html>
|
||
|
|
<html>
|
||
|
|
<head>
|
||
|
|
<meta charset="UTF-8">
|
||
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
|
|
<title>JSSDK</title>
|
||
|
|
<link href="https://cdn.bootcss.com/weui/2.2.0/style/weui.min.css" rel="stylesheet">
|
||
|
|
</head>
|
||
|
|
<body>
|
||
|
|
<div>
|
||
|
|
<p>注意此页面功能要在微信开发工具中进行调试!!!</p>
|
||
|
|
</div>
|
||
|
|
<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
|
||
|
|
<script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
|
||
|
|
<script src="js/site.js"></script>
|
||
|
|
<script>
|
||
|
|
wx.ready(function(){
|
||
|
|
//检查jsapi
|
||
|
|
wx.checkJsApi({
|
||
|
|
jsApiList: ['chooseImage'],
|
||
|
|
success: function(res) {
|
||
|
|
console.log(res);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
//分享给朋友的配置
|
||
|
|
wx.updateAppMessageShareData({
|
||
|
|
title:'模拟网页',
|
||
|
|
desc:'模拟网页模拟网页模拟网页模拟网页',
|
||
|
|
link:'https://www.xintijiao.com/wechat/sdk.html',
|
||
|
|
imgUrl:'https://www.xintijiao.com/img/sitelogo.af54d163.png',
|
||
|
|
success:function(){
|
||
|
|
console.log('配置成功');
|
||
|
|
}
|
||
|
|
});
|
||
|
|
});
|
||
|
|
wx.error(function(res){
|
||
|
|
console.log(res);
|
||
|
|
});
|
||
|
|
$(function(){
|
||
|
|
$.getJSON(url+"/wechat/jssdk?url="+encodeURIComponent(window.location.href),function(res,status){
|
||
|
|
if (status=='success'){
|
||
|
|
wx.config({
|
||
|
|
debug:true,
|
||
|
|
appId:res.app_id,
|
||
|
|
timestamp:res.timestamp,
|
||
|
|
nonceStr:res.nonce_str,
|
||
|
|
signature:res.signature,
|
||
|
|
jsApiList:["getLocation","updateAppMessageShareData","updateTimelineShareData","chooseImage","previewImage"],
|
||
|
|
});
|
||
|
|
}
|
||
|
|
});
|
||
|
|
});
|
||
|
|
</script>
|
||
|
|
</body>
|
||
|
|
</html>
|