123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title>联调</title>
- <script type="text/javascript">var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");document.write(unescape("%3Cspan id='cnzz_stat_icon_1275865236'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "s96.cnzz.com/z_stat.php%3Fid%3D1275865236' type='text/javascript'%3E%3C/script%3E"));</script>
- <style type="text/css">
- button{
- width: 300px;
- height: 80px;
- font-size: 30px;
- display: block;
- margin: 50px;
- }
- </style>
- <script>
- document.getElementById("cnzz_stat_icon_1275865236").style.display="none"; // 隐藏统计小图标
- //声明_czc对象:
- var _czc = _czc || [];
- //绑定siteid,请用您的siteid替换下方"XXXXXXXX"部分
- _czc.push(["_setAccount", "1275865236"]);
- </script>
- </head>
- <body>
- <button onclick="getToken()">获取token</button>
- <div class="token"></div>
- <button onclick="shareWechatVideo()">分享到微信video</button>
- <button onclick="sharePengyouquanVideo()">分享到朋友圈video</button>
- <button onclick="shareWechatImage()">分享到微信图片</button>
- <button onclick="sharePengyouquanImage()">分享到朋友圈图片</button>
- <button onclick="shareWechatUrl()">分享到微信url</button>
- <button onclick="sharePengyouquanUrl()">分享到朋友圈url</button>
- <button onclick="shareXiaochengxu()">分享到小程序</button>
- <button onclick="openTaobao()">打开淘宝</button>
- </body>
- </html>
- <script type="text/javascript">
- //获取token
- function getToken () {
- var param = '{"js_callback" : "callBackMethodName"}';
- try{
- if(navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)){
- window.webkit.messageHandlers.app_h5_login.postMessage(param);
- }
- if(navigator.userAgent.match(/android/i)){
- obj4H5.app_h5_login(param);
- }
- }catch(e){
- //TODO handle the exception
- _czc.push(['_trackEvent', '小说', '打分', '达芬奇密码','5','dafen']);
- _czc.push(["_trackEvent",'测试','获取token']);
- console.log("兼容")
- }
-
- }
- function callBackMethodName (data) {//app token 回调
- var data = JSON.parse(data)
- alert(data)
- document.getElementsByClassName('token')[0].innerHTML = data.token;
- }
-
-
- // 分享到微信视屏
- function shareWechatVideo () {
- var param = {
- "shareVideoUrl" : location.href,//视频链接
- "shareType":"1", //1:微信好友 2:朋友圈
- "shareTitle" : "我是标题",//视频标题
- "shareThumb" : "https://small-app.oss-cn-beijing.aliyuncs.com/youhuiquan/shareImg.jpg",//视频缩略图
- "shareDescription" : "我是描述"//视频描述
- }
- param = JSON.stringify(param)
- try {
- if(navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)){
- window.webkit.messageHandlers.app_h5_wx_share_video.postMessage(param);
- }
- if(navigator.userAgent.match(/android/i)){
- obj4H5.app_h5_wx_share_video(param);
- }
- } catch (error) {
- _czc.push(["_trackEvent",'测试','分享到微信视频']);
- }
-
-
- }
-
-
- // 分享到朋友圈视屏
- function sharePengyouquanVideo () {
- var param = {
- "shareVideoUrl" : location.href,//视频链接
- "shareType":"2", //1:微信好友 2:朋友圈
- "shareTitle" : "我是标题",//视频标题
- "shareThumb" : "http://",//视频缩略图
- "shareDescription" : "我是描述"//视频描述
- }
- param = JSON.stringify(param)
- try {
- if(navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)){
- window.webkit.messageHandlers.app_h5_wx_share_video.postMessage(param);
- }
- if(navigator.userAgent.match(/android/i)){
- obj4H5.app_h5_wx_share_video(param);
- }
- } catch (error) {
- _czc.push(["_trackEvent",'分享到朋友圈视频']);
- }
-
- }
-
- //分享到微信图片
- function shareWechatImage () {
- var param = {
- "shareImageUrl" : "https://small-app.oss-cn-beijing.aliyuncs.com/youhuiquan/shareImg.jpg",//图片链接
- "shareType":"1" //1:微信好友 2:朋友圈
- }
- param = JSON.stringify(param)
- if(navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)){
- window.webkit.messageHandlers.app_h5_wx_share_image.postMessage(param);
- }
- if(navigator.userAgent.match(/android/i)){
- obj4H5.app_h5_wx_share_image(param);
- }
- }
- //分享到朋友圈图片
- function sharePengyouquanImage () {
- var param = {
- "shareImageUrl" : "https://small-app.oss-cn-beijing.aliyuncs.com/youhuiquan/shareImg.jpg",//图片链接
- "shareType":"2" //1:微信好友 2:朋友圈
- }
- param = JSON.stringify(param)
- if(navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)){
- window.webkit.messageHandlers.app_h5_wx_share_image.postMessage(param);
- }
- if(navigator.userAgent.match(/android/i)){
- obj4H5.app_h5_wx_share_image(param);
- }
- }
- //分享到微信url
- function shareWechatUrl () {
- var param = {
- "shareImageUrl" : "https://small-app.oss-cn-beijing.aliyuncs.com/youhuiquan/shareImg.jpg",
- "shareTitle" : "分享的标题",
- "shareDescirpt":"描述",
- "shareUrl":"https://tbk.726p.com/newh5/guide.html",//详情链接
- "shareType":"1" //1:微信好友 2:朋友圈
- }
- param = JSON.stringify(param)
- if(navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)){
- window.webkit.messageHandlers.app_h5_wx_share_url.postMessage(param);
- }
- if(navigator.userAgent.match(/android/i)){
- obj4H5.app_h5_wx_share_url(param);
- }
- }
- //分享到朋友圈url
- function sharePengyouquanUrl () {
- var param = {
- "shareImageUrl" : "https://small-app.oss-cn-beijing.aliyuncs.com/youhuiquan/shareImg.jpg",
- "shareTitle" : "分享的标题",
- "shareDescirpt":"描述",
- "shareUrl":"https://tbk.726p.com/newh5/guide.html",//详情链接
- "shareType":"2" //1:微信好友 2:朋友圈
- }
- param = JSON.stringify(param)
- if(navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)){
- window.webkit.messageHandlers.app_h5_wx_share_url.postMessage(param);
- }
- if(navigator.userAgent.match(/android/i)){
- obj4H5.app_h5_wx_share_url(param);
- }
- }
- // 分享到小程序
- function shareXiaochengxu () {
- var param = {
- "shareUrl" : "https://tbk.726p.com/newh5/guide.html",//兼容低版本的网页链接
- "shareThumb":"https://small-app.oss-cn-beijing.aliyuncs.com/youhuiquan/shareImg.jpg", //小程序消息封面图片
- "shareTitle" : "小程序标题",//小程序标题
- "shareDescription" : "小程序描述",//小程序描述
- "sharePath" : "pages/startPage/startPage",//小程序页面路径
- "shareID" : "gh_90d12769d02d",// 小程序原始id,在微信平台查询
- }
- param = JSON.stringify(param)
- if(navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)){
- window.webkit.messageHandlers.app_h5_wx_share_min.postMessage(param);
- }
- if(navigator.userAgent.match(/android/i)){
- obj4H5.app_h5_wx_share_min(param);
- }
- }
-
-
- // 刷新页面
- function refresh_h5(){
- location.reload();
- }
-
- // 打开淘宝
- function openTaobao () {
- var param = {"taobaoUrl" : "http://s.click.taobao.com/t?e=m%3D2%26s%3DwQohPv7xCpBw4vFB6t2Z2ueEDrYVVa64K7Vc7tFgwiHjf2vlNIV67nBGGV1GX0sjc4zWPc6e823SWPP%2BQd1B8Ip5RFGP7nMHQJN6CCi9LyyN1OQhcy96f3L1qrEoIuEDuPAZ9DJauYfNEPXytV9ALtCLThlbPuuZoWxvgQAAl6huShzkDg9djgibaxIfjjYxojrslWDXPcnGJe8N%2FwNpGw%3D%3D&pvid=23238182&union_lens=lensId:0b0b4315_0dfc_16613cfdc09_cc13"}
- param = JSON.stringify(param)
- if(navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)){
- window.webkit.messageHandlers.app_h5_open_taobao_url.postMessage(param);
- }
- if(navigator.userAgent.match(/android/i)){
- obj4H5.app_h5_open_taobao_url(param);
- }
- }
- </script>
|