<script setup>
import { getFullUrl } from '~/utils/helper';

const props = defineProps({
  pid: String
})

const queryForm = reactive({
  limit: 10,
  page: 1,
  ks_id: props.pid
})

const data = $ref([])
const total = $ref(0)

const router = useRouter()
function routerPush(name, data) {
  router.push({ name, ...data })
}

request({
  url: '/yzy/zy_ssys_dtjl/index',
  data: queryForm
}).then(res => {
  if (res.code === '1') {
    data = res.data.page_data
    total = res.data.total_rows * 1
  }
})

</script>

<template>
  <div class="w-full shadow bg-white rounded-md flex items-center px-36 py-4 mb-4">
    <div class="text-lg text-hex-050026">学生作业</div>
    <el-divider direction="vertical" />
    <div class="text-sm">
      <span class="text-hex-949494">作业</span>
      <span class="text-hex-949494"> - 双师一生</span>
      <span class="text-hex-949494"> - 学生作业</span>
      <span> - 学生作业</span>
    </div>
  </div>
  <div class="w-full p-4 shadow">
    <div class="flex flex-wrap w-full justify-start">
      <template v-if="data.length">
        <div class="w-1/5 flex_center mb-4" v-for="i in data">
          <div class="w-268px h-204px rounded-xl shadow bg-white flex flex-col overflow-hidden cursor-pointer" :key="i">
            <div class="w-full flex-none h-157px">
              <img :src="getFullUrl(i.yzsd_file)" alt="" class="w-full h-full" />
            </div>
            <div class="p-2 flex justify-between items-center flex-auto">
              <!-- {{ i.name }} -->
              <el-rate disabled :model-value="i.yzsd_star*1"></el-rate>
              <div>
                <div
                  class=" w-58px h-24px flex_center rounded-full border border-hex-00A3FF text-hex-00A3FF text-xs cursor-pointer"
                  @click="routerPush('personal_homework_ssys_xszy_edit',{params:{id:i.yzsd_id}})">评价</div>
                <!-- <div
                  class="w-58px h-24px flex_center rounded-full border border-hex-00A3FF text-hex-00A3FF text-xs cursor-pointer"
                  @click="routerPush('personal_homework_ssys_xszy_detail',{params:{id:i.yzsd_id}})">查看</div> -->
              </div>

            </div>
          </div>
        </div>
      </template>

      <div v-else class="flex justify-center w-full">
        <el-empty description="暂无数据" />
      </div>
    </div>

    <div class="flex justify-end mt-6 mb-2">
      <el-pagination background layout="prev, pager, next" :total="total" v-model:current-page="queryForm.page" />
    </div>
  </div>

</template>
