examTeamApp/element/manuallyAdd/weightAdd.vue

143 lines
3.3 KiB
Vue

<template>
<view class="wrapper wrapperbg" v-if="isRecord">
<view class="bg" @click="onTap">
<view class="edit" @click.stop>
<view class="title">{{$t("index.manualRecording")}}</view>
<!-- -->
<view class="editem">
<view class="left">{{$t('common.titleDate')}}</view>
<view class="right">
<picker mode="date" :end="endDate" @change="changeLog" :fields="fields">
<view class="uni-input">{{regTime?regTime:$t('tips.verifyPicker')}}</view>
<icon class="iconfont icon-arrow-down-bold"></icon>
</picker>
</view>
</view>
<view class="">
<view class="editem">
<view class="name">{{$t('common.infoHeight')}}</view>
<view class="right">
<input type="digit" v-model="height" :placeholder="$t('tips.verifyRecord')" />cm
</view>
</view>
<view class="editem">
<view class="name">{{$t('common.infoWeight')}}</view>
<view class="right">
<input type="digit" v-model="weight" :placeholder="$t('tips.verifyRecord')">kg
</view>
</view>
<view class="editem" v-if="userInfo.stage=='婴儿'">
<view class="left">{{$t('common.infoHead')}}</view>
<view class="right">
<input v-model="head" type="digit" :placeholder="$t('tips.verifyRecord')" />cm
</view>
</view>
</view>
<view class="btn close" @click="onTap()">{{$t("tips.btnSancellation")}}</view>
<view class="btn" @click="handleTarget">{{$t("tips.btnConfirm")}}</view>
</view>
</view>
</view>
</template>
<script>
import {
mapState
} from "vuex";
export default {
data() {
return {
regTime: "",
weight: "",
height: '',
head: "",
fields: "",
}
},
computed: {
...mapState(["user", "isWeight","isRecord"]),
userInfo() {
return this.user
},
endDate() {
return this.$tools.getDate("start")
},
startDate() {
return this.$tools.GetDateStr(-90);
},
},
mounted() {
let that = this
// #ifdef APP-PLUS
that.fields = "time"
// #endif
// #ifndef APP-PLUS
that.fields = "day"
// #endif
},
methods: {
// 手动记录
handleTarget() {
let that = this
if (!that.regTime) {
that.$tools.msg(that.$t("tips.verifyDate"))
return
}
if (!that.height) {
that.$tools.msg(that.$t("tips.verifyHeight"))
return
}
if (!that.weight) {
that.$tools.msg(that.$t("tips.verifyWeight"))
return
}
that.$model.getinsertmeasure({
aud_id: uni.getStorageSync('userid'),
time: that.regTime,
weight: that.weight,
height: that.height,
head_data: that.head ? that.head : 0
}).then(res => {
if (res.code != 0) return
that.$tools.msg(res.msg)
that.$store.dispatch("getResult", {
aud_id: uni.getStorageSync('userid')
})
that.$store.dispatch("getUserInfo", {
aud_id: uni.getStorageSync('userid')
})
that.onTap()
})
},
//
changeLog(e) {
this.regTime = e.detail.value
},
onTap() {
this.regTime = ""
this.weight = ""
this.height = ""
this.$store.commit("changeRecord", false);
},
}
}
</script>
<style scoped lang="scss">
.btn {
width: 40%;
float: right;
margin-top: 15px;
background: $maincolor !important;
}
.edit {
top: 20%
}
.close {
background: #fff !important;
float: left;
color: #333;
}
</style>