diff --git a/miniprogram/pages/punchcardcheckin/punchcardcheckin.js b/miniprogram/pages/punchcardcheckin/punchcardcheckin.js index 5c415e5..53dcb45 100644 --- a/miniprogram/pages/punchcardcheckin/punchcardcheckin.js +++ b/miniprogram/pages/punchcardcheckin/punchcardcheckin.js @@ -1,4 +1,6 @@ // pages/punchcardcheckin/punchcardcheckin.js +const dayjs = require("./../../utils/dayjs.min.js"); + Page({ /** @@ -11,37 +13,75 @@ Page({ desc: '发冷' }, { + id: 1, title: '咳痰', desc: '气管不适' }, { + id: 2, title: '发烧', desc: '37度以上高温' }, { + id: 3, title: '咳痰', desc: '气管不适' }, { + id: 4, title: '发烧', desc: '37度以上高温' }, { + id: 5, title: '咳痰', desc: '气管不适' }, { + id: 6, title: '发烧', desc: '37度以上高温' }, - ] + ], + array: [], + index: 20, + date: dayjs().format('YYYY-MM-DD') + }, + bindDateChange: function (e) { + this.setData({ + date: dayjs(e.detail.value).format('YYYY-MM-DD') + }) + }, + toHomePage() { + wx.redirectTo({ + url: '/pages/index/index', + }) + }, + checkIn() { + const { array, index, date } = this.data; + wx.redirectTo({ + url: `/pages/punchcardstatus/punchcardstatus?temp=${array[index]}&date=${date}`, + }) + }, + bindPickerChange: function (e) { + this.setData({ + index: e.detail.value + }) }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + let temp = 35; + let temps = []; + while(temp < 41){ + temp = temp + 0.1 + temps.push(temp.toFixed(1)); + } + this.setData({ + array: temps + }) }, /** diff --git a/miniprogram/pages/punchcardcheckin/punchcardcheckin.wxml b/miniprogram/pages/punchcardcheckin/punchcardcheckin.wxml index 7de605c..231122c 100644 --- a/miniprogram/pages/punchcardcheckin/punchcardcheckin.wxml +++ b/miniprogram/pages/punchcardcheckin/punchcardcheckin.wxml @@ -1,28 +1,36 @@ - 本小区已经有500人参加健康打卡 + 本小区已经有453人参加健康打卡 日期 - + + + {{date}} + + 体温 - + + + {{array[index]}}℃ + + 备注 - + 其他症状 - + + - + \ No newline at end of file diff --git a/miniprogram/pages/punchcardlist/punchcardlist.js b/miniprogram/pages/punchcardlist/punchcardlist.js index 4354860..eed6e37 100644 --- a/miniprogram/pages/punchcardlist/punchcardlist.js +++ b/miniprogram/pages/punchcardlist/punchcardlist.js @@ -1,11 +1,57 @@ // pages/punchcardlist/punchcardlist.js +const util = require("./../../utils/util.js"); + Page({ /** * 页面的初始数据 */ data: { + list: [ + { + id:1, + content: '今天体温37.1度,一切正常,还需要适当运动,增加蛋白质的摄入。', + date: util.formatDate(new Date(2020,2,21,10,30,40)), + imgUrl: 'cloud://cloud-tcb.636c-cloud-tcb-1301077292/images/1_1.png', + }, + { + id: 2, + content: '今天体温37.0度,需要多运动了,胖了一些。', + date: util.formatDate(new Date(2020, 2, 1, 8, 56, 40)), + imgUrl: 'cloud://cloud-tcb.636c-cloud-tcb-1301077292/images/2_1.png', + }, + { + id: 3, + content: '今天体温37.3度,没有不正常反应。', + date: util.formatDate(new Date(2020, 1, 28, 8, 34, 40)), + imgUrl: 'cloud://cloud-tcb.636c-cloud-tcb-1301077292/images/3_1.png', + }, + { + id: 4, + content: '今天体温37.2度,到楼下购物,买一些日常用品。一切正常,还需要适当运动,增加蛋白质的摄入。', + date: util.formatDate(new Date(2020, 1, 23, 9, 48, 40)), + imgUrl: 'cloud://cloud-tcb.636c-cloud-tcb-1301077292/images/1_1.png', + }, + { + id: 5, + content: '今天体温37.4度,天气不错,没有什么不好的东西。一切正常,还需要适当运动,增加蛋白质的摄入。', + date: util.formatDate(new Date(2020, 1, 22, 9, 54, 32)), + imgUrl: 'cloud://cloud-tcb.636c-cloud-tcb-1301077292/images/2_1.png', + }, + { + id: 6, + content: '今天体温37.0度,早上起床比较晚,要多一些好的东西学习。一切正常,还需要适当运动,增加蛋白质的摄入。', + date: util.formatDate(new Date(2020, 1, 21, 11, 30, 2)), + imgUrl: 'cloud://cloud-tcb.636c-cloud-tcb-1301077292/images/3_1.png', + }, + ] + + }, + toCheckIn(){ + wx.redirectTo({ + url: '/pages/punchcardcheckin/punchcardcheckin', + }) }, /** diff --git a/miniprogram/pages/punchcardlist/punchcardlist.wxml b/miniprogram/pages/punchcardlist/punchcardlist.wxml index 7e4de8c..f2a0dd8 100644 --- a/miniprogram/pages/punchcardlist/punchcardlist.wxml +++ b/miniprogram/pages/punchcardlist/punchcardlist.wxml @@ -1,15 +1,18 @@ - + - 打卡第一天 + 打卡第 {{(list.length - i)}} 天 - 今天体温37度,一切正常,还需要更多营养补充,希望明天一切正常,还能出门出去购物 - 1小时前 + {{item.content}} + {{item.date}} + + + - - + + \ No newline at end of file diff --git a/miniprogram/pages/punchcardlist/punchcardlist.wxss b/miniprogram/pages/punchcardlist/punchcardlist.wxss index ea02060..d3ab068 100644 --- a/miniprogram/pages/punchcardlist/punchcardlist.wxss +++ b/miniprogram/pages/punchcardlist/punchcardlist.wxss @@ -1,7 +1,7 @@ .punch-list{ border: solid rgba(0,0,0,.05); border-width: 1rpx 0; - padding: 0 40rpx; + padding: 0 40rpx 80rpx 40rpx; } .header{ @@ -22,7 +22,7 @@ } .title{ - font-size: 32rpx; + font-size: 28rpx; font-weight: bold; margin: 10rpx 0 20rpx 0; } @@ -31,6 +31,19 @@ color: rgba(0,0,0,.3); } .img{ - width: 200rpx; - background-color: rgba(0,0,0,.1); + width: 160rpx; + margin-left: 30rpx; +} +.img image{ + width: 100%; + height: 100%; + object-fit: cover; +} +.button.button-primary.btn-back{ + margin: 0; + width: 100%; + bottom: 0; + right: 0; + left: 0; + border-radius: 0; } \ No newline at end of file diff --git a/miniprogram/pages/punchcardstatus/punchcardstatus.js b/miniprogram/pages/punchcardstatus/punchcardstatus.js index e668390..8094439 100644 --- a/miniprogram/pages/punchcardstatus/punchcardstatus.js +++ b/miniprogram/pages/punchcardstatus/punchcardstatus.js @@ -1,11 +1,13 @@ - +const dayjs = require("./../../utils/dayjs.min.js"); Page({ /** * 页面的初始数据 */ data: { - type: "warn" // ["succ", "warn"] + date: dayjs().format('YYYY-MM-DD'), + temp: 37.1, + type: "succ" // ["succ", "warn"] }, /** @@ -13,8 +15,15 @@ Page({ */ onLoad: function (options) { this.setData({ - type: options.type + temp: options.temp, + date: options.date }) + const normalTemp = 37.2; + if (options.temp > normalTemp){ + this.setData({ + type: 'warn' + }); + } }, /** diff --git a/miniprogram/pages/punchcardstatus/punchcardstatus.wxml b/miniprogram/pages/punchcardstatus/punchcardstatus.wxml index 08ae3dd..cd7013c 100644 --- a/miniprogram/pages/punchcardstatus/punchcardstatus.wxml +++ b/miniprogram/pages/punchcardstatus/punchcardstatus.wxml @@ -6,13 +6,13 @@ 您的体温达到了 - 38度 + {{temp}}度 请尽快就医 避免与他人接触 日期 - 2020-02-05 + {{date}} @@ -21,7 +21,7 @@ 体温 - 小于36度 + {{temp}} diff --git a/miniprogram/utils/dayjs.min.js b/miniprogram/utils/dayjs.min.js new file mode 100644 index 0000000..7d22800 --- /dev/null +++ b/miniprogram/utils/dayjs.min.js @@ -0,0 +1 @@ +!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):t.dayjs=n()}(this,function(){"use strict";var t="millisecond",n="second",e="minute",r="hour",i="day",s="week",u="month",a="year",o=/^(\d{4})-?(\d{1,2})-?(\d{0,2})(.*?(\d{1,2}):(\d{1,2}):(\d{1,2}))?.?(\d{1,3})?$/,h=/\[.*?\]|Y{2,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,c={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},d=function(t,n,e){var r=String(t);return!r||r.length>=n?t:""+Array(n+1-r.length).join(e)+t},f={padStart:d,padZoneStr:function(t){var n=Math.abs(t),e=Math.floor(n/60),r=n%60;return(t<=0?"+":"-")+d(e,2,"0")+":"+d(r,2,"0")},monthDiff:function(t,n){var e=12*(n.year()-t.year())+(n.month()-t.month()),r=t.clone().add(e,"months"),i=n-r<0,s=t.clone().add(e+(i?-1:1),"months");return Number(-(e+(n-r)/(i?r-s:s-r)))},absFloor:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},prettyUnit:function(o){return{M:u,y:a,w:s,d:i,h:r,m:e,s:n,ms:t}[o]||String(o||"").toLowerCase().replace(/s$/,"")},isUndefined:function(t){return void 0===t}},$="en",l={};l[$]=c;var m=function(t){return t instanceof p},y=function(t,n,e){var r;if(!t)return null;if("string"==typeof t)l[t]&&(r=t),n&&(l[t]=n,r=t);else{var i=t.name;l[i]=t,r=i}return e||($=r),r},M=function(t,n){if(m(t))return t.clone();var e=n||{};return e.date=t,new p(e)},S=function(t,n){return M(t,{locale:n.$L})},D=f;D.parseLocale=y,D.isDayjs=m,D.wrapper=S;var p=function(){function c(t){this.parse(t)}var d=c.prototype;return d.parse=function(t){var n,e;this.$d=null===(n=t.date)?new Date(NaN):D.isUndefined(n)?new Date:n instanceof Date?n:"string"==typeof n&&/.*[^Z]$/i.test(n)&&(e=n.match(o))?new Date(e[1],e[2]-1,e[3]||1,e[5]||0,e[6]||0,e[7]||0,e[8]||0):new Date(n),this.init(t)},d.init=function(t){var n=this.$d;this.$y=n.getFullYear(),this.$M=n.getMonth(),this.$D=n.getDate(),this.$W=n.getDay(),this.$H=n.getHours(),this.$m=n.getMinutes(),this.$s=n.getSeconds(),this.$ms=n.getMilliseconds(),this.$L=this.$L||y(t.locale,null,!0)||$},d.$utils=function(){return D},d.isValid=function(){return!("Invalid Date"===this.$d.toString())},d.isSame=function(t,n){var e=M(t);return this.startOf(n)<=e&&e<=this.endOf(n)},d.isAfter=function(t,n){return M(t)-1?t.replace(/\[|\]/g,""):{YY:String(n.$y).slice(-2),YYYY:String(n.$y),M:String(n.$M+1),MM:D.padStart(n.$M+1,2,"0"),MMM:a(i.monthsShort,n.$M,u,3),MMMM:u[n.$M],D:String(n.$D),DD:D.padStart(n.$D,2,"0"),d:String(n.$W),dd:a(i.weekdaysMin,n.$W,s,2),ddd:a(i.weekdaysShort,n.$W,s,3),dddd:s[n.$W],H:String(n.$H),HH:D.padStart(n.$H,2,"0"),h:o(t),hh:o(t),a:n.$H<12?"am":"pm",A:n.$H<12?"AM":"PM",m:String(n.$m),mm:D.padStart(n.$m,2,"0"),s:String(n.$s),ss:D.padStart(n.$s,2,"0"),SSS:D.padStart(n.$ms,3,"0"),Z:r}[t]||r.replace(":","")})},d.diff=function(t,o,h){var c,d=D.prettyUnit(o),f=M(t),$=this-f,l=D.monthDiff(this,f);return l=(c={},c[a]=l/12,c[u]=l,c.quarter=l/3,c[s]=$/6048e5,c[i]=$/864e5,c[r]=$/36e5,c[e]=$/6e4,c[n]=$/1e3,c)[d]||$,h?l:D.absFloor(l)},d.daysInMonth=function(){return this.endOf(u).$D},d.$locale=function(){return l[this.$L]},d.locale=function(t,n){var e=this.clone();return e.$L=y(t,n,!0),e},d.clone=function(){return S(this.toDate(),this)},d.toDate=function(){return new Date(this.$d)},d.toArray=function(){return[this.$y,this.$M,this.$D,this.$H,this.$m,this.$s,this.$ms]},d.toJSON=function(){return this.toISOString()},d.toISOString=function(){return this.$d.toISOString()},d.toObject=function(){return{years:this.$y,months:this.$M,date:this.$D,hours:this.$H,minutes:this.$m,seconds:this.$s,milliseconds:this.$ms}},d.toString=function(){return this.$d.toUTCString()},c}();return M.extend=function(t,n){return t(n,p,M),M},M.locale=y,M.isDayjs=m,M.unix=function(t){return M(1e3*t)},M.en=l[$],M}); diff --git a/miniprogram/utils/util.js b/miniprogram/utils/util.js index 993b3bf..13880da 100644 --- a/miniprogram/utils/util.js +++ b/miniprogram/utils/util.js @@ -119,11 +119,21 @@ function json2Form(json) {   }   return str.join("&"); }  + +/** + * 格式化日期 + */ +const formatDate = (cellval) => { + const t = new Date(cellval).toJSON(); + const date = new Date(+new Date(t) + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '') + return date; +} module.exports = { randomNum, converMbSize, converSize, checkImage, checkFont, - json2Form + json2Form, + formatDate }