<template>
  <div class="hyper-index">
    <div>
        <!-- <div class="hyper-link" v-if="!showiframe">
            <div class="hyper-link-row">{{content.contentName}}</div>
            <div class="hyper-link-row">{{content.content}}</div>
            <div class="hyper-link-row">
            <el-button @click="showiframe = true" type="warning">本页面打开</el-button>
            <el-button @click="widthOpen(content.content)" type="primary">新窗口打开</el-button>
            </div>
        </div>
        <div v-if="showiframe">
            <iframe :src="content.content" style="width: 100%;border:0px;min-height: 473px;" frameborder="0"></iframe>
        </div> -->
          <div class="hyper-link" v-if="conLink.openType==2">
                        <div class="hyper-link-row">{{content.contentName}}</div>
                        <div class="hyper-link-row">{{conLink.url}}</div>
                    </div>
                    <div v-if="conLink.openType==1">
                        <iframe :src="conLink.url" style="width: 100%;border:0px;min-height: 473px;" frameborder="0"></iframe>
                    </div>
    </div>
  </div>
</template>
<script>
import apiStudy from '@/api/modules/courseStudy.js';
import apiCourse from '@/api/modules/course.js';
import {formatDate,formatSeconds} from '@/utils/datetime.js';
import {testType,correctJudgment,numberToLetter} from '@/utils/tools.js';
export default {
  props:{
      content: {
        type: Object,
        default:()=>{}
      },
  },
  data() {
    return {
      showiframe:false,
      conLink:{openType:1,url:''},//对于超连接的内容
    };
  },
  mounted() {
    console.log(this.content,'content');
       if(this.content.content.startsWith('\{')){
           this.conLink=JSON.parse(this.content.content);
        }else{
           this.conLink.url=this.content.content;
           this.conLink.openType=1;
        }
        if(this.conLink.openType==2){
          //直接设置完成状态
          this.widthOpen(this.conLink.url);
        }
  },
  methods: {
    widthOpen(url) {
      window.open(this.webBaseUrl+url,'_blank');
    },
  }
}
</script>

<style scoped lang="scss">
 .hyper-link{
  padding-left:20px;
  text-align: center;
  padding-top: 100px;
  .hyper-link-row{
    padding: 20px;
  }
}
</style>
