<template>
  <div class="chapterCard" >
    <!-- <div class="cc_title">{{ data.title }}</div> -->
    <div class="cc_box">
      <div
        class="cc_b_item"
      >
				<!-- <div class="cc_b_i_title" v-text="data.title"></div> -->
        <div class="cc_b_i_image">
          <el-image
            style="width: 100%;height: 100%;"
            :src="require('../../../assets/images/pocAiClassroom/classImage.png')"
          ></el-image>
          <span v-text="data.title"></span>
        </div>

        <div class="cc_b_i_message" >
         
          <div>
            <div>
              {{ subjectList.find(i => i.value === data.subject)?subjectList.find(i => i.value === data.subject).label:'' }}
            </div>
          </div>

					<div>
            <span v-if="data.isComplete">已完成</span>
            <span v-else>待完成</span>
          </div>
        </div>
        <div class="cc_b_i_btnArea">
          <span
            :class="['cc_b_i_ba_goClass',data.disabled?'cc_b_i_ba_disabled':'']"
            v-if="[0].includes(data.type) && !data.disabled"
            @click.stop="goClass(data)"
            >去上课</span
          >
          <span
            :class="['cc_b_i_ba_doWorks',data.disabled?'cc_b_i_ba_disabled':'']"
            v-if="[0, 1].includes(data.type) && !data.disabled"
            @click.stop="goWorks(data)"
            >做练习</span
          >
					<span class="cc_b_i_ba_disabled" @click.stop="goWorks(data)" v-if="data.disabled">资源建设中</span>
        </div>
      </div>
    </div>
		<van-popup v-model="disabledShow" round>
			<div class="disabledShowBox">
				<div class="dsb_top">
					<div class="dsb_top_title">敬请期待</div>
					<div class="dsb_top_content">当前课程资源正在建设中，请您耐心等待。</div>
				</div>
				<div class="dsb_bottom">
					<span @click.stop="disabledShow = false">催一催</span>
					<span @click.stop="disabledShow = false">好的</span>
				</div>
			</div>
		</van-popup>
  </div>
</template>

<script>
import { Dialog } from 'vant';
export default {
  props: {
    data: {
      type: Object,
      default: () => {}
    },
    subjectList: {
      type: Array,
      default: () => []
    },
		index:{
			type:Number,
			default:0
		},
		index2:{
			type:Number,
			default:0
		}
  },
  data() {
    return {
      userId: this.$store.state.user.userinfo.userid,
      org: this.$store.state.user.userinfo.org,
      oid: this.$store.state.user.userinfo.organizeid,
			showBtnAreaIndex:"",
			disabledShow:false,
    };
  },
  methods: {
    goClass(item) {
			if(this.data.disabled)return this.disabledShow = true;
			if((this.index2+'-'+this.index)=='1-0'){//2.1
				this.$router.push(
          `/pocClass?type=1`
        );
			}else if((this.index2+'-'+this.index)=='1-1'){//2.2
				this.$router.push(
          `/pocClass?type=2`
        );
			}
			// window.localStorage.setItem('firstEnterStatus',this.userId)
    },
    goWorks(item) {
			if(this.data.disabled)return this.disabledShow = true;
      this.$router.push(
        `/pocDoTask?type=${this.index2}-${this.index}`
      );
			// window.localStorage.setItem('firstEnterStatus',this.userId)
    },
  }
};
</script>

<style scoped>
.chapterCard {
  width: auto;
  height: auto;
  margin-bottom: 10px;
  position: relative;
}

.cc_box {
  width: 100%;
  height: auto;
  display: flex;
  flex-wrap: wrap;
  position: relative;
}

.cc_b_item {
  width: 35vw;
	max-width: 150px;
  height: auto;
	margin: 5px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  /* margin-bottom: 5px; */
  background-color: #fff;
  padding: 10px 15px 10px 15px;
  border-radius: 6px;
  border: 2px solid #f0f2f5;
  position: relative;
  transition: 0.3s;
}


.cc_b_i_image {
  width: 100%;
  height: 80px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
	opacity: 1;
	transition: .3s;
}

.cc_b_i_image > span {
  position: absolute;
  font-size: 14px;
  color: black;
  display: block;
  max-width: 95%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: bold;
}

.cc_b_i_message {
  width: 100%;
  height: auto;
  display: flex;
  margin-top: 5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cc_b_i_message > div > span {
  font-size: 14px;
  display: flex;
	color:#00000066 ;
  align-items: center;
}

.cc_b_i_message > div > div {
  font-size: 12px;
  padding: 4px;
  background-color: #e0eafb;
  border-radius: 3px;
  color: #3681fc;
  font-weight: bold;
}

.cc_b_i_btnArea {
  width: 100%;
  height: auto;
	margin-top: 10px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
}

.cc_b_i_btnArea > span {
  flex: 1;
  height: 25px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  border-radius: 4px;
  color: black;
  /* background-image: radial-gradient(73% 147%, #EADFDF 59%, #ECE2DF 100%), radial-gradient(91% 146%, rgba(255,255,255,0.50) 47%, rgba(0,0,0,0.50) 100%); */
  background-color: #f0f2f5;
  box-sizing: border-box;
  font-size: 13px;
  transition: 0.3s;
}

.cc_b_i_btnArea > span:nth-of-type(2){
	margin-left: 10px;
}



.cc_b_i_ba_doWorks{
	background: linear-gradient(90deg, #82B1FF 0%, #3681FC 100%);
	color: #fff !important;
}

.cc_b_i_ba_goClass{
	background: #F0F2F5;
	color: #3681FC !important;
}

.cc_b_i_ba_disabled{
	background: #F0F2F5 !important;
	color: #00000042 !important;
}

.cc_b_i_title{
	width: 100%;
	height: auto;
	font-size: 14px;
	margin-bottom: 5px;
	font-weight: bold;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* .cc_b_item:hover .cc_b_i_image>.cc_b_i_btnArea{
	display: flex;
} */

/* .cc_b_i_image {
  width: 100%;
  height: 260px;
  background-color: #fff;
  border-radius: 10px;
  overflow: hidden;
	position: relative;
}

.cc_b_i_btnArea{
	width: 100%;
	height: 50px;
	position: absolute;
	bottom: 5px;
	display: none;
	justify-content: space-around;
	align-items: center;
	padding: 0 10px;
	box-sizing: border-box;
	
} */

/* .cc_b_i_btnArea>span:nth-of-type(2n){
	margin-left: 10px;
}

.cc_b_i_title {
  width: 100%;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.cc_b_i_title > span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 20px;
} */

.disabledShowBox{
	/* width: 250px; */
	width: 80vw;
	height: 200px;
	display: flex;
	flex-direction: column;
	align-items: center;
}

.dsb_top{
	flex: 1;
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-direction: column;
}

.dsb_top_title{
	font-size: 18px;
	font-weight: bold;
	margin-bottom: 20px;
}

.dsb_top_content{
	font-size: 16px;
	max-width: 80%;
	display: flex;
	align-items: center;
	color: #666666;
}

.dsb_bottom{
	width: 100%;
	height: 60px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	box-sizing: border-box;
	padding: 10px 20px;
}

.dsb_bottom>span{
	flex: 1;
	height: 90%;
	border-radius: 8px;
	display: flex;
	justify-content: center;
	align-items: center;
	font-size: 16px;
	font-weight: bold;
	background-color: #F0F2F5;
	color: #3681FC;
}

.dsb_bottom>span:nth-of-type(2){
	margin-left: 20px;
	background-color: #3681FC;
	color: #fff !important;
}
</style>
