<template>
  <div id="siteMain">
    <div id="maxSite">
      <a-layout>
        <!-- 页头 -->
        <headerPage />
        <!-- 主体部分 -->
        <a-layout-content>
          <a-card class="rowGutter" id="jcgkkDom">
            <template #title>
              <div style="font-size: 24px; font-weight: bold">教师已阅信息</div>
            </template>
            <a-row :gutter="[16, 16]" style="margin-top: 20px">
              <a-col v-for="(item, index) in listData" :key="index" :span="24">
                <a-row style="margin-top: 15px">
                  <a-col :span="22" style="text-align: left; padding-left: 15px">
                    <div style="margin-top: 5px">{{ index + 1 }}、{{ item.content }}</div>
                  </a-col>
                  <a-col :span="2" style="text-align: right">
                    <a-button type="primary" @click="openKecheng(item)" style="margin-left: 10px">已读</a-button>
                  </a-col>
                </a-row>
              </a-col>
              <a-col v-if="listData.length > 0">
                <a-pagination v-model:current="pageNo" size="small" :total="current" show-quick-jumper @change="onPageChange" />
              </a-col>
              <a-col :span="24" style="line-height: 50px" v-if="listData.length == 0">
                <div style="text-align: center"> 暂无数据 </div>
              </a-col>
            </a-row>
          </a-card>
        </a-layout-content>
        <!-- 页尾 -->
        <footerPage />
      </a-layout>
    </div>
  </div>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { defHttp } from '/@/utils/http/axios';
import { dateFormat } from '/@/utils/common/compUtils';
import { Image as AImage } from 'ant-design-vue';
import { getFileAccessHttpUrl } from '/@/utils/common/compUtils';
import { useMessage } from '/@/hooks/web/useMessage';
import { useUserStore } from '/@/store/modules/user';
import headerPage from '/@/views/site/common/header.vue';
import footerPage from '/@/views/site/common/footer.vue';
import { JDictSelectTag, JInput } from '/@/components/Form';

import { getSysConfig } from '/@/views/site/utils/index';

import { Pagination } from 'ant-design-vue';
const APagination = Pagination;
const userStore = useUserStore();
let listData = ref<any>([]);
const list = (params) => defHttp.get({ url: '/zyDbtx/zyDbtx/list', params });

const { createMessage } = useMessage();
const queryParam = ref<any>({});
const pageNo = ref(1);
let current = 0;

async function onPageChange() {
  console.log('onPageChange', pageNo.value);
  await loadData();
}
function openKecheng(record) {
  var url = '/zy/zuoyeMain';
  if (record.type == '5') {
    //当前作业
    url = '/zy/dqkcDqzy';
  } else if (record.type == '6') {
    //测验消息
    url = '/zy/ceshiWenjuan';
  } else if (record.type == '7') {
    //问卷消息
    url = '/zy/dcwjWenjuan';
  }
  url = url + '?rwbh=' + record.rwbh + '&xqxn=' + getSysConfig().flag1 + '&teano=' + record.fbr;
  window.open(url, '_blank');
}
//进入就加载
onMounted(() => {
  loadData();
});
/**
 * 加载数据
 */
function loadData() {
  queryParam.value.pageSize = 10;
  queryParam.value.pageNo = pageNo;
  queryParam.value.createBy = userStore.getUserInfo.username;
  queryParam.value.flag = '1' 
  listData.value = [];
  list(queryParam.value).then((res) => {
    console.log('🤞', res);
    var list = res.records;
    listData.value = list;
    current = res.total;
  });
}
</script>
<style lang="less" scoped>
.ggkTimeClass {
  display: inline-block;
  width: 90%;
  margin-bottom: 10px;
  margin-left: 12px;
  padding: 0 15px;
  height: 40px;
  font-size: 16px;
  font-weight: 500;
  line-height: 39px;
  border-radius: 36px;
  background-color: #f3f3f3;
  text-align: center;
}
.ggkTitle {
  line-height: 2rem;
  font-size: 18px;
  font-weight: 600;
  color: black;
}
.ggkTwoTitle {
  color: black;
  font-size: 14px;
  line-height: 25px;
}
.ggkThreeTitle {
  font-size: 16px;
  color: #337ab7;
  font-weight: 700;
  line-height: 50px;
}
.ggkFourTitle {
  line-height: 40px;
  color: black;
}
.ggkButton {
  width: 100%;
  height: 40px;
  background: #1c84c6;
  color: #fff;
  font-weight: 600;
  font-size: 18px;
  border-radius: 5px;
  line-height: 37px;
}
.ggkCcxs {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.redImgClass {
  background: linear-gradient(45deg, #b23d59, #d3718a);
}
.blueImgClass {
  background: linear-gradient(45deg, #53637a, #8590a6);
}
.greenImgClass {
  background: linear-gradient(45deg, #7999fc, #79bdfc);
}

#siteMain {
  // font-size: ;
  // height: 100%;
  background: #f3f3f4;
  #maxSite {
    //最大宽度
    max-width: 1170px;
    //居中
    margin: 0 auto;
    .rowGutter {
      margin-top: 1rem;
      margin-bottom: 1rem;
    }

    .ant-layout-header {
      color: #fff;
      background: #1ab394;
    }
    .ant-layout-footer {
      line-height: 1.5;
      background: #fff;
    }
    .ant-layout-sider {
      color: #fff;
      line-height: 120px;
      background: #3ba0e9;
    }
    .ant-layout-content {
      min-height: 120px;
      color: #000;
      line-height: 120px;
      background: #f3f3f4;
    }
    .dictBox :deep(.ant-select) {
      width: 100%;
    }
  }
}
/**暗黑模式特殊配色*/
[data-theme='dark'] #siteMain #maxSite {
  .ant-layout-header,
  .ant-layout-footer {
    background: #6aa0c7;
  }
  .ant-layout-content {
    background: #107bcb;
  }
  .ant-layout-sider {
    background: #3499ec;
  }
}
</style>