12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- <!DOCTYPE html>
- <html lang="">
- <head>
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width,initial-scale=1.0">
- <link rel="icon" href="<%= BASE_URL %>favicon.ico">
- <title>
- <%= htmlWebpackPlugin.options.title %>
- </title>
- <!-- <script src="//cdn.jsdelivr.net/npm/eruda"></script>
- <script>
- eruda.init();
- </script> -->
- </head>
- <body>
- <noscript>
- <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.
- Please enable it to continue.</strong>
- </noscript>
- <div id="app"></div>
- <!-- built files will be auto injected -->
- <script>
- loadScript("http://res.wx.qq.com/open/js/jweixin-1.6.0.js?v=" + Date.now(), function () {
- fetch("https://import.smcic.net/weixin/share?url=" + encodeURIComponent(location.href.split("#")[0])).then(res => {
- return res.json()
- }).then(res => {
- let data = res || {};
- wx.config({
- debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
- appId: data.appid, // 必填,公众号的唯一标识
- timestamp: data.timestamp, // 必填,生成签名的时间戳
- nonceStr: data.nonceStr, // 必填,生成签名的随机串
- signature: data.signature, // 必填,签名
- jsApiList: [
- "updateAppMessageShareData",
- "updateTimelineShareData",
- "onMenuShareAppMessage",
- "onMenuShareTimeline",
- "onMenuShareQQ",
- "onMenuShareQZone",
- ], // 必填,需要使用的JS接口列表
- });
- wx.error(function (err) {
- console.log("err=>", err.errMsg);
- });
- wx.ready(function (res) {
- let title = "许个心愿吧 万一成真了呢"
- document.title = title
- //需在用户可能点击分享按钮前就先调用
- wx.updateAppMessageShareData({
- title: title, // 分享标题
- desc: "你负责建设美好 我负责实现愿望", // 分享描述
- link: location.href.split("?")[0] + "?v=" + Date.now(), // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
- imgUrl: "https://djweb.smcic.net/wish/shanjian1.jpg", // 分享图标
- });
- wx.updateTimelineShareData({
- title: title, // 分享标题
- link: location.href.split("?")[0] + "?v=" + Date.now(), // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
- imgUrl: "https://djweb.smcic.net/wish/shanjian1.jpg", // 分享图标
- });
- });
- })
- });
- // 创建script标签
- function loadScript(url, callback) {
- let script = document.createElement("script");
- if (script.readyState) {
- // IE
- script.onreadystatechange = function () {
- if (
- script.readyState === "loaded" ||
- script.readyState === "complete"
- ) {
- script.onreadystatechange = null;
- callback();
- }
- };
- } else {
- // 其他浏览器
- script.onload = function () {
- callback();
- };
- }
- script.src = url;
- document.getElementsByTagName("head")[0].appendChild(script);
- }
- </script>
- </body>
- </html>
|