testmobile.php 2.76 KB
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>YO'HOOD | 全球潮流新品嘉年华</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0 user-scalable=no" />
    <meta content="yes" name="apple-mobile-web-app-capable" />
    <meta content="yes" name="apple-touch-fullscreen" />
    <meta content="telephone=no" name="format-detection" />
    <meta content="black" name="apple-mobile-web-app-status-bar-style" />
</head>
<body>
test
</body>
<script type="text/javascript" charset="utf-8" src="http://staticzine.myoho.net/download/jquery.min.js?v=20150429"></script>
<script type="text/javascript" charset="utf-8" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script type="text/javascript">
wx.config({
    debug: true,
    appId: "<?php echo $this->view->wechat['appId'];?>",
    timestamp: <?php echo $this->view->wechat['timestamp'];?>,
    nonceStr: "<?php echo $this->view->wechat['nonceStr'];?>",
    signature: "<?php echo $this->view->wechat['signature'];?>",
    jsApiList: ['checkJsApi','onMenuShareTimeline','onMenuShareAppMessage','onMenuShareQQ',
        'onMenuShareWeibo','hideMenuItems','showMenuItems','hideAllNonBaseMenuItem','showAllNonBaseMenuItem',
        'translateVoice','startRecord','stopRecord','onRecordEnd','playVoice','pauseVoice','stopVoice',
        'uploadVoice','downloadVoice','chooseImage','previewImage','uploadImage','downloadImage',
        'getNetworkType','openLocation','getLocation','hideOptionMenu','showOptionMenu','closeWindow',
        'scanQRCode','chooseWXPay','openProductSpecificView','addCard','chooseCard','openCard'
    ]
});
wx.ready(function () {
        wx.onMenuShareAppMessage({
        title: '互联网之子',
        desc: '在长大的过程中,我才慢慢发现,我身边的所有事,别人跟我说的所有事,那些所谓本来如此,注定如此的事,它们其实没有非得如此,事情是可以改变的。更重要的是,有些事既然错了,那就该做出改变。',
        link: 'http://movie.douban.com/subject/25785114/',
        imgUrl: 'http://demo.open.weixin.qq.com/jssdk/images/p2166127561.jpg',
        trigger: function (res) {
          // 不要尝试在trigger中使用ajax异步请求修改本次分享的内容,因为客户端分享操作是一个同步操作,这时候使用ajax的回包会还没有返回
          alert('用户点击发送给朋友');
        },
        success: function (res) {
          alert('已分享');
        },
        cancel: function (res) {
          alert('已取消');
        },
        fail: function (res) {
          alert(JSON.stringify(res));
        }
      });
      alert('aaa');
});
wx.error(function (res) {
     alert(res.errMsg);
});
</script>
</html>