<script setup>
import { child } from '~/store/child';
const children = JSON.parse(sessionStorage.getItem('children'))

const handleNavLeftClick = () => {
  router.back()
  // router.replace('/stxk/jz')
}


const router = useRouter()
function handleClickCard(item) {
  console.log(item)
  router.push(`/stxk/jz/wd/kcxq/${item.kk_id}`)
}

function getTagText(item) {
  if (item.kjf_zfzt === '1') {
    return '已申请'
  } else if (item.kjf_zfzt === '2') {
    return '已报名'
  } else if (item.kjf_zfzt === '3') {
    return '已报名'
  }
}
</script>

<template>
  <van-sticky>
    <van-nav-bar title="我的社团课程" left-arrow @click-left="handleNavLeftClick">
    </van-nav-bar>
  </van-sticky>

  <remote-list url="/khfw/kcbmxx/index"
    :d="{ token: child.token, kkbm_s_user_id: children.map(item => item.user_id).join(',') }">
    <template #default="{ row: item }">
      <van-card :price="item.khfw_kcgl.kk_kcfy" :desc="`报名学生：${item.kkbm_s_class_name} ${item.kkbm_s_realname}`"
        :title="item.kk_name" :thumb="item.khfw_kcgl.kk_img" @click="handleClickCard(item)">
        <template #num>
          <van-tag type="primary">{{ getTagText(item.khfw_kcbmxx) }}</van-tag>
        </template>
      </van-card>
    </template>
  </remote-list>
</template>
