examTeamApp/element/manuallyAdd/weightAdd.vue

143 lines
3.3 KiB
Vue
Raw Normal View History

2024-05-29 16:35:45 +08:00
<template>
2025-05-10 14:31:09 +08:00
<view class="wrapper wrapperbg" v-if="isRecord">
2024-05-29 16:35:45 +08:00
<view class="bg" @click="onTap">
<view class="edit" @click.stop>
2025-05-10 14:31:09 +08:00
<view class="title">{{$t("index.manualRecording")}}</view>
2024-05-29 16:35:45 +08:00
<!-- -->
2025-05-10 14:31:09 +08:00
<view class="editem">
<view class="left">{{$t('common.titleDate')}}</view>
2024-05-29 16:35:45 +08:00
<view class="right">
2024-10-11 10:04:19 +08:00
<picker mode="date" :end="endDate" @change="changeLog" :fields="fields">
2025-05-10 14:31:09 +08:00
<view class="uni-input">{{regTime?regTime:$t('tips.verifyPicker')}}</view>
2024-07-22 14:13:19 +08:00
<icon class="iconfont icon-arrow-down-bold"></icon>
</picker>
2024-05-29 16:35:45 +08:00
</view>
</view>
<view class="">
<view class="editem">
2025-05-10 14:31:09 +08:00
<view class="name">{{$t('common.infoHeight')}}</view>
2024-05-29 16:35:45 +08:00
<view class="right">
2025-05-10 14:31:09 +08:00
<input type="digit" v-model="height" :placeholder="$t('tips.verifyRecord')" />cm
2024-05-29 16:35:45 +08:00
</view>
</view>
<view class="editem">
2025-05-10 14:31:09 +08:00
<view class="name">{{$t('common.infoWeight')}}</view>
2024-05-29 16:35:45 +08:00
<view class="right">
2025-05-10 14:31:09 +08:00
<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
2024-05-29 16:35:45 +08:00
</view>
</view>
</view>
2025-05-10 14:31:09 +08:00
<view class="btn close" @click="onTap()">{{$t("tips.btnSancellation")}}</view>
<view class="btn" @click="handleTarget">{{$t("tips.btnConfirm")}}</view>
2024-05-29 16:35:45 +08:00
</view>
</view>
</view>
</template>
<script>
import {
mapState
} from "vuex";
export default {
data() {
return {
regTime: "",
weight: "",
2025-05-10 14:31:09 +08:00
height: '',
head: "",
fields: "",
2024-05-29 16:35:45 +08:00
}
},
computed: {
2025-05-10 14:31:09 +08:00
...mapState(["user", "isWeight","isRecord"]),
userInfo() {
return this.user
},
2024-05-29 16:35:45 +08:00
endDate() {
return this.$tools.getDate("start")
},
startDate() {
return this.$tools.GetDateStr(-90);
},
},
2025-05-10 14:31:09 +08:00
mounted() {
let that = this
// #ifdef APP-PLUS
that.fields = "time"
// #endif
// #ifndef APP-PLUS
that.fields = "day"
// #endif
},
2024-05-29 16:35:45 +08:00
methods: {
// 手动记录
handleTarget() {
let that = this
if (!that.regTime) {
2025-05-10 14:31:09 +08:00
that.$tools.msg(that.$t("tips.verifyDate"))
2024-05-29 16:35:45 +08:00
return
}
if (!that.height) {
2025-05-10 14:31:09 +08:00
that.$tools.msg(that.$t("tips.verifyHeight"))
2024-05-29 16:35:45 +08:00
return
}
if (!that.weight) {
2025-05-10 14:31:09 +08:00
that.$tools.msg(that.$t("tips.verifyWeight"))
2024-05-29 16:35:45 +08:00
return
}
that.$model.getinsertmeasure({
aud_id: uni.getStorageSync('userid'),
time: that.regTime,
weight: that.weight,
height: that.height,
2025-05-10 14:31:09 +08:00
head_data: that.head ? that.head : 0
2024-05-29 16:35:45 +08:00
}).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')
})
2025-05-10 14:31:09 +08:00
that.onTap()
2024-05-29 16:35:45 +08:00
})
},
//
changeLog(e) {
2024-07-22 14:13:19 +08:00
this.regTime = e.detail.value
2024-05-29 16:35:45 +08:00
},
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;
}
2025-05-10 14:31:09 +08:00
2024-05-29 16:35:45 +08:00
.edit {
top: 20%
}
2025-05-10 14:31:09 +08:00
2024-05-29 16:35:45 +08:00
.close {
background: #fff !important;
float: left;
color: #333;
}
</style>