<template>
  <sdLoading v-if="!isAlertShow" />
  <a-result v-else status="warning" :title="alertMessage" />
</template>

<script>
import sdLoading from '@/common/pages/sd-loading.vue'
import loginService from './../../src/login/login-service'
import components from './_import-components/xm-thirdparty-login-import'
import sdLogin from './../../src/login/sd-login.vue'
export default {
  name: 'XmThirdpartyLogin',

  components: {
    ...components,
    sdLoading,
  },
  mixins: [sdLogin],
  data() {
    return {
      isAlertShow: false,
      alertMessage: '单点失败',
    }
  },
  created() {
    loginService
      .ssoLogin(this.$route.query)
      .then((res) => {
        // 移除url中的ssoTodoLogin参数
        window.location.href = window.location.href.replace(/(\?ssoTodoLogin).*?#/g, '')
        return this.loginSuccess()
      })
      .catch((e) => {
        this.isAlertShow = true
        this.alertMessage = e.message
      })
  },
  methods: {},
}
</script>

<style module lang="scss">
@use '@/common/design' as *;
</style>
