examTeamApp/element/manuallyAdd/skipAdd.vue

148 lines
3.4 KiB
Vue
Raw Normal View History

2024-05-29 16:35:45 +08:00
<template>
<view class="wrapper">
<view class="bg" @click="onTap">
<view class="edit" @click.stop>
<view class="title">手动记录</view>
<!-- -->
<view class="editem" @click="hideKeyboard">
<view class="left">日期</view>
<view class="right">
2024-10-11 10:04:19 +08:00
<picker mode="date" :end="endDate" @change="changeLog" :fields="fields">
2024-07-22 14:13:19 +08:00
<view class="uni-input">{{regTime?regTime:'请选择'}}</view>
<icon class="iconfont icon-arrow-down-bold"></icon>
</picker>
2024-05-29 16:35:45 +08:00
</view>
</view>
<view class="">
<view class="editem">
<view class="name">时长</view>
<view class="right">
<picker mode="multiSelector" :range="timeList" :value="timesTndex" @change="bindTimeChange">
2024-07-22 14:13:19 +08:00
<view class="size16">{{time_m?time_m+':':'请选择'}}{{time_s?time_s:''}}</view>
2024-05-29 16:35:45 +08:00
</picker>
2024-07-22 14:13:19 +08:00
<uni-icons type="bottom" class="ml-15 c666"></uni-icons>
2024-05-29 16:35:45 +08:00
</view>
</view>
<view class="editem">
<view class="name">个数</view>
<view class="right">
2024-06-13 18:03:50 +08:00
<input type="number" v-model="number" placeholder="请输入">
2024-05-29 16:35:45 +08:00
</view>
</view>
</view>
<view class="btn close" @click="onTap()">取消</view>
<view class="btn" @click="handleTarget">确定</view>
</view>
</view>
</view>
</template>
<script>
import {
mapState
} from "vuex";
export default {
data() {
return {
regTime: "",
number: '',
timeList: [],
time_m: "",
time_s: "",
2024-07-22 14:13:19 +08:00
timesTndex: [1, 0]
2024-05-29 16:35:45 +08:00
}
},
computed: {
...mapState(["user"]),
endDate() {
return this.$tools.getDate("start")
},
startDate() {
return this.$tools.GetDateStr(-90);
},
},
mounted() {
this.timeList = this.$tools.gethms()
},
methods: {
bindTimeChange(e) {
2024-07-22 14:13:19 +08:00
let that = this
2024-05-29 16:35:45 +08:00
let m = e.target.value[0]
let s = e.target.value[1]
2024-07-22 14:13:19 +08:00
that.timesTndex = e.target.value
let time_m = Number(that.timeList[0][m].substring(0, 2)) * 60
let time_s = Number(that.timeList[1][s].substring(0, 2))
if (Number(time_m + time_s) < 30) {
that.time_m = '00'
that.time_s = '30'
} else {
that.time_m = that.timeList[0][m].substring(0, 2)
that.time_s = that.timeList[1][s].substring(0, 2)
}
2024-05-29 16:35:45 +08:00
},
// 手动记录
handleTarget() {
let that = this
if (!that.regTime) {
that.$tools.msg("请选择测量日期")
return
}
if (!that.number) {
that.$tools.msg("请输入跳绳个数")
return
}
that.$model.getskipmeasure({
aud_id: uni.getStorageSync('userid'),
r_time: that.regTime,
num: that.number,
2024-07-22 14:13:19 +08:00
time_m: that.time_m,
time_s: that.time_s,
2024-05-29 16:35:45 +08:00
type: "free",
}).then(res => {
if (res.code != 0) return
that.$tools.msg(res.msg)
that.$store.commit("changeRecord", false);
that.$store.dispatch("getUserInfo", {
aud_id: uni.getStorageSync('userid'),
})
that.$store.dispatch("getSkipResult", {
aud_id: uni.getStorageSync('userid'),
})
that.regTime = ""
that.weight = ""
})
},
//
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.$store.commit("changeRecord", false);
},
hideKeyboard() {
uni.hideKeyboard()
},
}
}
</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>