examTeamApp/element/target/firstweight.vue

120 lines
2.7 KiB
Vue
Raw Normal View History

2024-05-02 15:59:36 +08:00
<template>
2024-05-29 16:35:45 +08:00
<view v-if="isFirst" class="wrapper wrapperbg">
<view class="bg" @click="onTap">
<view class="edit" @click.stop>
2025-04-18 14:53:38 +08:00
<view class="title">{{type==1?$t("body.target_weight"):$t("body.initial_weight")}}</view>
2024-05-29 16:35:45 +08:00
<view class="editem" @click="hideKeyboard" v-if="type!=1">
2025-04-18 14:53:38 +08:00
<view class="name">{{$t("common.titleDate")}}</view>
2024-05-29 16:35:45 +08:00
<view class="right">
<picker mode="date" :end="endDate" @change="changeLog" :fields="fields">
2025-04-18 14:53:38 +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="editem">
2025-04-18 14:53:38 +08:00
<view class="name">{{$t("common.infoWeight")}}</view>
2024-05-29 16:35:45 +08:00
<view class="right">
2025-04-18 14:53:38 +08:00
<input v-model="weight" type="digit" :placeholder="$t('tips.verifyRecord')" />kg
2024-05-29 16:35:45 +08:00
</view>
</view>
2025-04-18 14:53:38 +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>
2024-05-02 15:59:36 +08:00
</template>
<script>
2024-05-29 16:35:45 +08:00
import {
mapState
} from "vuex";
export default {
props: {
type: {}
},
data() {
return {
regTime: "",
weight: "",
2024-10-11 10:04:19 +08:00
fields: "",
2024-05-02 15:59:36 +08:00
}
2024-05-29 16:35:45 +08:00
},
computed: {
...mapState(["user", "isFirst"]),
endDate() {
return this.$tools.getDate("start")
2024-09-12 11:20:52 +08:00
},
2024-05-29 16:35:45 +08:00
},
2024-10-11 10:04:19 +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.type != 1 && !that.regTime) {
2025-04-18 14:53:38 +08:00
that.$tools.msg(that.$t("tips.verifyDate"))
2024-05-29 16:35:45 +08:00
return
2024-05-02 15:59:36 +08:00
}
2024-05-29 16:35:45 +08:00
if (!that.weight) {
2025-04-18 14:53:38 +08:00
that.$tools.msg(that.$t("tips.verifyWeight"))
2024-05-29 16:35:45 +08:00
return
2024-05-02 15:59:36 +08:00
}
2024-05-29 16:35:45 +08:00
that.$model.getfirstweight({
aud_id: that.user.id,
time: that.type == 1 ? '' : that.regTime ? that.regTime : that.user.firstresulttime,
weight: that.weight,
type: that.type
}).then(res => {
that.$tools.msg(res.msg)
if (res.code == 0) {
that.$store.commit("changeFirst", false);
that.$store.commit('changeMeasureResult', {
2024-05-29 16:35:45 +08:00
target_current: res.data
})
that.regTime = ""
that.weight = ""
2024-05-02 15:59:36 +08:00
}
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.weight = ""
this.regTime = ""
this.$store.commit("changeFirst", false);
},
hideKeyboard() {
uni.hideKeyboard()
},
2024-05-02 15:59:36 +08:00
}
}
2024-05-29 16:35:45 +08:00
</script>
2024-05-02 15:59:36 +08:00
2024-05-29 16:35:45 +08:00
<style scoped lang="scss">
.btn {
width: 40%;
float: right;
margin-top: 15px;
background: $maincolor !important;
}
.edit {
top: 20%
}
2024-05-02 15:59:36 +08:00
2024-05-29 16:35:45 +08:00
.close {
background: #fff !important;
float: left;
color: #333;
}
</style>