Dashboard-dev.cae2ce38.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. 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-dev.7a51ac2d.js";
  2. import { u as useAuthStore } from "./index-dev.bb5c7162.js";
  3. import { b as ElMessageBox, a as ElMessage } from "./element-dev.26a170ea.js";
  4. import { _ as _export_sfc } from "./_plugin-vue_export-helper-dev.cc2b3d55.js";
  5. import "./utils-dev.be08a1a2.js";
  6. const _hoisted_1 = { class: "dashboard" };
  7. const _hoisted_2 = { class: "header-right" };
  8. const _hoisted_3 = { class: "user-info" };
  9. const _hoisted_4 = { class: "username" };
  10. const _hoisted_5 = { class: "welcome-section" };
  11. const _hoisted_6 = { class: "feature-grid" };
  12. const _hoisted_7 = { class: "feature-content" };
  13. const _hoisted_8 = { class: "feature-content" };
  14. const _hoisted_9 = { class: "feature-content" };
  15. const _hoisted_10 = { class: "info-content" };
  16. const _sfc_main = /* @__PURE__ */ defineComponent({
  17. __name: "Dashboard",
  18. setup(__props) {
  19. const router = useRouter();
  20. const route = useRoute();
  21. const authStore = useAuthStore();
  22. const activeMenu = computed(() => route.path);
  23. const handleCommand = async (command) => {
  24. switch (command) {
  25. case "profile":
  26. ElMessage.info("个人资料功能开发中...");
  27. break;
  28. case "logout":
  29. try {
  30. await ElMessageBox.confirm("确定要退出登录吗?", "提示", {
  31. confirmButtonText: "确定",
  32. cancelButtonText: "取消",
  33. type: "warning"
  34. });
  35. await authStore.logout();
  36. ElMessage.success("已退出登录");
  37. router.push("/login");
  38. } catch (error) {
  39. }
  40. break;
  41. }
  42. };
  43. return (_ctx, _cache) => {
  44. const _component_el_avatar = resolveComponent("el-avatar");
  45. const _component_ArrowDown = resolveComponent("ArrowDown");
  46. const _component_el_icon = resolveComponent("el-icon");
  47. const _component_User = resolveComponent("User");
  48. const _component_el_dropdown_item = resolveComponent("el-dropdown-item");
  49. const _component_SwitchButton = resolveComponent("SwitchButton");
  50. const _component_el_dropdown_menu = resolveComponent("el-dropdown-menu");
  51. const _component_el_dropdown = resolveComponent("el-dropdown");
  52. const _component_el_header = resolveComponent("el-header");
  53. const _component_House = resolveComponent("House");
  54. const _component_el_menu_item = resolveComponent("el-menu-item");
  55. const _component_Grid = resolveComponent("Grid");
  56. const _component_Document = resolveComponent("Document");
  57. const _component_el_menu = resolveComponent("el-menu");
  58. const _component_el_aside = resolveComponent("el-aside");
  59. const _component_el_card = resolveComponent("el-card");
  60. const _component_el_divider = resolveComponent("el-divider");
  61. const _component_el_main = resolveComponent("el-main");
  62. const _component_el_container = resolveComponent("el-container");
  63. return openBlock(), createElementBlock("div", _hoisted_1, [
  64. createVNode(_component_el_container, null, {
  65. default: withCtx(() => [
  66. createVNode(_component_el_header, { class: "header" }, {
  67. default: withCtx(() => [
  68. _cache[4] || (_cache[4] = createBaseVNode("div", { class: "header-left" }, [
  69. createBaseVNode("h1", null, "子系统示例")
  70. ], -1)),
  71. createBaseVNode("div", _hoisted_2, [
  72. createVNode(_component_el_dropdown, { onCommand: handleCommand }, {
  73. dropdown: withCtx(() => [
  74. createVNode(_component_el_dropdown_menu, null, {
  75. default: withCtx(() => [
  76. createVNode(_component_el_dropdown_item, { command: "profile" }, {
  77. default: withCtx(() => [
  78. createVNode(_component_el_icon, null, {
  79. default: withCtx(() => [
  80. createVNode(_component_User)
  81. ]),
  82. _: 1
  83. }),
  84. _cache[2] || (_cache[2] = createTextVNode(" 个人资料 ", -1))
  85. ]),
  86. _: 1
  87. }),
  88. createVNode(_component_el_dropdown_item, {
  89. divided: "",
  90. command: "logout"
  91. }, {
  92. default: withCtx(() => [
  93. createVNode(_component_el_icon, null, {
  94. default: withCtx(() => [
  95. createVNode(_component_SwitchButton)
  96. ]),
  97. _: 1
  98. }),
  99. _cache[3] || (_cache[3] = createTextVNode(" 退出登录 ", -1))
  100. ]),
  101. _: 1
  102. })
  103. ]),
  104. _: 1
  105. })
  106. ]),
  107. default: withCtx(() => {
  108. var _a, _b;
  109. return [
  110. createBaseVNode("span", _hoisted_3, [
  111. createVNode(_component_el_avatar, {
  112. src: (_a = unref(authStore).user) == null ? void 0 : _a.avatar_url,
  113. size: 32
  114. }, {
  115. default: withCtx(() => {
  116. var _a2, _b2;
  117. return [
  118. createTextVNode(toDisplayString((_b2 = (_a2 = unref(authStore).user) == null ? void 0 : _a2.username) == null ? void 0 : _b2.charAt(0).toUpperCase()), 1)
  119. ];
  120. }),
  121. _: 1
  122. }, 8, ["src"]),
  123. createBaseVNode("span", _hoisted_4, toDisplayString((_b = unref(authStore).user) == null ? void 0 : _b.username), 1),
  124. createVNode(_component_el_icon, null, {
  125. default: withCtx(() => [
  126. createVNode(_component_ArrowDown)
  127. ]),
  128. _: 1
  129. })
  130. ])
  131. ];
  132. }),
  133. _: 1
  134. })
  135. ])
  136. ]),
  137. _: 1
  138. }),
  139. createVNode(_component_el_container, null, {
  140. default: withCtx(() => [
  141. createVNode(_component_el_aside, {
  142. width: "200px",
  143. class: "sidebar"
  144. }, {
  145. default: withCtx(() => [
  146. createVNode(_component_el_menu, {
  147. "default-active": activeMenu.value,
  148. class: "sidebar-menu",
  149. router: ""
  150. }, {
  151. default: withCtx(() => [
  152. createVNode(_component_el_menu_item, { index: "/dashboard" }, {
  153. default: withCtx(() => [
  154. createVNode(_component_el_icon, null, {
  155. default: withCtx(() => [
  156. createVNode(_component_House)
  157. ]),
  158. _: 1
  159. }),
  160. _cache[5] || (_cache[5] = createBaseVNode("span", null, "仪表盘", -1))
  161. ]),
  162. _: 1
  163. }),
  164. createVNode(_component_el_menu_item, { index: "/products" }, {
  165. default: withCtx(() => [
  166. createVNode(_component_el_icon, null, {
  167. default: withCtx(() => [
  168. createVNode(_component_Grid)
  169. ]),
  170. _: 1
  171. }),
  172. _cache[6] || (_cache[6] = createBaseVNode("span", null, "产品管理", -1))
  173. ]),
  174. _: 1
  175. }),
  176. createVNode(_component_el_menu_item, { index: "/orders" }, {
  177. default: withCtx(() => [
  178. createVNode(_component_el_icon, null, {
  179. default: withCtx(() => [
  180. createVNode(_component_Document)
  181. ]),
  182. _: 1
  183. }),
  184. _cache[7] || (_cache[7] = createBaseVNode("span", null, "订单管理", -1))
  185. ]),
  186. _: 1
  187. })
  188. ]),
  189. _: 1
  190. }, 8, ["default-active"])
  191. ]),
  192. _: 1
  193. }),
  194. createVNode(_component_el_main, { class: "main-content" }, {
  195. default: withCtx(() => {
  196. var _a, _b;
  197. return [
  198. createBaseVNode("div", _hoisted_5, [
  199. _cache[8] || (_cache[8] = createBaseVNode("h2", null, "欢迎使用子系统示例", -1)),
  200. _cache[9] || (_cache[9] = createBaseVNode("p", null, "这是一个集成了SSO认证的子系统示例", -1)),
  201. createBaseVNode("p", null, "当前用户:" + toDisplayString((_a = unref(authStore).user) == null ? void 0 : _a.username) + " (" + toDisplayString((_b = unref(authStore).user) == null ? void 0 : _b.email) + ")", 1)
  202. ]),
  203. createBaseVNode("div", _hoisted_6, [
  204. createVNode(_component_el_card, {
  205. class: "feature-card",
  206. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$router.push("/products"))
  207. }, {
  208. default: withCtx(() => [
  209. createBaseVNode("div", _hoisted_7, [
  210. createVNode(_component_el_icon, {
  211. size: "48",
  212. color: "#409EFF"
  213. }, {
  214. default: withCtx(() => [
  215. createVNode(_component_Grid)
  216. ]),
  217. _: 1
  218. }),
  219. _cache[10] || (_cache[10] = createBaseVNode("h3", null, "产品管理", -1)),
  220. _cache[11] || (_cache[11] = createBaseVNode("p", null, "管理系统中的产品信息", -1))
  221. ])
  222. ]),
  223. _: 1
  224. }),
  225. createVNode(_component_el_card, {
  226. class: "feature-card",
  227. onClick: _cache[1] || (_cache[1] = ($event) => _ctx.$router.push("/orders"))
  228. }, {
  229. default: withCtx(() => [
  230. createBaseVNode("div", _hoisted_8, [
  231. createVNode(_component_el_icon, {
  232. size: "48",
  233. color: "#67C23A"
  234. }, {
  235. default: withCtx(() => [
  236. createVNode(_component_Document)
  237. ]),
  238. _: 1
  239. }),
  240. _cache[12] || (_cache[12] = createBaseVNode("h3", null, "订单管理", -1)),
  241. _cache[13] || (_cache[13] = createBaseVNode("p", null, "查看和管理用户订单", -1))
  242. ])
  243. ]),
  244. _: 1
  245. }),
  246. createVNode(_component_el_card, { class: "feature-card" }, {
  247. default: withCtx(() => [
  248. createBaseVNode("div", _hoisted_9, [
  249. createVNode(_component_el_icon, {
  250. size: "48",
  251. color: "#E6A23C"
  252. }, {
  253. default: withCtx(() => [
  254. createVNode(_component_User)
  255. ]),
  256. _: 1
  257. }),
  258. _cache[14] || (_cache[14] = createBaseVNode("h3", null, "用户中心", -1)),
  259. _cache[15] || (_cache[15] = createBaseVNode("p", null, "管理个人信息和设置", -1))
  260. ])
  261. ]),
  262. _: 1
  263. })
  264. ]),
  265. createVNode(_component_el_card, { class: "info-card" }, {
  266. header: withCtx(() => [..._cache[16] || (_cache[16] = [
  267. createBaseVNode("span", null, "SSO集成说明", -1)
  268. ])]),
  269. default: withCtx(() => [
  270. createBaseVNode("div", _hoisted_10, [
  271. _cache[17] || (_cache[17] = createBaseVNode("p", null, "✅ 已成功集成SSO单点登录", -1)),
  272. _cache[18] || (_cache[18] = createBaseVNode("p", null, "✅ 用户信息自动同步", -1)),
  273. _cache[19] || (_cache[19] = createBaseVNode("p", null, "✅ 统一认证和授权", -1)),
  274. _cache[20] || (_cache[20] = createBaseVNode("p", null, "✅ 安全的令牌验证", -1)),
  275. createVNode(_component_el_divider),
  276. _cache[21] || (_cache[21] = createBaseVNode("h4", null, "技术特性:", -1)),
  277. _cache[22] || (_cache[22] = createBaseVNode("ul", null, [
  278. createBaseVNode("li", null, "OAuth 2.0 授权码模式"),
  279. createBaseVNode("li", null, "JWT令牌验证"),
  280. createBaseVNode("li", null, "自动令牌刷新"),
  281. createBaseVNode("li", null, "统一登出")
  282. ], -1))
  283. ])
  284. ]),
  285. _: 1
  286. })
  287. ];
  288. }),
  289. _: 1
  290. })
  291. ]),
  292. _: 1
  293. })
  294. ]),
  295. _: 1
  296. })
  297. ]);
  298. };
  299. }
  300. });
  301. const Dashboard_vue_vue_type_style_index_0_scoped_079ba3f8_lang = "";
  302. const Dashboard = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-079ba3f8"]]);
  303. export {
  304. Dashboard as default
  305. };
  306. //# sourceMappingURL=Dashboard-dev.cae2ce38.js.map