feat:更新运动健康模块
This commit is contained in:
@@ -16,8 +16,8 @@
|
||||
<span>运动项目</span>
|
||||
</template>
|
||||
|
||||
<el-select v-model="healthStore.currentHealth.project"
|
||||
placeholder="请选择运行项目" style="width: 150px;">
|
||||
<el-select v-model="healthStore.currentHealth.sportProject"
|
||||
placeholder="请选择运行项目" clearable style="width: 150px;">
|
||||
<el-option v-for="(item, index) in projectList" :key="index"
|
||||
:label="item" :value="item"/>
|
||||
</el-select>
|
||||
@@ -29,7 +29,8 @@
|
||||
<span>运动时长</span>
|
||||
</template>
|
||||
|
||||
<el-input-number v-model="healthStore.currentHealth.duration"
|
||||
<el-input-number v-model="healthStore.currentHealth.sportDuration"
|
||||
:min="0" :max="300" :precision="0"
|
||||
style="width: 120px;"></el-input-number>
|
||||
|
||||
<span style="margin-left: 5px;">分钟</span>
|
||||
@@ -41,7 +42,8 @@
|
||||
<span>体重</span>
|
||||
</template>
|
||||
|
||||
<el-input-number v-model="healthStore.currentHealth.value"
|
||||
<el-input-number v-model="healthStore.currentHealth.weight"
|
||||
:min="0" :max="200"
|
||||
style="width: 120px;"></el-input-number>
|
||||
|
||||
<span style="margin-left: 5px;">千克</span>
|
||||
@@ -59,14 +61,27 @@
|
||||
<script lang="ts" setup>
|
||||
import { useHealthStore } from '@/store/health'
|
||||
import { formatDate, isBeforeDate } from 'vue3-common/utils/dateUtil'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
const healthStore = useHealthStore()
|
||||
|
||||
const projectList = ['羽毛球', '乒乓球', '跑步', '其他']
|
||||
|
||||
const onSubmit = async () => {
|
||||
// await periodStore.updatePeriodDay()
|
||||
// periodStore.currentPeriodDay = periodStore.getPeriodDay(periodStore.selectDate)
|
||||
const { sportProject, sportDuration, weight } = healthStore.currentHealth
|
||||
if (sportProject === '' && sportDuration === 0 && weight === 0) {
|
||||
return
|
||||
}
|
||||
|
||||
if (sportDuration) {
|
||||
if (!sportProject) {
|
||||
ElMessage.error('请选择运动项目')
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
await healthStore.updateHealthDay()
|
||||
healthStore.currentHealth = healthStore.getHealthDay(healthStore.selectDate)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user