add miniprogram
This commit is contained in:
36
miniprogram/pages/report/myreport.js
Normal file
36
miniprogram/pages/report/myreport.js
Normal file
@@ -0,0 +1,36 @@
|
||||
Page({
|
||||
|
||||
data:{
|
||||
|
||||
tableInfo: {},
|
||||
count:''
|
||||
},
|
||||
|
||||
|
||||
onReady: function () {
|
||||
// 生命周期函数--监听页面初次渲染完成
|
||||
var that = this;
|
||||
wx.request({
|
||||
url: 'http://127.0.0.1:8080/report/myReport',
|
||||
data: {
|
||||
id:wx.getStorageSync('id')
|
||||
},
|
||||
success: function (d) {
|
||||
let item = [];
|
||||
for (const iterator of d.data.data) {
|
||||
let item1 = [iterator.name,iterator.time,iterator.normal,iterator.address];
|
||||
item.push(item1)
|
||||
}
|
||||
that.setData({
|
||||
tableInfo:{
|
||||
title:["姓名","填报时间","体温状况","位置"],
|
||||
contentItem: item,
|
||||
},
|
||||
count: d.data.data.length
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
})
|
3
miniprogram/pages/report/myreport.json
Normal file
3
miniprogram/pages/report/myreport.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
22
miniprogram/pages/report/myreport.wxml
Normal file
22
miniprogram/pages/report/myreport.wxml
Normal file
@@ -0,0 +1,22 @@
|
||||
<template name="tableTemp">
|
||||
<view>
|
||||
<view class="table">
|
||||
<view class="tr">
|
||||
<block wx:for="{{title}}" wx:key="{{index}}">
|
||||
<view class="th left">{{item}}</view>
|
||||
</block>
|
||||
</view>
|
||||
<view class="tr" wx:for="{{contentItem}}" wx:key="index">
|
||||
<block wx:for="{{item}}" wx:key="index">
|
||||
<view class="td left">{{item}}</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<view style="margin-left: 220px;margin-top: 10px;">
|
||||
<h2>累计上报天数: {{count}}</h2>
|
||||
</view>
|
||||
<view class="tb1">
|
||||
<template is="tableTemp" data="{{...tableInfo}}" />
|
||||
</view>
|
42
miniprogram/pages/report/myreport.wxss
Normal file
42
miniprogram/pages/report/myreport.wxss
Normal file
@@ -0,0 +1,42 @@
|
||||
|
||||
.table-wrap{
|
||||
top: 20rpx;
|
||||
}
|
||||
/* 表格代码 */
|
||||
.table{
|
||||
background-color: white;
|
||||
border:1px solid #dadada;
|
||||
border-right:0;
|
||||
border-bottom: 0;
|
||||
width: 96%;
|
||||
margin: auto;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.tr{
|
||||
width:100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.th{
|
||||
padding: 3px;
|
||||
border-bottom: 1px solid #dadada;
|
||||
border-right: 1px solid #dadada;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
background-color: rgba(139, 182, 155, 0.12);
|
||||
font-size: 28rpx;
|
||||
color: rgba(23, 21, 23, 0.73);
|
||||
}
|
||||
.td{
|
||||
padding: 3px;
|
||||
border-bottom: 1px solid #dadada;
|
||||
border-right: 1px solid #dadada;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
font-size: 28rpx;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.left{
|
||||
text-align: left;
|
||||
}
|
193
miniprogram/pages/report/report.js
Normal file
193
miniprogram/pages/report/report.js
Normal file
@@ -0,0 +1,193 @@
|
||||
// pages/report/report.js
|
||||
|
||||
var util = require('../../utils/util')
|
||||
Page({
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
id:'',
|
||||
address: '',
|
||||
time: '',
|
||||
radio1: [{value:'正常',checked: 'true'},{value:'发热'}],
|
||||
radio2:[{value:'无需隔离',checked:'true'},{value:'居家隔离'},{value:'集中隔离'},{value:'入院隔离'}],
|
||||
normal:'正常',
|
||||
isolation:'无需隔离',
|
||||
name: '',
|
||||
stuId: '',
|
||||
yes_noon_temp:36.2,
|
||||
yes_night_temp:36.4,
|
||||
today_morning_temp:36.2
|
||||
},
|
||||
radioChange1: function(e) {
|
||||
this.setData({
|
||||
normal:e.detail.value
|
||||
})
|
||||
},
|
||||
radioChange2: function(e) {
|
||||
this.setData({
|
||||
isolation:e.detail.value
|
||||
})
|
||||
},
|
||||
|
||||
chooseLocation: function () {
|
||||
var that = this;
|
||||
wx.getSetting({
|
||||
success(res) {
|
||||
if (!res.authSetting['scope.userLocation']) {
|
||||
wx.authorize({
|
||||
scope: 'scope.userLocationBackground',
|
||||
success(){
|
||||
that.location();
|
||||
}
|
||||
})
|
||||
} else {
|
||||
that.location();
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
location:function () {
|
||||
var that = this;
|
||||
wx.chooseLocation({
|
||||
success: function (res) {
|
||||
that.setData({
|
||||
'address': res.address,
|
||||
})
|
||||
},
|
||||
fail: function () {
|
||||
wx.showToast({
|
||||
title: "请获取当前位置",
|
||||
icon: 'error'
|
||||
})
|
||||
},
|
||||
})
|
||||
},
|
||||
|
||||
myreport:function () {
|
||||
wx.navigateTo({
|
||||
url: './myreport'
|
||||
})
|
||||
},
|
||||
|
||||
report: function () {
|
||||
var that = this
|
||||
if(this.data.address==''){
|
||||
wx.showToast({
|
||||
title: '请先选择地址',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}else{
|
||||
wx.request({
|
||||
url: 'http://127.0.0.1:8080/report/doReport',
|
||||
data: {
|
||||
user_id:this.data.id,
|
||||
name:this.data.name,
|
||||
address: this.data.address,
|
||||
time: this.data.time,
|
||||
normal:this.data.normal,
|
||||
yes_noon_temp:this.data.yes_noon_temp,
|
||||
yes_night_temp:this.data.yes_night_temp,
|
||||
today_morning_temp:this.data.today_morning_temp,
|
||||
isolation:this.data.isolation
|
||||
},
|
||||
success: function (d) {
|
||||
|
||||
if (d.data == "填报成功") {
|
||||
wx.showToast({
|
||||
title: d.data,
|
||||
icon: 'success',
|
||||
success: function () {
|
||||
if(that.data.normal != "发热" && that.data.isolation == "无需隔离"){
|
||||
wx.setStorageSync("state",that.formatDate(new Date()))
|
||||
}else{
|
||||
wx.setStorageSync("state","1999-01-01")
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: d.data,
|
||||
icon: 'error',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
formatDate: function(date) {
|
||||
let year = date.getFullYear()
|
||||
let month = date.getMonth() + 1
|
||||
month = month.toString()
|
||||
month[1] ? month=month :month='0' + month
|
||||
let day = date.getDate()
|
||||
day = day.toString()
|
||||
day[1] ? day=day : day='0' + day
|
||||
return year+"-"+month+"-"+day
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
var TIME = util.formatTime(new Date());
|
||||
this.setData({
|
||||
time: TIME,
|
||||
name: wx.getStorageSync('name'),
|
||||
stuId: wx.getStorageSync('stuId'),
|
||||
id:wx.getStorageSync('id')
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
3
miniprogram/pages/report/report.json
Normal file
3
miniprogram/pages/report/report.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
81
miniprogram/pages/report/report.wxml
Normal file
81
miniprogram/pages/report/report.wxml
Normal file
@@ -0,0 +1,81 @@
|
||||
<page-meta root-font-size="system" />
|
||||
<view>
|
||||
<view class="weui-form" style="padding:20px 0">
|
||||
<view class="weui-form__text-area">
|
||||
<h2 class="weui-form__title">每日健康上报</h2>
|
||||
</view>
|
||||
<view class="weui-form__text-area" style="margin-top: 10px;">
|
||||
<h2 style="float: left;">{{stuId}}</h2>
|
||||
<h2 style="float: right;">{{name}}</h2>
|
||||
</view>
|
||||
<view class="weui-form__text-area" style="margin-top: 20px;">
|
||||
<h2 style="float: right;color: royalblue;text-decoration:underline;" bindtap="myreport">历史填报记录</h2>
|
||||
</view>
|
||||
<view class="weui-form__control-area" style="margin-top: 10px;margin-bottom: 0;">
|
||||
<view class="weui-cells__group weui-cells__group_form">
|
||||
|
||||
<view class="weui-cells__title">1.目前所在位置</view>
|
||||
<view class="weui-cell weui-cell_active">
|
||||
<view class="weui-cell__hd"><label class="weui-label">地址</label></view>
|
||||
<view class="weui-cell__bd" bindtap="chooseLocation">
|
||||
<input class="weui-input" placeholder="点击获取当前位置" placeholder-class="weui-input__placeholder" value="{{address}}" disabled="true" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="weui-cells__title">2.填报时间</view>
|
||||
<view class="weui-cell weui-cell_active">
|
||||
<view class="weui-cell__hd"><label class="weui-label">时间</label></view>
|
||||
<view class="weui-cell__bd" bindtap="">
|
||||
<input class="weui-input" placeholder="填报时间" placeholder-class="weui-input__placeholder" disabled="true" value="{{time}}" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="weui-cells__title">3.今日体温是否正常?(体温小于37.3度为正常)</view>
|
||||
<radio-group class="weui-cell weui-cell_active" style="display: flex;text-align: center;" bindchange="radioChange1">
|
||||
<label class="radio" wx:for="{{radio1}}" style="margin-right: 60px;">
|
||||
<radio value="{{item.value}}" checked="{{item.checked}}" />{{item.value}}
|
||||
</label>
|
||||
</radio-group>
|
||||
<view class="weui-cell" hidden="true">
|
||||
<view class="weui-cell__hd"><label class="weui-label">体温</label></view>
|
||||
<view class="weui-cell__bd">
|
||||
<input class="weui-input" placeholder="填报时间" placeholder-class="weui-input__placeholder" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="weui-cells__title">4.昨日午检体温</view>
|
||||
<view class="weui-cell weui-cell_active">
|
||||
<input class="weui-input" placeholder="昨日午检体温" placeholder-class="weui-input__placeholder" value="{{yes_noon_temp}}" />
|
||||
</view>
|
||||
|
||||
<view class="weui-cells__title">5.昨日晚检体温</view>
|
||||
<view class="weui-cell weui-cell_active">
|
||||
<input class="weui-input" placeholder="昨日晚检体温" placeholder-class="weui-input__placeholder" value="{{yes_night_temp}}" />
|
||||
</view>
|
||||
|
||||
<view class="weui-cells__title">6.今日晨检体温</view>
|
||||
<view class="weui-cell weui-cell_active">
|
||||
<input class="weui-input" placeholder="今日晨检体温" placeholder-class="weui-input__placeholder" value="{{today_morning_temp}}" />
|
||||
</view>
|
||||
|
||||
<view class="weui-cells__title">7.今日隔离情况</view>
|
||||
<radio-group class="weui-cell weui-cell_active" style="display: block;">
|
||||
<view style="text-align: center;">
|
||||
<label class="radio" wx:for="{{radio2}}" style="margin-right:60px;">
|
||||
<radio value="{{item.value}}" checked="{{item.checked}}"style="margin-bottom: 10px;" />{{item.value}}
|
||||
</label>
|
||||
</view>
|
||||
</radio-group>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
<view class="weui-form__tips-area">
|
||||
<view class="weui-form__tips" style="color: red;">
|
||||
* 本人承诺以上所填报的内容全部真实,并愿意承担相应责任。
|
||||
</view>
|
||||
</view>
|
||||
<view class="weui-form__opr-area">
|
||||
<a aria-role="button" class="weui-btn weui-btn_primary" bindtap="report">提交信息</a>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
4
miniprogram/pages/report/report.wxss
Normal file
4
miniprogram/pages/report/report.wxss
Normal file
@@ -0,0 +1,4 @@
|
||||
/* pages/report/report.wxss */
|
||||
.page{height:100%}.weui-label{width:4.1em}
|
||||
.weui-cells__title{font-size: 17px;}
|
||||
.form9{padding:10px 0 0 0 !important;display: flex;}
|
Reference in New Issue
Block a user