{"id":33558,"date":"2024-11-25T17:43:53","date_gmt":"2024-11-25T09:43:53","guid":{"rendered":"https:\/\/fwq.ai\/blog\/33558\/"},"modified":"2024-11-25T17:43:53","modified_gmt":"2024-11-25T09:43:53","slug":"%e5%be%ae%e4%bf%a1%e5%b0%8f%e7%a8%8b%e5%ba%8f%e5%ae%9e%e7%8e%b0%e7%ad%be%e5%88%b0%e7%9a%84%e6%97%a5%e5%8e%86%e5%8a%9f%e8%83%bd","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/33558\/","title":{"rendered":"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5b9e\u73b0\u7b7e\u5230\u7684\u65e5\u5386\u529f\u80fd"},"content":{"rendered":"<p><em><\/em> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/052\/5f3a4197191a5688.jpg\" class=\"aligncenter\" title=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5b9e\u73b0\u7b7e\u5230\u7684\u65e5\u5386\u529f\u80fd\u63d2\u56fe\" alt=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5b9e\u73b0\u7b7e\u5230\u7684\u65e5\u5386\u529f\u80fd\u63d2\u56fe\" \/><\/p>\n<h2> <span><\/span>\u524d\u8a00<\/h2>\n<p>\u56e0\u4e3a\u8981\u505a\u7b7e\u5230,\u6240\u4ee5\u8981\u5199\u4e86\u4e2a\u65e5\u5386\u3002<\/p>\n<p>\u53ea\u6709\u57fa\u7840\u7684\u65e5\u5386,\u7b7e\u5230\u9700\u8981\u81ea\u884c\u5b9e\u73b0\u3002<\/p>\n<p>(\u6211\u7b49\u4e0b\u4e5f\u8981\u5b9e\u73b0\u7b7e\u5230\u4e86\u2026)<\/p>\n<blockquote><p>\n  \u76f8\u5173\u5b66\u4e60\u63a8\u8350\uff1a\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u6559\u7a0b\n<\/p><\/blockquote>\n<h2> <span><\/span>\u6548\u679c\u56fe<\/h2>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/052\/b949a1cd28635fc6371594f8de644576-0.png\" class=\"aligncenter\" title=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5b9e\u73b0\u7b7e\u5230\u7684\u65e5\u5386\u529f\u80fd\u63d2\u56fe1\" alt=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5b9e\u73b0\u7b7e\u5230\u7684\u65e5\u5386\u529f\u80fd\u63d2\u56fe1\" \/><\/p>\n<h2> <span><\/span>wxml<\/h2>\n<pre>&lt;view class=\"sign-wrapper\"&gt;\n    &lt;view class=\"calendar\"&gt;\n      &lt;view class=\"month\"&gt;\n\n        &lt;view class=\"item\" wx:for=\"{{ week }}\"&gt;\n            {{ item }}\n        &lt;\/view&gt;\n        &lt;view class=\"item {{ item.type != 'curr' ? 'othe' : '' }}\" \n        wx:for=\"{{ dateData }}\"&gt;\n            {{ item.day }}\n        &lt;\/view&gt;\n\n      &lt;\/view&gt;\n    &lt;\/view&gt;\n  &lt;\/view&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<h2> <span><\/span>wxss<\/h2>\n<pre>.calendar{\n   margin-top: 10%;}.month{\n      display: flex;\n      flex-flow: row wrap;\n      font-size: 1.1rem;  }.item{\n      width: 14.28%;\n      text-align: center;\n      line-height: 3rem;}.othe{\n   color: grey}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<h2> <span><\/span>js<\/h2>\n<pre>\/\/ pages\/sing_in\/sing_in.jsPage({\n  data: {\n    dateData: [],\n    isSignin: false,\n    week: ['\u65e5','\u4e00','\u4e8c','\u4e09','\u56db','\u4e94','\u516d'],\n  },\n  onLoad: function (options) {\n      this.initCurrMonthData()\n  },\n  \/**\n  * year string \u5e74  \u5982:2020 \n  * month string \u6708 \u5982: 5\n  * return array \u6240\u6709\u5929\u6570 \u5982:[1,2,3...,31]\n  **\/\n  monthDays(year,month){ \n     let days_count = new Date(year,month,0).getDate() \/\/\u6708\u603b\u5929\u6570 \u5982:31\n     let days = []; \/\/\u5b58\u653e\u6708\u7684\u5929\u6570\n     for(let i = 1; i &lt;= days_count; i++)\n     days.push(i)\n     return days;\n  },\n  \/\/\u521d\u59cb\u5316\u5f53\u6708\u6570\u636e\n  initCurrMonthData(){\n     let currDate = new Date(); \/\/\u5f53\u524d\u65e5\u671f\n     let currMonthDays =  this.monthDays(currDate.getFullYear(),currDate.getMonth() + 1) \/\/\u5f53\u6708 +1\u662f\u56e0\u4e3a\u6708\u4ece0\u5f00\u59cb  \u53ea\u67090-11\n     let lastMonthDays = this.monthDays(currDate.getFullYear(),currDate.getMonth() ) \/\/\u4e0a\u4e2a\u6708\n     let currFirstWeek = new Date(currDate.getFullYear(),currDate.getMonth() - 1, 1).getDay() + 1;   \/\/\u8fd9\u4e2a\u6708\u76841\u53f7\u662f\u661f\u671f\u51e0  -1\u662f\u56e0\u4ece0\u5f00\u59cb \n     \/\/\u6708\u6700\u540e\u4e00\u5929\u662f\u661f\u671f\u51e0\n\n     let dateData = [];\n     dateData = currMonthDays.map(val =&gt; this.formatDay(val)) \/\/\u5f53\u6708\u7684\u6570\u636e\n\n     for(let i = 0; i &lt; currFirstWeek; i++)  \/\/\u4e0a\u6708\u8981\u663e\u793a\u7684\n     dateData.unshift( \n       this.formatDay( lastMonthDays.pop(),'last')\n     );\n\n    let nextLenth = 42 - dateData.length;  \/\/ 42\u662f\u56e0\u4e3a 6 * 7\u683c\u5f0f\n    for(var i = 1; i &lt;= nextLenth; i++) \/\/\u4e0b\u4e2a\u6708\u9700\u8981\u663e\u793a\u7684\u65e5\u671f\n    dateData.push(\n        this.formatDay( i, 'next')\n    );\n\n    this.setData({\n      dateData : dateData    })\n   },\n   formatDay(day,type = 'curr'){ \/\/\u65e5\u671f\u6570\u636e\u7684\u683c\u5f0f\u5316\n    return {day:day,type:type};\n   },\n\n   onShareAppMessage: function () {\n\n   }})<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<blockquote>\n<p>\u76f8\u5173\u5b66\u4e60\u63a8\u8350\uff1a<\/p>\n<\/blockquote>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5b9e\u73b0\u7b7e\u5230\u7684\u65e5\u5386\u529f\u80fd\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>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \u524d\u8a00 \u56e0\u4e3a\u8981\u505a\u7b7e\u5230,\u6240\u4ee5\u8981\u5199\u4e86\u4e2a\u65e5\u5386\u3002 \u53ea\u6709\u57fa\u7840\u7684\u65e5\u5386,\u7b7e\u5230\u9700\u8981\u81ea\u884c\u5b9e\u73b0\u3002 (\u6211\u7b49\u4e0b\u4e5f\u8981\u5b9e\u73b0\u7b7e\u5230\u4e86\u2026) \u76f8\u5173\u5b66\u4e60\u63a8\u8350\uff1a\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u6559\u7a0b \u6548\u679c\u56fe wxml &lt;view class=&#8221;sign-wrapper&#8221;&gt; &lt;view class=&#8221;calendar&#8221;&gt; &lt;view class=&#8221;month&#8221;&gt; &lt;view class=&#8221;item&#8221; wx:for=&#8221;{{ week }}&#8221;&gt; {{ item }} &lt;\/view&gt; &lt;view class=&#8221;item {{ item.type != [&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-33558","post","type-post","status-publish","format-standard","hentry","category-19"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/33558","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=33558"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/33558\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=33558"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=33558"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=33558"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}