examTeamApp/element/target/targetWeight.vue

210 lines
3.6 KiB
Vue
Raw Normal View History

2024-05-02 15:59:36 +08:00
<template>
<view v-if="isTarget" class="wrapper">
<view class="bg" @click="onTap">
<view class="edit" @click.stop>
<view class="title">目标体重</view>
<view class="editem">
<view class="left">目标体重</view>
<view class="right">
<input class="text" type="digit" placeholder="请输入" v-model="inputvalue" />kg
</view>
</view>
<view class="btn close" @click="onTap()">取消</view>
<view class="btn" @click="handleWeight">确定</view>
</view>
</view>
</view>
</template>
<script>
import {
mapState
} from "vuex";
export default {
data() {
return {
inputvalue: "",
}
},
computed: {
...mapState(["user", "isTarget"]),
startDate() {
return this.$tools.getDate('start');
}
},
methods: {
// 目标体重
handleWeight() {
let that = this
console.log("startDate", that.startDate)
if (!that.inputvalue) {
that.$tools.msg("请输入目标体重")
return
}
that.$model.setTarget({
familyid: that.user.familyid,
time: that.startDate,
weight: that.inputvalue,
}).then(res => {
if (res.code != 0) return
2024-05-29 16:35:45 +08:00
that.$tools.msg(res.msg)
2024-05-02 15:59:36 +08:00
that.$store.commit("changeTarget", false);
that.$store.dispatch("getUserInfo", {
familyid: that.user.familyid,
})
})
},
onTap() {
this.inputvalue = ""
this.$store.commit("changeTarget", false);
}
}
}
</script>
<style scoped lang="scss">
.wrapper {
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: 999;
.bg {
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.4);
z-index: 99;
}
.edit {
width: 15rem;
height: auto;
background: #fff;
border-radius: 10px;
padding: 15px;
position: relative;
top: 15%;
margin: auto;
z-index: 99999;
overflow: hidden;
.title {
text-align: center;
width: 100%;
color: #333;
2024-08-05 10:01:06 +08:00
font-size: 36rpx;
2024-05-02 15:59:36 +08:00
font-weight: bold;
}
.editem {
position: relative;
display: flex;
2024-08-05 10:01:06 +08:00
font-size: 32rpx;
2024-05-02 15:59:36 +08:00
border-radius: 10px;
margin-top: 15px;
height: 40px;
justify-content: space-between;
background: #eee;
padding: 0px 10px;
align-items: center;
.radioimg {
2024-08-05 10:01:06 +08:00
font-size: 44rpx;
2024-05-02 15:59:36 +08:00
color: $btncolor;
}
.radio {
width: 50%;
text-align: right;
display: flex;
justify-content: center;
align-items: center;
}
.name {
width: 4rem;
color: #333;
}
.right {
width: 60%;
height: 40px;
line-height: 40px;
text-align: right;
display: flex;
justify-content: flex-end;
input {
margin-right: 10px;
height: 40px;
line-height: 40px;
text-align: left;
}
picker {
width: 100%;
text-align: left;
}
.uni-input {
position: absolute;
right: 30px;
top: 0;
left: 0;
height: 40px;
line-height: 40px;
text-align: right;
z-index: 9999;
}
}
.value {
position: relative;
z-index: 999;
width: 3rem;
text-align: center;
float: left;
margin-right: 10px;
}
.iconfont {
margin-left: 10px;
float: right;
display: flex;
}
}
.tips {
2024-08-05 10:01:06 +08:00
font-size:28rpx;
2024-05-02 15:59:36 +08:00
color: #999;
text-align: center;
margin-top: 15px;
margin-bottom: 20px;
display: flex;
}
}
}
.btn {
width: 40%;
float: right;
margin-top: 15px;
background: $maincolor !important;
}
.edit {
top: 20%
}
.close {
background: #dfdfdf !important;
float: left;
}
</style>