<template>
  <div class="right-wrap">
  </div>
</template>

<script>
import { getRequest } from '@/api/api';

export default {
  name: "public_num_attention",
  data() {
    return {
        baseUrl: '', // 域名
        enterpriseId :'',
    }
  },
  beforeMount() {
    var that = this
    var host = window.location.origin;
    console.log("当前host:",host)
    if (host.indexOf('localhost') != '-1') {
      that.baseUrl = 'http://gicdev.demogic.com';
    }else {
      that.baseUrl = host
    }
  },
  methods: {
    // 跳转商户
    redirect(enterpriseId){
      var that = this
      var para = {
        eid: enterpriseId
      }
      getRequest('/api-auth/do-login-for-clique',para)
      .then((res) => {
        // console.log(res,res.data,res.data.errorCode)
        var resData = res.data
        if (resData.errorCode == 0) {

          var href = that.baseUrl + ''
          window.location.href= href + "/report/#/memberSummary"
          return;
        }
        // that.userFormVisible = false;
        errMsg.errorMsg(resData)

      })
      .catch(function (error) {
        console.log(error);
        // that.toLogin()
        // that.userFormVisible = false;
        that.$message.error({
          duration: 1000,
          message: error.message
        })
      });
    },

  },
  mounted() {
    var that = this;
    // var href = that.baseUrl + ''
    // window.location.href= href + "/gic-web/#/login"
    console.log("mounted",that.$route.query.gradeId)
    that.enterpriseId = that.$route.query.enterpriseId
    that.redirect(that.enterpriseId)
  }
}
</script>
