<template>
	<view class="shouye-card-box kecheng-card-box">
		<!-- card title -->
		<view class="card-head-box">
			<view class="card-line-title">课程</view>
			<view class="card-more" @click="checkMore" v-if="data.count">更多<text class="more-num">{{data.count}}</text><icon class="more-jt"></icon></view>
		</view>
		<!-- kaoshi title -->
		<view class="card-name-box">
			<view class="card-name" v-if="data.zyName"><icon></icon>{{data.zyName}}</view>
			<text class="card-level">{{data.zyLevelName}}</text>
		</view>
		<!-- 内容区域 -->
		<view class="card-content-box kaoshi-content-box">
			<view class="card-content-item">
				<icon class="card-time-icon"></icon>
				<view class="content-text-box">
					<text>时间</text>
					<view>{{formatSecondsToCnhms(data.period, true)}}</view>
				</view>
			</view>
		</view>
		<!-- 底部 -->
		<view class="card-bottom-box">
			<button type="default" class="index-card-btn" @click="handleStudy(data)">课程学习</button>
		</view>
	</view>
</template>

<script setup>
	import {formatSecondsToCnhms} from "@/utils/common.js"
	defineProps({
		data: {
			type: Object,
		}
	})
	
	function checkMore() {
		uni.navigateTo({
			url:"/pages/client/Kecheng/list?from=shouye"
		})
	}
	
	function handleStudy(item) {
		uni.navigateTo({
			url: `/pages/client/Kecheng/study?kcId=${item.kcId}&from=shouye`
		})
	}
</script>

<style>
</style>