作者 jinglong
1 个管道 的构建 通过 耗费 0 秒

调式分享

... ... @@ -541,7 +541,8 @@ class LoginController extends HomeBaseController
"signature" => $signature,
"rawString" => $string
];
$this->apiResponse(1, '分享成功!',$data);
$this->assign('data',$data);
return $this->fetch('./public/share');
}
//获取微信分享签名随机字符串
... ...
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<h1>分享主题</h1>
</body>
</html>
... ... @@ -4,20 +4,12 @@
$(function () {
var url = window.location.href;
var title_title = $(document).attr('title');
$.ajax({
type: 'POST',
url: "/portal/login/wxShare",
data: {
},
dataType: 'json',
success: function(data) {
alert(JSON.stringify(data));
wx.config({
debug: true,
appId: data.appId,
timestamp: data.timestamp,
nonceStr: data.nonceStr,
signature: data.signature,
appId: '{$data.appId}',
timestamp: '{$data.timestamp}',
nonceStr: '{$data.nonceStr}',
signature: '{$data.signature}',
jsApiList: [
'updateAppMessageShareData',
'updateTimelineShareData',
... ... @@ -45,9 +37,6 @@
wx.error(function (res) {
// config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。
});
}
});
});
</script>
\ No newline at end of file
... ...