{"id":30811,"date":"2024-11-25T09:02:49","date_gmt":"2024-11-25T01:02:49","guid":{"rendered":"https:\/\/fwq.ai\/blog\/30811\/"},"modified":"2024-11-25T09:02:49","modified_gmt":"2024-11-25T01:02:49","slug":"%e5%be%ae%e4%bf%a1%e5%b0%8f%e7%a8%8b%e5%ba%8f%e5%bc%80%e5%8f%91%e9%a1%b5%e9%9d%a2%e6%8b%a6%e6%88%aa%e5%99%a8%e7%9a%84%e8%af%a6%e8%a7%a3","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/30811\/","title":{"rendered":"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u9875\u9762\u62e6\u622a\u5668\u7684\u8be6\u89e3"},"content":{"rendered":"<p>\u672c\u7bc7\u6587\u7ae0\u4e3b\u8981\u4ecb\u7ecd\u4e86\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e4b\u9875\u9762\u62e6\u622a\u5668\u7684\u793a\u4f8b\u4ee3\u7801\uff0c\u5c0f\u7f16\u89c9\u5f97\u633a\u4e0d\u9519\u7684\uff0c\u73b0\u5728\u5206\u4eab\u7ed9\u5927\u5bb6\uff0c\u4e5f\u7ed9\u5927\u5bb6\u505a\u4e2a\u53c2\u8003\u3002\u4e00\u8d77\u8ddf\u968f\u5c0f\u7f16\u8fc7\u6765\u770b\u770b\u5427<\/p>\n<p><strong>\u573a\u666f<\/strong><\/p>\n<ul>\n<li>\n<p>\u5c0f\u7a0b\u5e8f\u670952\u4e2a\u9875\u9762\uff0c\u5176\u4e2d13\u4e2a\u9875\u9762\u65e0\u9700\u4efb\u4f55\u8eab\u4efd\uff0c\u53e6\u591639\u4e2a\u9875\u9762\u9700\u8981\u7cfb\u7edf\u89d2\u8272\u3002\u5bf9\u4e8e\u8fd939\u4e2a\u9875\u9762\uff0c\u5982\u679c\u5fae\u4fe1\u7528\u6237\u6ca1\u6709\u7cfb\u7edf\u89d2\u8272\uff0c\u5219\u8df3\u8f6c\u5230\u767b\u5f55\u9875\u3002<\/p>\n<\/li>\n<li>\n<p>\u662f\u5426\u6709\u7cfb\u7edf\u89d2\u8272\u4fe1\u606f\u9700\u8981\u901a\u8fc7\u5f02\u6b65\u8bf7\u6c42\u6765\u83b7\u53d6\u3002<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u9700\u6c42\u5206\u6790&amp;\u5b9e\u73b0<\/strong><\/p>\n<p>\u5bf9\u9700\u6c42\u8fdb\u884c\u62bd\u8c61\uff0c\u5176\u5b9e\u8981\u7684\u5c31\u662f\u4e00\u4e2a\u8fc7\u6ee4\u5668\uff0c\u5bf9\u5c0f\u7a0b\u5e8f\u9875\u9762\u7684\u8bbf\u95ee\u8fdb\u884c\u8fc7\u6ee4\uff0c\u7b26\u5408\u6761\u4ef6\u7684\u901a\u8fc7\uff0c\u4e0d\u7b26\u5408\u6761\u4ef6\u8fdb\u884c\u5176\u4ed6\u5904\u7406\u3002<\/p>\n<p>\u4f7f\u7528\u8fc7php\u7684laravel\u6846\u67b6\u7684\u7ae5\u978b\uff0c\u80af\u5b9a\u4e00\u4e0b\u5b50\u5c31\u8054\u60f3\u5230\u4e86laravel\u6846\u67b6\u7684http\u4e2d\u95f4\u4ef6:<\/p>\n<p>HTTP \u4e2d\u95f4\u4ef6\u63d0\u4f9b\u4e00\u4e2a\u65b9\u4fbf\u7684\u673a\u5236\u6765\u8fc7\u6ee4\u8fdb\u5165\u5e94\u7528\u7a0b\u5e8f\u7684 HTTP \u8bf7\u6c42\uff0c\u4f8b\u5982\uff0cLaravel \u9ed8\u8ba4\u5305\u542b\u4e86\u4e00\u4e2a\u4e2d\u95f4\u4ef6\u6765\u68c0\u9a8c\u7528\u6237\u8eab\u4efd\u9a8c\u8bc1\uff0c\u5982\u679c\u7528\u6237\u6ca1\u6709\u7ecf\u8fc7\u8eab\u4efd\u9a8c\u8bc1\uff0c\u4e2d\u95f4\u4ef6\u4f1a\u5c06\u7528\u6237\u5bfc\u5411\u767b\u5f55\u9875\u9762\uff0c\u7136\u800c\uff0c\u5982\u679c\u7528\u6237\u901a\u8fc7\u8eab\u4efd\u9a8c\u8bc1\uff0c\u4e2d\u95f4\u4ef6\u5c06\u4f1a\u5141\u8bb8\u8fd9\u4e2a\u8bf7\u6c42\u8fdb\u4e00\u6b65\u7ee7\u7eed\u524d\u8fdb\u3002\u5f53\u7136\uff0c\u9664\u4e86\u8eab\u4efd\u9a8c\u8bc1\u4e4b\u5916\uff0c\u4e2d\u95f4\u4ef6\u4e5f\u53ef\u4ee5\u88ab\u7528\u6765\u6267\u884c\u5404\u5f0f\u5404\u6837\u7684\u4efb\u52a1\uff0cCORS \u4e2d\u95f4\u4ef6\u8d1f\u8d23\u66ff\u6240\u6709\u5373\u5c06\u79bb\u5f00\u7a0b\u5e8f\u7684\u54cd\u5e94\u52a0\u5165\u9002\u5f53\u7684\u54cd\u5e94\u5934\uff0c\u4e00\u4e2a\u65e5\u5fd7\u4e2d\u95f4\u4ef6\u53ef\u4ee5\u8bb0\u5f55\u6240\u6709\u4f20\u5165\u5e94\u7528\u7a0b\u5e8f\u7684\u8bf7\u6c42\u3002<\/p>\n<p>\u4ee4\u4eba\u5fe7\u6851\u7684\u662f\uff0c\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5e76\u6ca1\u6709\u63d0\u4f9b\u9488\u5bf9Page\u5b9e\u4f8b\u7684\u4e2d\u95f4\u4ef6\u673a\u5236\u3002\u6240\u4ee5\u53ea\u80fd\u4ecePage\u5b9e\u4f8b\u7684\u751f\u547d\u5468\u671f\u5904\u4e0b\u624b\u3002<\/p>\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/194\/9af0102d9f9d19fc06dac8043365f9f5-0.png\" style=\"max-width:90%\" class=\"aligncenter\" title=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u9875\u9762\u62e6\u622a\u5668\u7684\u8be6\u89e3\u63d2\u56fe\" alt=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u9875\u9762\u62e6\u622a\u5668\u7684\u8be6\u89e3\u63d2\u56fe\" \/><\/p>\n<p>\u5bf9\u4e8eonLoad,\u4e00\u4e2a\u9875\u9762\u53ea\u4f1a\u8c03\u7528\u4e00\u6b21\uff1b\u5bf9\u4e8eonShow,\u6bcf\u6b21\u6253\u5f00\u9875\u9762(\u6bd4\u5982\u5c0f\u7a0b\u5e8f\u4ece\u540e\u53f0\u8f6c\u5230\u524d\u53f0)\u90fd\u4f1a\u8c03\u7528\u4e00\u6b21\u3002<\/p>\n<p>\u5728onLoad\u6216\u8005onShow\u94a9\u5b50\u51fd\u6570\u91cc\uff0c\u5bf9\u7528\u6237\u8eab\u4efd\u8fdb\u884c\u6821\u9a8c\uff0c\u901a\u8fc7\u540e\u5219\u62c9\u53d6\u8be5\u9875\u9762\u9700\u8981\u7684\u6570\u636e\uff0c\u5426\u5219\u8df3\u8f6c\u5230\u767b\u5f55\u9875\u3002<\/p>\n<pre>\/\/orderDetail.js\r\nonShow:&nbsp;function&nbsp;()&nbsp;{\r\n&nbsp;&nbsp;let&nbsp;that&nbsp;=&nbsp;this;\r\n&nbsp;&nbsp;\/\/\u8eab\u4efd\u6821\u9a8c\r\n&nbsp;&nbsp;service.identityCheck(()&nbsp;=&amp;gt;&nbsp;{\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u8df3\u8f6c\u5230\u767b\u5f55\u9875\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wx.redirectTo({\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;url:&nbsp;\"\/pages\/common\/login\/login\"\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;});\r\n&nbsp;&nbsp;&nbsp;&nbsp;},&nbsp;()&nbsp;=&amp;gt;&nbsp;{&nbsp;&nbsp;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u83b7\u53d6\u9875\u9762\u6570\u636e\u7b49\u7b49&nbsp;&nbsp;&nbsp;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;that.getDetail(this.orderId);\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...\r\n&nbsp;&nbsp;&nbsp;&nbsp;}\r\n&nbsp;&nbsp;);\r\n&nbsp;},<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u4e0d\u8fc7\uff0c\u6bcf\u4e2a\u9875\u9762\u90fd\u8981\u8fd9\u6837\u5199\uff0c\u91cd\u590d\u4ee3\u7801\u597d\u591a\u554a\uff0c\u4fb5\u5165\u6027\u4e5f\u5f3a\u3002\u4e0d\u5982\u7528\u88c5\u9970\u51fd\u6570\uff08\u9ad8\u5927\u4e0a\u7684\u8bf4\u6cd5\u662f\u88c5\u9970\u8005\u6a21\u5f0f\uff09\u6765\u5305\u88c5\u4e00\u4e0b\uff1a<\/p>\n<pre>\/\/filter.js\r\nfunction&nbsp;identityFilter(pageObj){\r\n&nbsp;&nbsp;if(pageObj.onShow){\r\n&nbsp;&nbsp;&nbsp;&nbsp;let&nbsp;_onShow&nbsp;=&nbsp;pageObj.onShow;\r\n&nbsp;&nbsp;&nbsp;&nbsp;pageObj.onShow&nbsp;=&nbsp;function(){\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;service.identityCheck(()=&amp;gt;{\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u8df3\u8f6c\u5230\u767b\u5f55\u9875\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wx.redirectTo({\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;url:&nbsp;\"\/pages\/common\/login\/login\"\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;});\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},()=&amp;gt;{\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u83b7\u53d6\u9875\u9762\u5b9e\u4f8b\uff0c\u9632\u6b62this\u52ab\u6301\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;let&nbsp;currentInstance&nbsp;=&nbsp;getPageInstance();\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_onShow.call(currentInstance);\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;});\r\n&nbsp;&nbsp;&nbsp;&nbsp;}\r\n&nbsp;&nbsp;}\r\n&nbsp;&nbsp;return&nbsp;pageObj;\r\n}\r\n\r\nfunction&nbsp;getPageInstance(){\r\n&nbsp;&nbsp;var&nbsp;pages&nbsp;=&nbsp;getCurrentPages();\r\n&nbsp;&nbsp;return&nbsp;pages[pages.length&nbsp;-&nbsp;1];\r\n}\r\n\r\nexports.identityFilter&nbsp;=&nbsp;identityFilter;<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>filter.js\u7528\u4ee5\u63d0\u4f9b\u8fc7\u6ee4\u5668\u65b9\u6cd5\uff0c\u9664\u4e86\u73b0\u6709\u7684\u7528\u6237\u8eab\u4efd\u62e6\u622a\uff0c\u540e\u7eed\u5982\u679c\u9700\u8981\u5176\u4ed6\u62e6\u622a\uff0c\u53ef\u4ee5\u5728\u8fd9\u4e2a\u6587\u4ef6\u589e\u52a0\u3002\u7136\u540e\uff0c\u5728\u9700\u8981\u7528\u6237\u8eab\u4efd\u62e6\u622a\u7684\u5c0f\u7a0b\u5e8f\u9875\u9762\u4ee3\u7801\u91cc\uff0c\u7528filter.identityFilter\u5904\u7406\u4e00\u4e0b\u5c31\u53ef\u4ee5\u4e86:<\/p>\n<pre>\/\/orderDetail.js\r\nlet&nbsp;filter&nbsp;=&nbsp;require('filter.js');\r\nPage(filter.identityFilter({\r\n&nbsp;&nbsp;...\r\n&nbsp;&nbsp;onShow:&nbsp;function&nbsp;()&nbsp;{\r\n&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u83b7\u53d6\u9875\u9762\u6570\u636e\u7b49\u7b49\r\n&nbsp;&nbsp;&nbsp;&nbsp;this.getDetail(this.orderId);\r\n&nbsp;&nbsp;&nbsp;&nbsp;\/\/...\r\n&nbsp;&nbsp;},\r\n&nbsp;&nbsp;...\r\n}));<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p><strong>\u4f7f\u7528Promise\u8fdb\u884c\u4f18\u5316<\/strong><\/p>\n<p>\u4e0a\u9762\u7684\u5b9e\u73b0\u4e2d\uff0c\u6bcf\u6b21\u8bbf\u95ee\u9875\u9762\uff0c\u90fd\u4f1a\u6267\u884c\u4e00\u6b21\u83b7\u53d6\u7528\u6237\u8eab\u4efd\u7684\u65b9\u6cd5\uff08\u5c31\u662f\u4e0a\u9762\u4ee3\u7801\u91cc\u7684service. identityCheck \uff09\u3002\u5176\u5b9e\u6ca1\u6709\u5fc5\u8981\uff0c\u5728\u5c0f\u7a0b\u5e8f\u542f\u52a8\u7684\u65f6\u5019\u83b7\u53d6\u4e00\u6b21\u5c31\u884c\u4e86\u3002\u4e5f\u5c31\u662f\u8bf4\uff0c\u653e\u5728app.js\u7684onLaunch\u65b9\u6cd5\u91cc\u6267\u884c\u3002<\/p>\n<p>\u6bcf\u4e2a\u5c0f\u7a0b\u5e8f\u9875\u9762\u5b9e\u4f8b\u5316\u65f6\uff0c\u4e00\u822c\u4e5f\u4f1a\u6267\u884c\u5f02\u6b65\u65b9\u6cd5\uff0c\u7528\u6765\u83b7\u53d6\u9875\u9762\u9700\u8981\u7684\u6570\u636e\u3002\u5173\u952e\u5728\u4e8e\uff0c\u6211\u4eec\u9700\u8981\u4fdd\u8bc1\uff0c\u9875\u9762\u7684\u5f02\u6b65\u65b9\u6cd5 \u5fc5\u987b\u5728 \u83b7\u53d6\u7528\u6237\u8eab\u4efd\u7684\u5f02\u6b65\u8bf7\u6c42 \u4e4b\u540e\u6267\u884c\u3002<\/p>\n<p>\u6bcb\u5bb9\u7f6e\u7591\uff0cPromise\u6700\u64c5\u957f\u5904\u7406\u5f02\u6b65\u8bf7\u6c42\u7684\u6267\u884c\u987a\u5e8f\u4e86\u3002\u4e3b\u5b50\uff0c\u5feb\u653e\u4ee3\u7801\u7c97\u6765\uff1a<\/p>\n<pre>\/\/app.js\r\nApp({\r\n&nbsp;&nbsp;onLaunch:function(){\r\n&nbsp;&nbsp;&nbsp;&nbsp;let&nbsp;p&nbsp;=&nbsp;new&nbsp;Promise(function(resolve,reject){\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;service.identityCheck(resolve,reject);\r\n&nbsp;&nbsp;&nbsp;&nbsp;});\r\n&nbsp;&nbsp;&nbsp;&nbsp;this.globalData.promise&nbsp;=&nbsp;p;&nbsp;\r\n&nbsp;&nbsp;},\r\n&nbsp;&nbsp;...\r\n&nbsp;&nbsp;globalData:&nbsp;{\r\n&nbsp;&nbsp;&nbsp;&nbsp;promise:null,\r\n&nbsp;&nbsp;}&nbsp;&nbsp;\r\n});<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236    <\/p>\n<pre>\/\/filter.js\r\nconst&nbsp;appData&nbsp;=&nbsp;getApp().globalData;\r\nfunction&nbsp;identityFilter(pageObj){\r\n&nbsp;&nbsp;if(pageObj.onShow){\r\n&nbsp;&nbsp;&nbsp;&nbsp;let&nbsp;_onShow&nbsp;=&nbsp;pageObj.onShow;\r\n&nbsp;&nbsp;&nbsp;&nbsp;pageObj.onShow&nbsp;=&nbsp;function(){\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u6539\u52a8\u70b9\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;appData.promise.then(()=&amp;gt;{\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u8df3\u8f6c\u5230\u767b\u5f55\u9875\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wx.redirectTo({\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;url:&nbsp;\"\/pages\/common\/login\/login\"\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;});\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},()=&amp;gt;{\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u83b7\u53d6\u9875\u9762\u5b9e\u4f8b\uff0c\u9632\u6b62this\u52ab\u6301\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;let&nbsp;currentInstance&nbsp;=&nbsp;getPageInstance();\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_onShow.call(currentInstance);\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;});\r\n&nbsp;&nbsp;&nbsp;&nbsp;}\r\n&nbsp;&nbsp;}\r\n&nbsp;&nbsp;return&nbsp;pageObj;\r\n}<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p><strong>\u5c0f\u7ed3<\/strong><\/p>\n<p>\u57fa\u672c\u5b9e\u73b0\u4e86\u5c0f\u7a0b\u5e8f\u9875\u9762\u7684\u7528\u6237\u8eab\u4efd\u62e6\u622a\u5668\uff0c\u4f46\u662f\u6bd4\u8d77laravel\u7684http\u4e2d\u95f4\u4ef6\u8fd8\u662f\u900a\u8272\u4e00\u4e9b\uff1a<\/p>\n<ul>\n<li>\n<p>\u9700\u8981\u5bf9\u6bcf\u4e2a\u9875\u9762\u4ee3\u7801\u5305\u88c5\u4e00\u5c42\u3002<\/p>\n<\/li>\n<li>\n<p>\u5373\u4f7f\u7528\u6237\u8eab\u4efd\u6821\u9a8c\u4e0d\u901a\u8fc7\uff0c\u5c0f\u7a0b\u5e8f\u4e5f\u5e76\u4e0d\u4f1a\u963b\u585e\u9875\u9762\u7684\u6e32\u67d3\u3002\u5047\u5982\u83b7\u53d6\u7528\u6237\u8eab\u4efd\u7684\u5f02\u6b65\u65b9\u6cd5\u4e00\u5206\u949f\u624d\u6267\u884c\u5b8c\uff0c\u5c0f\u7a0b\u5e8f\u9875\u9762\u8fd8\u662f\u4f1a\u5c55\u793a\u51fa\u6765\uff0c\u4e00\u5206\u949f\u4e4b\u540e\u624d\u8df3\u8f6c\u5230\u767b\u5f55\u9875\u3002\u9700\u8981\u81ea\u5df1\u589e\u52a0\u903b\u8f91\uff0c\u6bd4\u5982\u5728\u8fd9\u4e00\u5206\u949f\u5185\uff0c\u9875\u9762\u5c55\u793a\u7a7a\u767d\u5185\u5bb9\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u9875\u9762\u62e6\u622a\u5668\u7684\u8be6\u89e3\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u7bc7\u6587\u7ae0\u4e3b\u8981\u4ecb\u7ecd\u4e86\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e4b\u9875\u9762\u62e6\u622a\u5668\u7684\u793a\u4f8b\u4ee3\u7801\uff0c\u5c0f\u7f16\u89c9\u5f97\u633a\u4e0d\u9519\u7684\uff0c\u73b0\u5728\u5206\u4eab\u7ed9\u5927\u5bb6\uff0c\u4e5f\u7ed9\u5927\u5bb6\u505a\u4e2a\u53c2\u8003\u3002\u4e00\u8d77\u8ddf\u968f\u5c0f\u7f16\u8fc7\u6765\u770b\u770b\u5427 \u573a\u666f \u5c0f\u7a0b\u5e8f\u670952\u4e2a\u9875\u9762\uff0c\u5176\u4e2d13\u4e2a\u9875\u9762\u65e0\u9700\u4efb\u4f55\u8eab\u4efd\uff0c\u53e6\u591639\u4e2a\u9875\u9762\u9700\u8981\u7cfb\u7edf\u89d2\u8272\u3002\u5bf9\u4e8e\u8fd939\u4e2a\u9875\u9762\uff0c\u5982\u679c\u5fae\u4fe1\u7528\u6237\u6ca1\u6709\u7cfb\u7edf\u89d2\u8272\uff0c\u5219\u8df3\u8f6c\u5230\u767b\u5f55\u9875\u3002 \u662f\u5426\u6709\u7cfb\u7edf\u89d2\u8272\u4fe1\u606f\u9700\u8981\u901a\u8fc7\u5f02\u6b65\u8bf7\u6c42\u6765\u83b7\u53d6\u3002 \u9700\u6c42\u5206\u6790&amp;\u5b9e\u73b0 \u5bf9\u9700\u6c42\u8fdb\u884c\u62bd\u8c61\uff0c\u5176\u5b9e\u8981\u7684\u5c31\u662f\u4e00\u4e2a\u8fc7\u6ee4\u5668\uff0c\u5bf9\u5c0f\u7a0b\u5e8f\u9875\u9762\u7684\u8bbf\u95ee\u8fdb\u884c\u8fc7\u6ee4\uff0c\u7b26\u5408\u6761\u4ef6\u7684\u901a\u8fc7\uff0c\u4e0d\u7b26\u5408\u6761\u4ef6\u8fdb\u884c\u5176\u4ed6\u5904\u7406\u3002 \u4f7f\u7528\u8fc7php\u7684laravel\u6846\u67b6\u7684\u7ae5\u978b\uff0c\u80af\u5b9a\u4e00\u4e0b\u5b50\u5c31\u8054\u60f3\u5230\u4e86laravel\u6846\u67b6\u7684http\u4e2d\u95f4\u4ef6: HTTP \u4e2d\u95f4\u4ef6\u63d0\u4f9b\u4e00\u4e2a\u65b9\u4fbf\u7684\u673a\u5236\u6765\u8fc7\u6ee4\u8fdb\u5165\u5e94\u7528\u7a0b\u5e8f\u7684 HTTP \u8bf7\u6c42\uff0c\u4f8b\u5982\uff0cLaravel \u9ed8\u8ba4\u5305\u542b\u4e86\u4e00\u4e2a\u4e2d\u95f4\u4ef6\u6765\u68c0\u9a8c\u7528\u6237\u8eab\u4efd\u9a8c\u8bc1\uff0c\u5982\u679c\u7528\u6237\u6ca1\u6709\u7ecf\u8fc7\u8eab\u4efd\u9a8c\u8bc1\uff0c\u4e2d\u95f4\u4ef6\u4f1a\u5c06\u7528\u6237\u5bfc\u5411\u767b\u5f55\u9875\u9762\uff0c\u7136\u800c\uff0c\u5982\u679c\u7528\u6237\u901a\u8fc7\u8eab\u4efd\u9a8c\u8bc1\uff0c\u4e2d\u95f4\u4ef6\u5c06\u4f1a\u5141\u8bb8\u8fd9\u4e2a\u8bf7\u6c42\u8fdb\u4e00\u6b65\u7ee7\u7eed\u524d\u8fdb\u3002\u5f53\u7136\uff0c\u9664\u4e86\u8eab\u4efd\u9a8c\u8bc1\u4e4b\u5916\uff0c\u4e2d\u95f4\u4ef6\u4e5f\u53ef\u4ee5\u88ab\u7528\u6765\u6267\u884c\u5404\u5f0f\u5404\u6837\u7684\u4efb\u52a1\uff0cCORS \u4e2d\u95f4\u4ef6\u8d1f\u8d23\u66ff\u6240\u6709\u5373\u5c06\u79bb\u5f00\u7a0b\u5e8f\u7684\u54cd\u5e94\u52a0\u5165\u9002\u5f53\u7684\u54cd\u5e94\u5934\uff0c\u4e00\u4e2a\u65e5\u5fd7\u4e2d\u95f4\u4ef6\u53ef\u4ee5\u8bb0\u5f55\u6240\u6709\u4f20\u5165\u5e94\u7528\u7a0b\u5e8f\u7684\u8bf7\u6c42\u3002 \u4ee4\u4eba\u5fe7\u6851\u7684\u662f\uff0c\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5e76\u6ca1\u6709\u63d0\u4f9b\u9488\u5bf9Page\u5b9e\u4f8b\u7684\u4e2d\u95f4\u4ef6\u673a\u5236\u3002\u6240\u4ee5\u53ea\u80fd\u4ecePage\u5b9e\u4f8b\u7684\u751f\u547d\u5468\u671f\u5904\u4e0b\u624b\u3002 \u5bf9\u4e8eonLoad,\u4e00\u4e2a\u9875\u9762\u53ea\u4f1a\u8c03\u7528\u4e00\u6b21\uff1b\u5bf9\u4e8eonShow,\u6bcf\u6b21\u6253\u5f00\u9875\u9762(\u6bd4\u5982\u5c0f\u7a0b\u5e8f\u4ece\u540e\u53f0\u8f6c\u5230\u524d\u53f0)\u90fd\u4f1a\u8c03\u7528\u4e00\u6b21\u3002 \u5728onLoad\u6216\u8005onShow\u94a9\u5b50\u51fd\u6570\u91cc\uff0c\u5bf9\u7528\u6237\u8eab\u4efd\u8fdb\u884c\u6821\u9a8c\uff0c\u901a\u8fc7\u540e\u5219\u62c9\u53d6\u8be5\u9875\u9762\u9700\u8981\u7684\u6570\u636e\uff0c\u5426\u5219\u8df3\u8f6c\u5230\u767b\u5f55\u9875\u3002 \/\/orderDetail.js onShow:&nbsp;function&nbsp;()&nbsp;{ &nbsp;&nbsp;let&nbsp;that&nbsp;=&nbsp;this; &nbsp;&nbsp;\/\/\u8eab\u4efd\u6821\u9a8c &nbsp;&nbsp;service.identityCheck(()&nbsp;=&amp;gt;&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u8df3\u8f6c\u5230\u767b\u5f55\u9875 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wx.redirectTo({ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;url:&nbsp;&#8220;\/pages\/common\/login\/login&#8221; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}); &nbsp;&nbsp;&nbsp;&nbsp;},&nbsp;()&nbsp;=&amp;gt;&nbsp;{&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u83b7\u53d6\u9875\u9762\u6570\u636e\u7b49\u7b49&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;that.getDetail(this.orderId); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8230; &nbsp;&nbsp;&nbsp;&nbsp;} &nbsp;&nbsp;); &nbsp;}, \u767b\u5f55\u540e\u590d\u5236 \u4e0d\u8fc7\uff0c\u6bcf\u4e2a\u9875\u9762\u90fd\u8981\u8fd9\u6837\u5199\uff0c\u91cd\u590d\u4ee3\u7801\u597d\u591a\u554a\uff0c\u4fb5\u5165\u6027\u4e5f\u5f3a\u3002\u4e0d\u5982\u7528\u88c5\u9970\u51fd\u6570\uff08\u9ad8\u5927\u4e0a\u7684\u8bf4\u6cd5\u662f\u88c5\u9970\u8005\u6a21\u5f0f\uff09\u6765\u5305\u88c5\u4e00\u4e0b\uff1a \/\/filter.js function&nbsp;identityFilter(pageObj){ &nbsp;&nbsp;if(pageObj.onShow){ &nbsp;&nbsp;&nbsp;&nbsp;let&nbsp;_onShow&nbsp;=&nbsp;pageObj.onShow; &nbsp;&nbsp;&nbsp;&nbsp;pageObj.onShow&nbsp;=&nbsp;function(){ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;service.identityCheck(()=&amp;gt;{ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u8df3\u8f6c\u5230\u767b\u5f55\u9875 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wx.redirectTo({ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;url:&nbsp;&#8220;\/pages\/common\/login\/login&#8221; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},()=&amp;gt;{ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u83b7\u53d6\u9875\u9762\u5b9e\u4f8b\uff0c\u9632\u6b62this\u52ab\u6301 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;let&nbsp;currentInstance&nbsp;=&nbsp;getPageInstance(); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_onShow.call(currentInstance); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}); &nbsp;&nbsp;&nbsp;&nbsp;} &nbsp;&nbsp;} &nbsp;&nbsp;return&nbsp;pageObj; } function&nbsp;getPageInstance(){ &nbsp;&nbsp;var&nbsp;pages&nbsp;=&nbsp;getCurrentPages(); [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[],"class_list":["post-30811","post","type-post","status-publish","format-standard","hentry","category-19"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/30811","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=30811"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/30811\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=30811"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=30811"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=30811"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}