security.vue 3.77 KB
<template name="index">
	<view class="index">
		<view class="temp">
			<view  v-show="!hiddenFlag">
				<view class="btnList">
					<span style="font-weight: bold;color:#fff;font-size: 58upx;">{{obj.userName?obj.userName:''}}</span>
					<button class="btnNormal" type="primary" @click="normal">体温正常</button>
					<button class="btnAbnormal" type="primary" @click="abnormal">体温异常</button>
				</view>
				<view v-show="abnormalFlag">
					<view class="cu-form-group">
						<view class="title">体温值:</view>
						<input class="text-left" type="number" :value="form['heat']" name="input" @input="updateInputVal($event,'heat')"></input>
					</view>
					<view class="btnList" style="padding-top:5upx;">
						<button class="btnSubmit" type="primary" @click="submit">提交</button>
					</view>
				</view>
			</view>
			<view  v-show="hiddenFlag" class="tip">
				<view class="tips">
					<span style="font-weight: bold;">{{obj.userName?obj.userName:''}}</span>
					今日已测温
				</view>
				<view class="tips" v-show="obj.heat>0">
					体温值:<span style="font-weight: bold;">{{obj.heat}}</span>
				</view>
				<view class="tips" v-show="obj.notice">
					提示:<span style="font-weight: bold;">{{obj.notice}}</span>
				</view>
				<view class="tips">
					结果 :<span style="font-weight: bold;">{{obj.heatNormal?'体温异常、建议劝返':'体温正常、允许通行'}}</span> 
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		components: {},
		name: "home",
		data() {
			return {
				form:{
					heat:'',
					heatNomal:-1,
					userId:''
				},
				obj:{
					heat:'',
					heatNormal:'',
					notice:''
				},
				hiddenFlag:false,
				temperature:'',
				abnormalFlag:false
			};
		},
		onLoad: function(option) {
			this.form.userId = option.userId
			this.getData()
		},
		onShow() {},
		methods: {
			getData(){
				this.$http.get(`/sict-ncov/report/daily/heat?userId=${this.form.userId}`).then(res => {
					if (res.data.code == 1) {
						this.obj = res.data.object
						this.hiddenFlag = this.obj.heatNormal == 1 || this.obj.heatNormal == 0
					}
				}).catch(err => {
					console.log(err)
				})
			},
			// 体温正常
			normal() {
				this.form.heatNomal = 0
				this.form.heat = ''
				this.$http.post(`/sict-ncov/report/daily/heat`,this.form).then(res => {
					const d = res.data
					if (d.code == 1) {
						this.getData()
					}
				}).catch(err => {
					console.log(err)
				})
			},
			// 体温异常
			abnormal() {
				this.abnormalFlag = true
			},
			// 更新输入框绑定的表单内容
			updateInputVal(event, props) {
				this.form[props] = event.target.value
			},
			// 提交异常体温
			submit(){
				this.form.heatNomal = this.form.heat<37.2?0:1
				this.form.userId = this.$store.state.user.userInfo.id
				this.$http.post(`/sict-ncov/report/daily/heat`,this.form).then(res => {
					const d = res.data
					if (d.code == 1) {
						this.getData()
					}
				}).catch(err => {
					console.log(err)
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.temp {
		font-size: 40px;
		text-align: center;
		height: 100vh;
		width: 100vw;
		background-color: #24A1E3;
		.btnList{
			padding-top: 235upx;
			.btnNormal,.btnAbnormal,.btnSubmit{
				background-color: #92d0f1;
				color: #FFFFFF;
				border-radius: 60upx;
				width: 52%;
				margin-top:75upx;
				text-align: center;
			}
			.btnAbnormal{
				margin-top:95upx;
			}
		}
		.cu-form-group{
			margin-top:55upx;
			padding: 1upx 150upx;
			background-color: #24A1E3;
			.title,.text-left{
				font-size: 40upx;
				color:#FFFFFF;
			}
			.text-left{
				border-bottom: 2upx solid #FFFFFF;
			}
		}
		.tip{
			font-size: 42upx;
			color: #fff;
			margin-left:25%;
			padding-top: 300upx;
			.tips{
				text-align: left;
				margin-top: 30upx;
			}
		}
	}
</style>