import { v as defineComponent, r as ref, l as onMounted, B as createElementBlock, C as createVNode, D as withCtx, aA as useRouter, aB as useRoute, ak as resolveComponent, y as openBlock, E as createBaseVNode, O as toDisplayString, M as createTextVNode } from "./vue-dev.7a51ac2d.js"; import { u as useAuthStore } from "./index-dev.bb5c7162.js"; import { a as ElMessage } from "./element-dev.26a170ea.js"; import { _ as _export_sfc } from "./_plugin-vue_export-helper-dev.cc2b3d55.js"; import "./utils-dev.be08a1a2.js"; const _hoisted_1 = { class: "callback-container" }; const _hoisted_2 = { key: 0, class: "loading-content" }; const _hoisted_3 = { key: 1, class: "error-content" }; const _hoisted_4 = { key: 2, class: "success-content" }; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "AuthCallback", setup(__props) { const router = useRouter(); const route = useRoute(); const authStore = useAuthStore(); const loading = ref(true); const error = ref(""); onMounted(async () => { try { const token = route.query.token; const errorParam = route.query.error; if (errorParam) { error.value = "授权失败: " + errorParam; loading.value = false; return; } if (!token) { error.value = "未收到访问令牌"; loading.value = false; return; } authStore.setToken(token); await authStore.fetchUserInfo(); loading.value = false; ElMessage.success("登录成功"); setTimeout(() => { router.push("/dashboard"); }, 1e3); } catch (err) { console.error("处理登录回调失败:", err); error.value = err.message || "登录处理失败"; loading.value = false; } }); return (_ctx, _cache) => { const _component_Loading = resolveComponent("Loading"); const _component_el_icon = resolveComponent("el-icon"); const _component_Warning = resolveComponent("Warning"); const _component_el_button = resolveComponent("el-button"); const _component_SuccessFilled = resolveComponent("SuccessFilled"); const _component_el_card = resolveComponent("el-card"); return openBlock(), createElementBlock("div", _hoisted_1, [ createVNode(_component_el_card, { class: "callback-box" }, { default: withCtx(() => [ loading.value ? (openBlock(), createElementBlock("div", _hoisted_2, [ createVNode(_component_el_icon, { class: "is-loading", size: "48" }, { default: withCtx(() => [ createVNode(_component_Loading) ]), _: 1 }), _cache[1] || (_cache[1] = createBaseVNode("h2", null, "正在处理登录...", -1)), _cache[2] || (_cache[2] = createBaseVNode("p", null, "请稍候,系统正在验证您的身份", -1)) ])) : error.value ? (openBlock(), createElementBlock("div", _hoisted_3, [ createVNode(_component_el_icon, { size: "48", color: "#F56C6C" }, { default: withCtx(() => [ createVNode(_component_Warning) ]), _: 1 }), _cache[4] || (_cache[4] = createBaseVNode("h2", null, "登录失败", -1)), createBaseVNode("p", null, toDisplayString(error.value), 1), createVNode(_component_el_button, { type: "primary", onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$router.push("/login")) }, { default: withCtx(() => [..._cache[3] || (_cache[3] = [ createTextVNode(" 重新登录 ", -1) ])]), _: 1 }) ])) : (openBlock(), createElementBlock("div", _hoisted_4, [ createVNode(_component_el_icon, { size: "48", color: "#67C23A" }, { default: withCtx(() => [ createVNode(_component_SuccessFilled) ]), _: 1 }), _cache[5] || (_cache[5] = createBaseVNode("h2", null, "登录成功", -1)), _cache[6] || (_cache[6] = createBaseVNode("p", null, "正在跳转到系统首页...", -1)) ])) ]), _: 1 }) ]); }; } }); const AuthCallback_vue_vue_type_style_index_0_scoped_b75e7ee2_lang = ""; const AuthCallback = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-b75e7ee2"]]); export { AuthCallback as default }; //# sourceMappingURL=AuthCallback-dev.4480f579.js.map