<template>
  <div class="subscriber">
    <div class="top">
      <div class="title">{{lan.$t("zhibobaomingxuesheng")}}</div>
      <div class="sel">
        <img src="@/static/images/sousuo.png" alt="" class="icon" />
           <input type="text" :placeholder="lan.$t('sousuoxuesheng')" v-model="condition.keyword" @keyup.enter="search(condition)"/>
      </div>
    </div>
    <div class="mid">
      <div class="studentlist">
        <div class="stuitem" v-for="(i,j) in teacherlikedlist" :key="j">
          <img :src="i.img" alt="" class="photo" />
          <div>
            <div class="info">
              <div class="infoitem">
                <span class="label">{{lan.$t("xingming")}}:</span>
                <span class="one-line-hide">{{i.name}}</span>
              </div>

              <div class="infoitem">
                <span class="label">{{lan.$t('suozaiguojia')}}:</span>
                <span class="one-line-hide">{{i.country}}</span>
              </div>

              <div class="infoitem">
                <span class="label">{{lan.$t('nianling')}}:</span>
                <span class="one-line-hide">{{i.age}}</span>
              </div>
            </div>

            <div class="info">
              <div class="infoitem">
                <span class="label">{{lan.$t('xueshengmuyu')}}:</span>
                <span class="one-line-hide">{{i.mtongue	}}</span>
              </div>

              <div class="infoitem">
                <span class="label">{{lan.$t('xingqudian')}}:</span>
                <span class="one-line-hide">{{i.interestStr}}</span>
              </div>

              <div class="infoitem">
                <span class="label">{{lan.$t("yuyandengji")}}:</span>
                <span class="one-line-hide">{{i.levelStr}}</span>
              </div>

              <div>{{lan.$t('canyupingtaishichang')}}<span class="time">{{i.length}}min</span></div>
            </div>
          </div>
        </div>
        <template v-if="!teacherlikedlist.length">
            <a-empty />
        </template>
      </div>
    </div>
    <!-- <div class="pages">
      <a-pagination v-model:current="page" :total="teacherlikedlist.total" :showLessItems="true" @change="pagechange"/>
    </div> -->
  </div>
</template>
<style lang="scss" scoped>
.subscriber {
  width: 100%;
  // height: 706px;
  background-color: #fff;
  border-radius: 17px;
  // padding: 40px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 200px;
  .top {
    display: flex;
    width: 1241px;
    justify-content: space-between;
    align-items: center;
    margin-top: 21px;
    border-bottom: 1px solid #eeeeee;
    padding-bottom: 6px;
    .title {
      font-size: 13px;
      color: #121212;
      font-weight: bold;
    }
    .sel {
      // width: 171px;
      height: 26px;
      border: 1px solid #999;
      display: flex;
      align-items: center;
      // padding: 8px;
      border-radius: 4px;
      padding-right:30px;
      > img {
        width: 11px;
        height: 11px;
        margin-left:5px
      }
      > input {
        width: 170px;
        font-size: 9px;
        line-height: 1;
        margin-left: 6px;
        border: none;
        outline: none;
      }
    }
  }
  .mid {
    .studentlist {
      width: 1241px;
      margin: 0 auto;
      .stuitem {
        height: 131px;
        border-bottom: 1px solid #eeeeee;
        display: flex;
        align-items: center;
        .photo {
          width: 74px;
          height: 74px;
          background: #125cb4;
          border-radius: 50%;
        }
        .info {
          margin-left: 35px;
          display: flex;
          font-size: 12px;
          color: #121212;
          line-height: 45px;
          .infoitem {
            width: 194px;
            display: flex;
            .label{
              flex-shrink: 0;
            }
          }
        }

        .time {
          color: #08AE98;
        }
      }
    }
  }
  .pages {
    position: absolute;
    bottom: 114px;
    display: flex;
    justify-content: center;
    ::v-deep(.ant-pagination-next) > .ant-pagination-item-link,
    ::v-deep(.ant-pagination-prev) > .ant-pagination-item-link,
    ::v-deep(.ant-pagination-item),
    ::v-deep(.ant-pagination-jump-next-custom-icon),
    ::v-deep(.ant-pagination-jump-prev-custom-icon) {
      border: 1px solid #08ae98;
    }
    ::v-deep(.ant-pagination-item-active) a {
      color: #fff;
    }
    ::v-deep(.ant-pagination-item-active) {
      background-color: #08ae98;
    }
  }
}
</style>
<script lang="ts">
import { getstudentlist, getteacherliked } from '@/api';
import { useI18n } from '@/utils/i18n';
import { defineComponent, onMounted, ref, toRaw } from "vue";
import { useRoute } from 'vue-router';
export default defineComponent({
  name: "Subscriber",
  components: {},
  setup() {
    const page = ref(1);
    const lan: any = useI18n();

    const teacherlikedlist =ref<any>({

    });
    const title=ref('')
    const condition = ref<any>({
      keyword:"",
      id:Number(useRoute().query.liveid)
    })
    onMounted(async () => {
      console.log(useRoute().query.liveid,"mmmmmmm")
      const id=useRoute().query.liveid
      teacherlikedlist.value=await getstudentlist({id:Number(id)})
    });
    async function search(e: any){
      teacherlikedlist.value=await getstudentlist(e)
    }
    async function pagechange(){
      teacherlikedlist.value=await getstudentlist(toRaw(condition.value))
    }
    
    return {
      page,
      teacherlikedlist,
      condition,
      title,
      search,
      lan
    };
  },
});
</script>