<template>
  <!-- <a-list item-layout="horizontal" :data-source="list" :grid="{ gutter: 16, xs: 1, sm: 2, md: 4, lg: 4, xl: 6, xxl: 3, xxxl: 2 }"> -->
  <a-list item-layout="horizontal" :data-source="list">
    <template #renderItem="{ item }">
      <a-list-item>
        <a-list-item-meta>
          <template #title>
            <div class="wenZiJiaCu">
              听了&nbsp;&nbsp;&nbsp;&nbsp;{{ item.kkdw }}&nbsp;&nbsp;&nbsp;&nbsp;{{item.skjs}}&nbsp;&nbsp;&nbsp;&nbsp;{{ item.kcmc }}
            </div>
          </template>
          <template #description>
            <!-- -{{ item }}- -->
            <span v-if="item.score" style="color: #337ab7;" @click="viewModal.view(item)">已评分：{{ item.score }}分</span>
            <span v-else style="color: #337ab7;" @click="tingKeZuJiAddModal.view(item)"><FormOutlined/>填写评价</span>
          </template>
          <template #avatar>
            <div class="wenZiJuZhong">
              <TeamOutlined/>
              <div>{{ item.shijian }}</div>
              <div style="color: #1ab394;">{{ item.tkrq }}</div>
            </div>
          </template>
        </a-list-item-meta>
      </a-list-item>
    </template>
  </a-list>
  <addModalPage ref="tingKeZuJiAddModal"/>
  <viewModalPage ref="viewModal"/>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { TeamOutlined, FormOutlined } from '@ant-design/icons-vue';
import { getUserId,getSysConfig } from '/@/views/site/utils/index';

import addModalPage from '/@/views/site/tingKeZuJi/components/addModal.vue';
import viewModalPage from '/@/views/site/tingKeZuJi/components/viewModal.vue';
import { defHttp } from '/@/utils/http/axios';
enum Api {
  list = '/kcTingke/kcTingke/findTingKeZuJiBytingketimeAndUserId'
}

const tingKeZuJiAddModal = ref();
const viewModal = ref();

/**
 * 列表接口
 * @param params
 */
const listApi = (params) => defHttp.get({ url: Api.list, params });

const list = ref<any>([]);
onMounted(() => {
  listApi({ userid: getUserId(), tingketime: getSysConfig().bxqkssj }).then(res => {

    console.log(`🚀 ---------------------------------------------🚀`);
    console.log(`🚀 ~ file: index.vue:57 ~ listApi ~ res:`, res);
    console.log(`🚀 ---------------------------------------------🚀`);

    list.value = res ?? [];
  });
});

</script>
<style lang="less" scoped>
.wenZiJuZhong {
  text-align: center;
}
.wenZiJiaCu {
  font-weight: 700;
}

</style>