创建新的小程序,进出码,体温上报功能迁移基本完成
This commit is contained in:
215
weixin-miniprogram/pages/residents/code.js
Normal file
215
weixin-miniprogram/pages/residents/code.js
Normal file
@@ -0,0 +1,215 @@
|
||||
// pages/residents/code.js
|
||||
import SparkMD5 from '../../utils/spark-md5.min'
|
||||
import utils from '../../utils/util'
|
||||
import drawQrcode from '../../utils/qrcode/index'
|
||||
import scanQRCode from '../../utils/scanQRCode'
|
||||
|
||||
const app = getApp();
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
timeInterval: null,
|
||||
isShow: 'none',
|
||||
userText: '',
|
||||
showText: '',
|
||||
showTextColor: '',
|
||||
time: '',
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
console.log('onShow')
|
||||
// setTimeout(this.refershData, 100)
|
||||
this.refershData()
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
console.log('onHide')
|
||||
clearInterval(this.data.timeInterval);
|
||||
this.setData({
|
||||
isShow: 'none',
|
||||
time: ''
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
console.log('onUnload')
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
console.log('onPullDownRefresh')
|
||||
this.refershData(() => {
|
||||
wx.stopPullDownRefresh();
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
|
||||
},
|
||||
|
||||
|
||||
refershData(callback) {
|
||||
console.log('this.refershData()')
|
||||
wx.showNavigationBarLoading();
|
||||
clearInterval(this.data.timeInterval);
|
||||
this.setData({
|
||||
isShow: 'none',
|
||||
time: '',
|
||||
userInfo: wx.getStorageSync("userInfo"),
|
||||
})
|
||||
if (!this.data.userInfo) {
|
||||
wx.redirectTo({
|
||||
url: '/pages/index/login'
|
||||
})
|
||||
}
|
||||
wx.showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
var that = this;
|
||||
wx.request({
|
||||
url: `${app.globalData.baseUrl}/access/code/getCodeInfo`,
|
||||
method: "POST",
|
||||
header: {
|
||||
"Content-Type": "application/x-www-form-urlencoded" //用于post
|
||||
},
|
||||
data: {
|
||||
id: this.data.userInfo.id,
|
||||
},
|
||||
success: function (d) {
|
||||
console.log("begin success")
|
||||
wx.hideLoading()
|
||||
let result = d.data;
|
||||
if (result.success) {
|
||||
console.log("result.data", result.data);
|
||||
that.setData({
|
||||
userText: `${that.data.userInfo.id} | ${that.data.userInfo.realname}`,
|
||||
showText: result.data.infoText,
|
||||
showTextColor: result.data.infoTextColor
|
||||
})
|
||||
|
||||
let t = Date.now();
|
||||
let chksum = SparkMD5.hash(JSON.stringify({
|
||||
id: that.data.userInfo.id,
|
||||
t: t
|
||||
}));
|
||||
console.log("chksum", chksum)
|
||||
that.drawCode(`https://epp.cxyxiaomo.com/access/validCode?id=${that.data.userInfo.id}&t=${t}&chksum=${chksum}`, result.data.qrcodeColor)
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: result.msg,
|
||||
icon: 'error',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
that.setData({
|
||||
isShow: ''
|
||||
})
|
||||
console.log("end success")
|
||||
},
|
||||
fail: function () {
|
||||
console.log("begin fail")
|
||||
wx.hideLoading()
|
||||
wx.showToast({
|
||||
title: "请求失败",
|
||||
icon: 'error',
|
||||
duration: 2000
|
||||
})
|
||||
console.log("end fail")
|
||||
},
|
||||
complete: function () {
|
||||
console.log("begin complete")
|
||||
if (typeof (callback) === "function")
|
||||
callback();
|
||||
wx.hideNavigationBarLoading();
|
||||
console.log("end complete")
|
||||
}
|
||||
})
|
||||
},
|
||||
drawCode(text = 'https://www.baidu.com/', foreground = 'red') {
|
||||
console.log("drawCode was called.")
|
||||
var that = this;
|
||||
const query = wx.createSelectorQuery()
|
||||
query.select('#myQrcode')
|
||||
.fields({
|
||||
node: true,
|
||||
size: true
|
||||
})
|
||||
.exec(async (res) => {
|
||||
console.log("before drawQrcode")
|
||||
var canvas = res[0].node
|
||||
if (!canvas) {
|
||||
wx.showToast({
|
||||
title: "canvas获取失败",
|
||||
icon: 'error',
|
||||
duration: 2000
|
||||
})
|
||||
return
|
||||
}
|
||||
console.log("canvas:", canvas, "res:", res)
|
||||
// 调用方法drawQrcode生成二维码
|
||||
await drawQrcode(wx, {
|
||||
canvas: canvas,
|
||||
canvasId: 'myQrcode',
|
||||
width: 150,
|
||||
padding: 0,
|
||||
background: '#ffffff',
|
||||
foreground: foreground,
|
||||
text: text,
|
||||
})
|
||||
console.log("end drawQrcode")
|
||||
|
||||
this.updateTime();
|
||||
this.setData({
|
||||
timeInterval: setInterval(this.updateTime, 1000)
|
||||
})
|
||||
})
|
||||
},
|
||||
updateTime() {
|
||||
this.setData({
|
||||
time: utils.formatTime(new Date())
|
||||
})
|
||||
console.log("刷新时间")
|
||||
},
|
||||
scan() {
|
||||
scanQRCode(wx)
|
||||
}
|
||||
})
|
5
weixin-miniprogram/pages/residents/code.json
Normal file
5
weixin-miniprogram/pages/residents/code.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"usingComponents": {},
|
||||
"navigationBarTitleText": "身份码",
|
||||
"enablePullDownRefresh": true
|
||||
}
|
10
weixin-miniprogram/pages/residents/code.wxml
Normal file
10
weixin-miniprogram/pages/residents/code.wxml
Normal file
@@ -0,0 +1,10 @@
|
||||
<!--pages/residents/code.wxml-->
|
||||
<view id="codeView" :style="{ display: isShow }">
|
||||
<view id="user-text"><text>{{ userText }}</text></view>
|
||||
<view id="time-text"><text>{{ time }}</text></view>
|
||||
<canvas type="2d" style="width: 250px; height: 250px;" id="myQrcode"></canvas>
|
||||
<view id="show-text"><text style="color: {{ showTextColor }}">{{ showText }}</text></view>
|
||||
<view id="small-text"><text>下拉可刷新</text></view>
|
||||
|
||||
<button id="scan-btn" size="mini" bindtap="scan">扫门禁码</button>
|
||||
</view>
|
37
weixin-miniprogram/pages/residents/code.wxss
Normal file
37
weixin-miniprogram/pages/residents/code.wxss
Normal file
@@ -0,0 +1,37 @@
|
||||
/* pages/residents/code.wxss */
|
||||
#codeView {
|
||||
text-align: center;
|
||||
margin-top: 50px;
|
||||
}
|
||||
|
||||
#user-text {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
#time-text {
|
||||
font-weight: bold;
|
||||
font-size: 22px;
|
||||
margin-top: 30px;
|
||||
}
|
||||
|
||||
#myQrcode {
|
||||
display: block;
|
||||
margin: 30px auto;
|
||||
}
|
||||
|
||||
#show-text {
|
||||
font-weight: bold;
|
||||
font-size: 25px;
|
||||
}
|
||||
|
||||
#small-text {
|
||||
margin-top: 30px;
|
||||
color: grey;
|
||||
font-size: small;
|
||||
}
|
||||
|
||||
#scan-btn {
|
||||
margin-top: 20px;
|
||||
padding: 9px 60px;
|
||||
font-size: initial;
|
||||
}
|
291
weixin-miniprogram/pages/residents/report.js
Normal file
291
weixin-miniprogram/pages/residents/report.js
Normal file
@@ -0,0 +1,291 @@
|
||||
// pages/residents/report.js
|
||||
import utils from '../../utils/util'
|
||||
|
||||
const app = getApp();
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
isSkipOnShowFunc: false, // 是否跳过 onShow
|
||||
userInfo: null,
|
||||
timeInterval: null,
|
||||
formData: {
|
||||
userId: '',
|
||||
userRealname: '',
|
||||
address: '',
|
||||
time: '',
|
||||
timestamp: '',
|
||||
temperature: 0,
|
||||
},
|
||||
// 是否填报过
|
||||
isFilled: true,
|
||||
filledMsg: "",
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
if (this.data.isSkipOnShowFunc) {
|
||||
this.setData({
|
||||
isSkipOnShowFunc: false,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
console.log('onShow')
|
||||
let userInfo = wx.getStorageSync("userInfo")
|
||||
console.log("userInfo", userInfo)
|
||||
this.setData({
|
||||
userInfo: userInfo,
|
||||
"formData.userId": userInfo.id,
|
||||
"formData.userRealname": userInfo.realname,
|
||||
timeInterval: setInterval(this.updateTime, 1000)
|
||||
})
|
||||
console.log("formData", this.data.formData)
|
||||
|
||||
this.updateTime();
|
||||
|
||||
// 获取用户当日是否填报过
|
||||
wx.showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
var that = this;
|
||||
wx.request({
|
||||
url: `${app.globalData.baseUrl}/access/report/getLatestRecord`,
|
||||
method: "POST",
|
||||
header: {
|
||||
"Content-Type": "application/x-www-form-urlencoded" //用于post
|
||||
},
|
||||
data: {
|
||||
userId: this.data.userInfo.id
|
||||
},
|
||||
success: function (d) {
|
||||
wx.hideLoading()
|
||||
let result = d.data
|
||||
console.log("result", result)
|
||||
if (result.success) {
|
||||
console.log("result.data", result.data);
|
||||
if (result.data == null || new Date(result.data.time) < new Date(new Date().toISOString().substring(0, 10))) {
|
||||
// 如果没有填报记录,或者填报记录不是今天,那么说明没有填报过
|
||||
that.setData({
|
||||
isFilled: false
|
||||
})
|
||||
} else {
|
||||
// 有今日记录,说明已经填报过
|
||||
that.setData({
|
||||
isFilled: true,
|
||||
filledMsg: "您已完成今日体温填报"
|
||||
})
|
||||
}
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: "加载填报信息失败",
|
||||
icon: 'error',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
},
|
||||
fail: function () {
|
||||
wx.hideLoading()
|
||||
wx.showToast({
|
||||
title: "请求失败",
|
||||
icon: 'error',
|
||||
duration: 2000
|
||||
})
|
||||
},
|
||||
complete: function () {
|
||||
wx.hideNavigationBarLoading();
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
|
||||
},
|
||||
|
||||
|
||||
bindTemperatureChanged(e) {
|
||||
this.setData({
|
||||
"formData.temperature": e.detail.value
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
updateTime() {
|
||||
let timestamp = Date.now()
|
||||
this.setData({
|
||||
"formData.timestamp": timestamp,
|
||||
"formData.time": utils.formatTime(new Date(timestamp))
|
||||
})
|
||||
},
|
||||
chooseLocation: async function () {
|
||||
wx.showLoading({
|
||||
title: '正在获取权限'
|
||||
})
|
||||
await new Promise((resolve) => {
|
||||
wx.getSetting({
|
||||
success(res) {
|
||||
wx.hideLoading()
|
||||
if (!res.authSetting['scope.userLocation']) {
|
||||
wx.authorize({
|
||||
scope: 'scope.userLocationBackground',
|
||||
success() {
|
||||
resolve();
|
||||
}
|
||||
})
|
||||
} else {
|
||||
resolve();
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
wx.showLoading({
|
||||
title: '正在定位'
|
||||
})
|
||||
var that = this;
|
||||
this.setData({
|
||||
isSkipOnShowFunc: true, // 关闭位置选择器后,会触发 onShow,这里避免掉
|
||||
})
|
||||
wx.chooseLocation({
|
||||
success: function (res) {
|
||||
console.log("wx.chooseLocation success")
|
||||
that.setData({
|
||||
"formData.address": res.address
|
||||
})
|
||||
},
|
||||
fail: function () {
|
||||
console.log("wx.chooseLocation fail", that.data.formData)
|
||||
if (!that.data.formData.address) {
|
||||
wx.showToast({
|
||||
title: "请获取当前位置",
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
},
|
||||
})
|
||||
wx.hideLoading()
|
||||
},
|
||||
// 体温上报 提交按钮
|
||||
report() {
|
||||
console.log("点击提交", "this.data.formData", this.data.formData)
|
||||
if (!this.data.formData.address) {
|
||||
wx.showToast({
|
||||
title: "请获取当前位置",
|
||||
icon: 'error'
|
||||
})
|
||||
return;
|
||||
}
|
||||
wx.showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
var that = this;
|
||||
wx.request({
|
||||
url: `${app.globalData.baseUrl}/access/report/submit`,
|
||||
method: "POST",
|
||||
header: {
|
||||
"Content-Type": "application/x-www-form-urlencoded" //用于post
|
||||
},
|
||||
data: {
|
||||
...this.data.formData,
|
||||
},
|
||||
success: function (d) {
|
||||
console.log("begin success")
|
||||
wx.hideLoading()
|
||||
let result = d.data;
|
||||
if (result.success) {
|
||||
// 填报完成
|
||||
that.setData({
|
||||
isFilled: true,
|
||||
filledMsg: "您已完成今日体温填报"
|
||||
})
|
||||
console.log("result.data", result.data);
|
||||
wx.showToast({
|
||||
title: "填报成功",
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: result.msg || "出错啦",
|
||||
icon: 'error',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
that.isShow = ''
|
||||
console.log("end success")
|
||||
},
|
||||
fail: function () {
|
||||
console.log("begin fail")
|
||||
wx.hideLoading()
|
||||
wx.showToast({
|
||||
title: "请求失败",
|
||||
icon: 'error',
|
||||
duration: 2000
|
||||
})
|
||||
console.log("end fail")
|
||||
},
|
||||
complete: function () {
|
||||
console.log("begin complete")
|
||||
if (typeof (callback) === "function")
|
||||
callback();
|
||||
wx.hideNavigationBarLoading();
|
||||
console.log("end complete")
|
||||
}
|
||||
})
|
||||
},
|
||||
// 历史填报
|
||||
myreport() {
|
||||
wx.navigateTo({
|
||||
url: "/pages/residents/reportHistory"
|
||||
})
|
||||
}
|
||||
})
|
4
weixin-miniprogram/pages/residents/report.json
Normal file
4
weixin-miniprogram/pages/residents/report.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"usingComponents": {},
|
||||
"navigationBarTitleText": "体温上报"
|
||||
}
|
59
weixin-miniprogram/pages/residents/report.wxml
Normal file
59
weixin-miniprogram/pages/residents/report.wxml
Normal file
@@ -0,0 +1,59 @@
|
||||
<!--pages/residents/report.wxml-->
|
||||
<view>
|
||||
<view wx:if="{{ !isFilled }}" class="form">
|
||||
<view class="row">
|
||||
<view class="rowItem rowLeft center">
|
||||
<text>姓名</text>
|
||||
</view>
|
||||
<view class="rowItem rowRight center">
|
||||
<input class="rowRightElement" value="{{ formData.userRealname }}" disabled="true" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="row">
|
||||
<view class="rowItem rowLeft center">
|
||||
<text>填报时间</text>
|
||||
</view>
|
||||
<view class="rowItem rowRight center">
|
||||
<input class="rowRightElement" value="{{ formData.time }}" disabled="true" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="row">
|
||||
<view class="rowItem rowLeft center">
|
||||
<text>地址</text>
|
||||
</view>
|
||||
<view class="rowItem rowRight center" bindtap="chooseLocation">
|
||||
<input class="rowRightElement" placeholder="点击获取当前位置" value="{{ formData.address }}" disabled="true" maxlength="500" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="row">
|
||||
<view class="rowItem rowLeft center">
|
||||
<text>今日体温</text>
|
||||
</view>
|
||||
<view class="rowItem rowRight center">
|
||||
<radio-group class="rowRightElement" bindchange="bindTemperatureChanged">
|
||||
<radio value="0" checked="true" />正常
|
||||
<radio value="1" />异常(≥37.3°)
|
||||
</radio-group>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="tips-area">
|
||||
<view class="tips" style="color: red;">
|
||||
* 本人承诺以上所填报的内容全部真实,并愿意承担相应责任。
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view style="text-align: center;">
|
||||
<button class="controlBtn" size="mini" type="none" bindtap="myreport">历史填报</button>
|
||||
<button class="controlBtn" size="mini" type="primary" bindtap="report">提交</button>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:else style="text-align: center;">
|
||||
<!-- -->
|
||||
<view style="margin: 40px 0;">{{ filledMsg }}</view>
|
||||
<button class="controlBtn" size="mini" type="none" bindtap="myreport">历史填报</button>
|
||||
</view>
|
||||
</view>
|
39
weixin-miniprogram/pages/residents/report.wxss
Normal file
39
weixin-miniprogram/pages/residents/report.wxss
Normal file
@@ -0,0 +1,39 @@
|
||||
/* pages/residents/report.wxss */
|
||||
.form {
|
||||
padding: 20px 30px;
|
||||
}
|
||||
|
||||
.row {
|
||||
margin: 30px 0;
|
||||
border-bottom: 2px solid grey;
|
||||
}
|
||||
|
||||
.rowItem {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: inline-block;
|
||||
|
||||
vertical-align: middle;
|
||||
height: 1.6rem;
|
||||
}
|
||||
|
||||
.rowLeft {
|
||||
width: 30%;
|
||||
}
|
||||
|
||||
.rowRight {
|
||||
width: 70%;
|
||||
}
|
||||
|
||||
.rowRightElement {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.controlBtn {
|
||||
width: 250px;
|
||||
margin: 0 30px;
|
||||
}
|
125
weixin-miniprogram/pages/residents/reportHistory.js
Normal file
125
weixin-miniprogram/pages/residents/reportHistory.js
Normal file
@@ -0,0 +1,125 @@
|
||||
// pages/residents/reportHistory.js
|
||||
|
||||
const app = getApp();
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
userInfo: null,
|
||||
displayName: '',
|
||||
displayResult: [],
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
console.log('onShow')
|
||||
let userInfo = wx.getStorageSync("userInfo")
|
||||
this.setData({
|
||||
userInfo: userInfo,
|
||||
displayName: userInfo.realname
|
||||
})
|
||||
|
||||
// 获取用户填报历史
|
||||
wx.showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
var that = this;
|
||||
wx.request({
|
||||
url: `${app.globalData.baseUrl}/access/report/getRecordList`,
|
||||
method: "POST",
|
||||
header: {
|
||||
"Content-Type": "application/x-www-form-urlencoded" //用于post
|
||||
},
|
||||
data: {
|
||||
userId: this.data.userInfo.id
|
||||
},
|
||||
success: function (d) {
|
||||
wx.hideLoading()
|
||||
let result = d.data
|
||||
console.log("result", result)
|
||||
if (result.success) {
|
||||
console.log("result.data", result.data)
|
||||
that.setData({
|
||||
displayResult: result.data.map(item => {
|
||||
// 时间友好化显示
|
||||
let t = new Date(item.time).getTime() + 8 * 3600 * 1000
|
||||
item.time = new Date(t).toISOString().substring(0, 19).replace("T", " ")
|
||||
return item
|
||||
})
|
||||
})
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: "加载填报信息失败",
|
||||
icon: 'error',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
},
|
||||
fail: function () {
|
||||
wx.hideLoading()
|
||||
wx.showToast({
|
||||
title: "请求失败",
|
||||
icon: 'error',
|
||||
duration: 2000
|
||||
})
|
||||
},
|
||||
complete: function () {
|
||||
wx.hideNavigationBarLoading();
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
|
||||
}
|
||||
})
|
4
weixin-miniprogram/pages/residents/reportHistory.json
Normal file
4
weixin-miniprogram/pages/residents/reportHistory.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"usingComponents": {},
|
||||
"navigationBarTitleText": "体温上报 - 历史记录"
|
||||
}
|
21
weixin-miniprogram/pages/residents/reportHistory.wxml
Normal file
21
weixin-miniprogram/pages/residents/reportHistory.wxml
Normal file
@@ -0,0 +1,21 @@
|
||||
<!--pages/residents/reportHistory.wxml-->
|
||||
<view>
|
||||
<view style="margin: 20px; text-align: center;">
|
||||
<text>姓名:{{ displayName }}</text>
|
||||
</view>
|
||||
<view class="container">
|
||||
<view class="item {{ item.temperature == 1 ? 'abnormal' : 'normal' }}" wx:for="{{displayResult}}" wx:for-item="item">
|
||||
<view>
|
||||
<view class="record_time">
|
||||
<!-- 填报时间: -->
|
||||
{{ item.time }}
|
||||
</view>
|
||||
<view class="record_address">
|
||||
<!-- 地址: -->
|
||||
{{ item.address }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="statusText">{{ item.temperature == 1 ? "异常" : "正常" }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
33
weixin-miniprogram/pages/residents/reportHistory.wxss
Normal file
33
weixin-miniprogram/pages/residents/reportHistory.wxss
Normal file
@@ -0,0 +1,33 @@
|
||||
/* pages/residents/reportHistory.wxss */
|
||||
.item {
|
||||
/* background-color: #dedede; */
|
||||
border-radius: 8px;
|
||||
margin: 12px 20px;
|
||||
padding: 18px;
|
||||
display: grid;
|
||||
grid-template-columns: 1fr auto;
|
||||
place-items: center;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.item.normal {
|
||||
background-color: green;
|
||||
}
|
||||
|
||||
.item.abnormal {
|
||||
background-color: red;
|
||||
}
|
||||
|
||||
.record_time {
|
||||
font-size: 17px;
|
||||
}
|
||||
|
||||
.record_address {
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.statusText {
|
||||
font-size: large;
|
||||
font-weight: bold;
|
||||
padding: 0 20px;
|
||||
}
|
Reference in New Issue
Block a user