<template>
  <view class="examact">
    <view class="examact-tname">{{ tenantInfo.name }}</view>
    <img
      :src="$method.splitImgHost('oss/images/file/20230317/1679036853309.png')"
      alt=""
      srcset=""
    />
    <view class="examact-btn" @click="collectMerch"> 点击领取真题题库 </view>
    <img
      class="examact-qrcode"
      :src="'../../static/qrcode/' + tenantInfo.qrcodeUrl"
      alt=""
      srcset=""
    />
    <view class="examact-phone" v-if="tenantInfo.phone">{{
      tenantInfo.phone
    }}</view>
  </view>
</template>

<script>
const map = {
  "test.jqbao.net": {
    name: "测试云学堂",
    qrcodeUrl: "hnjsxt_act.png",
  },
  "120.79.166.78:19012": {
    name: "广东省祥粤建设职业培训学校",
    qrcodeUrl: "h_act.png",
    phone: "报名热线: 020-87085982/87085983",
  },
  "h.xyyxt.net": {
    name: "广东省祥粤建设职业培训学校",
    qrcodeUrl: "h_act.png",
    phone: "报名热线: 020-87085982/87085983",
  },
  "www.hnjsxt.cn": {
    name: "企帮（广州）工程建设咨询服务有限公司",
    qrcodeUrl: "hnjsxt_act.png",
    scheme: "http://",
  },
  "zsh5.zzyxt.net": {
    name: "中山市勘设工程咨询有限公司",
    qrcodeUrl: "zsh5_act.png",
  },
  "zh5.zzyxt.net": {
    name: "肇庆市建筑业协会",
    qrcodeUrl: "zh5_act.png",
  },
  "sdyxt.gdzzkj.net": {
    name: "佛山市顺德区市政建设工程协会",
    qrcodeUrl: "sdyxt_act.png",
  },
  "mh5.zzyxt.net": {
    name: "茂名市建设培训学校",
    qrcodeUrl: "mh5_act.png",
  },
  "sxh5.zzyxt.net": {
    name: "山西晋锦建族教育咨询有限公司",
    qrcodeUrl: "sxh5_act.png",
  },
  "yf.zzyxt.net": {
    name: "云浮市建筑业协会",
    qrcodeUrl: "yf_act.png",
  },
};
import { actCheck } from "../../common/httpList/act";
export default {
  name: "SaasMiniprogramExamact",
  data() {
    return {
      goodsId: "16370",
      goodsType: "2",
      example:
        "http://localhost:8080/pages5/scan/examact?jump=www.hnjsxt.cn/detail/6",
      jump: undefined,
      tenantInfo: {},
    };
  },
  onLoad(option) {
    this.jump = option.jump;
    this.tenantInfo = this.backInfo();
  },
  methods: {
    collectMerch() {
      actCheck().then((res) => {
        if (res.data.code === 200) {
          //跳转去对应域名
          this.toDatail();
        }
      });
    },
    toDatail() {
      if (this.jump) {
        window.location.href = this.tenantInfo.scheme
          ? this.tenantInfo.scheme
          : "https://" + this.jump;
        return;
      }
      uni.navigateTo({
        url:
          "/pages3/course/detail?id=" +
          this.goodsId +
          "&goodsType=" +
          this.goodsType +
          "&isAct=" +
          1,
      });
    },
    backInfo() {
      let domain = this.jump ? this.jump.split("/")[0] : window.location.host;
      domain = this.$method.checkDomain(domain)
        ? domain
        : "120.79.166.78:19012";
      return map[domain];
    },
  },
};
</script>

<style lang="scss" scoped>
.examact {
  position: relative;
  img {
    width: 100vw;
  }
  .examact-tname {
    position: absolute;
    top: 41rpx;
    left: 48rpx;
    font-size: 36rpx;
    color: #2e3174;
    font-weight: 500;
  }
  .examact-btn {
    width: 620rpx;
    height: 102rpx;
    position: absolute;
    top: 806rpx;
    left: 50%;
    margin-left: -310rpx;
    background: linear-gradient(90deg, #1762ff 0%, #4af7da 100%);
    box-shadow: 0px 9px 12px 0px rgba(50, 84, 130, 0.18);
    border-radius: 200rpx;
    line-height: 104rpx;
    text-align: center;
    font-weight: bold;
    color: #ffffff;
    font-size: 36rpx;
  }
  .examact-qrcode {
    width: 180rpx;
    height: 180rpx;
    position: absolute;
    right: 32rpx;
    bottom: 52rpx;
  }
  .examact-phone {
    position: absolute;
    bottom: 52rpx;
    left: 33rpx;
    color: #222222;
    font-size: 28rpx;
  }
}
</style>
