小程序添加体温上报页面
This commit is contained in:
@@ -7,6 +7,7 @@ export default defineAppConfig({
|
|||||||
* 用户侧
|
* 用户侧
|
||||||
*/
|
*/
|
||||||
'pages/residents/code', // 进出码
|
'pages/residents/code', // 进出码
|
||||||
|
'pages/residents/report', // 体温上报
|
||||||
],
|
],
|
||||||
window: {
|
window: {
|
||||||
backgroundTextStyle: 'dark',
|
backgroundTextStyle: 'dark',
|
||||||
@@ -29,25 +30,33 @@ export default defineAppConfig({
|
|||||||
"iconPath": "image/icon/_code.png",
|
"iconPath": "image/icon/_code.png",
|
||||||
"selectedIconPath": "image/icon/code.png"
|
"selectedIconPath": "image/icon/code.png"
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// "pagePath": "pages/report/report",
|
"pagePath": "pages/residents/report",
|
||||||
// "text": "日报",
|
"text": "体温上报",
|
||||||
// "iconPath": "/icon/_report.png",
|
"iconPath": "image/icon/_report.png",
|
||||||
// "selectedIconPath": "/icon/report.png"
|
"selectedIconPath": "image/icon/report.png"
|
||||||
// },
|
},
|
||||||
// {
|
// {
|
||||||
// "pagePath": "pages/apply/apply",
|
// "pagePath": "pages/apply/apply",
|
||||||
// "text": "申请",
|
// "text": "申请",
|
||||||
// "iconPath": "/icon/_apply.png",
|
// "iconPath": "image/icon/_apply.png",
|
||||||
// "selectedIconPath": "/icon/apply.png"
|
// "selectedIconPath": "image/icon/apply.png"
|
||||||
// },
|
// },
|
||||||
// {
|
// {
|
||||||
// "pagePath": "pages/person/person",
|
// "pagePath": "pages/person/person",
|
||||||
// "text": "我的",
|
// "text": "我的",
|
||||||
// "selectedColor": "#FF8966",
|
// "selectedColor": "#FF8966",
|
||||||
// "iconPath": "/icon/_person.png",
|
// "iconPath": "image/icon/_person.png",
|
||||||
// "selectedIconPath": "/icon/person.png"
|
// "selectedIconPath": "image/icon/person.png"
|
||||||
// }
|
// }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"permission": {
|
||||||
|
"scope.userLocation": {
|
||||||
|
"desc": "你的位置信息将用于体温上报"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"requiredPrivateInfos": [
|
||||||
|
"chooseLocation"
|
||||||
|
]
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
...Taro.getApp().globalData,
|
||||||
userInfo: null,
|
userInfo: null,
|
||||||
displayUsername: "",
|
displayUsername: "",
|
||||||
userGroup: "unknown",
|
userGroup: "unknown",
|
||||||
@@ -48,6 +49,13 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onLoad() {
|
||||||
|
// 开发模式下自动跳转到指定页面,节省开发时间
|
||||||
|
if (this.debugMode) {
|
||||||
|
Taro.switchTab({ url: '/pages/residents/report' })
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
onShow() {
|
onShow() {
|
||||||
console.log('onShow')
|
console.log('onShow')
|
||||||
console.log("menuItemDict", menuItemDict)
|
console.log("menuItemDict", menuItemDict)
|
||||||
|
|||||||
3
miniprogram/src/pages/residents/report.config.js
Normal file
3
miniprogram/src/pages/residents/report.config.js
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
export default definePageConfig({
|
||||||
|
navigationBarTitleText: '体温上报',
|
||||||
|
})
|
||||||
179
miniprogram/src/pages/residents/report.vue
Normal file
179
miniprogram/src/pages/residents/report.vue
Normal file
@@ -0,0 +1,179 @@
|
|||||||
|
|
||||||
|
<style>
|
||||||
|
.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;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<view 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" @tap="chooseLocation">
|
||||||
|
<input class="rowRightElement" placeholder="点击获取当前位置" v-model="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" @change="(e) => formData.temperature = e.detail.value">
|
||||||
|
<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" @tap="myreport">历史填报</button>
|
||||||
|
<button class="controlBtn" size="mini" type="primary" @tap="report">提交</button>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<textarea v-if="this.debugMode" maxlength="-1" disabled="true" auto-height="true" style="width: 100%"
|
||||||
|
:value="JSON.stringify(formData, null, 8)"></textarea>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import Taro from '@tarojs/taro'
|
||||||
|
import utils from '../../utils/utils'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
...Taro.getApp().globalData,
|
||||||
|
userInfo: null,
|
||||||
|
timeInterval: null,
|
||||||
|
formData: {
|
||||||
|
userId: '',
|
||||||
|
userRealname: '',
|
||||||
|
address: '',
|
||||||
|
time: '',
|
||||||
|
timestamp: '',
|
||||||
|
temperature: 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
onShow() {
|
||||||
|
console.log('onShow')
|
||||||
|
this.userInfo = Taro.getStorageSync("userInfo")
|
||||||
|
this.formData.userId = this.userInfo.id
|
||||||
|
this.formData.userRealname = this.userInfo.realname
|
||||||
|
this.updateTime();
|
||||||
|
this.timeInterval = setInterval(this.updateTime, 1000);
|
||||||
|
},
|
||||||
|
|
||||||
|
onHide() {
|
||||||
|
console.log('onHide')
|
||||||
|
clearInterval(this.timeInterval)
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
updateTime() {
|
||||||
|
this.formData.timestamp = Date.now();
|
||||||
|
this.formData.time = utils.formatTime(new Date(this.formData.timestamp));
|
||||||
|
},
|
||||||
|
chooseLocation: async function () {
|
||||||
|
Taro.showLoading({ title: '正在定位' })
|
||||||
|
await new Promise((resolve) => {
|
||||||
|
Taro.getSetting({
|
||||||
|
success(res) {
|
||||||
|
if (!res.authSetting['scope.userLocation']) {
|
||||||
|
Taro.authorize({
|
||||||
|
scope: 'scope.userLocationBackground',
|
||||||
|
success() {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
var that = this;
|
||||||
|
Taro.chooseLocation({
|
||||||
|
success: function (res) {
|
||||||
|
that.formData.address = res.address;
|
||||||
|
},
|
||||||
|
fail: function () {
|
||||||
|
if (!that.formData.address) {
|
||||||
|
Taro.showToast({
|
||||||
|
title: "请获取当前位置",
|
||||||
|
icon: 'error'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
Taro.hideLoading()
|
||||||
|
},
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -8,7 +8,7 @@ let menuItemDict = {
|
|||||||
title: "登录",
|
title: "登录",
|
||||||
image: "code.png",
|
image: "code.png",
|
||||||
switchFunc: switchTab,
|
switchFunc: switchTab,
|
||||||
url: '/pages/residents/code',
|
url: '/pages/index/login',
|
||||||
},
|
},
|
||||||
'code': {
|
'code': {
|
||||||
for: ['visitor', 'user'],
|
for: ['visitor', 'user'],
|
||||||
@@ -22,7 +22,7 @@ let menuItemDict = {
|
|||||||
title: "体温上报",
|
title: "体温上报",
|
||||||
image: "report.png",
|
image: "report.png",
|
||||||
switchFunc: switchTab,
|
switchFunc: switchTab,
|
||||||
url: ''
|
url: '/pages/residents/report'
|
||||||
},
|
},
|
||||||
'apply-record': {
|
'apply-record': {
|
||||||
for: ['visitor', 'user'],
|
for: ['visitor', 'user'],
|
||||||
|
|||||||
Reference in New Issue
Block a user