<template>
  <div>
    <a-row class="rowGutter" :gutter="[16, 16]">
      <a-col :xs="{ span: 24 }" :sm="{ span: 8 }" :lg="{ span: 6 }" v-for="(item, index) in listData"
        :key="index" style="margin-bottom: 40px;">
        <div style="border: 2px #eef1f2 solid;">
          <div>
            <div style="width: 100%;height: 20px;background-color: #1c84c6;"></div>
            <div style="width:100%;white-space:normal; word-break:break-all;overflow:hidden;padding: 10px;height: 70px;font-weight: 600;font-size: 16px;">
              {{ item.kcmc }}
            </div>
          </div>
          <a-divider style="margin: 0px;color: #eef1f2;" />
          <div style="padding: 20px;font-weight: 600;">
            <a-row>
              <a-col :span="16">
                <div style="height: 30px;font-size: 16px;">{{ item.skjs }}</div>
                <div style="height: 30px;font-size: 14px;">{{ item.kcxz }}</div>
              </a-col>
              <a-col :span="8" style="text-align: center;height: 70px;">
                <div style="color: #1c84c6;font-size: 24px;font-weight: 600;">{{ item.xkrs }}</div>
                <div style="font-size: 14px;">选课人数</div>
              </a-col>
              <a-col :span="24" style="margin-top:20px;">
                <div>
                  第<span>{{ item.hh }}</span>节
                </div>
              </a-col>
              <a-col :span="24">
                <div style="width:100%;text-align: center;">
                  —————线下上课地点—————
                </div>
              </a-col>
              <a-col :span="24">
                <div style="height: 60px;">
                  {{ item.skdd }}
                </div>
              </a-col>
              <a-col :span="24">
                <a-button type="primary" style="background-color: #1c84c6;float: left;font-weight: 600;">预约</a-button>
                <a-button type="primary" style="background-color: #1c84c6;float: right;font-weight: 600;">报错</a-button>
              </a-col>
            </a-row>
          </div>
        </div>
      </a-col>
    </a-row>
  </div>
</template>

<script lang="ts" setup>
import { ref,watch,reactive } from 'vue';
import { defHttp } from '/@/utils/http/axios';
const emit = defineEmits(['setTotal']);

let listData = ref<any>([]);
const list = (params) => defHttp.get({ url: '/ktgl/kcKetangbiao/list', params });
const props = defineProps({
    queryParam:{type:Object}
  });
  
watch(() => props.queryParam, async (newRow, oldRow) => {
  rkbLoadData(newRow)
},{ deep: true });

function rkbLoadData(newRow) {
console.log(`🚀 ~ file: kclbList.vue:62 ~ rkbLoadData ~ newRow2:`, newRow)

  list(newRow).then(res => {
    console.log(`🚀 ~ file: kclbList.vue:71 ~ list ~ res:`, res)
    listData.value = res.records;
    emit('setTotal', res.total);
  })
}
</script>
