<!-- 小程序统一认证 -->
<template>
  <div class="miniProgramAuthentication">

  </div>
</template>
<script>
  import wx from "weixin-webview-jssdk";
  export default {
    name: 'index',
    data () {
      return {}
    },
    created () {
      let url = decodeURIComponent(window.location.href);
      if (url.indexOf('token') != -1) {
        let list = url.split("?")[1].split("&");
        let codeData = {};
        list.forEach((item) => {
          codeData[item.split("=")[0]] = item.split("=")[1];
        });
        wx.miniProgram.navigateTo({
          url: '/pages/views/login/ssoCertification?token='+codeData.token
        })
      } else if (url.indexOf('code') != -1) {
        //code 异常状态处理
        if(url.split('=')[1] == '10100'){
          //当前用户不存在，请联系管理员!
          wx.miniProgram.navigateTo({
            url: '/pages/views/login/ssoCertification?code=10100'
          })
        }else if(url.split('=')[1] == '500'){
          //服务异常,请稍候再试!
          wx.miniProgram.navigateTo({
            url: '/pages/views/login/ssoCertification?code=500'
          })
        }
      } else {
        //跳转至认证页面
        window.location.href = process.env.VUE_APP_OUT_URL;
      }
    },
    mounted () {

    },
    methods: {

    },
  }
</script>
<style scoped lang="scss">
  .miniProgramAuthentication{

  }
</style>
