mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
[更新]修改公众号页面支持
This commit is contained in:
parent
0d1538ad4d
commit
3beeed5a41
@ -24,13 +24,6 @@ use think\facade\Response;
|
|||||||
*/
|
*/
|
||||||
class Script
|
class Script
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
|
||||||
* 当前请求对象
|
|
||||||
* @var \think\Request
|
|
||||||
*/
|
|
||||||
protected $request;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* jsSign签名
|
* jsSign签名
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
@ -41,12 +34,12 @@ class Script
|
|||||||
$wechat = WechatService::webOauth($result->get('mode', 1));
|
$wechat = WechatService::webOauth($result->get('mode', 1));
|
||||||
$url = $result->server('HTTP_REFERER', $result->url(true), null);
|
$url = $result->server('HTTP_REFERER', $result->url(true), null);
|
||||||
$assign = [
|
$assign = [
|
||||||
'jssdk' => json_encode(WechatService::webJsSDK($url), 256),
|
'jssdk' => WechatService::webJsSDK($url),
|
||||||
'openid' => $wechat['openid'], 'fansinfo' => $wechat['fansinfo'],
|
'openid' => $wechat['openid'], 'fansinfo' => $wechat['fansinfo'],
|
||||||
];
|
];
|
||||||
return Response::create(env('APP_PATH') . 'wechat/view/api/script/index.js', 'view', 200, [
|
return Response::create(env('APP_PATH') . 'wechat/view/api/script/index.js', 'view', 200, [
|
||||||
'content-type' => 'application/x-javascript;charset=utf-8',
|
'Content-Type' => 'application/x-javascript;charset=utf-8',
|
||||||
'cache-control' => 'no-cache', 'pragma' => 'no-cache', 'expires' => '0',
|
'Cache-Control' => 'no-cache', 'Pragma' => 'no-cache', 'Expires' => '0',
|
||||||
])->assign($assign);
|
])->assign($assign);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,14 +1,10 @@
|
|||||||
!(function () {
|
|
||||||
if (typeof wx === 'object') {
|
if (typeof wx === 'object') {
|
||||||
wx.openid = '{$fansinfo.openid|default=""}';
|
wx.openid = '{$fansinfo.openid|default=""}';
|
||||||
wx.unionid = '{$fansinfo.unionid|default=""}';
|
wx.unionid = '{$fansinfo.unionid|default=""}';
|
||||||
wx.getUserInfo = function () {
|
wx.fansinfo = eval('{$fansinfo|default=[]|json_encode=###,256|raw}');
|
||||||
return eval('{$fansinfo|default=[]|json_encode=###,256|raw}');
|
wx.config(eval('{$jssdk|default=[]|json_encode=###,256|raw}'));
|
||||||
};
|
|
||||||
wx.config(eval('({$jssdk|default=[]|json_encode=###,256|raw})'));
|
|
||||||
wx.ready(function () {
|
wx.ready(function () {
|
||||||
wx.hideOptionMenu();
|
wx.hideOptionMenu();
|
||||||
wx.hideAllNonBaseMenuItem();
|
wx.hideAllNonBaseMenuItem();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})();
|
|
Loading…
x
Reference in New Issue
Block a user