<template>
  <view class="">
    <view class="road">
      <view class="nav"
        ><view class="left">科目三真实考场</view>
        <navigator url="/otherPages/myExamRoadVideo/index">
          <view class="right">
            查找我的考场<van-icon color="#498EF5" name="arrow"
          /></view>
        </navigator>
      </view>
      <view class="mark">
        <navigator url="/otherPages/examRoadVideo/index">
          <view class="button1">社会化驾驶人考场</view>
        </navigator>
        <image mode="widthFix" class="play" :src="bottom_arrrow"></image>
      </view>
      <view class="nav2">
        <image
          mode="widthFix"
          class="left"
          src="https://ndata.zzxcx.net/jklsj/xcx/teacherVideo/kemu3.png"
        ></image>
        <view class="right">
          <view>熟记考场</view>
          <view>考试不用慌</view>
          <navigator url="/otherPages/examRoadVideo/index">
            <view class="look">去看考场</view></navigator
          >
        </view>
      </view>
    </view>
    <view class="subject">
      <view v-for="(item, index) in kemu" :key="index" class="list">
        <view
          @click="
            goPath('/otherPages/videoSubjectList/index?subject=' + (index + 1))
          "
        >
          <image
            mode="widthFix"
            class="subject-bg"
            :src="
              'https://ndata.zzxcx.net/jklsj/xcx/teacherVideo/kemubg' +
              (index + 1) +
              '.png'
            "
          ></image>

          <!-- <view class="text1"> 科目{{ item }} </view> -->
          <!-- <view class="text2"> 《视频讲解》 </view> -->
        </view>
      </view>
    </view>
    <view class="care" :style="careVisible ? '' : 'display:none'">
      <view class="dialog">
        <view class="title">请先关注公众号</view>
        <official-account></official-account>
        <view
          @click="
            () => {
              careVisible = false;
            }
          "
          class="confirm"
        >
          关闭</view
        >
      </view>
    </view>

    <view class="wxad">
      <ad
        ad-type="video"
        :ad-intervals="100"
        unit-id="adunit-8eb44bbd7e3147d4"
      ></ad>
    </view>
  </view>
</template>

<script>
import bottom_arrrow from "@/assets/img/bottom_arrrow.png";
import api from "@/api";
export default {
  data() {
    return {
      careVisible: false,
      bottom_arrrow,
      query: {},
      kemu: ["一", "二", "三", "四"],
    };
  },
  methods: {
    goPath(url) {
      let that = this;
      let userInfo = uni.getStorageSync("userInfo");
      let gzhOpenid = userInfo.gzhOpenid;
      console.log(userInfo);
      if (gzhOpenid) {
        uni.navigateTo({
          url,
        });
      } else {
        let hotStartupOption = uni.getStorageSync("hot_startup_option");
        let coldStartupOption = uni.getStorageSync("cold_startup_option");
        console.log(hotStartupOption.scene);
        console.log(coldStartupOption.scene);
        switch (coldStartupOption.scene) {
          case 1011:
          case 1017:
          case 1038:
          case 1047:
          case 1124:
            that.careVisible = true;
            break;
          default:
            uni.showModal({
              title: "请关注公众号",
              content: "关注后回到这里观看相关视频",
              success(res) {
                if (res.confirm) {
                  uni.navigateTo({ url: "/otherPages/careGzh/index" });
                } else if (res.cancel) {
                }
              },
            });
            break;
        }
        // switch (){
        //   case :
        //   break;

        // }
      }
    },
    onLoad(query) {
      this.query = query;
    },
  },
  onShow() {
    api.user.getInfo().then((res) => {
      uni.setStorageSync("userInfo", res.data);
      this.$store.commit("SET_USERINFO", res.data);
    });
  },
};
</script>

<style lang="scss" scoped>
.care {
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.35);
  position: fixed;
  z-index: 10;
  top: 0;
  left: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  align-content: center;

  .dialog {
    width: 300px;
    height: calc(84px + 144rpx);
    background: #fff;
    border-radius: 16rpx;
    overflow: hidden;
    .title {
      width: 100%;
      height: 72rpx;
      text-align: center;
      font-size: 32rpx;
      line-height: 72rpx;
      color: #333;
      background: #fff;
   
      font-weight: bold;
    }
    .confirm {
      width: 100%;
      height: 72rpx;
      text-align: center;
      font-size: 40rpx;
      line-height: 72rpx;
      color: #ee0a24;
      background: #fff;
      letter-spacing: 15px;
    }
  }
}
.road {
  width: 690rpx;
  margin: 0 auto;
  height: 478rpx;
  background: linear-gradient(
    188deg,
    #edf4ff 0%,
    rgba(237, 244, 255, 0.43) 100%
  );
  border-radius: 20rpx 20rpx 20rpx 20rpx;
  opacity: 1;
  .nav {
    display: flex;
    width: 100%;
    justify-content: space-between;
    align-content: center;
    align-items: center;
    padding-left: 30rpx;
    padding-right: 30rpx;
    padding-top: 36rpx;
    .left {
      font-size: 36rpx;
      font-weight: bold;
    }
    .right {
      color: #3AC770;
    }
  }
  .mark {
    position: relative;
    padding-left: 30rpx;
    padding-right: 30rpx;
    margin-top: 22rpx;
    width: 328rpx;
    text-align: center;
    font-size: 0;
    .button1 {
      width: 268rpx;
      line-height: 64rpx;
      background: #3AC770;
      border-radius: 20rpx 20rpx 20rpx 20rpx;
      opacity: 1;
      color: #fff;
      font-size: 26rpx;
      text-align: center;
    }
    .play {
      width: 36rpx;
      margin-top: 4rpx;
    }
  }
  .nav2 {
    display: flex;
    width: 100%;
    padding-left: 30rpx;
    padding-right: 30rpx;
    justify-content: space-between;
    margin-top: 20rpx;
    .left {
      width: 408rpx;
    }
    .right {
      width: 200rpx;
      color: #3AC770;
      font-size: 30rpx;
      text-align: center;
      line-height: 1.5;
      .look {
        width: 200rpx;
        line-height: 92rpx;
        background: #3AC770;
        border-radius: 50rpx 50rpx 50rpx 50rpx;
        opacity: 1;
        font-size: 34rpx;
        color: #fff;
        margin-top: 10rpx;
      }
    }
  }
}
.subject {
  padding: 0 30rpx;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-between;

  .list {
    position: relative;
    margin-bottom: 15rpx;
    .subject-bg {
      width: 334rpx;
    }
    .text1 {
      font-size: 42rpx;
      color: #fff;
      position: absolute;
      top: 30rpx;
      left: 60rpx;
    }
    .text2 {
      font-size: 42rpx;
      color: #fff;
      position: absolute;
      top: 88rpx;
      left: 40rpx;
    }
  }
}
.wxad {
  border: none;
  padding: 0 30rpx;
}
</style>