{"id":31341,"date":"2024-11-25T16:14:55","date_gmt":"2024-11-25T08:14:55","guid":{"rendered":"https:\/\/fwq.ai\/blog\/31341\/"},"modified":"2024-11-25T16:14:55","modified_gmt":"2024-11-25T08:14:55","slug":"%e5%be%ae%e4%bf%a1%e5%b0%8f%e7%a8%8b%e5%ba%8f%e8%a1%a8%e5%8d%95%e9%aa%8c%e8%af%81%e5%bc%80%e5%8f%91%e4%ba%8c","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/31341\/","title":{"rendered":"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f)\u8868\u5355\u9a8c\u8bc1\u5f00\u53d1\u4e8c"},"content":{"rendered":"<p style=\"text-align: left\">\u4e0a\u4e00\u7bc7\u6211\u4eec\u548c\u5927\u5bb6\u5206\u4eab\u4e86\uff0c\u672c\u6587\u6211\u4eec\u4e3b\u8981\u548c\u5927\u5bb6\u5206\u4eab\u5fae\u4fe1\u5c0f\u7a0b\u5e8f)\u8868\u5355\u9a8c\u8bc1\u5f00\u53d1\u4e8c\uff0c\u5e0c\u671b\u80fd\u5e2e\u52a9\u5230\u5927\u5bb6\u3002<\/p>\n<p style=\"text-align: left\"><span style=\"font-family:\">\u4e00.\u77e5\u8bc6\u70b9<\/span><\/p>\n<p style=\"text-align: left\"><span style=\"font-family:\">1.\u662f\u5426\u4e3a\u7a7a<\/span><\/p>\n<pre>if(e.detail.value.userName.length==0||e.detail.value.psw.length==0||e.detail.value.tel.length==0){\r\n\t      \tthis.setData({\r\n\t        \ttip:'\u63d0\u793a\uff1a\u4e0d\u80fd\u4e3a\u7a7a\uff01',\r\n\t      \t})\r\n    \t}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p style=\"text-align: left\"><span style=\"font-family:\">2.\u6b63\u5219\u8868\u8fbe\u5f0f\uff1a<\/span><\/p>\n<p style=\"text-align: left\"><span style=\"font-family:\">\u624b\u673a\u53f7\u7801\uff1avar regtel=new RegExp(&#8216;(^1[3|4|5|7|8][0-9]{9}$)&#8217;,&#8217;g&#8217;);<\/span><\/p>\n<pre>&lt;input  name=\"tel\" placeholder=\"\u8bf7\u8f93\u5165\u624b\u673a\u53f7\u7801\"  type=\"text\" focus=\"false\" class=\"section__iput\"\/&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<pre>&nbsp;if(!regtel.exec(e.detail.value.tel)){\r\n&nbsp;&nbsp;&nbsp;&nbsp;\t\tthis.setData({\r\n\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\ttip:'\u624b\u673a\u53f7\u7801\u683c\u5f0f\u4e0d\u6b63\u786e\uff01',\r\n\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\t})\r\n&nbsp;&nbsp;&nbsp;&nbsp;\t}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p style=\"text-align: left\">\u4e8c.\u770b\u5217\u5b50<\/p>\n<p style=\"text-align:center\"><span style=\"font-family:\"><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/054\/025\/8201ddde3f69f23b65e65bac0218ac3b-0.png\" class=\"aligncenter\" title=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f)\u8868\u5355\u9a8c\u8bc1\u5f00\u53d1\u4e8c\u63d2\u56fe\" alt=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f)\u8868\u5355\u9a8c\u8bc1\u5f00\u53d1\u4e8c\u63d2\u56fe\" \/><\/span><\/p>\n<p><span style=\"font-size:18px;color:#333333\">1.index.wxml<\/span><\/p>\n<pre><\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 \u59d3\u540d\uff1a &nbsp;&nbsp; \u624b\u673a\u53f7\u7801\uff1a &nbsp;&nbsp; &nbsp;&nbsp; \u5bc6\u7801\uff1a &nbsp;&nbsp; \u6027\u522b\uff1a \u7537 \u5973 &nbsp;&nbsp; \u65e5\u671f: &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {{date}} &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; \u7559\u8a00\uff1a &nbsp;&nbsp; {{tip}} Submit Reset <\/p>\n<p><span style=\"font-size:18px;color:#333333\"><br \/>2.index.wxss<\/span><\/p>\n<pre>.section{\r\n\tmargin:10px&nbsp;20px;&nbsp;\r\n\tdisplay:flex;\r\n\tborder-bottom:1px&nbsp;solid&nbsp;#ccc;\r\n\tpadding:15px&nbsp;0;\r\n}\r\n.section__title{\r\n\twidth:30%;\r\n}\r\n.section__iput{\r\n\twidth:70%;\r\n\tline-height:25px;\r\n\tborder:1px&nbsp;solid&nbsp;#ccc;\r\n}\r\n.btn-area{\r\n\tdisplay:flex;\r\n\tjustify-content:center;\r\n\tmargin:20px;\r\n}\r\n.btn-area&nbsp;button{\r\n\twidth:40%;\r\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><span style=\"font-size:18px;color:#333333\">3.index.js<\/span><\/p>\n<pre>var&nbsp;app&nbsp;=&nbsp;getApp()\r\nPage({\r\n\tdata:&nbsp;{\r\n\t&nbsp;&nbsp;&nbsp;&nbsp;date:&nbsp;'2016-09-01',\r\n\t&nbsp;&nbsp;&nbsp;&nbsp;tip:'',\r\n\t},\r\n\t\/\/\u65e5\u671f\r\n\tbindDateChange:&nbsp;function(e)&nbsp;{\r\n\t&nbsp;&nbsp;&nbsp;&nbsp;this.setData({\r\n\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;date:&nbsp;e.detail.value\r\n\t&nbsp;&nbsp;&nbsp;&nbsp;})\r\n\t},\r\n\t\/\/\u63d0\u4ea4\r\n\tformSubmit:&nbsp;function(e)&nbsp;{\r\n\t\tvar&nbsp;regtel=new&nbsp;RegExp('(^1[3|4|5|7|8][0-9]{9}$)','g');\r\n\t\tif(e.detail.value.userName.length==0||e.detail.value.psw.length==0||e.detail.value.tel.length==0){\r\n\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\tthis.setData({\r\n\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\ttip:'\u63d0\u793a\uff1a\u4e0d\u80fd\u4e3a\u7a7a\uff01',\r\n\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\t})\r\n&nbsp;&nbsp;&nbsp;&nbsp;\t}else&nbsp;if(!regtel.exec(e.detail.value.tel)){\r\n&nbsp;&nbsp;&nbsp;&nbsp;\t\tthis.setData({\r\n\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\ttip:'\u624b\u673a\u53f7\u7801\u683c\u5f0f\u4e0d\u6b63\u786e\uff01',\r\n\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\t})\r\n&nbsp;&nbsp;&nbsp;&nbsp;\t}else{\r\n&nbsp;&nbsp;&nbsp;&nbsp;\t\tthis.setData({\r\n\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\ttip:'',\r\n\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\t})\r\n&nbsp;&nbsp;&nbsp;&nbsp;\t}\r\n\t},\r\n\t\/\/\u91cd\u7f6e\r\n\tformReset:&nbsp;function()&nbsp;{\r\n\t&nbsp;&nbsp;&nbsp;&nbsp;console.log('form\u53d1\u751f\u4e86reset\u4e8b\u4ef6')\r\n\t}\r\n})<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><span style=\"font-size:18px;color:#333333\">\u6709\u66f4\u597d\u7684\u65b9\u5f0f\uff0c\u6b22\u8fce\u5927\u5bb6\u6765\u8865\u5145\u3002\u3002\u3002<img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/054\/025\/8201ddde3f69f23b65e65bac0218ac3b-1.gif\" class=\"aligncenter\" title=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f)\u8868\u5355\u9a8c\u8bc1\u5f00\u53d1\u4e8c\u63d2\u56fe1\" alt=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f)\u8868\u5355\u9a8c\u8bc1\u5f00\u53d1\u4e8c\u63d2\u56fe1\" \/><\/span><\/p>\n<p>\u76f8\u5173\u63a8\u8350\uff1a<\/p>\n<\/p>\n<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5fae\u4fe1\u5c0f\u7a0b\u5e8f)\u8868\u5355\u9a8c\u8bc1\u5f00\u53d1\u4e8c\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>\u4e0a\u4e00\u7bc7\u6211\u4eec\u548c\u5927\u5bb6\u5206\u4eab\u4e86\uff0c\u672c\u6587\u6211\u4eec\u4e3b\u8981\u548c\u5927\u5bb6\u5206\u4eab\u5fae\u4fe1\u5c0f\u7a0b\u5e8f)\u8868\u5355\u9a8c\u8bc1\u5f00\u53d1\u4e8c\uff0c\u5e0c\u671b\u80fd\u5e2e\u52a9\u5230\u5927\u5bb6\u3002 \u4e00.\u77e5\u8bc6\u70b9 1.\u662f\u5426\u4e3a\u7a7a if(e.detail.value.userName.length==0||e.detail.value.psw.length==0||e.detail.value.tel.length==0){ this.setData({ tip:&#8217;\u63d0\u793a\uff1a\u4e0d\u80fd\u4e3a\u7a7a\uff01&#8217;, }) } \u767b\u5f55\u540e\u590d\u5236 2.\u6b63\u5219\u8868\u8fbe\u5f0f\uff1a \u624b\u673a\u53f7\u7801\uff1avar regtel=new RegExp(&#8216;(^1[3|4|5|7|8][0-9]{9}$)&#8217;,&#8217;g&#8217;); &lt;input name=&#8221;tel&#8221; placeholder=&#8221;\u8bf7\u8f93\u5165\u624b\u673a\u53f7\u7801&#8221; type=&#8221;text&#8221; focus=&#8221;false&#8221; class=&#8221;section__iput&#8221;\/&gt; \u767b\u5f55\u540e\u590d\u5236 &nbsp;if(!regtel.exec(e.detail.value.tel)){ &nbsp;&nbsp;&nbsp;&nbsp; this.setData({ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tip:&#8217;\u624b\u673a\u53f7\u7801\u683c\u5f0f\u4e0d\u6b63\u786e\uff01&#8217;, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }) &nbsp;&nbsp;&nbsp;&nbsp; } \u767b\u5f55\u540e\u590d\u5236 \u4e8c.\u770b\u5217\u5b50 1.index.wxml \u767b\u5f55\u540e\u590d\u5236 \u59d3\u540d\uff1a &nbsp;&nbsp; \u624b\u673a\u53f7\u7801\uff1a &nbsp;&nbsp; &nbsp;&nbsp; \u5bc6\u7801\uff1a &nbsp;&nbsp; \u6027\u522b\uff1a \u7537 \u5973 &nbsp;&nbsp; \u65e5\u671f: &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {{date}} &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; \u7559\u8a00\uff1a &nbsp;&nbsp; {{tip}} Submit [&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-31341","post","type-post","status-publish","format-standard","hentry","category-19"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/31341","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=31341"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/31341\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=31341"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=31341"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=31341"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}