<template>
  <div class="subscriber">
    <div class="top">
      <div class="title">{{lan.$t('dingyuezhe')}}（{{teacherlikedlist.total}}）</div>
      <div class="sel">
        <img src="@/static/images/sousuo.png" alt="" class="icon" />
           <input type="text" :placeholder="lan.$t('sousuodingyue')" v-model="condition.title" @keyup.enter="search(condition)"/>
      </div>
    </div>
    <div class="mid">
      <!-- {{teacherlikedlist}} -->
      <div class="studentlist">
        <div class="stuitem" v-for="(i,j) in teacherlikedlist.data" :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">&nbsp;{{i.name}}</span>
              </div>

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

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

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

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

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

              <div>{{lan.$t('canyupingtaishichang')}}：<span class="time">&nbsp;{{i.longtime}}min</span></div>
            </div>
          </div>
        </div>
        <template v-if="!teacherlikedlist.total">
            <a-empty />
      </template>
      </div>
    </div>
    <div class="pages">
      <a-pagination v-if="teacherlikedlist.total" 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 { getteacherliked } from '@/api';
import { useI18n } from '@/utils/i18n';
import { defineComponent, onMounted, ref, toRaw } from "vue";
export default defineComponent({
  name: "Subscriber",
  components: {},
  setup() {
    const lan: any = useI18n();
    const page = ref(1);
    const teacherlikedlist =ref<any>({

    });
    const title=ref('')
    const condition = ref<any>({
      title:""
    })
    onMounted(async () => {
      teacherlikedlist.value=await getteacherliked()
    });
    async function search(e: any){
      teacherlikedlist.value=await getteacherliked(e)
    }
    async function pagechange(){
      teacherlikedlist.value=await getteacherliked(toRaw(condition.value))
    }
    
    return {
      page,
      teacherlikedlist,
      condition,
      title,
      search,
      lan
    };
  },
});
</script>