兰宝车间质量管理系统-前端
疯狂的狮子Li
2024-06-18 4143285ec6fbe024e5627b380a2081ac937dc0d4
src/layout/components/SocialCallback/index.vue
@@ -10,7 +10,6 @@
const route = useRoute();
const loading = ref(true);
/**
 * 接收Route传递的参数
 * @param {Object} route.query.
@@ -18,19 +17,23 @@
const code = route.query.code as string;
const state = route.query.state as string;
const source = route.query.source as string;
const tenantId = localStorage.getItem("tenantId") ? localStorage.getItem("tenantId") as string : '000000';
const tenantId = route.query.tenantId as string ? route.query.tenantId as string : '000000';
const processResponse = async (res: any) => {
  if (res.code !== 200) {
    throw new Error(res.msg);
  }
  if (res.data !== null) {
  if (res.data !== null && res.data.access_token !== null) {
    setToken(res.data.access_token);
  }
  ElMessage.success(res.msg);
  setTimeout(() => {
    location.href = import.meta.env.VITE_APP_CONTEXT_PATH + 'index';
    if (res.data !== null  && res.data.domain !== null) {
      let protocol = window.location.protocol === 'https:' ? 'https://' : 'http://';
      location.href = protocol + res.data.domain + import.meta.env.VITE_APP_CONTEXT_PATH + 'index';
    } else {
      location.href = import.meta.env.VITE_APP_CONTEXT_PATH + 'index';
    }
  }, 2000);
};
@@ -52,7 +55,6 @@
};
const loginByCode = async (data: LoginData) => {
  console.log(2)
  try {
    const res = await login(data);
    await processResponse(res);