<template name="index"> <view class="index"> <view class="temp"> <view class="btnList"> <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: 55upx;"> <button class="btnSubmit" type="primary" @click="submit">提交</button> </view> </view> </view> </view> </template> <script> export default { components: {}, name: "home", data() { return { form:{ heat:'', heatNomal:-1, userId:'' }, temperature:'', abnormalFlag:false }; }, onLoad: function(option) { console.log(option) }, onShow() {}, methods: { // 体温正常 normal() { this.form.heatNomal = 0 this.form.userId = this.$store.state.user.userInfo.id this.form.heat = '' this.$http.post(`/sict-ncov/report/daily/heat`,this.form).then(res => { const d = res.data if (d.code == 1) { console.log(d) } }).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 console.log(this.form) // uni.showToast({ // icon: 'none', // title: "提交异常体温!" // }) this.$http.post(`/sict-ncov/report/daily/heat`,this.form).then(res => { const d = res.data if (d.code == 1) { console.log(d) } }).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%; 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; } } } </style>