1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <?php
- /* @var $this \yii\web\View */
- /* @var $content string */
- use yii\helpers\Html;
- use company\assets\wechat\AppAsset;
- AppAsset::register($this);
- $wechat = new \common\library\WeChat();
- $timestamp = time();
- $noncestr = rand('10000','99999');
- ?>
- <?php $this->beginPage() ?>
- <!DOCTYPE html>
- <html lang="<?= Yii::$app->language ?>">
- <head>
- <meta charset="UTF-8">
- <meta charset="<?= Yii::$app->charset ?>">
- <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
- <?= Html::csrfMetaTags() ?>
- <title><?= Html::encode($this->title) ?></title>
- <?php $this->head() ?>
- </head>
- <body>
- <?=Html::jsFile('@web/js/jweixin-1.0.0.js');?>
- <script>
- wx.config({
- debug: false,
- appId: '<?php echo Yii::$app->params['wechat']['appID'] ?>', // 必填,公众号的唯一标识
- timestamp:<?php echo $timestamp?>, // 必填,生成签名的
- nonceStr: '<?php echo $noncestr; ?>', // 必填,生成签名的
- signature: '<?php echo $wechat->getsignature($noncestr,$timestamp,Yii::$app->request->hostInfo.Yii::$app->request->getUrl());?>',
- jsApiList: ['onMenuShareTimeline','onMenuShareAppMessage','hideOptionMenu','chooseImage','previewImage','uploadImage','downloadImage','showMenuItems','startRecord', 'stopRecord', 'onVoiceRecordEnd', 'playVoice', 'pauseVoice', 'stopVoice', 'onVoicePlayEnd', 'uploadVoice']
- });
- wx.ready(function() {
- wx.showMenuItems({
- menuList: ["menuItem:favorite"] // 要显示的菜单项,所有menu项见附录3
- });
- wx.hideOptionMenu();
- });
- </script>
- <?php $this->beginBody() ?>
- <?php if(Yii::$app->getSession()->hasFlash('success')): ?>
- <script>
- $.alert('<?=Yii::$app->session->getFlash('success');?>');
- </script>
- <?php endif;?>
- <?php if(Yii::$app->getSession()->hasFlash('error')): ?>
- <script>
- $.alert('<?=Yii::$app->session->getFlash('error');?>','警告');
- </script>
- <?php endif;?>
- <?= $content ?>
- <?php $this->endBody() ?>
- </body>
- </html>
- <?php $this->endPage() ?>
|