<template>
  <section class="active-finish-toast-wrap">
    <div class="content">
      <div class="top">活动已过期，感谢您的关注</div>
      <div class="bottom">
        <span @click="closePage">确认</span>
      </div>
    </div>
  </section>
</template>

<script>
  import {is_weixin} from '@/utils/wxLogin'
  export default {
    name: "finish-toast",
    methods: {
      isAndroid() {
        let u = navigator.userAgent;
        if (u.indexOf("Android") > -1 || u.indexOf("Linux") > -1) {
          if (window.ShowFitness !== undefined) return true;
        }
        return false;
      },
      isIos() {
        let u = navigator.userAgent;
        if (u.indexOf("iPhone") > -1 || u.indexOf("iOS") > -1) {
          return true;
        }
        return false;
      },
      closePage() {
        if(this.$rocNative.isWeb) {
          if(is_weixin()) {
            if(this.isIos()) {
              WeixinJSBridge.call('closeWindow');
            } else if(this.isAndroid()){
              document.addEventListener('WeixinJSBridgeReady', function(){ WeixinJSBridge.call('closeWindow'); }, false)
            }
          } else {
            window.location.href="about:blank";
            window.close();
          }
        } else {
          this.$rocNative.goBack();
        }
      }
    }
  }
</script>

<style scoped lang="less">
.active-finish-toast-wrap {
  width: 100%;
  position: fixed;
  top: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  .content {
    width: 300px;
    height: 131px;
    background: #fff;
    border-radius: 4px;
    .top {
      color: #373839;
      font-size: 18px;
      height: 80.5px;
      line-height: 80.5px;
      text-align: center;
      position: relative;
    }
    .top:after {
      position: absolute;
      content: " ";
      left: 0;
      bottom: 0;
      right: 0;
      height: 1PX;
      border-bottom: 1PX solid #F0F1F2;
      color: #F0F1F2;
      -webkit-transform-origin: 0 100%;
      -ms-transform-origin: 0 100%;
      transform-origin: 0 100%;
      -webkit-transform: scaleY(0.5);
      -ms-transform: scaleY(0.5);
      transform: scaleY(0.5);
    }
    .bottom {
      text-align: center;
      color: #449284;
      font-size: 17px;
      line-height: 50px;
    }
  }
}
</style>