Skip to content

Commit

Permalink
Merge pull request #9 from TencentCloudBase/master
Browse files Browse the repository at this point in the history
合并代码
  • Loading branch information
snail1 authored Feb 21, 2020
2 parents db632e4 + 830b1e0 commit 8729722
Show file tree
Hide file tree
Showing 9 changed files with 156 additions and 26 deletions.
44 changes: 42 additions & 2 deletions miniprogram/pages/punchcardcheckin/punchcardcheckin.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// pages/punchcardcheckin/punchcardcheckin.js
const dayjs = require("./../../utils/dayjs.min.js");

Page({

/**
Expand All @@ -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
})
},

/**
Expand Down
22 changes: 15 additions & 7 deletions miniprogram/pages/punchcardcheckin/punchcardcheckin.wxml
Original file line number Diff line number Diff line change
@@ -1,28 +1,36 @@
<view class="punchin flex flex-column">
<view class="stats flex-none">本小区已经有<text>500</text>人参加健康打卡</view>
<view class="stats flex-none">本小区已经有<text>453</text>人参加健康打卡</view>
<view class="form flex-auto">
<view class="box">
<view class="label">日期</view>
<input class="input" placeholder="2020-02-09"></input>
<picker mode="date" value="{{date}}" start="2015-09-01" end="2017-09-01" bindchange="bindDateChange">
<view class="picker">
{{date}}
</view>
</picker>
</view>
<view class="box">
<view class="label">体温</view>
<input class="input" placeholder="2020-02-09"></input>
<picker bindchange="bindPickerChange" value="{{index}}" range="{{array}}">
<view class="picker">
{{array[index]}}℃
</view>
</picker>
</view>
<view class="box">
<view class="label">备注</view>
<input class="input" placeholder="2020-02-09"></input>
<input class="input" placeholder="无明显反应"></input>
</view>
<view class="other">
<view class="label">其他症状</view>
<view class="radios flex flex-row align-center">
<view class="box flex-none flex flex-column align-start" wx:for="{{symptoms}}" wx:key="title">
<label class="box flex-none flex flex-column align-start" wx:for="{{symptoms}}" wx:key="id">
<radio></radio>
<text class="title">{{item.title}}</text>
<text class="label">{{item.desc}}</text>
</view>
</label>
</view>
</view>
</view>
<button class="fixed btn-back flex-none button button-primary">回到主页</button>
<button bindtap="checkIn" class="fixed btn-back flex-none button button-primary">立即打卡</button>
</view>
46 changes: 46 additions & 0 deletions miniprogram/pages/punchcardlist/punchcardlist.js
Original file line number Diff line number Diff line change
@@ -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',
})
},

/**
Expand Down
15 changes: 9 additions & 6 deletions miniprogram/pages/punchcardlist/punchcardlist.wxml
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
<view class="punch-list">
<view class="item flex flex-column" wx:for="{{4}}" wx:key="item">
<view class="item flex flex-column" wx:for="{{list}}" wx:for-index="i" wx:key="item">
<view class="header flex align-center">
<text class="icon flex-none"></text>
打卡第一天
打卡第 {{(list.length - i)}} 天
</view>
<view class="body flex">
<view class="flex-auto">
<view class="title maxline2">今天体温37度,一切正常,还需要更多营养补充,希望明天一切正常,还能出门出去购物</view>
<view class="date">1小时前</view>
<view class="title maxline2">{{item.content}}</view>
<view class="date">{{item.date}}</view>
</view>
<view class="flex-none img">
<image src="{{item.imgUrl}}" mode="aspectFill" />
</view>
<view class="flex-none img"></view>
</view>
</view>
</view>
<button bindtap="toCheckIn" class="fixed btn-back flex-none button button-primary">为爱打卡</button>
</view>
21 changes: 17 additions & 4 deletions miniprogram/pages/punchcardlist/punchcardlist.wxss
Original file line number Diff line number Diff line change
@@ -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{
Expand All @@ -22,7 +22,7 @@
}

.title{
font-size: 32rpx;
font-size: 28rpx;
font-weight: bold;
margin: 10rpx 0 20rpx 0;
}
Expand All @@ -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;
}
15 changes: 12 additions & 3 deletions miniprogram/pages/punchcardstatus/punchcardstatus.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@

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"]
},

/**
* 生命周期函数--监听页面加载
*/
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'
});
}
},

/**
Expand Down
6 changes: 3 additions & 3 deletions miniprogram/pages/punchcardstatus/punchcardstatus.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
</view>
<view class="status flex-none flex align-center flex-column" wx:else>
<view class="big">您的体温达到了</view>
<view class="big">38度</view>
<view class="big">{{temp}}度</view>
<view class="small gray">请尽快就医 避免与他人接触</view>
</view>
<view class="panel flex-auto">
<view class="box row">
<view class="label">日期</view>
<text>2020-02-05</text>
<text>{{date}}</text>
</view>
<view class="flex row justify-between">
<view class="box flex-auto">
Expand All @@ -21,7 +21,7 @@
</view>
<view class="box flex-auto">
<view class="label">体温</view>
<text>小于36度</text>
<text>{{temp}}</text>
</view>
</view>
</view>
Expand Down
1 change: 1 addition & 0 deletions miniprogram/utils/dayjs.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 11 additions & 1 deletion miniprogram/utils/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 8729722

Please sign in to comment.