{"id":6868,"date":"2018-09-09T18:20:08","date_gmt":"2018-09-09T10:20:08","guid":{"rendered":"https:\/\/sdeno.com\/?p=6868"},"modified":"2020-11-25T16:57:30","modified_gmt":"2020-11-25T08:57:30","slug":"%e5%be%ae%e4%bf%a1%e7%ab%af%e5%88%86%e4%ba%ab%e3%80%81%e6%89%8b%e6%9c%baqq%e5%a5%bd%e5%8f%8b%e5%88%86%e4%ba%ab","status":"publish","type":"post","link":"https:\/\/sdeno.com\/?p=6868","title":{"rendered":"\u5fae\u4fe1\u7aef\u5206\u4eab\u3001\u624b\u673aQQ\u597d\u53cb\u5206\u4eab\u4ee5\u53ca\u5c0f\u7a0b\u5e8f\u548cH5\u6570\u636e\u4ea4\u4e92"},"content":{"rendered":"<p>\u5fae\u4fe1\u4e3a\u6211\u4eec\u63d0\u4f9b\u4e86\u4ece\u5fae\u4fe1\u5206\u4eab\u5230\u5230\u670b\u53cb\u5708\u3001\u5fae\u4fe1\u597d\u53cb\u3001qq\u597d\u53cb\u3001qq\u7a7a\u95f4\u65f6\uff0c\u6240\u663e\u793a\u4e0d\u540c\u7684\u5206\u4eab\u6587\u6848\u3002\uff08\u63a5\u53e3\u662f\u6536\u8d39\u7684\uff09<\/p>\n<p>&nbsp;<\/p>\n<p>\u6548\u679c\uff1a\u7528\u6237\u7528\u5fae\u4fe1\u626b\u7801\u663e\u793a\u7684h5\u9875\u9762\uff0c\u70b9\u51fb\u53f3\u4e0a\u89d2\u5c31\u4f1a\u5f39\u51fa\u5e95\u90e8\u6846\u3002\u5982\u679c\u662fapp\u5d4c\u5957h5\u9875\u9762\u5206\u4eab\u529f\u80fd\u7684\u8bdd\uff0c\u8ba9app\u5f00\u53d1\u4eba\u5458\u63d0\u4f9b\u8c03\u7528\u5524\u8d77\u5206\u4eab\u5f39\u51fa\u7a97\u53e3\u7684\u4ee3\u7801\uff0c\u4e5f\u6709\u5fae\u4fe1\u670b\u53cb\u5206\u4eab\u548c\u5fae\u4fe1\u670b\u53cb\u5708\u5206\u4eab\u3002<\/p>\n<figure class=\"mdx-lazyload-container\" style=\"max-width:417px\"><div style=\"padding-top:181.29496402878%\"><\/div><div class=\"mdx-img-loading-sp mdui-valign\"><div><div class=\"mdui-spinner\"><\/div><\/div><\/div><img width=\"417\" height=\"756\" class=\"alignnone size-full wp-image-7418 lazyload\" title=\"\u5fae\u4fe1\u7aef\u5206\u4eab\u3001\u624b\u673aQQ\u597d\u53cb\u5206\u4eab\u4ee5\u53ca\u5c0f\u7a0b\u5e8f\u548cH5\u6570\u636e\u4ea4\u4e92\" src=\"data:image\/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\" data-src=\"https:\/\/sdeno.com\/wp-content\/uploads\/2018\/09\/share_img.jpg\" alt=\"https:\/\/sdeno.com\/wp-content\/uploads\/2018\/09\/share_img.jpg\" data-srcset=\"https:\/\/sdeno.com\/wp-content\/uploads\/2018\/09\/share_img.jpg 417w, https:\/\/sdeno.com\/wp-content\/uploads\/2018\/09\/share_img-165x300.jpg 165w\" sizes=\"auto, (max-width: 417px) 100vw, 417px\"><\/figure>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #ff0000;\">\u8bbe\u7f6e\u57df\u540d<\/span><\/p>\n<p>\u5fae\u4fe1\u516c\u4f17\u5e73\u53f0\u8fdb\u5165&#8212;\u201c\u516c\u4f17\u53f7\u8bbe\u7f6e\u201d&#8212;-\u201c\u529f\u80fd\u8bbe\u7f6e\u201d&#8212;\u201cJS\u63a5\u53e3\u5b89\u5168\u57df\u540d\u201d<\/p>\n<p>\u4e0d\u8981\u5e26http:\/\/<\/p>\n<figure class=\"mdx-lazyload-container\" style=\"max-width:872px\"><div style=\"padding-top:56.651376146789%\"><\/div><div class=\"mdx-img-loading-sp mdui-valign\"><div><div class=\"mdui-spinner\"><\/div><\/div><\/div><img width=\"872\" height=\"494\" class=\"alignnone size-full wp-image-7522 lazyload\" title=\"\u5fae\u4fe1\u7aef\u5206\u4eab\u3001\u624b\u673aQQ\u597d\u53cb\u5206\u4eab\u4ee5\u53ca\u5c0f\u7a0b\u5e8f\u548cH5\u6570\u636e\u4ea4\u4e92\" src=\"data:image\/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\" data-src=\"https:\/\/sdeno.com\/wp-content\/uploads\/2018\/09\/wxshare1.jpg\" alt=\"https:\/\/sdeno.com\/wp-content\/uploads\/2018\/09\/wxshare1.jpg\" data-srcset=\"https:\/\/sdeno.com\/wp-content\/uploads\/2018\/09\/wxshare1.jpg 872w, https:\/\/sdeno.com\/wp-content\/uploads\/2018\/09\/wxshare1-300x170.jpg 300w, https:\/\/sdeno.com\/wp-content\/uploads\/2018\/09\/wxshare1-768x435.jpg 768w\" sizes=\"auto, (max-width: 872px) 100vw, 872px\"><\/figure>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #ff0000;\">\u5fae\u4fe1\u5206\u4eabH5<\/span><\/p>\n<p>\u5b98\u65b9\u6587\u6863\u5730\u5740\u4e3a\uff1a<br \/>\n<a href=\"https:\/\/mp.weixin.qq.com\/wiki?t=resource\/res_main&amp;id=mp1421141115\" target=\"_blank\" rel=\"noopener\">https:\/\/mp.weixin.qq.com\/wiki?t=resource\/res_main&amp;id=mp1421141115<\/a><\/p>\n<p>\u627e\u5230\u5df2\u6709\u516c\u4f17\u53f7\u7684appid\uff0c\u6839\u636e\u8fd9\u4e2aappid\u548curl\u5411\u540e\u7aef\u53d1\u8d77\u8bf7\u6c42\uff0c\u62ff\u5230\u914d\u7f6e\u6240\u9700\u8981\u7684\u53c2\u6570\uff1atimestamp\u3001noncestr\u548csignature\u3002<\/p>\n<p>\u6dfb\u52a0<\/p>\n<pre>&lt;script src=\"https:\/\/res.wx.qq.com\/open\/js\/jweixin-1.2.0.js\" type=\"text\/javascript\"&gt;&lt;\/script&gt;<\/pre>\n<figure class=\"mdx-lazyload-container\" style=\"max-width:300px\"><div style=\"padding-top:45.333333333333%\"><\/div><div class=\"mdx-img-loading-sp mdui-valign\"><div><div class=\"mdui-spinner\"><\/div><\/div><\/div><img width=\"300\" height=\"136\" class=\"alignnone wp-image-6875 size-medium lazyload\" title=\"\u5fae\u4fe1\u7aef\u5206\u4eab\u3001\u624b\u673aQQ\u597d\u53cb\u5206\u4eab\u4ee5\u53ca\u5c0f\u7a0b\u5e8f\u548cH5\u6570\u636e\u4ea4\u4e92\" src=\"data:image\/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\" data-src=\"https:\/\/sdeno.com\/wp-content\/uploads\/2018\/09\/wx1-300x136.jpg\" alt=\"https:\/\/sdeno.com\/wp-content\/uploads\/2018\/09\/wx1-300x136.jpg\" data-srcset=\"https:\/\/sdeno.com\/wp-content\/uploads\/2018\/09\/wx1-300x136.jpg 300w, https:\/\/sdeno.com\/wp-content\/uploads\/2018\/09\/wx1-768x348.jpg 768w, https:\/\/sdeno.com\/wp-content\/uploads\/2018\/09\/wx1.jpg 822w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\"><\/figure>\n<pre>var wxTitle = '\u6807\u9898'; \r\nvar wxDesc = \"\u6458\u8981\"; \r\nvar wxLogo = \"http:\/\/xx\/1.png\"\u00a0 \/\/\u7f29\u7565\u56fe \r\nvar wxLink = \"http:\/\/xx.com\/\";\u00a0 \/\/\u5206\u4eab\u70b9\u51fb\u8981\u8df3\u8f6c\u7684\u9875\u9762 \r\n\r\n\/\/\u914d\u7f6e\u4fe1\u606f \r\nwx.config({ \r\n\"debug\":false, \r\n\"beta\":true, \r\n\"appId\":\"<span style=\"color: #ffffff;\">wx48d79203b4f0c482<\/span>\", \r\n\"nonceStr\":\"rand_5b94f14f204b0\", \r\n\"timestamp\":1536487759, \r\n\"url\":\"https:\\\/\\\/m.weiclicai.com\\\/activity\\\/third-yearend-act\\\/thirdbill\", \r\n\"signature\":\"4e3c1ff25ee8daa742322278aaaeaf1af91f3d5c\", \r\n\"jsApiList\":[\r\n \"hideMenuItems\",\r\n \"onMenuShareAppMessage\",\r\n \"onMenuShareTimeline\",\r\n \"onMenuShareQQ\"] \r\n});\r\n\r\n\r\nwx.ready(function () {\r\n  wx.hideMenuItems({\r\n    menuList: [ \/\/\u9650\u5236\u5206\u4eab\u5230\u5230\u7684\u5e73\u53f0\r\n     \"menuItem:share:weiboApp\",\r\n     \"menuItem:share:facebook\",\r\n     \"menuItem:share:QZone\",\r\n     \"menuItem:originPage\",\r\n     \"menuItem:readMode\",\r\n     \"menuItem:openWithQQBrowser\",\r\n     \"menuItem:openWithSafari\",\r\n     \"menuItem:share:email\"\r\n   ]\r\n  });\r\n\r\n  wx.onMenuShareTimeline({\r\n    title: wxDesc,\r\n    desc: wxDesc,\r\n    link: wxLink,\r\n    imgUrl: wxLogo,\r\n    success: function () {\r\n     \/\/\u5206\u4eab\u5fae\u4fe1\u670b\u53cb\u5708\r\n \r\n    },\r\n    cancel: function () {\r\n\r\n    }\r\n  });\r\n\r\n  wx.onMenuShareAppMessage({\r\n    title: wxTitle,\r\n    desc: wxDesc,\r\n    link: wxLink,\r\n    imgUrl: wxLogo,\r\n    success: function () {\r\n    \/\/\u5206\u4eab\u5fae\u4fe1\u670b\u53cb\r\n \r\n    },\r\n    cancel: function () {\r\n\r\n    }\r\n  });\r\n\r\n  wx.onMenuShareQQ({\r\n    title: wxTitle,\r\n    desc: wxDesc,\r\n    link: wxLink,\r\n    imgUrl:wxLogo,\r\n    success: function () {\r\n    \/\/\u5206\u4eabqq\u670b\u53cb\r\n \r\n    },\r\n    cancel: function () {\r\n\r\n    }\r\n  });\r\n});<\/pre>\n<p><a href=\"https:\/\/segmentfault.com\/a\/1190000016199418\" target=\"_blank\" rel=\"noopener\">https:\/\/segmentfault.com\/a\/1190000016199418<\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #ff0000;\">QQ\u5206\u4eab\u597d\u53cb \uff08\u514d\u8d39\uff09<\/span><\/p>\n<p>qq\u624b\u673a \u597d\u53cb\u4e4b\u95f4\u7684\u5206\u4eab\uff0c\u70b9\u51fb\u53f3\u4e0a\u89d2\uff0c\u53bb\u5206\u4eab<\/p>\n<figure class=\"mdx-lazyload-container\" style=\"max-width:300px\"><div style=\"padding-top:65.333333333333%\"><\/div><div class=\"mdx-img-loading-sp mdui-valign\"><div><div class=\"mdui-spinner\"><\/div><\/div><\/div><img width=\"300\" height=\"196\" class=\"alignnone size-medium wp-image-6876 lazyload\" title=\"\u5fae\u4fe1\u7aef\u5206\u4eab\u3001\u624b\u673aQQ\u597d\u53cb\u5206\u4eab\u4ee5\u53ca\u5c0f\u7a0b\u5e8f\u548cH5\u6570\u636e\u4ea4\u4e92\" src=\"data:image\/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\" data-src=\"https:\/\/sdeno.com\/wp-content\/uploads\/2018\/09\/qq-300x196.jpg\" alt=\"https:\/\/sdeno.com\/wp-content\/uploads\/2018\/09\/qq-300x196.jpg\" data-srcset=\"https:\/\/sdeno.com\/wp-content\/uploads\/2018\/09\/qq-300x196.jpg 300w, https:\/\/sdeno.com\/wp-content\/uploads\/2018\/09\/qq.jpg 668w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\"><\/figure>\n<pre> &lt;script type=\"text\/javascript\" src=\"https:\/\/qzonestyle.gtimg.cn\/qzone\/qzact\/common\/share\/share.js\"&gt;&lt;\/script&gt;\r\n &lt;script type=\"text\/javascript\"&gt;\r\n var title = \"\u7ef4C\u7269\u67433\u5468\u5e74\u7ea2\u5305\uff0c\u624b\u6162\u65e0\";\r\n var summary = \"\u6211\u5728\u7ef4C\u7269\u6743\u7684\u6536\u76ca\u8d85\u8fc70%\u7528\u6237,\u8d76\u7d27\u6765\u8f83\u91cf\u4e00\u4e0b\u5427~\";\r\n var sharepic = 'https:\/\/dn-weiclicai.qbox.me\/5b725146ce0af.png'; \/\/\u8fd9\u91cc\u8981\u5199\u5f53\u524d\u57df\u540d\u7684\u56fe\u7247\r\n var shareurl = \"https:\/\/m.weiclicai.com\/activity\/third-yearend-act\/thirdbill\";\/\/\u8fd9\u91cc\u8981\u5199\u5f53\u524d\u57df\u540d\u7684\u56fe\u7247\r\n \r\n setShareInfo({\r\n   title: title,\r\n   summary: summary,\r\n   pic: sharepic,\r\n   url: shareurl\r\n });\r\n &lt;\/script&gt;<\/pre>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/www.cnblogs.com\/joshua317\/p\/4761948.html\" target=\"_blank\" rel=\"noopener\">https:\/\/www.cnblogs.com\/joshua317\/p\/4761948.html<\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #ff0000;\">jweixin-1.4.0.js\u7684\u4f7f\u7528\u65b9\u6cd5\uff1a<\/span><\/p>\n<p>\u8e29\u5751\uff1a\u6839\u636e\u5fae\u4fe1\u5b98\u65b9\u6587\u6863\uff0conMeneShareTimeline\u3001onMenuShareAppMessage\u3001onMenuShareQQ\u3001onMenuShareQZone\u63a5\u53e3\u5373\u5c06\u5e9f\u5f03\u3002\u5efa\u8bae\u4f7f\u75281.4.0\u7248\u672c\u4e4b\u540e\u7684\u5206\u4eab\u63a5\u53e3\uff1aupdateAppMessageShareData\u3001updateTimelineShareData\u3001onMenuShareWeibo\u3002\u4f46\u662f\u5728config\u7684jsApiList\u5217\u8868\u4e2d\uff0c\u5728\u52a0\u4e0a1.4.0\u7684\u63a5\u53e3\u540d\u79f0\u65f6\uff0c\u4e00\u5b9a\u8981\u5c06\u5bf9\u5e94\u7684\u8001\u7248\u672c\u7684\u63a5\u53e3\u540d\u79f0\u52a0\u4e0a\uff0c\u5426\u5219\u65b0\u7684\u63a5\u53e3\u4e0d\u8d77\u4f5c\u7528\u3002<\/p>\n<p>https:\/\/res.wx.qq.com\/open\/js\/jweixin-1.4.0.js<\/p>\n<pre>wx.config({\r\n   debug: true, \/\/ \u5f00\u542f\u8c03\u8bd5\u6a21\u5f0f,\u8c03\u7528\u7684\u6240\u6709api\u7684\u8fd4\u56de\u503c\u4f1a\u5728\u5ba2\u6237\u7aefalert\u51fa\u6765\uff0c\u82e5\u8981\u67e5\u770b\u4f20\u5165\u7684\u53c2\u6570\uff0c\u53ef\u4ee5\u5728pc\u7aef\u6253\u5f00\uff0c\u53c2\u6570\u4fe1\u606f\u4f1a\u901a\u8fc7log\u6253\u51fa\uff0c\u4ec5\u5728pc\u7aef\u65f6\u624d\u4f1a\u6253\u5370\u3002\r\n   appId: '{$data.appId}', \/\/ \u5fc5\u586b\uff0c\u516c\u4f17\u53f7\u7684\u552f\u4e00\u6807\u8bc6\r\n   timestamp: '{$data.timeStamp}', \/\/ \u5fc5\u586b\uff0c\u751f\u6210\u7b7e\u540d\u7684\u65f6\u95f4\u6233\r\n   nonceStr: '{$data.nonceStr}', \/\/ \u5fc5\u586b\uff0c\u751f\u6210\u7b7e\u540d\u7684\u968f\u673a\u4e32\r\n   signature: '{$data.signature}',\/\/ \u5fc5\u586b\uff0c\u7b7e\u540d\r\n   jsApiList: [\r\n    'checkJsApi',\/\/\u68c0\u6d4b\u63a5\u53e3\u6743\u9650\r\n    'updateTimelineShareData',\/\/1.4.0\u7684\u5206\u4eab\u63a5\u53e3\uff0c\u6ce8\u610f\uff1a\u4f7f\u7528\u65b0\u7248\u672c\u7684\u5206\u4eab\u529f\u80fd\uff0c\u4e00\u5b9a\u8981\u5728\u8be5\u5217\u8868\u52a0\u4e0a\u5bf9\u5e94\u7684\u8001\u7248\u672c\u529f\u80fd\u63a5\u53e3\uff0c\u5426\u5219\u65b0\u63a5\u53e3\u4e0d\u8d77\u4f5c\u7528\r\n    'updateAppMessageShareData',\/\/1.4.0\u7684\u5206\u4eab\u63a5\u53e3,\u6ce8\u610f\uff1a\u4f7f\u7528\u65b0\u7248\u672c\u7684\u5206\u4eab\u529f\u80fd\uff0c\u4e00\u5b9a\u8981\u5728\u8be5\u5217\u8868\u52a0\u4e0a\u5bf9\u5e94\u7684\u8001\u7248\u672c\u529f\u80fd\u63a5\u53e3\uff0c\u5426\u5219\u65b0\u63a5\u53e3\u4e0d\u8d77\u4f5c\u7528\r\n    'onMenuShareAppMessage',\/\/\u8001\u7248\u672c\u5206\u4eab\u63a5\u53e3\u3002\r\n    'onMenuShareTimeline'\/\/\u8001\u7248\u672c\u5206\u4eab\u63a5\u53e3\u3002\r\n   ] \/\/ \u5fc5\u586b\uff0c\u9700\u8981\u4f7f\u7528\u7684JS\u63a5\u53e3\u5217\u8868\r\n});\r\n\r\nwx.checkJsApi({\r\n  jsApiList: [ 'updateTimelineShareData',\r\n   'updateAppMessageShareData',\r\n   'onMenuShareAppMessage',\r\n   'onMenuShareTimeline'\r\n  ], \/\/ \u9700\u8981\u68c0\u6d4b\u7684JS\u63a5\u53e3\u5217\u8868\uff0c\u6240\u6709JS\u63a5\u53e3\u5217\u8868\u89c1\u9644\u5f552,\r\n  success: function(res) {\r\n    \/\/ \u4ee5\u952e\u503c\u5bf9\u7684\u5f62\u5f0f\u8fd4\u56de\uff0c\u53ef\u7528\u7684api\u503ctrue\uff0c\u4e0d\u53ef\u7528\u4e3afalse\r\n    \/\/ \u5982\uff1a{\"checkResult\":{\"chooseImage\":true},\"errMsg\":\"checkJsApi:ok\"}\r\n    alert(JSON.stringify(res));\r\n  },\r\n  error:function(res){\r\n    alert(res);\r\n  }\r\n\r\n});\r\n\r\n\r\n\/\/\u5206\u4eab\u529f\u80fd\r\nwx.ready(function () { \/\/\u9700\u5728\u7528\u6237\u53ef\u80fd\u70b9\u51fb\u5206\u4eab\u6309\u94ae\u524d\u5c31\u5148\u8c03\u7528\r\n  var shareData = {\r\n   title: '\u5206\u4eab\u6807\u9898', \/\/ \u5206\u4eab\u6807\u9898\r\n   desc: '\u5206\u4eab\u63cf\u8ff0', \/\/ \u5206\u4eab\u63cf\u8ff0\r\n   link: 'http:\/\/www.baidu.com', \/\/ \u5206\u4eab\u94fe\u63a5\uff0c\u8be5\u94fe\u63a5\u57df\u540d\u6216\u8def\u5f84\u5fc5\u987b\u4e0e\u5f53\u524d\u9875\u9762\u5bf9\u5e94\u7684\u516c\u4f17\u53f7JS\u5b89\u5168\u57df\u540d\u4e00\u81f4\r\n   imgUrl: 'http:\/\/www.baidu.com\/static\/addHtml\/images\/iterationTheme\/common\/logo_new.png', \/\/ \u5206\u4eab\u56fe\u6807\r\n   success: function (res) {\r\n     \/\/ \u8bbe\u7f6e\u6210\u529f\r\n   },\r\n   error:function(res){\r\n   }\r\n  };\r\n  \/\/\u81ea\u5b9a\u4e49\u201c\u5206\u4eab\u7ed9\u670b\u53cb\u201d\u53ca\u201c\u5206\u4eab\u5230QQ\u201d\u6309\u94ae\u7684\u5206\u4eab\u5185\u5bb9\uff081.4.0\uff09\r\n  wx.updateAppMessageShareData(shareData);\r\n  \/\/\u81ea\u5b9a\u4e49\u201c\u5206\u4eab\u5230\u670b\u53cb\u5708\u201d\u53ca\u201c\u5206\u4eab\u5230QQ\u7a7a\u95f4\u201d\u6309\u94ae\u7684\u5206\u4eab\u5185\u5bb9\uff081.4.0\uff09\r\n  wx.updateTimelineShareData(shareData);\r\n\r\n  <span style=\"color: #ff0000;\">*\u5728\u5b9e\u9645\u5f00\u53d1\u4e2d1.4.0\u4ecd\u7136\u80fd\u4f7f\u7528\u8001\u7684\u90a3\u4e9b\u65b9\u6cd5<\/span>\r\n});\r\n\r\nwx.error(function(res){\r\n  \/\/ config\u4fe1\u606f\u9a8c\u8bc1\u5931\u8d25\u4f1a\u6267\u884cerror\u51fd\u6570\uff0c\u5982\u7b7e\u540d\u8fc7\u671f\u5bfc\u81f4\u9a8c\u8bc1\u5931\u8d25\uff0c\u5177\u4f53\u9519\u8bef\u4fe1\u606f\u53ef\u4ee5\u6253\u5f00config\u7684debug\u6a21\u5f0f\u67e5\u770b\uff0c\u4e5f\u53ef\u4ee5\u5728\u8fd4\u56de\u7684res\u53c2\u6570\u4e2d\u67e5\u770b\uff0c\u5bf9\u4e8eSPA\u53ef\u4ee5\u5728\u8fd9\u91cc\u66f4\u65b0\u7b7e\u540d\u3002\r\n  alert(res.errMsg);\r\n});\r\n\r\n<\/pre>\n<p><a href=\"https:\/\/blog.csdn.net\/u012274155\/article\/details\/90716828\" target=\"_blank\" rel=\"noopener\">https:\/\/blog.csdn.net\/u012274155\/article\/details\/90716828<\/a><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #ff0000;\">app\u5206\u4eab\u5185\u7f6e\u7684H5<\/span><\/p>\n<p>\u9700\u8981app\u7684\u5f00\u53d1\u4eba\u5458\u63d0\u4f9b\uff0ch5\u80fd\u8c03\u7528app\u7684\u5206\u4eab\u63a5\u53e3\uff0c\u5982<\/p>\n<figure class=\"mdx-lazyload-container\" style=\"max-width:395px\"><div style=\"padding-top:185.82278481013%\"><\/div><div class=\"mdx-img-loading-sp mdui-valign\"><div><div class=\"mdui-spinner\"><\/div><\/div><\/div><img width=\"395\" height=\"734\" class=\"alignnone size-full wp-image-7585 lazyload\" title=\"\u5fae\u4fe1\u7aef\u5206\u4eab\u3001\u624b\u673aQQ\u597d\u53cb\u5206\u4eab\u4ee5\u53ca\u5c0f\u7a0b\u5e8f\u548cH5\u6570\u636e\u4ea4\u4e92\" src=\"data:image\/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\" data-src=\"https:\/\/sdeno.com\/wp-content\/uploads\/2018\/09\/appshare.jpg\" alt=\"https:\/\/sdeno.com\/wp-content\/uploads\/2018\/09\/appshare.jpg\" data-srcset=\"https:\/\/sdeno.com\/wp-content\/uploads\/2018\/09\/appshare.jpg 395w, https:\/\/sdeno.com\/wp-content\/uploads\/2018\/09\/appshare-161x300.jpg 161w\" sizes=\"auto, (max-width: 395px) 100vw, 395px\"><\/figure>\n<p>&nbsp;<\/p>\n<p>\u70b9\u51fb\u5206\u4eab\u7ed9\u5fae\u4fe1\u597d\u53cb \uff0c\u8c8c\u4f3c\u53ef\u4ee5\u662f\u5c0f\u7a0b\u5e8f\u6216\u8005\u662fH5\uff0c\uff08\u65b0\u6d6a\u5fae\u535a\u5206\u4eab\u7ed9\u5fae\u4fe1\u597d\u53cb\u7684\u5361\u7247\u662f\u5c0f\u7a0b\u5e8f\u5361\u7247\uff09<\/p>\n<p>\u81f3\u4e8e\u5206\u4eab\u51fa\u53bb\u7684\u6807\u9898\u548c\u56fe\u6807\uff0c\u8ba9app\u5f00\u53d1\u81ea\u5df1\u53bb\u5b9a\u4e49<\/p>\n<pre>\/\/\u6211\u516c\u53f8\u7684\u90e8\u5206\u4ee3\u7801\r\nif (dev.isIosApp()) {\r\n  window.webkit.messageHandlers.nativeJsBridge.postMessage({\r\n     name: 'app.ComponentShareMethod',\r\n     shareData: {...}\r\n  });\r\n} else if (dev.isAndApp()) {} {\r\n  window.nativeJsBridge &amp;&amp; window.nativeJsBridge.nativeShare(JSON.stringify({...}));\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #ff0000;\">\u5c0f\u7a0b\u5e8f\u5206\u4eab\u5185\u7f6eH5<\/span><\/p>\n<p>\u6700\u65b0 jweixin.js\uff1a<a href=\"https:\/\/mp.weixin.qq.com\/wiki?t=resource\/res_main&amp;id=mp1421141115\" target=\"_blank\" rel=\"noopener\">https:\/\/mp.weixin.qq.com\/wiki?t=resource\/res_main&amp;id=mp1421141115<\/a><br \/>\n<a href=\"https:\/\/developers.weixin.qq.com\/miniprogram\/dev\/component\/web-view.html\" target=\"_blank\" rel=\"noopener\">https:\/\/developers.weixin.qq.com\/miniprogram\/dev\/component\/web-view.html<\/a><\/p>\n<p>&nbsp;<\/p>\n<p>\u9700\u8981\u53bb\u5fae\u4fe1\u516c\u4f17\u5e73\u53f0\u8bbe\u7f6e\uff1a<\/p>\n<p>\u8981\u8ba9\u5c0f\u7a0b\u5e8f \u5d4c\u5957h5\u9875\u9762\u9700\u8981 \u8bbe\u7f6e \u4e1a\u52a1\u57df\u540d\uff0c\u4f46\u4e1a\u52a1\u57df\u540d\u4e0d\u652f\u6301\u4e2a\u4eba\u5f00\u53d1\uff0c\u9700\u8981\u516c\u53f8\u5e10\u53f7<br \/>\n\u8bbe\u7f6e\u8def\u5f84\u5728 \u5f00\u53d1&gt;\u5f00\u53d1\u8bbe\u7f6e<\/p>\n<figure class=\"mdx-lazyload-container\" style=\"max-width:213px\"><div style=\"padding-top:37.558685446009%\"><\/div><div class=\"mdx-img-loading-sp mdui-valign\"><div><div class=\"mdui-spinner\"><\/div><\/div><\/div><img width=\"213\" height=\"80\" class=\"alignnone size-full wp-image-7589 lazyload\" title=\"\u5fae\u4fe1\u7aef\u5206\u4eab\u3001\u624b\u673aQQ\u597d\u53cb\u5206\u4eab\u4ee5\u53ca\u5c0f\u7a0b\u5e8f\u548cH5\u6570\u636e\u4ea4\u4e92\" src=\"data:image\/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\" data-src=\"https:\/\/sdeno.com\/wp-content\/uploads\/2018\/09\/xcxh5.png\" alt=\"https:\/\/sdeno.com\/wp-content\/uploads\/2018\/09\/xcxh5.png\"><\/figure>\n<p><a href=\"https:\/\/www.cnblogs.com\/imgss\/p\/8504185.html\" target=\"_blank\" rel=\"noopener\">https:\/\/www.cnblogs.com\/imgss\/p\/8504185.html<\/a><\/p>\n<p>&nbsp;<\/p>\n<p>\uff081\uff09h5\u5411\u5c0f\u7a0b\u5e8f\u4f20\u6570\u636e<\/p>\n<pre>*\u6ce8\u610fbindmessage\u89e6\u53d1\u6761\u4ef6\u662f\uff1a\u5c0f\u7a0b\u5e8f\u540e\u9000\u3001\u7ec4\u4ef6\u9500\u6bc1\u3001\u5206\u4eab\r\n\u5c0f\u7a0b\u5e8f\uff1a\r\n&lt;web-view src=\"https:\/\/mp.weixin.qq.com\/\" bindmessage=\"msgHandler\"&gt;&lt;\/web-view&gt;\r\n\r\nPage({\r\n  ...\r\n  msgHandler(e){\r\n    console.log(e.detail.data) \/\/\u6211\u662f\u7f51\u9875\uff0c\u83b7\u53d6\u5230\u6765\u81ea\u4e5f\u9875\u9762\u7684\u6570\u636e\r\n  }\r\n})<\/pre>\n<p>&nbsp;<\/p>\n<p>html\u9875\u9762\uff1a<\/p>\n<pre>&lt;script type=\"text\/javascript\" src=\"https:\/\/res.wx.qq.com\/open\/js\/jweixin-1.3.2.js\"&gt;&lt;\/script&gt;\r\n\r\n&lt;script&gt;\r\n  wx.miniProgram.navigateTo({ \/\/\u8df3\u8f6c\r\n   url: xcxUrl,\r\n  })\r\n\r\n  wx.miniProgram.postMessage({ data: {msg: '\u6211\u662f\u7f51\u9875' }})\/\/\u7b2c\u4e00\u5c42\u5e94\u8be5\u662fdata,\u4e0d\u80fd\u5199\u6210\uff0cwx.miniProgram.postMessage({msg: '\u6211\u662f\u7f51\u9875' }) \/\/\u9519\u8bef\u5199\u6cd5\r\n&lt;\/script&gt;<\/pre>\n<p>&nbsp;<\/p>\n<p>\uff082\uff09\u5c0f\u7a0b\u5e8f\u5411h5\u9875\u9762\u53d1\u9001\u6570\u636e\uff0c\u4e3b\u8981\u4ee5url\u5e26\u53c2\u6570\u5f62\u5f0f\u4f20<\/p>\n<pre>\/\/wxml\r\n&lt;web-view src=\"{{url}}\"&gt;&lt;\/web-view&gt;\r\n\r\n\/\/js\r\nPage({\r\n data:{\r\n url: ''\r\n}\r\n...\r\nonLoad(options){\r\n let phone = options.phone;\/\/\u83b7\u53d6\u5230\u5c0f\u7a0b\u5e8f\u5176\u4ed6\u9875\u9762\u4f20\u6765\u7684\u7535\u8bdd\u53f7\u7801\uff1b\r\n let url = `http:\/\/localhost?phone=${phone}`;\r\n   this.setData({url : url})\r\n }\r\n})<\/pre>\n<p>\u5982\u679c\u53d1\u73b0 url\u5e26\u53c2\u6570\u65f6\uff0c\u4f20\u7ed9web-view\uff0c\u53c2\u6570\u662f\u88ab\u8fc7\u6ee4\u6389\u7684\uff0c\u5c31\u4f7f\u7528\u5982\u4e0b\u65b9\u6cd5\uff1a<br \/>\nencodeURIComponent(&#8216;http:\/\/www.baidu.com?wd=1&#8217;) \/\/ &#8220;http%3A%2F%2Fwww.baidu.com%3Fwd%3D1&#8221;<\/p>\n<p>&nbsp;<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-node.js\u540e\u7aef&#8212;\u7b7e\u540d&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>AppID\u548cAppSecret\u53ef\u5728\u201c\u5fae\u4fe1\u516c\u4f17\u5e73\u53f0-\u5f00\u53d1-\u57fa\u672c\u914d\u7f6e\u201d\u9875\u4e2d\u83b7\u5f97\uff08\u9700\u8981\u5df2\u7ecf\u6210\u4e3a\u5f00\u53d1\u8005\uff0c\u4e14\u5e10\u53f7\u6ca1\u6709\u5f02\u5e38\u72b6\u6001\uff09\u3002<br \/>\n**\u8c03\u7528\u63a5\u53e3\u65f6\uff0c\u8bf7\u767b\u5f55\u201c\u5fae\u4fe1\u516c\u4f17\u5e73\u53f0-\u5f00\u53d1-\u57fa\u672c\u914d\u7f6e\u201d\u63d0\u524d\u5c06\u670d\u52a1\u5668IP\u5730\u5740\u6dfb\u52a0\u5230IP\u767d\u540d\u5355\u4e2d\uff0c\u70b9\u51fb\u67e5\u770b\u8bbe\u7f6e\u65b9\u6cd5\uff0c\u5426\u5219\u5c06\u65e0\u6cd5\u8c03\u7528\u6210\u529f\u3002<br \/>\n**\u5c0f\u7a0b\u5e8f\u65e0\u9700\u914d\u7f6eIP\u767d\u540d\u5355\u3002<br \/>\n1\uff0c\u7528AppID\u548cAppSecret\u83b7\u53d6access_token<\/p>\n<pre>https:\/\/api.weixin.qq.com\/cgi-bin\/token?grant_type=client_credential&amp;appid=APPID&amp;secret=APPSECRET<\/pre>\n<p>&nbsp;<\/p>\n<p>2\uff0c\u7528access_token\u83b7\u53d6jsapi_ticket\u7968\u636e<\/p>\n<pre>https:\/\/api.weixin.qq.com\/cgi-bin\/ticket\/getticket?access_token=ACCESS_TOKEN&amp;type=jsapi<\/pre>\n<p>&nbsp;<\/p>\n<p>3\uff0c\u7528jsapi_ticket\u7968\u636e\u83b7\u53d6signature\u7b7e\u540d<\/p>\n<pre>var args={\r\n noncestr=Wm3WZYTPz0wzccnW \/\/Math.random().toString(36).substr(2,15)\r\n jsapi_ticket=sM4AOVdWfPE4DxkXGEs8VMCPGGVi4C3VM0P37wVUCFvkVAy_90u5h9nbSlYy3-Sl-HhTdfl2fzFy1AOcHKP7qg\r\n timestamp=1414587457 \/\/parseInt(new Date().getTime() \/ 1000) + ''\r\n url=http:\/\/mp.weixin.qq.com?params=value\r\n}\r\n\r\nfunction raw(args){\r\n let keys = Object.keys(args).sort();\r\n let obj = {};\r\n keys.forEach((key)=&gt;{\r\n   obj[key] = args[key];\r\n })\r\n \/\/ {a:1,b:2} =&gt; &amp;a=1&amp;b=2\r\n \/\/ \u5c06\u5bf9\u8c61\u8f6c\u6362\u4e3a&amp;\u5206\u5272\u7684\u53c2\u6570\r\n let val = '';\r\n for(let k in obj){\r\n   val += '&amp;' + k + '=' +obj[k];\r\n }\r\n return val.substr(1);\r\n}\r\n\r\nlet string = util.raw(params);\r\nlet sign = createHash('sha1').update(string).digest('hex'); \/\/\u5f97\u5230\u7684\u5c31\u662fsignature (\u8981\u5b89\u88c5create-hash@1.2.0\u5305)<\/pre>\n<p>&nbsp;<\/p>\n<p>4\uff0c\u7528signature\u5c31\u80fd\u5728H5\u91cc\u9762\u8c03\u7528\u8d77\u5fae\u4fe1\u81ea\u5e26\u7684\u529f\u80fd\u4e86\uff0c\u4f8b\u5982\u5206\u4eab\u548c\u652f\u4ed8\u7b49\u7b49<\/p>\n<pre>wx.config({\r\n debug: true, \/\/ \u5f00\u542f\u8c03\u8bd5\u6a21\u5f0f,\u8c03\u7528\u7684\u6240\u6709api\u7684\u8fd4\u56de\u503c\u4f1a\u5728\u5ba2\u6237\u7aefalert\u51fa\u6765\uff0c\u82e5\u8981\u67e5\u770b\u4f20\u5165\u7684\u53c2\u6570\uff0c\u53ef\u4ee5\u5728pc\u7aef\u6253\u5f00\uff0c\u53c2\u6570\u4fe1\u606f\u4f1a\u901a\u8fc7log\u6253\u51fa\uff0c\u4ec5\u5728pc\u7aef\u65f6\u624d\u4f1a\u6253\u5370\u3002\r\n appId: '{$data.appId}', \/\/ \u5fc5\u586b\uff0c\u516c\u4f17\u53f7\u7684\u552f\u4e00\u6807\u8bc6\r\n timestamp: '{$data.timeStamp}', \/\/ \u5fc5\u586b\uff0c\u751f\u6210\u7b7e\u540d\u7684\u65f6\u95f4\u6233\r\n nonceStr: '{$data.nonceStr}', \/\/ \u5fc5\u586b\uff0c\u751f\u6210\u7b7e\u540d\u7684\u968f\u673a\u4e32\r\n signature: '{$data.signature}',\/\/ \u5fc5\u586b\uff0c\u7b7e\u540d,<span style=\"color: #ff0000;\">\u4e0a\u9762\u7684\u6b65\u9aa4\u5c31\u4e3a\u4e86\u5f97\u5230\u8fd9\u4e2a\u5b57\u6bb5<\/span>\r\n jsApiList: [\r\n   ...\r\n ] \/\/ \u5fc5\u586b\uff0c\u9700\u8981\u4f7f\u7528\u7684JS\u63a5\u53e3\u5217\u8868\r\n});<\/pre>\n<p>&nbsp;<\/p>\n<p><audio style=\"display: none;\" controls=\"controls\"><\/audio><\/p>\n<p><audio style=\"display: none;\" controls=\"controls\"><\/audio><\/p>\n<p><audio style=\"display: none;\" controls=\"controls\"><\/audio><\/p>\n<p><audio style=\"display: none;\" controls=\"controls\"><\/audio><\/p>\n<p><audio style=\"display: none;\" controls=\"controls\"><\/audio><\/p>\n<p><audio style=\"display: none;\" controls=\"controls\"><\/audio><\/p>\n<p><audio style=\"display: none;\" controls=\"controls\"><\/audio><\/p>\n<p><audio style=\"display: none;\" controls=\"controls\"><\/audio><\/p>\n<p><audio style=\"display: none;\" controls=\"controls\"><\/audio><\/p>\n<p><audio style=\"display: none;\" controls=\"controls\"><\/audio><\/p>\n<p><audio style=\"display: none;\" controls=\"controls\"><\/audio><\/p>\n<p><audio style=\"display: none;\" controls=\"controls\"><\/audio><\/p>\n<p><audio style=\"display: none;\" controls=\"controls\"><\/audio><\/p>\n<p><audio style=\"display: none;\" controls=\"controls\"><\/audio><\/p>\n<p><audio style=\"display: none;\" controls=\"controls\"><\/audio><\/p>\n<p><audio style=\"display: none;\" controls=\"controls\"><\/audio><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5fae\u4fe1\u4e3a\u6211\u4eec\u63d0\u4f9b\u4e86\u4ece\u5fae\u4fe1\u5206\u4eab\u5230\u5230\u670b\u53cb\u5708\u3001\u5fae\u4fe1\u597d\u53cb\u3001qq\u597d\u53cb\u3001qq\u7a7a\u95f4\u65f6\uff0c\u6240\u663e\u793a\u4e0d\u540c\u7684\u5206\u4eab\u6587\u6848\u3002\uff08\u63a5\u53e3\u662f\u6536\u8d39\u7684\uff09  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"class_list":["post-6868","post","type-post","status-publish","format-standard","hentry","category-11"],"_links":{"self":[{"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/posts\/6868","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sdeno.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6868"}],"version-history":[{"count":0,"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/posts\/6868\/revisions"}],"wp:attachment":[{"href":"https:\/\/sdeno.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6868"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sdeno.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6868"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sdeno.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6868"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}