import { v as defineComponent, c as computed, B as createElementBlock, C as createVNode, D as withCtx, aA as useRouter, aB as useRoute, ak as resolveComponent, y as openBlock, E as createBaseVNode, M as createTextVNode, u as unref, O as toDisplayString } from "./vue-test.7a51ac2d.js";
import { u as useAuthStore } from "./index-test.c1e2f623.js";
import { b as ElMessageBox, a as ElMessage } from "./element-test.6f17ea1d.js";
import { _ as _export_sfc } from "./_plugin-vue_export-helper-test.cc2b3d55.js";
import "./utils-test.79bb04fa.js";
const _hoisted_1 = { class: "dashboard" };
const _hoisted_2 = { class: "header-right" };
const _hoisted_3 = { class: "user-info" };
const _hoisted_4 = { class: "username" };
const _hoisted_5 = { class: "welcome-section" };
const _hoisted_6 = { class: "feature-grid" };
const _hoisted_7 = { class: "feature-content" };
const _hoisted_8 = { class: "feature-content" };
const _hoisted_9 = { class: "feature-content" };
const _hoisted_10 = { class: "info-content" };
const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "Dashboard",
  setup(__props) {
    const router = useRouter();
    const route = useRoute();
    const authStore = useAuthStore();
    const activeMenu = computed(() => route.path);
    const handleCommand = async (command) => {
      switch (command) {
        case "profile":
          ElMessage.info("个人资料功能开发中...");
          break;
        case "logout":
          try {
            await ElMessageBox.confirm("确定要退出登录吗？", "提示", {
              confirmButtonText: "确定",
              cancelButtonText: "取消",
              type: "warning"
            });
            await authStore.logout();
            ElMessage.success("已退出登录");
            router.push("/login");
          } catch (error) {
          }
          break;
      }
    };
    return (_ctx, _cache) => {
      const _component_el_avatar = resolveComponent("el-avatar");
      const _component_ArrowDown = resolveComponent("ArrowDown");
      const _component_el_icon = resolveComponent("el-icon");
      const _component_User = resolveComponent("User");
      const _component_el_dropdown_item = resolveComponent("el-dropdown-item");
      const _component_SwitchButton = resolveComponent("SwitchButton");
      const _component_el_dropdown_menu = resolveComponent("el-dropdown-menu");
      const _component_el_dropdown = resolveComponent("el-dropdown");
      const _component_el_header = resolveComponent("el-header");
      const _component_House = resolveComponent("House");
      const _component_el_menu_item = resolveComponent("el-menu-item");
      const _component_Grid = resolveComponent("Grid");
      const _component_Document = resolveComponent("Document");
      const _component_el_menu = resolveComponent("el-menu");
      const _component_el_aside = resolveComponent("el-aside");
      const _component_el_card = resolveComponent("el-card");
      const _component_el_divider = resolveComponent("el-divider");
      const _component_el_main = resolveComponent("el-main");
      const _component_el_container = resolveComponent("el-container");
      return openBlock(), createElementBlock("div", _hoisted_1, [
        createVNode(_component_el_container, null, {
          default: withCtx(() => [
            createVNode(_component_el_header, { class: "header" }, {
              default: withCtx(() => [
                _cache[4] || (_cache[4] = createBaseVNode("div", { class: "header-left" }, [
                  createBaseVNode("h1", null, "子系统示例")
                ], -1)),
                createBaseVNode("div", _hoisted_2, [
                  createVNode(_component_el_dropdown, { onCommand: handleCommand }, {
                    dropdown: withCtx(() => [
                      createVNode(_component_el_dropdown_menu, null, {
                        default: withCtx(() => [
                          createVNode(_component_el_dropdown_item, { command: "profile" }, {
                            default: withCtx(() => [
                              createVNode(_component_el_icon, null, {
                                default: withCtx(() => [
                                  createVNode(_component_User)
                                ]),
                                _: 1
                              }),
                              _cache[2] || (_cache[2] = createTextVNode(" 个人资料 ", -1))
                            ]),
                            _: 1
                          }),
                          createVNode(_component_el_dropdown_item, {
                            divided: "",
                            command: "logout"
                          }, {
                            default: withCtx(() => [
                              createVNode(_component_el_icon, null, {
                                default: withCtx(() => [
                                  createVNode(_component_SwitchButton)
                                ]),
                                _: 1
                              }),
                              _cache[3] || (_cache[3] = createTextVNode(" 退出登录 ", -1))
                            ]),
                            _: 1
                          })
                        ]),
                        _: 1
                      })
                    ]),
                    default: withCtx(() => {
                      var _a, _b;
                      return [
                        createBaseVNode("span", _hoisted_3, [
                          createVNode(_component_el_avatar, {
                            src: (_a = unref(authStore).user) == null ? void 0 : _a.avatar_url,
                            size: 32
                          }, {
                            default: withCtx(() => {
                              var _a2, _b2;
                              return [
                                createTextVNode(toDisplayString((_b2 = (_a2 = unref(authStore).user) == null ? void 0 : _a2.username) == null ? void 0 : _b2.charAt(0).toUpperCase()), 1)
                              ];
                            }),
                            _: 1
                          }, 8, ["src"]),
                          createBaseVNode("span", _hoisted_4, toDisplayString((_b = unref(authStore).user) == null ? void 0 : _b.username), 1),
                          createVNode(_component_el_icon, null, {
                            default: withCtx(() => [
                              createVNode(_component_ArrowDown)
                            ]),
                            _: 1
                          })
                        ])
                      ];
                    }),
                    _: 1
                  })
                ])
              ]),
              _: 1
            }),
            createVNode(_component_el_container, null, {
              default: withCtx(() => [
                createVNode(_component_el_aside, {
                  width: "200px",
                  class: "sidebar"
                }, {
                  default: withCtx(() => [
                    createVNode(_component_el_menu, {
                      "default-active": activeMenu.value,
                      class: "sidebar-menu",
                      router: ""
                    }, {
                      default: withCtx(() => [
                        createVNode(_component_el_menu_item, { index: "/dashboard" }, {
                          default: withCtx(() => [
                            createVNode(_component_el_icon, null, {
                              default: withCtx(() => [
                                createVNode(_component_House)
                              ]),
                              _: 1
                            }),
                            _cache[5] || (_cache[5] = createBaseVNode("span", null, "仪表盘", -1))
                          ]),
                          _: 1
                        }),
                        createVNode(_component_el_menu_item, { index: "/products" }, {
                          default: withCtx(() => [
                            createVNode(_component_el_icon, null, {
                              default: withCtx(() => [
                                createVNode(_component_Grid)
                              ]),
                              _: 1
                            }),
                            _cache[6] || (_cache[6] = createBaseVNode("span", null, "产品管理", -1))
                          ]),
                          _: 1
                        }),
                        createVNode(_component_el_menu_item, { index: "/orders" }, {
                          default: withCtx(() => [
                            createVNode(_component_el_icon, null, {
                              default: withCtx(() => [
                                createVNode(_component_Document)
                              ]),
                              _: 1
                            }),
                            _cache[7] || (_cache[7] = createBaseVNode("span", null, "订单管理", -1))
                          ]),
                          _: 1
                        })
                      ]),
                      _: 1
                    }, 8, ["default-active"])
                  ]),
                  _: 1
                }),
                createVNode(_component_el_main, { class: "main-content" }, {
                  default: withCtx(() => {
                    var _a, _b;
                    return [
                      createBaseVNode("div", _hoisted_5, [
                        _cache[8] || (_cache[8] = createBaseVNode("h2", null, "欢迎使用子系统示例", -1)),
                        _cache[9] || (_cache[9] = createBaseVNode("p", null, "这是一个集成了SSO认证的子系统示例", -1)),
                        createBaseVNode("p", null, "当前用户：" + toDisplayString((_a = unref(authStore).user) == null ? void 0 : _a.username) + " (" + toDisplayString((_b = unref(authStore).user) == null ? void 0 : _b.email) + ")", 1)
                      ]),
                      createBaseVNode("div", _hoisted_6, [
                        createVNode(_component_el_card, {
                          class: "feature-card",
                          onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$router.push("/products"))
                        }, {
                          default: withCtx(() => [
                            createBaseVNode("div", _hoisted_7, [
                              createVNode(_component_el_icon, {
                                size: "48",
                                color: "#409EFF"
                              }, {
                                default: withCtx(() => [
                                  createVNode(_component_Grid)
                                ]),
                                _: 1
                              }),
                              _cache[10] || (_cache[10] = createBaseVNode("h3", null, "产品管理", -1)),
                              _cache[11] || (_cache[11] = createBaseVNode("p", null, "管理系统中的产品信息", -1))
                            ])
                          ]),
                          _: 1
                        }),
                        createVNode(_component_el_card, {
                          class: "feature-card",
                          onClick: _cache[1] || (_cache[1] = ($event) => _ctx.$router.push("/orders"))
                        }, {
                          default: withCtx(() => [
                            createBaseVNode("div", _hoisted_8, [
                              createVNode(_component_el_icon, {
                                size: "48",
                                color: "#67C23A"
                              }, {
                                default: withCtx(() => [
                                  createVNode(_component_Document)
                                ]),
                                _: 1
                              }),
                              _cache[12] || (_cache[12] = createBaseVNode("h3", null, "订单管理", -1)),
                              _cache[13] || (_cache[13] = createBaseVNode("p", null, "查看和管理用户订单", -1))
                            ])
                          ]),
                          _: 1
                        }),
                        createVNode(_component_el_card, { class: "feature-card" }, {
                          default: withCtx(() => [
                            createBaseVNode("div", _hoisted_9, [
                              createVNode(_component_el_icon, {
                                size: "48",
                                color: "#E6A23C"
                              }, {
                                default: withCtx(() => [
                                  createVNode(_component_User)
                                ]),
                                _: 1
                              }),
                              _cache[14] || (_cache[14] = createBaseVNode("h3", null, "用户中心", -1)),
                              _cache[15] || (_cache[15] = createBaseVNode("p", null, "管理个人信息和设置", -1))
                            ])
                          ]),
                          _: 1
                        })
                      ]),
                      createVNode(_component_el_card, { class: "info-card" }, {
                        header: withCtx(() => [..._cache[16] || (_cache[16] = [
                          createBaseVNode("span", null, "SSO集成说明", -1)
                        ])]),
                        default: withCtx(() => [
                          createBaseVNode("div", _hoisted_10, [
                            _cache[17] || (_cache[17] = createBaseVNode("p", null, "✅ 已成功集成SSO单点登录", -1)),
                            _cache[18] || (_cache[18] = createBaseVNode("p", null, "✅ 用户信息自动同步", -1)),
                            _cache[19] || (_cache[19] = createBaseVNode("p", null, "✅ 统一认证和授权", -1)),
                            _cache[20] || (_cache[20] = createBaseVNode("p", null, "✅ 安全的令牌验证", -1)),
                            createVNode(_component_el_divider),
                            _cache[21] || (_cache[21] = createBaseVNode("h4", null, "技术特性：", -1)),
                            _cache[22] || (_cache[22] = createBaseVNode("ul", null, [
                              createBaseVNode("li", null, "OAuth 2.0 授权码模式"),
                              createBaseVNode("li", null, "JWT令牌验证"),
                              createBaseVNode("li", null, "自动令牌刷新"),
                              createBaseVNode("li", null, "统一登出")
                            ], -1))
                          ])
                        ]),
                        _: 1
                      })
                    ];
                  }),
                  _: 1
                })
              ]),
              _: 1
            })
          ]),
          _: 1
        })
      ]);
    };
  }
});
const Dashboard_vue_vue_type_style_index_0_scoped_079ba3f8_lang = "";
const Dashboard = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-079ba3f8"]]);
export {
  Dashboard as default
};
//# sourceMappingURL=Dashboard-test.593d85a3.js.map
