<template>
    <view class="scroll-container theme-light">
        <view class="bt-page" v-if="session">
            <MemberInfoSubNav title="训练详情" @back="onBack" />
            <view class="bt-page__body">
                <view class="bt-score-card">
                    <view class="bt-score-card__info">
                        <text class="bt-score-card__title">{{ session.title }}</text>
                        <text class="bt-score-card__date">{{ session.date }} {{ session.time }}</text>
                    </view>
                </view>
                <view class="bt-card">
                    <text class="bt-card__title">训练数据</text>
                    <view class="bt-metrics">
                        <view class="bt-metric"><text class="bt-metric__value">{{ session.duration }}</text><text class="bt-metric__label">时长</text></view>
                        <view class="bt-metric"><text class="bt-metric__value">{{ session.calories }}</text><text class="bt-metric__label">消耗(kcal)</text></view>
                        <view class="bt-metric"><text class="bt-metric__value">{{ session.heartRate }}</text><text class="bt-metric__label">平均心率</text></view>
                        <view class="bt-metric"><text class="bt-metric__value">{{ session.typeLabel }}</text><text class="bt-metric__label">类型</text></view>
                    </view>
                </view>
                <view class="bt-card">
                    <text class="bt-card__title">签到时间</text>
                    <text class="bt-card__desc">{{ session.checkInTime }}</text>
                </view>
                <view class="bt-card">
                    <text class="bt-card__title">教练评语</text>
                    <text class="bt-card__desc">{{ session.comment }}</text>
                </view>
            </view>
        </view>
    </view>
</template>

<script>
import MemberInfoSubNav from '@/components/memberInfo/MemberInfoSubNav.vue'
import { PAGE, goBackOrTab } from '@/common/constants/routes.js'
import { loadMemberStore } from '@/common/memberInfo/store.js'
import { getTrainingSessionById } from '@/common/memberInfo/moduleStore.js'

export default {
    components: { MemberInfoSubNav },
    data() { return { session: null } },
    onLoad(options) {
        this.session = getTrainingSessionById(loadMemberStore(), options?.id)
    },
    methods: {
        onBack() { goBackOrTab(PAGE.TRAIN_REPORT) }
    }
}
</script>

<style>
@import '@/common/style/base.css';
@import '@/common/style/memberInfo/pages/page-reset.css';
@import '@/common/style/memberInfo/pages/sub-page-base.css';
@import '@/common/style/memberInfo/member-info-sub-nav.css';
@import '@/common/style/memberInfo/pages/body-test-common.css';
</style>
