<template>
  <h2 class="contentTitle">其他课程资源</h2>
  <el-row :gutter="20">
    <el-col :span="6" v-if="Identity != 1">
      <div class="grid-content" @click="openApplications('project')">
        <!-- <router-link to="/iframe/其他课程资源/课程管理"> -->
        <img :src="Img1" alt="">
        <div>
          <p class="title" title="创建课程">创建课程</p>
          <p title="教师自定义创建个人人工智能课程教学资源。">教师自定义创建个人人工智能课程教学资源。</p>
        </div>
        <!-- </router-link> -->

      </div>
    </el-col>
    <el-col :span="6">
      <div class="grid-content" @click="openApplications('study')">
        <!-- <router-link to="/iframe/其他课程资源/课程中心"> -->
        <img :src="Img2" alt="">
        <span class="course_down" @click="courseDown($event)">课件下载</span>
        <div>
          <p class="title" title="拓展课程">拓展课程</p>
          <p title="教师使用预置或自定义补充资源开展授课。">教师使用预置或自定义补充资源开展授课。</p>
        </div>
        <!-- </router-link> -->
      </div>
    </el-col>
    <!-- <el-col :span="6">
      <div class="grid-content" @click="openApplication('evaluate')">
        <img :src="Img3" alt="">
        <div>
          <p title="学生评价" class="title">学生评价</p>
          <p title="教师基于平台数据采集开展对应目标的学生评价。">教师基于平台数据采集开展对应目标的学生评价。</p>
        </div>
      </div>
    </el-col> -->
  </el-row>
  <el-dialog v-model="dialogVisible" :before-close="handleClose" width=1200 >
    <template #header>
      <div class="dialog-header img_text_middle">
        <!-- <img :src="WarningImg" alt=""> -->
        <span class="warning_text">课程中心</span>
      </div>
    </template>
    <CourseSelect :classDown="false"></CourseSelect>
    <template #footer>
      <div class="dialog-footer">
        <!-- <el-button type="primary" @click="updateReduction()">
          确认修改
        </el-button> -->
        <el-button @click="dialogVisible = false">取消</el-button>
      </div>
    </template>
  </el-dialog>
</template>
<script setup>
import { ref } from 'vue';
import Img1 from '@/assets/icon/课程管理.png'
import Img2 from '@/assets/icon/课程中心.png'
import Img3 from '@/assets/icon/学生评价icon.png'
import CourseSelect from './downloadCourse.vue';
import { userInfoStore } from '@/stores/counter'

const InfoStore = userInfoStore()
const dialogVisible = ref(false)
const courseDown = e => {
  dialogVisible.value = true
  e.stopPropagation();
}
const openApplication = (type) => {
  top.U.MD.D.I.openApplication(type)
}

const openApplications = (type) => {
  if (type) {
    console.log(type, InfoStore.user)
    window.open('https://cloud.cocorobo.cn//#/' + type)
  }else{
    window.open("https://knowledge.cocorobo.cn/zh-CN/story-telling/643a21ae-d2ef-11ef-9d05-12e77c4cb76b")
  }
}
</script>
<style lang="scss" scoped>
.el-row {
  margin-bottom: 20px;

  .el-col {
    border-radius: 4px;

    .grid-content {
      border-radius: 4px;
      min-height: 36px;
      background: #fff;
      border-radius: 10px;
      position: relative;
      padding: 16px;
      display: flex;
      align-items: center;

      img {
        width: 56px;
        height: fit-content;
        margin-right: 5px;
      }

      .course_down {
        // display: inline-block;
        padding: 5px 8px;
        position: absolute;
        background-color: #efefef;
        top: 5px;
        right: 8px;
        border-radius: 5px;
        font-size: 12px;
        color: #555;
        cursor: pointer;
        z-index: 10;
      }

      div {
        // position: absolute;
        // left: 80px;
        // top: 16px;
        width: calc(100% - 56px);
        cursor: pointer;


        .title {
          display: -webkit-box;
          -webkit-line-clamp: 1;
          width: 100%;
          color: rgba(0, 0, 0, 0.9);
          font-size: 14px;
          margin-bottom: 10px;
          font-weight: 400;
          text-overflow: ellipsis;
          overflow: hidden;
          word-break: break-all;
        }

        p {
          color: rgba(0, 0, 0, 0.4);
          font-size: 12px;
          overflow: hidden;
          text-overflow: ellipsis;
          -webkit-line-clamp: 2;
          display: -webkit-box;
          -webkit-box-orient: vertical;
        }
      }
    }
  }


}

.el-row:last-child {
  margin-bottom: 0;
}
</style>