const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["js/index.DmwdN1Z7.js","js/.pnpm.BW3P1y8f.js","css/.pnpm.DodhYl8G.css","js/element-plus.CkEW9frc.js","css/element-plus.B-meKFhT.css","js/_plugin-vue_export-helper.1tPrXgE0.js","js/index.vue_vue_type_script_setup_true_lang.BmYCVfK2.js","js/dateUtil.SHphbRyf.js","js/ConfigInfoDrawer.BaOb71oS.js","js/SingleImageUpload.CngBsWfh.js","css/SingleImageUpload.Cg7fJwgk.css","js/codemirror.CvJAcn2d.js","css/codemirror.DCcVQTiv.css","css/ConfigInfoDrawer.7ibcyrlA.css","js/quickStartManager.Dn9BdP3l.js","js/index.DZZZOFI8.js","css/index.CpzkiDIY.css","js/index.Df6e1nWk.js","js/index.DmV9p5XN.js","js/index.vue_vue_type_script_setup_true_lang.BdXauzXx.js","css/index.jrO8Mc14.css","css/index.CmSXqhBD.css","js/401.R1wHF71k.js","css/401.BWWG0azH.css","js/404.oeqooIKq.js","css/404.8p-1_j-l.css","js/500.XL5EBMGm.js","js/index.WOSfjnwM.js","js/index.vue_vue_type_script_setup_true_lang.DN-P1Gi6.js","js/echarts.Cg_Ec8L-.js","js/common.ySZAMJjg.js","css/index.CYAq-Xnm.css","js/profile.DeJNaI1M.js","css/profile.BUOhcTYO.css","js/InternalApp.BwMxktXz.js","css/InternalApp.ChwezFNV.css","js/workplace.rWkFN-uT.js","css/workplace.BdWwhVD7.css","js/index.oTkWBrWl.js","css/index.DgJP36ao.css","js/index.C-FwI7eF.js","js/ai_config.BnEV7HHL.js","css/index.kS1UTmbr.css","js/index.Cn8BFTsV.js","js/knowledge_base.CHSLq1jf.js","css/index.DdTSKf-r.css","js/JobLogDrawer.DF46FHsP.js","js/JobLogDrawer.vue_vue_type_script_setup_true_lang.ClGD6wLS.js","js/index.fgd49PES.js","css/index.a790i8oj.css","js/index.Cu5O_6Z1.js","css/index.BMtNdZF0.css","js/ExportModal.vue_vue_type_script_setup_true_lang.Bok1HJuH.js","js/exceljs.CkFT-P7Q.js","js/index.07n6FPd0.js","js/UserTableSelect.vue_vue_type_script_setup_true_lang.7Fjc3bJT.js","css/UserTableSelect.CFaGLLvG.css","css/index.CpyXSBhL.css","js/index.DX25MiWJ.js","css/index.CPAJv1z6.css","js/index.58109uec.js","css/index.C2OQ608c.css","js/CustomNode.DH3hMbi5.js","css/CustomNode.DA-yYUEN.css","js/index.C0CAvyUI.js","css/index.djkxxPgo.css","js/index.DqXkPevt.js","js/index.A3_mN65w.js","css/index.BRm3mI01.css","js/index.BNtoswJC.js","js/index.zGZzNPwc.js","js/ImportModal.vue_vue_type_script_setup_true_lang.DYvH1hkB.js","js/index.BR9biJsE.js","js/menu.uy9JHUjy.js","js/menu.enum.Q9hatFRE.js","js/index.DWKHrtNR.js","css/index.CGtVAHuU.css","js/index.CJFXhG7y.js","js/index.vue_vue_type_script_setup_true_lang.DSV4pgC3.js","js/index.BfYcGZ4Z.js","css/index.CLpCLG21.css","js/index.BYkCj64N.js","js/Login.C_oFk9qn.js","css/Login.DhaQY825.css","js/Register.OcLvSvcl.js","js/ResetPwd.D74e_hLH.js","js/index copy.DWRMaWNG.js","css/index copy.D3Cky0Rx.css","js/index._Rs0xG0B.js","js/dept.BQxPXXgN.js","js/DataDrawer.DI2NmdEo.js","js/DataDrawer.vue_vue_type_script_setup_true_lang.hRKiSPvC.js","js/index.GcX9rZiR.js","js/index.Crjb_SsD.js","css/index.BrZoivlL.css","js/index.vuz2VKc_.js","css/index.phVN4Vqd.css","js/index.aqqxijpF.js","js/wangeditor.XL_xTBwo.js","css/wangeditor.CZV1BwWe.css","js/index.LiV4SBeL.js","js/index.BOVbbDxl.js","js/position.QXDy5vCW.js","js/PermissonDrawer.CbjYaZxw.js","js/PermissonDrawer.vue_vue_type_script_setup_true_lang.CdjriRtw.js","js/role.B8EtFSdB.js","js/index.UF9Oowpt.js","js/DeptTree.BoDatJLk.js","js/DeptTree.vue_vue_type_script_setup_true_lang.DJ6-tBs5.js","js/UserTableSelect.DRlBq5Na.js","js/index.C7h5-SaY.js","js/index.Bop-u9q0.js","css/index.BPvT6D4L.css","js/index.C9fbkg-5.js","css/index.C8VmFyXr.css","js/index.B_sJyFIz.js","js/index.C41JgKdI.js","js/index.BTd1jIIZ.js","js/yifan_membership.CCYhkrJx.js","css/index.krgoY6jY.css","js/index.BhWri54q.js","css/index.BFc7CNRb.css","js/index.CWXFQmKt.js","css/index.OQMzYR5D.css","js/index.BxJURNFu.js","js/index.pfmZwPPm.js","js/index.CNHnJSL5.js","js/index.BInwOfG7.js","css/index.s63UPNq2.css"])))=>i.map(i=>d[i]); import { dW as defineStore, dX as useStorage, ak as reactive, j as computed, m as watch, r as ref, dY as useRouter, dZ as useRoute, d_ as createRouter, d$ as createWebHashHistory, e0 as axios, e1 as qs, e2 as createPinia, e3 as src_default, J as defineComponent, aO as resolveComponent, S as openBlock, T as createBlock, a0 as withCtx, $ as createVNode, o as unref, e4 as createI18n, e5 as NProgress, bx as createApp } from "./.pnpm.BW3P1y8f.js"; import { e as en_default, z as zh_cn_default, E as ElMessage, a as ElNotification, b as ElWatermark, c as ElConfigProvider, d as ElementPlusIconsVue, f as element_plus_default } from "./element-plus.CkEW9frc.js"; import { W as We } from "./codemirror.CvJAcn2d.js"; (function polyfill() { const relList = document.createElement("link").relList; if (relList && relList.supports && relList.supports("modulepreload")) { return; } for (const link of document.querySelectorAll('link[rel="modulepreload"]')) { processPreload(link); } new MutationObserver((mutations) => { for (const mutation of mutations) { if (mutation.type !== "childList") { continue; } for (const node of mutation.addedNodes) { if (node.tagName === "LINK" && node.rel === "modulepreload") processPreload(node); } } }).observe(document, { childList: true, subtree: true }); function getFetchOpts(link) { const fetchOpts = {}; if (link.integrity) fetchOpts.integrity = link.integrity; if (link.referrerPolicy) fetchOpts.referrerPolicy = link.referrerPolicy; if (link.crossOrigin === "use-credentials") fetchOpts.credentials = "include"; else if (link.crossOrigin === "anonymous") fetchOpts.credentials = "omit"; else fetchOpts.credentials = "same-origin"; return fetchOpts; } function processPreload(link) { if (link.ep) return; link.ep = true; const fetchOpts = getFetchOpts(link); fetch(link.href, fetchOpts); } })(); var ResultEnum = /* @__PURE__ */ ((ResultEnum2) => { ResultEnum2[ResultEnum2["SUCCESS"] = 0] = "SUCCESS"; ResultEnum2[ResultEnum2["ERROR"] = 1] = "ERROR"; ResultEnum2[ResultEnum2["EXCEPTION"] = -1] = "EXCEPTION"; ResultEnum2[ResultEnum2["UNAUTHORIZED"] = 10403] = "UNAUTHORIZED"; ResultEnum2[ResultEnum2["TOKEN_EXPIRED"] = 10401] = "TOKEN_EXPIRED"; return ResultEnum2; })(ResultEnum || {}); var LayoutMode = /* @__PURE__ */ ((LayoutMode2) => { LayoutMode2["LEFT"] = "left"; LayoutMode2["TOP"] = "top"; LayoutMode2["MIX"] = "mix"; return LayoutMode2; })(LayoutMode || {}); var SidebarStatus = /* @__PURE__ */ ((SidebarStatus2) => { SidebarStatus2["OPENED"] = "opened"; SidebarStatus2["CLOSED"] = "closed"; return SidebarStatus2; })(SidebarStatus || {}); var ComponentSize = /* @__PURE__ */ ((ComponentSize2) => { ComponentSize2["DEFAULT"] = "default"; ComponentSize2["LARGE"] = "large"; ComponentSize2["SMALL"] = "small"; return ComponentSize2; })(ComponentSize || {}); var ThemeMode = /* @__PURE__ */ ((ThemeMode2) => { ThemeMode2["LIGHT"] = "light"; ThemeMode2["DARK"] = "dark"; ThemeMode2["AUTO"] = "auto"; return ThemeMode2; })(ThemeMode || {}); var SidebarColor = /* @__PURE__ */ ((SidebarColor2) => { SidebarColor2["CLASSIC_BLUE"] = "classic-blue"; SidebarColor2["MINIMAL_WHITE"] = "minimal-white"; return SidebarColor2; })(SidebarColor || {}); var LanguageEnum = /* @__PURE__ */ ((LanguageEnum2) => { LanguageEnum2["ZH_CN"] = "zh-cn"; LanguageEnum2["EN"] = "en"; return LanguageEnum2; })(LanguageEnum || {}); var DeviceEnum = /* @__PURE__ */ ((DeviceEnum2) => { DeviceEnum2["DESKTOP"] = "desktop"; DeviceEnum2["MOBILE"] = "mobile"; return DeviceEnum2; })(DeviceEnum || {}); var define_APP_INFO_default = { pkg: { name: "fastapiadmin" } }; const { pkg } = define_APP_INFO_default; const mediaQueryList = window.matchMedia("(prefers-color-scheme: dark)"); const defaultSettings = { // 是否显示设置按钮 showSettings: false, // 桌面端工具项单独控制 showMenuSearch: true, showFullscreen: true, showSizeSelect: true, showLangSelect: true, // 是否显示通知 showNotification: true, // 是否显示标签视图 showTagsView: true, // 是否显示应用Logo showAppLogo: true, // 布局方式,默认为左侧布局 layout: LayoutMode.LEFT, // 主题,根据操作系统的色彩方案自动选择 theme: mediaQueryList.matches ? ThemeMode.DARK : ThemeMode.LIGHT, // 组件大小 default | medium | small | large size: ComponentSize.DEFAULT, // 语言 language: LanguageEnum.ZH_CN, // 主题颜色 - 修改此值时需同步修改 src/styles/variables.scss themeColor: "#4080FF", // 是否显示水印 (修改默认开启水印) showWatermark: true, // 水印内容 watermarkContent: pkg.name, // 侧边栏配色方案 sidebarColorScheme: SidebarColor.CLASSIC_BLUE, // 项目引导 guideVisible: false, /** 是否启动引导 */ showGuide: true }; const themeColorPresets = [ // === 精选常用颜色 - 多样化色系 === "#4080FF", // Arco Design 蓝 - 现代感强 "#52C41A", // 成功绿 - 活力清新 "#722ED1", // 优雅紫 - 高端大气 "#FA8C16", // 活力橙 - 温暖友好 "#13C2C2", // 青色 - 科技感 "#F5222D", // 警示红 - 醒目强烈 "#EB2F96", // 品红 - 时尚个性 "#EC4899", // 玫瑰粉 - 浪漫温馨 "#10B981", // 翠绿色 - 清新自然 // === 蓝色系 - 科技与专业 === "#409EFF", // Element Plus 蓝 - 清新自然 "#2F54EB", // 深蓝 - 稳重专业 "#1E40AF", // 深蓝色 - 商务精英 "#1D4ED8", // 皇家蓝 - 高端商务 // === 绿色系 - 自然与活力 === "#10B981", // 翠绿色 - 清新自然 "#059669", // 森林绿 - 生态环保 "#16A34A", // 草绿色 - 健康活力 "#15803D", // 深绿色 - 稳重大气 // === 紫色系 - 创意与优雅 === "#7C3AED", // 紫罗兰 - 创意无限 "#8B5CF6", // 浅紫色 - 时尚现代 "#6D28D9", // 深紫色 - 神秘高端 "#5B21B6", // 皇家紫 - 王者风范 // === 橙色系 - 温暖与活力 === "#F97316", // 火橙色 - 热情奔放 "#EA580C", // 深橙色 - 阳光活力 "#DC2626", // 珊瑚红 - 温暖亲切 // === 青色系 - 科技与清新 === "#0891B2", // 天蓝色 - 清新自然 "#0E7490", // 深青色 - 专业科技 "#06B6D4", // 青蓝色 - 海洋清新 // === 红色系 - 激情与警示 === "#DC2626", // 猩红色 - 激情四射 "#B91C1C", // 深红色 - 庄重严肃 // === 粉色系 - 温柔与时尚 === "#EC4899", // 玫瑰粉 - 浪漫温馨 "#F472B6", // 浅粉色 - 柔美可爱 // === 灰色系 - 简约与现代 === "#6B7280", // 经典灰 - 简约现代 "#4B5563", // 深灰色 - 商务专业 "#374151" // 石板灰 - 高端商务 ]; const useAppStore = defineStore("app", () => { const device = useStorage("device", DeviceEnum.DESKTOP); const size = useStorage("size", defaultSettings.size); const language = useStorage("language", defaultSettings.language); const sidebarStatus = useStorage("sidebarStatus", SidebarStatus.CLOSED); const sidebar = reactive({ opened: sidebarStatus.value === SidebarStatus.OPENED, withoutAnimation: false }); const activeTopMenuPath = useStorage("activeTopMenuPath", ""); const guideVisible = useStorage("guideVisible", defaultSettings.guideVisible); const locale = computed(() => { if ((language == null ? void 0 : language.value) == "en") { return en_default; } else { return zh_cn_default; } }); function toggleSidebar() { sidebar.opened = !sidebar.opened; sidebarStatus.value = sidebar.opened ? SidebarStatus.OPENED : SidebarStatus.CLOSED; } function closeSideBar() { sidebar.opened = false; sidebarStatus.value = SidebarStatus.CLOSED; } function openSideBar() { sidebar.opened = true; sidebarStatus.value = SidebarStatus.OPENED; } function toggleDevice(val) { device.value = val; } function changeSize(val) { size.value = val; } function changeLanguage(val) { language.value = val; } function activeTopMenu(val) { activeTopMenuPath.value = val; } function showGuide(val) { guideVisible.value = val; } return { device, sidebar, language, locale, size, activeTopMenu, toggleDevice, showGuide, changeSize, changeLanguage, toggleSidebar, closeSideBar, openSideBar, activeTopMenuPath, guideVisible }; }); function useAppStoreHook() { return useAppStore(store); } function hexToRgb(hex) { const bigint = parseInt(hex.slice(1), 16); return [bigint >> 16 & 255, bigint >> 8 & 255, bigint & 255]; } function rgbToHex(r, g, b) { return `#${((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1)}`; } function getDarkColor(color, level) { const rgb = hexToRgb(color); for (let i = 0; i < 3; i++) rgb[i] = Math.round(20.5 * level + rgb[i] * (1 - level)); return rgbToHex(rgb[0], rgb[1], rgb[2]); } const getLightColor = (color, level) => { const rgb = hexToRgb(color); for (let i = 0; i < 3; i++) rgb[i] = Math.round(255 * level + rgb[i] * (1 - level)); return rgbToHex(rgb[0], rgb[1], rgb[2]); }; function generateThemeColors(primary, theme) { const colors = { primary }; for (let i = 1; i <= 9; i++) { colors[`primary-light-${i}`] = theme === ThemeMode.LIGHT ? `${getLightColor(primary, i / 10)}` : `${getDarkColor(primary, i / 10)}`; } colors["primary-dark-2"] = theme === ThemeMode.LIGHT ? `${getLightColor(primary, 0.2)}` : `${getDarkColor(primary, 0.3)}`; return colors; } function applyTheme(colors) { const el = document.documentElement; Object.entries(colors).forEach(([key, value]) => { el.style.setProperty(`--el-color-${key}`, value); }); requestAnimationFrame(() => { el.style.setProperty("--theme-update-trigger", Date.now().toString()); }); } function toggleDarkMode(isDark) { if (isDark) { document.documentElement.classList.add(ThemeMode.DARK); } else { document.documentElement.classList.remove(ThemeMode.DARK); } } function toggleSidebarColor(isBuleSidebar) { if (isBuleSidebar) { document.documentElement.classList.add("sidebar-color-blue"); } else { document.documentElement.classList.remove("sidebar-color-blue"); } } const ACCESS_TOKEN_KEY = "access_token"; const REFRESH_TOKEN_KEY = "refresh_token"; const REMEMBER_ME_KEY = "remember_me"; const SHOW_TAGS_VIEW_KEY = "showTagsView"; const SHOW_APP_LOGO_KEY = "showAppLogo"; const SHOW_WATERMARK_KEY = "showWatermark"; const SHOW_SETTINGS_KEY = "showSettings"; const SHOW_MENU_SEARCH_KEY = "showMenuSearch"; const SHOW_FULLSCREEN_KEY = "showFullscreen"; const SHOW_SIZE_SELECT_KEY = "showSizeSelect"; const SHOW_LANG_SELECT_KEY = "showLangSelect"; const SHOW_NOTIFICATION_KEY = "showNotification"; const SHOW_GUIDE_KEY = "showGuide"; const LAYOUT_KEY = "layout"; const SIDEBAR_COLOR_SCHEME_KEY = "sidebarColorScheme"; const THEME_KEY = "theme"; const THEME_COLOR_KEY = "themeColor"; const ROLE_ROOT = "ADMIN"; const AUTH_KEYS = { ACCESS_TOKEN: ACCESS_TOKEN_KEY, REFRESH_TOKEN: REFRESH_TOKEN_KEY, REMEMBER_ME: REMEMBER_ME_KEY }; const SETTINGS_KEYS = { SHOW_TAGS_VIEW: SHOW_TAGS_VIEW_KEY, SHOW_APP_LOGO: SHOW_APP_LOGO_KEY, SHOW_WATERMARK: SHOW_WATERMARK_KEY, SHOW_SETTINGS: SHOW_SETTINGS_KEY, SHOW_MENU_SEARCH: SHOW_MENU_SEARCH_KEY, SHOW_FULLSCREEN: SHOW_FULLSCREEN_KEY, SHOW_SIZE_SELECT: SHOW_SIZE_SELECT_KEY, SHOW_LANG_SELECT: SHOW_LANG_SELECT_KEY, SHOW_NOTIFICATION: SHOW_NOTIFICATION_KEY, SHOW_GUIDE: SHOW_GUIDE_KEY, SIDEBAR_COLOR_SCHEME: SIDEBAR_COLOR_SCHEME_KEY, LAYOUT: LAYOUT_KEY, THEME_COLOR: THEME_COLOR_KEY, THEME: THEME_KEY }; const useSettingsStore = defineStore("setting", () => { const settingsVisible = ref(false); const showTagsView = useStorage( SETTINGS_KEYS.SHOW_TAGS_VIEW, defaultSettings.showTagsView ); const showAppLogo = useStorage(SETTINGS_KEYS.SHOW_APP_LOGO, defaultSettings.showAppLogo); const showWatermark = useStorage( SETTINGS_KEYS.SHOW_WATERMARK, defaultSettings.showWatermark ); const showSettings = useStorage( SETTINGS_KEYS.SHOW_SETTINGS, defaultSettings.showSettings ); const showGuide = useStorage(SETTINGS_KEYS.SHOW_GUIDE, defaultSettings.showGuide); const showMenuSearch = useStorage( SETTINGS_KEYS.SHOW_MENU_SEARCH, defaultSettings.showMenuSearch ); const showFullscreen = useStorage( SETTINGS_KEYS.SHOW_FULLSCREEN, defaultSettings.showFullscreen ); const showSizeSelect = useStorage( SETTINGS_KEYS.SHOW_SIZE_SELECT, defaultSettings.showSizeSelect ); const showLangSelect = useStorage( SETTINGS_KEYS.SHOW_LANG_SELECT, defaultSettings.showLangSelect ); const showNotification = useStorage( SETTINGS_KEYS.SHOW_NOTIFICATION, defaultSettings.showNotification ); const sidebarColorScheme = useStorage( SETTINGS_KEYS.SIDEBAR_COLOR_SCHEME, defaultSettings.sidebarColorScheme ); const layout = useStorage(SETTINGS_KEYS.LAYOUT, defaultSettings.layout); const themeColor = useStorage(SETTINGS_KEYS.THEME_COLOR, defaultSettings.themeColor); const theme = useStorage(SETTINGS_KEYS.THEME, defaultSettings.theme); const settingsMap = { showTagsView, showAppLogo, showWatermark, showSettings, showGuide, showMenuSearch, showFullscreen, showSizeSelect, showLangSelect, showNotification, sidebarColorScheme, layout }; watch( [theme, themeColor], ([newTheme, newThemeColor]) => { toggleDarkMode(newTheme === ThemeMode.DARK); const colors = generateThemeColors(newThemeColor, newTheme); applyTheme(colors); }, { immediate: true } ); watch( [sidebarColorScheme], ([newSidebarColorScheme]) => { toggleSidebarColor(newSidebarColorScheme === SidebarColor.CLASSIC_BLUE); }, { immediate: true } ); function updateSetting(key, value) { const setting = settingsMap[key]; if (setting) { setting.value = value; } } function updateTheme(newTheme) { theme.value = newTheme; } function updateThemeColor(newColor) { themeColor.value = newColor; } function updateSidebarColorScheme(newScheme) { sidebarColorScheme.value = newScheme; } function updateLayout(newLayout) { layout.value = newLayout; } function toggleSettingsPanel() { settingsVisible.value = !settingsVisible.value; } function showSettingsPanel() { settingsVisible.value = true; } function hideSettingsPanel() { settingsVisible.value = false; } function resetSettings() { showTagsView.value = defaultSettings.showTagsView; showAppLogo.value = defaultSettings.showAppLogo; showWatermark.value = defaultSettings.showWatermark; showSettings.value = defaultSettings.showSettings; showGuide.value = defaultSettings.showGuide; showMenuSearch.value = defaultSettings.showMenuSearch; showFullscreen.value = defaultSettings.showFullscreen; showSizeSelect.value = defaultSettings.showSizeSelect; showLangSelect.value = defaultSettings.showLangSelect; showNotification.value = defaultSettings.showNotification; sidebarColorScheme.value = defaultSettings.sidebarColorScheme; layout.value = defaultSettings.layout; themeColor.value = defaultSettings.themeColor; theme.value = defaultSettings.theme; } return { // 🎯 基础状态 settingsVisible, // 🎯 界面显示状态 showTagsView, showAppLogo, showWatermark, showSettings, showGuide, // 🎯 桌面端工具状态 showMenuSearch, showFullscreen, showSizeSelect, showLangSelect, showNotification, // 🎯 布局和主题状态 sidebarColorScheme, layout, themeColor, theme, // 🎯 更新方法 updateSetting, updateTheme, updateThemeColor, updateSidebarColorScheme, updateLayout, // 🎯 面板控制 toggleSettingsPanel, showSettingsPanel, hideSettingsPanel, // 🎯 重置功能 resetSettings }; }); const useTagsViewStore = defineStore("tagsView", () => { const visitedViews = ref([]); const cachedViews = ref([]); const router2 = useRouter(); const route = useRoute(); function addVisitedView(view) { if (view.path.startsWith("/redirect")) { return; } if (visitedViews.value.some((v) => v.name === view.name)) { return; } if (view.affix) { visitedViews.value.unshift(view); } else { visitedViews.value.push(view); } } function addCachedView(view) { const viewName = view.name; if (cachedViews.value.includes(viewName)) { return; } if (view.keepAlive) { cachedViews.value.push(viewName); } } function delVisitedView(view) { return new Promise((resolve) => { for (const [i, v] of visitedViews.value.entries()) { if (v.path === view.path) { visitedViews.value.splice(i, 1); break; } } resolve([...visitedViews.value]); }); } function delCachedView(view) { const viewName = view.name; return new Promise((resolve) => { const index = cachedViews.value.indexOf(viewName); if (index > -1) { cachedViews.value.splice(index, 1); } resolve([...cachedViews.value]); }); } function delOtherVisitedViews(view) { return new Promise((resolve) => { visitedViews.value = visitedViews.value.filter((v) => { return (v == null ? void 0 : v.affix) || v.path === view.path; }); resolve([...visitedViews.value]); }); } function delOtherCachedViews(view) { const viewName = view.name; return new Promise((resolve) => { const index = cachedViews.value.indexOf(viewName); if (index > -1) { cachedViews.value = cachedViews.value.slice(index, index + 1); } else { cachedViews.value = []; } resolve([...cachedViews.value]); }); } function updateVisitedView(view) { for (let v of visitedViews.value) { if (v.path === view.path) { v = Object.assign(v, view); break; } } } function addView(view) { addVisitedView(view); addCachedView(view); } function delView(view) { return new Promise((resolve) => { delVisitedView(view); delCachedView(view); resolve({ visitedViews: [...visitedViews.value], cachedViews: [...cachedViews.value] }); }); } function delOtherViews(view) { return new Promise((resolve) => { delOtherVisitedViews(view); delOtherCachedViews(view); resolve({ visitedViews: [...visitedViews.value], cachedViews: [...cachedViews.value] }); }); } function delLeftViews(view) { return new Promise((resolve) => { const currIndex = visitedViews.value.findIndex((v) => v.path === view.path); if (currIndex === -1) { return; } visitedViews.value = visitedViews.value.filter((item, index) => { if (index >= currIndex || (item == null ? void 0 : item.affix)) { return true; } const cacheIndex = cachedViews.value.indexOf(item.name); if (cacheIndex > -1) { cachedViews.value.splice(cacheIndex, 1); } return false; }); resolve({ visitedViews: [...visitedViews.value] }); }); } function delRightViews(view) { return new Promise((resolve) => { const currIndex = visitedViews.value.findIndex((v) => v.path === view.path); if (currIndex === -1) { return; } visitedViews.value = visitedViews.value.filter((item, index) => { if (index <= currIndex || (item == null ? void 0 : item.affix)) { return true; } }); resolve({ visitedViews: [...visitedViews.value] }); }); } function delAllViews() { return new Promise((resolve) => { const affixTags = visitedViews.value.filter((tag) => tag == null ? void 0 : tag.affix); visitedViews.value = affixTags; cachedViews.value = []; resolve({ visitedViews: [...visitedViews.value], cachedViews: [...cachedViews.value] }); }); } function delAllVisitedViews() { return new Promise((resolve) => { const affixTags = visitedViews.value.filter((tag) => tag == null ? void 0 : tag.affix); visitedViews.value = affixTags; resolve([...visitedViews.value]); }); } function delAllCachedViews() { return new Promise((resolve) => { cachedViews.value = []; resolve([...cachedViews.value]); }); } function closeCurrentView() { var _a, _b; const tags = { name: route.name, title: route.meta.title, path: route.path, fullPath: route.fullPath, affix: (_a = route.meta) == null ? void 0 : _a.affix, keepAlive: (_b = route.meta) == null ? void 0 : _b.keepAlive, query: route.query }; delView(tags).then((res) => { if (isActive(tags)) { toLastView(res.visitedViews, tags); } }); } function isActive(tag) { return tag.path === route.path; } function toLastView(visitedViews2, view) { const latestView = visitedViews2.slice(-1)[0]; if (latestView && latestView.fullPath) { router2.push(latestView.fullPath); } else { if ((view == null ? void 0 : view.name) === "Dashboard") { router2.replace("/redirect" + view.fullPath); } else { router2.push("/"); } } } return { visitedViews, cachedViews, addVisitedView, addCachedView, delVisitedView, delCachedView, delOtherVisitedViews, delOtherCachedViews, updateVisitedView, addView, delView, delOtherViews, delLeftViews, delRightViews, delAllViews, delAllVisitedViews, delAllCachedViews, closeCurrentView, isActive, toLastView }; }); const scriptRel = "modulepreload"; const assetsURL = function(dep) { return "/web/" + dep; }; const seen = {}; const __vitePreload = function preload(baseModule, deps, importerUrl) { let promise = Promise.resolve(); if (deps && deps.length > 0) { let allSettled2 = function(promises) { return Promise.all( promises.map( (p) => Promise.resolve(p).then( (value) => ({ status: "fulfilled", value }), (reason) => ({ status: "rejected", reason }) ) ) ); }; document.getElementsByTagName("link"); const cspNonceMeta = document.querySelector( "meta[property=csp-nonce]" ); const cspNonce = (cspNonceMeta == null ? void 0 : cspNonceMeta.nonce) || (cspNonceMeta == null ? void 0 : cspNonceMeta.getAttribute("nonce")); promise = allSettled2( deps.map((dep) => { dep = assetsURL(dep); if (dep in seen) return; seen[dep] = true; const isCss = dep.endsWith(".css"); const cssSelector = isCss ? '[rel="stylesheet"]' : ""; if (document.querySelector(`link[href="${dep}"]${cssSelector}`)) { return; } const link = document.createElement("link"); link.rel = isCss ? "stylesheet" : scriptRel; if (!isCss) { link.as = "script"; } link.crossOrigin = ""; link.href = dep; if (cspNonce) { link.setAttribute("nonce", cspNonce); } document.head.appendChild(link); if (isCss) { return new Promise((res, rej) => { link.addEventListener("load", res); link.addEventListener( "error", () => rej(new Error(`Unable to preload CSS for ${dep}`)) ); }); } }) ); } function handlePreloadError(err) { const e = new Event("vite:preloadError", { cancelable: true }); e.payload = err; window.dispatchEvent(e); if (!e.defaultPrevented) { throw err; } } return promise.then((res) => { for (const item of res || []) { if (item.status !== "rejected") continue; handlePreloadError(item.reason); } return baseModule().catch(handlePreloadError); }); }; const Layout$1 = () => __vitePreload(() => import("./index.DmwdN1Z7.js"), true ? __vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]) : void 0); const constantRoutes = [ { path: "/redirect", meta: { hidden: true }, component: Layout$1, children: [ { path: "/redirect/:path(.*)", component: () => __vitePreload(() => import("./index.Df6e1nWk.js"), true ? __vite__mapDeps([17,1,2]) : void 0) } ] }, { path: "/login", name: "Login", meta: { hidden: true }, component: () => __vitePreload(() => import("./index.DmV9p5XN.js"), true ? __vite__mapDeps([18,3,1,2,4,6,19,5,20,11,12,21]) : void 0) }, { path: "/401", name: "401", meta: { hidden: true, title: "401" }, component: () => __vitePreload(() => import("./401.R1wHF71k.js"), true ? __vite__mapDeps([22,3,1,2,4,5,23]) : void 0) }, { path: "/404", name: "404", meta: { hidden: true, title: "404" }, component: () => __vitePreload(() => import("./404.oeqooIKq.js"), true ? __vite__mapDeps([24,3,1,2,4,5,25]) : void 0) }, { path: "/500", name: "500", meta: { hidden: true, title: "500" }, component: () => __vitePreload(() => import("./500.XL5EBMGm.js"), true ? __vite__mapDeps([26,3,1,2,4]) : void 0) }, { path: "/:pathMatch(.*)*", component: () => __vitePreload(() => import("./404.oeqooIKq.js"), true ? __vite__mapDeps([24,3,1,2,4,5,25]) : void 0), meta: { hidden: true, title: "404" } }, // 以下内容必须放在后面 { path: "/", name: "/", redirect: "/home", component: Layout$1, children: [ { path: "home", component: () => __vitePreload(() => import("./index.WOSfjnwM.js"), true ? __vite__mapDeps([27,3,1,2,4,28,29,5,15,30,11,12,31]) : void 0), // 用于 keep-alive 功能,需要与 SFC 中自动推导或显式声明的组件名称一致 // 参考文档: https://cn.vuejs.org/guide/built-ins/keep-alive.html#include-exclude name: "Home", meta: { title: "首页", icon: "homepage", affix: true, keepAlive: true } }, { path: "profile", name: "Profile", meta: { title: "个人中心", icon: "user", hidden: true }, component: () => __vitePreload(() => import("./profile.DeJNaI1M.js"), true ? __vite__mapDeps([32,3,1,2,4,5,11,12,33]) : void 0) }, // 应用内部打开页面 { path: "internal-app/:appId", name: "InternalApp", meta: { title: "内部应用", icon: "Monitor", hidden: true, keepAlive: false }, component: () => __vitePreload(() => import("./InternalApp.BwMxktXz.js"), true ? __vite__mapDeps([34,3,1,2,4,5,11,12,35]) : void 0) } ] } ]; const router = createRouter({ history: createWebHashHistory(), routes: constantRoutes, // 刷新时,滚动条位置还原 scrollBehavior: () => ({ left: 0, top: 0 }) }); function setupRouter(app2) { app2.use(router); } const modules = /* @__PURE__ */ Object.assign({ "../../views/current/profile.vue": () => __vitePreload(() => import("./profile.DeJNaI1M.js"), true ? __vite__mapDeps([32,3,1,2,4,5,11,12,33]) : void 0), "../../views/dashboard/index.vue": () => __vitePreload(() => import("./index.WOSfjnwM.js"), true ? __vite__mapDeps([27,3,1,2,4,28,29,5,15,30,11,12,31]) : void 0), "../../views/dashboard/workplace.vue": () => __vitePreload(() => import("./workplace.rWkFN-uT.js"), true ? __vite__mapDeps([36,28,1,2,29,3,4,30,14,5,11,12,37]) : void 0), "../../views/error/401.vue": () => __vitePreload(() => import("./401.R1wHF71k.js"), true ? __vite__mapDeps([22,3,1,2,4,5,23]) : void 0), "../../views/error/404.vue": () => __vitePreload(() => import("./404.oeqooIKq.js"), true ? __vite__mapDeps([24,3,1,2,4,5,25]) : void 0), "../../views/error/500.vue": () => __vitePreload(() => import("./500.XL5EBMGm.js"), true ? __vite__mapDeps([26,3,1,2,4]) : void 0), "../../views/module_application/ai/index.vue": () => __vitePreload(() => import("./index.oTkWBrWl.js"), true ? __vite__mapDeps([38,3,1,2,4,5,39]) : void 0), "../../views/module_application/ai_config/index.vue": () => __vitePreload(() => import("./index.C-FwI7eF.js"), true ? __vite__mapDeps([40,3,1,2,4,41,5,11,12,42]) : void 0), "../../views/module_application/ai_model/index.vue": () => __vitePreload(() => import("./index.Cn8BFTsV.js"), true ? __vite__mapDeps([43,3,1,2,4,41,44,5,11,12,45]) : void 0), "../../views/module_application/job/components/JobLogDrawer.vue": () => __vitePreload(() => import("./JobLogDrawer.DF46FHsP.js"), true ? __vite__mapDeps([46,47,3,1,2,4,48,5,49,50,51,52,53,7,11,12]) : void 0), "../../views/module_application/job/index.vue": () => __vitePreload(() => import("./index.07n6FPd0.js"), true ? __vite__mapDeps([54,3,1,2,4,48,5,49,55,56,50,51,47,52,53,7,11,12,57]) : void 0), "../../views/module_application/knowledge_base/index.vue": () => __vitePreload(() => import("./index.DX25MiWJ.js"), true ? __vite__mapDeps([58,3,1,2,4,44,41,5,11,12,59]) : void 0), "../../views/module_application/myapp/components/InternalApp.vue": () => __vitePreload(() => import("./InternalApp.BwMxktXz.js"), true ? __vite__mapDeps([34,3,1,2,4,5,11,12,35]) : void 0), "../../views/module_application/myapp/index.vue": () => __vitePreload(() => import("./index.58109uec.js"), true ? __vite__mapDeps([60,3,1,2,4,48,5,49,55,56,7,11,12,61]) : void 0), "../../views/module_application/workflow/CustomNode.vue": () => __vitePreload(() => import("./CustomNode.DH3hMbi5.js"), true ? __vite__mapDeps([62,1,2,5,63]) : void 0), "../../views/module_application/workflow/index.vue": () => __vitePreload(() => import("./index.C0CAvyUI.js"), true ? __vite__mapDeps([64,1,2,62,5,63,3,4,65]) : void 0), "../../views/module_common/docs/index.vue": () => __vitePreload(() => import("./index.DqXkPevt.js"), true ? __vite__mapDeps([66,67,3,1,2,4,5,68]) : void 0), "../../views/module_common/redoc/index.vue": () => __vitePreload(() => import("./index.BNtoswJC.js"), true ? __vite__mapDeps([69,67,3,1,2,4,5,68]) : void 0), "../../views/module_example/demo/index.vue": () => __vitePreload(() => import("./index.zGZzNPwc.js"), true ? __vite__mapDeps([70,3,1,2,4,48,5,49,55,56,71,52,53,50,51,7,11,12]) : void 0), "../../views/module_generator/gencode/index.vue": () => __vitePreload(() => import("./index.BR9biJsE.js"), true ? __vite__mapDeps([72,3,1,2,4,48,5,49,11,12,73,30,74]) : void 0), "../../views/module_monitor/cache/index.vue": () => __vitePreload(() => import("./index.DWKHrtNR.js"), true ? __vite__mapDeps([75,3,1,2,4,29,5,11,12,76]) : void 0), "../../views/module_monitor/online/index.vue": () => __vitePreload(() => import("./index.CJFXhG7y.js"), true ? __vite__mapDeps([77,3,1,2,4,48,5,49,78,11,12]) : void 0), "../../views/module_monitor/resource/index.vue": () => __vitePreload(() => import("./index.BfYcGZ4Z.js"), true ? __vite__mapDeps([79,3,1,2,4,48,5,49,11,12,80]) : void 0), "../../views/module_monitor/server/index.vue": () => __vitePreload(() => import("./index.BYkCj64N.js"), true ? __vite__mapDeps([81,3,1,2,4,11,12]) : void 0), "../../views/module_system/auth/components/Login.vue": () => __vitePreload(() => import("./Login.C_oFk9qn.js"), true ? __vite__mapDeps([82,3,1,2,4,5,11,12,83]) : void 0), "../../views/module_system/auth/components/Register.vue": () => __vitePreload(() => import("./Register.OcLvSvcl.js"), true ? __vite__mapDeps([84,3,1,2,4,11,12]) : void 0), "../../views/module_system/auth/components/ResetPwd.vue": () => __vitePreload(() => import("./ResetPwd.D74e_hLH.js"), true ? __vite__mapDeps([85,3,1,2,4,11,12]) : void 0), "../../views/module_system/auth/index copy.vue": () => __vitePreload(() => import("./index copy.DWRMaWNG.js"), true ? __vite__mapDeps([86,3,1,2,4,6,19,5,20,11,12,87]) : void 0), "../../views/module_system/auth/index.vue": () => __vitePreload(() => import("./index.DmV9p5XN.js"), true ? __vite__mapDeps([18,3,1,2,4,6,19,5,20,11,12,21]) : void 0), "../../views/module_system/dept/index.vue": () => __vitePreload(() => import("./index._Rs0xG0B.js"), true ? __vite__mapDeps([88,3,1,2,4,50,5,51,89,30,7,11,12]) : void 0), "../../views/module_system/dict/components/DataDrawer.vue": () => __vitePreload(() => import("./DataDrawer.DI2NmdEo.js"), true ? __vite__mapDeps([90,91,3,1,2,4,48,5,49,50,51,52,53,7,11,12]) : void 0), "../../views/module_system/dict/index.vue": () => __vitePreload(() => import("./index.GcX9rZiR.js"), true ? __vite__mapDeps([92,3,1,2,4,48,5,49,50,51,91,52,53,7,11,12]) : void 0), "../../views/module_system/log/index.vue": () => __vitePreload(() => import("./index.Crjb_SsD.js"), true ? __vite__mapDeps([93,3,1,2,4,48,5,49,78,50,51,55,56,52,53,7,11,12,94]) : void 0), "../../views/module_system/menu/index.vue": () => __vitePreload(() => import("./index.vuz2VKc_.js"), true ? __vite__mapDeps([95,3,1,2,4,5,50,51,73,74,30,7,11,12,96]) : void 0), "../../views/module_system/notice/index.vue": () => __vitePreload(() => import("./index.aqqxijpF.js"), true ? __vite__mapDeps([97,3,1,2,4,98,99,48,5,49,50,51,55,56,52,53,7,11,12]) : void 0), "../../views/module_system/param/components/ConfigInfoDrawer.vue": () => __vitePreload(() => import("./ConfigInfoDrawer.BaOb71oS.js"), true ? __vite__mapDeps([8,3,1,2,4,9,5,10,11,12,13]) : void 0), "../../views/module_system/param/index.vue": () => __vitePreload(() => import("./index.LiV4SBeL.js"), true ? __vite__mapDeps([100,3,1,2,4,48,5,49,50,51,52,53,7,11,12]) : void 0), "../../views/module_system/position/index.vue": () => __vitePreload(() => import("./index.BOVbbDxl.js"), true ? __vite__mapDeps([101,3,1,2,4,48,5,49,50,51,102,55,56,52,53,7,11,12]) : void 0), "../../views/module_system/role/components/PermissonDrawer.vue": () => __vitePreload(() => import("./PermissonDrawer.CbjYaZxw.js"), true ? __vite__mapDeps([103,104,3,1,2,4,30,105,89,73,11,12]) : void 0), "../../views/module_system/role/index.vue": () => __vitePreload(() => import("./index.UF9Oowpt.js"), true ? __vite__mapDeps([106,3,1,2,4,104,30,105,89,73,48,5,49,50,51,52,53,7,11,12]) : void 0), "../../views/module_system/user/components/DeptTree.vue": () => __vitePreload(() => import("./DeptTree.BoDatJLk.js"), true ? __vite__mapDeps([107,108,3,1,2,4,89,30,11,12]) : void 0), "../../views/module_system/user/components/UserTableSelect.vue": () => __vitePreload(() => import("./UserTableSelect.DRlBq5Na.js"), true ? __vite__mapDeps([109,55,3,1,2,4,48,5,49,56,11,12]) : void 0), "../../views/module_system/user/index.vue": () => __vitePreload(() => import("./index.C7h5-SaY.js"), true ? __vite__mapDeps([110,3,1,2,4,48,5,49,50,51,30,102,89,105,7,108,55,56,71,52,53,11,12]) : void 0), "../../views/module_yifan/yifan_about_us/index.vue": () => __vitePreload(() => import("./index.Bop-u9q0.js"), true ? __vite__mapDeps([111,3,1,2,4,5,11,12,112]) : void 0), "../../views/module_yifan/yifan_about_video/index.vue": () => __vitePreload(() => import("./index.C9fbkg-5.js"), true ? __vite__mapDeps([113,3,1,2,4,48,5,49,55,56,71,52,53,9,10,11,12,114]) : void 0), "../../views/module_yifan/yifan_faq/index.vue": () => __vitePreload(() => import("./index.B_sJyFIz.js"), true ? __vite__mapDeps([115,3,1,2,4,48,5,49,55,56,7,50,51,71,52,53,11,12]) : void 0), "../../views/module_yifan/yifan_feedback/index.vue": () => __vitePreload(() => import("./index.C41JgKdI.js"), true ? __vite__mapDeps([116,3,1,2,4,48,5,49,71,52,53,11,12]) : void 0), "../../views/module_yifan/yifan_membership_discount/index.vue": () => __vitePreload(() => import("./index.BTd1jIIZ.js"), true ? __vite__mapDeps([117,3,1,2,4,118,5,11,12,119]) : void 0), "../../views/module_yifan/yifan_membership_member/index.vue": () => __vitePreload(() => import("./index.BhWri54q.js"), true ? __vite__mapDeps([120,3,1,2,4,48,5,49,118,11,12,121]) : void 0), "../../views/module_yifan/yifan_membership_user_center/index.vue": () => __vitePreload(() => import("./index.CWXFQmKt.js"), true ? __vite__mapDeps([122,3,1,2,4,118,5,11,12,123]) : void 0), "../../views/module_yifan/yifan_naming_solutions/index.vue": () => __vitePreload(() => import("./index.BxJURNFu.js"), true ? __vite__mapDeps([124,3,1,2,4,48,5,49,55,56,7,50,51,71,52,53,11,12]) : void 0), "../../views/module_yifan/yifan_partner_apply/index.vue": () => __vitePreload(() => import("./index.pfmZwPPm.js"), true ? __vite__mapDeps([125,3,1,2,4,48,5,49,55,56,7,50,51,71,52,53,11,12]) : void 0), "../../views/module_yifan/yifan_privacy_policy/index.vue": () => __vitePreload(() => import("./index.CNHnJSL5.js"), true ? __vite__mapDeps([126,3,1,2,4,48,5,49,71,52,53,11,12]) : void 0), "../../views/module_yifan/yifan_wx_pay_order/index.vue": () => __vitePreload(() => import("./index.BInwOfG7.js"), true ? __vite__mapDeps([127,3,1,2,4,48,5,49,71,52,53,11,12,128]) : void 0), "../../views/redirect/index.vue": () => __vitePreload(() => import("./index.Df6e1nWk.js"), true ? __vite__mapDeps([17,1,2]) : void 0) }); const Layout = () => __vitePreload(() => import("./index.DmwdN1Z7.js"), true ? __vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]) : void 0); const generator = (routers) => { return routers.map((item) => { const currentRouter = { children: [], path: item.route_path, name: item.route_name, component: item.component_path, redirect: item.redirect, meta: { title: item.title, icon: item.icon || void 0, keepAlive: item.keep_alive, hidden: item.hidden, order: item.order, alwaysShow: item.always_show, params: item.params, affix: item.affix } }; if (item.children && item.children.length > 0) { currentRouter.children = item.children ? generator(item.children) : []; } return currentRouter; }); }; const usePermissionStore = defineStore("permission", () => { const routes = ref([]); const mixLayoutSideMenus = ref([]); const isRouteGenerated = ref(false); async function generateRoutes() { try { const userStore = useUserStore(); if (!userStore.hasGetRoute) { await userStore.getUserInfo(); } const data = generator(userStore.routeList); const dynamicRoutes = transformRoutes(data); routes.value = [...constantRoutes, ...dynamicRoutes]; isRouteGenerated.value = true; return dynamicRoutes; } catch (error) { isRouteGenerated.value = false; throw error; } } const setMixLayoutSideMenus = (parentPath) => { const parentMenu = routes.value.find((item) => item.path === parentPath); mixLayoutSideMenus.value = (parentMenu == null ? void 0 : parentMenu.children) || []; }; const resetRouter = () => { const constantRouteNames = new Set(constantRoutes.map((route) => route.name).filter(Boolean)); routes.value.forEach((route) => { if (route.name && !constantRouteNames.has(route.name)) { router.removeRoute(route.name); } }); routes.value = [...constantRoutes]; mixLayoutSideMenus.value = []; isRouteGenerated.value = false; }; return { routes, mixLayoutSideMenus, isRouteGenerated, generateRoutes, setMixLayoutSideMenus, resetRouter }; }); const transformRoutes = (routes, isTopLevel = true) => { return routes.map((route) => { const normalizedRoute = { ...route }; if (normalizedRoute.children && normalizedRoute.children.length > 0) { if (isTopLevel) { normalizedRoute.component = Layout; } else { normalizedRoute.component = void 0; } normalizedRoute.children = transformRoutes(route.children, false); } else { normalizedRoute.component = normalizedRoute.component ? modules[`../../views/${normalizedRoute.component}.vue`] || modules["../../views/error/404.vue"] : modules["../../views/error/404.vue"]; } return normalizedRoute; }); }; function usePermissionStoreHook() { return usePermissionStore(store); } class Storage { /** * localStorage 存储 */ static set(key, value) { localStorage.setItem(key, JSON.stringify(value)); } static get(key, defaultValue) { const value = localStorage.getItem(key); if (!value) return defaultValue; try { return JSON.parse(value); } catch { return value; } } static remove(key) { localStorage.removeItem(key); } /** * localStorage 清空 */ static clear() { localStorage.clear(); } /** * sessionStorage 存储 */ static sessionSet(key, value) { sessionStorage.setItem(key, JSON.stringify(value)); } static sessionGet(key, defaultValue) { const value = sessionStorage.getItem(key); if (!value) return defaultValue; try { return JSON.parse(value); } catch { return value; } } static sessionRemove(key) { sessionStorage.removeItem(key); } /** * sessionStorage 清空 */ static sessionClear() { sessionStorage.clear(); } } class Auth { /** * 判断用户是否已登录 * @returns 是否已登录 */ static isLoggedIn() { return !!Auth.getAccessToken(); } /** * 获取当前有效的访问令牌 * 会根据"记住我"状态从适当的存储位置获取 * @returns 当前有效的访问令牌 */ static getAccessToken() { const isRememberMe = Storage.get(AUTH_KEYS.REMEMBER_ME, false); return isRememberMe ? Storage.get(AUTH_KEYS.ACCESS_TOKEN, "") : Storage.sessionGet(AUTH_KEYS.ACCESS_TOKEN, ""); } /** * 获取刷新令牌 * @returns 当前有效的刷新令牌 */ static getRefreshToken() { const isRememberMe = Storage.get(AUTH_KEYS.REMEMBER_ME, false); return isRememberMe ? Storage.get(AUTH_KEYS.REFRESH_TOKEN, "") : Storage.sessionGet(AUTH_KEYS.REFRESH_TOKEN, ""); } /** * 设置访问令牌和刷新令牌 * @param accessToken 访问令牌 * @param refreshToken 刷新令牌 * @param rememberMe 是否记住我 */ static setTokens(accessToken, refreshToken, rememberMe) { Storage.set(AUTH_KEYS.REMEMBER_ME, rememberMe); if (rememberMe) { Storage.set(AUTH_KEYS.ACCESS_TOKEN, accessToken); Storage.set(AUTH_KEYS.REFRESH_TOKEN, refreshToken); } else { Storage.sessionSet(AUTH_KEYS.ACCESS_TOKEN, accessToken); Storage.sessionSet(AUTH_KEYS.REFRESH_TOKEN, refreshToken); Storage.remove(AUTH_KEYS.ACCESS_TOKEN); Storage.remove(AUTH_KEYS.REFRESH_TOKEN); } } /** * 清除所有身份验证相关的数据 */ static clearAuth() { Storage.remove(AUTH_KEYS.ACCESS_TOKEN); Storage.remove(AUTH_KEYS.REFRESH_TOKEN); Storage.sessionRemove(AUTH_KEYS.ACCESS_TOKEN); Storage.sessionRemove(AUTH_KEYS.REFRESH_TOKEN); } /** * 获取"记住我"状态 * @returns 是否记住我 */ static getRememberMe() { return Storage.get(AUTH_KEYS.REMEMBER_ME, false); } } const httpRequest = axios.create({ baseURL: void 0, timeout: void 0, headers: { "Content-Type": "application/json;charset=utf-8" }, paramsSerializer: (params) => qs.stringify(params) }); httpRequest.interceptors.request.use( (config) => { const accessToken = Auth.getAccessToken(); if (!config.headers.Authorization && accessToken) { config.headers.Authorization = `Bearer ${accessToken}`; } else { delete config.headers.Authorization; } return config; }, (error) => { ElMessage.error(error); return Promise.reject(error); } ); httpRequest.interceptors.response.use( (response) => { var _a, _b, _c; if (response.config.responseType === "blob") { return response; } const data = response.data; if (data.code !== ResultEnum.SUCCESS) { ElMessage.error(data.msg); return Promise.reject(response); } if (((_a = response.config.method) == null ? void 0 : _a.toUpperCase()) !== "GET" && !((_b = response.config.url) == null ? void 0 : _b.includes("login")) && !((_c = response.config.url) == null ? void 0 : _c.includes("logout"))) { ElMessage.success(data.msg); } return response; }, async (error) => { var _a, _b, _c, _d, _e; if (!error.response) { let errorMessage = "网络连接异常"; if ((_a = error.message) == null ? void 0 : _a.includes("ECONNREFUSED")) { errorMessage = "服务器连接失败,请检查后端服务是否正常运行"; } else if ((_b = error.message) == null ? void 0 : _b.includes("timeout")) { errorMessage = "请求超时,请稍后重试"; } else if ((_c = error.message) == null ? void 0 : _c.includes("Network Error")) { errorMessage = "网络连接错误,请检查您的网络设置"; } console.error("网络请求失败:", error); ElMessage.error(errorMessage); return Promise.reject(new Error(errorMessage)); } const data = (_d = error.response) == null ? void 0 : _d.data; if (((_e = error.response) == null ? void 0 : _e.config.responseType) === "blob" && error.response.data instanceof Blob) { try { const text = await new Response(error.response.data).text(); const jsonData = JSON.parse(text); if (jsonData.code === ResultEnum.ERROR) { ElMessage.error(jsonData.msg || "请求错误"); return Promise.reject(new Error(jsonData.msg || "请求错误")); } else if (jsonData.code === ResultEnum.EXCEPTION) { ElMessage.error(jsonData.msg || "服务异常"); return Promise.reject(new Error(jsonData.msg || "服务异常")); } } catch (e) { console.error("请求异常:", e); ElMessage.error("数据解析失败"); return Promise.reject(new Error("数据解析失败")); } } if ((data == null ? void 0 : data.code) === ResultEnum.TOKEN_EXPIRED) { await redirectToLogin("登录已过期,请重新登录"); return Promise.reject(new Error(data.msg)); } else if ((data == null ? void 0 : data.code) === ResultEnum.ERROR) { ElMessage.error(data.msg || "请求错误"); return Promise.reject(new Error(data.msg || "请求错误")); } else if ((data == null ? void 0 : data.code) === ResultEnum.UNAUTHORIZED) { ElMessage.error(data.msg || "暂无权限"); return Promise.reject(new Error(data.msg || "请求错误")); } else if ((data == null ? void 0 : data.code) === ResultEnum.EXCEPTION) { ElMessage.error(data.msg || "服务异常"); return Promise.reject(new Error(data.msg || "服务异常")); } else { ElMessage.error("请求处理失败,请稍后重试"); return Promise.reject(new Error("请求处理失败")); } } ); async function redirectToLogin(message = "请重新登录") { try { ElNotification({ title: "提示", message, type: "warning", duration: 3e3 }); await useUserStoreHook().resetAllState(); const currentPath = router.currentRoute.value.fullPath; await router.push(`/login?redirect=${encodeURIComponent(currentPath)}`); } catch (error) { ElMessage.error(error.message); } } const API_PATH$4 = "/system/auth"; const AuthAPI = { login(body) { return httpRequest({ url: `${API_PATH$4}/login`, method: "post", headers: { "Content-Type": "multipart/form-data" }, data: body }); }, refreshToken(body) { return httpRequest({ url: `${API_PATH$4}/token/refresh`, method: "post", data: body }); }, getCaptcha() { return httpRequest({ url: `${API_PATH$4}/captcha/get`, method: "get" }); }, logout(body) { return httpRequest({ url: `${API_PATH$4}/logout`, method: "post", data: body }); } }; const API_PATH$3 = "/system/user"; const UserAPI = { getCurrentUserInfo() { return httpRequest({ url: `${API_PATH$3}/current/info`, method: "get" }); }, uploadCurrentUserAvatar(body) { return httpRequest({ url: `${API_PATH$3}/current/avatar/upload`, method: "post", data: body, headers: { "Content-Type": "multipart/form-data" } }); }, updateCurrentUserInfo(body) { return httpRequest({ url: `${API_PATH$3}/current/info/update`, method: "put", data: body }); }, changeCurrentUserPassword(body) { return httpRequest({ url: `${API_PATH$3}/current/password/change`, method: "put", data: body }); }, resetUserPassword(body) { return httpRequest({ url: `${API_PATH$3}/reset/password`, method: "put", data: body }); }, registerUser(body) { return httpRequest({ url: `${API_PATH$3}/register`, method: "post", data: body }); }, forgetPassword(body) { return httpRequest({ url: `${API_PATH$3}/forget/password`, method: "post", data: body }); }, listUser(query) { return httpRequest({ url: `${API_PATH$3}/list`, method: "get", params: query }); }, detailUser(query) { return httpRequest({ url: `${API_PATH$3}/detail/${query}`, method: "get" }); }, createUser(body) { return httpRequest({ url: `${API_PATH$3}/create`, method: "post", data: body }); }, updateUser(id, body) { return httpRequest({ url: `${API_PATH$3}/update/${id}`, method: "put", data: body }); }, deleteUser(body) { return httpRequest({ url: `${API_PATH$3}/delete`, method: "delete", data: body }); }, batchUser(body) { return httpRequest({ url: `${API_PATH$3}/available/setting`, method: "patch", data: body }); }, exportUser(body) { return httpRequest({ url: `${API_PATH$3}/export`, method: "post", data: body, responseType: "blob" }); }, downloadTemplateUser() { return httpRequest({ url: `${API_PATH$3}/import/template`, method: "post", responseType: "blob" }); }, importUser(body) { return httpRequest({ url: `${API_PATH$3}/import/data`, method: "post", data: body, headers: { "Content-Type": "multipart/form-data" } }); } }; const useUserStore = defineStore("user", { state: () => ({ basicInfo: {}, routeList: [], prems: [], hasGetRoute: false, // 记住我状态 rememberMe: ref(Auth.getRememberMe()) }), getters: { getBasicInfo: (state) => state.basicInfo, getRouteList: (state) => state.routeList, getPerms: (state) => state.prems, getHasGetRoute: (state) => state.hasGetRoute }, actions: { // 获取用户信息 async getUserInfo() { const response = await UserAPI.getCurrentUserInfo(); const routers = response.data.data.menus || []; delete response.data.data.menus; this.basicInfo = { ...this.basicInfo, ...response.data.data }; this.setRoute(routers); }, // 设置用户信息 setUserInfo(info) { this.basicInfo = info; this.setPermissions([]); }, // 设置路由 setRoute(routers) { this.routeList = routers; this.hasGetRoute = true; this.setPermissions(routers); }, setPermissions(menus) { this.prems = []; if (!this.basicInfo.roles) { return; } const roleMenus = this.basicInfo.roles.filter((role) => role.menus && role.menus.length > 0).flatMap((role) => role.menus).filter((menu) => menu !== void 0); const allMenus = [...menus, ...roleMenus]; const permissionSet = /* @__PURE__ */ new Set(); const collect = (items) => { items.forEach((item) => { if (item.permission) { permissionSet.add(item.permission); } if (item.children && item.children.length > 0) { collect(item.children.filter((child) => child !== void 0)); } }); }; collect(allMenus); this.prems = Array.from(permissionSet); }, setAvatar(avatar) { this.basicInfo = { ...this.basicInfo, avatar }; }, clearUserInfo() { this.basicInfo = {}; this.routeList = []; this.hasGetRoute = false; }, // 登录 async login(LoginFormData) { const response = await AuthAPI.login(LoginFormData); if (response.data.code === ResultEnum.SUCCESS) { ElNotification({ title: "通知", message: response.data.msg, type: "success" }); } this.rememberMe = LoginFormData.remember; Auth.setTokens( response.data.data.access_token, response.data.data.refresh_token, this.rememberMe ); }, // 登出 async logout() { const response = await AuthAPI.logout({ token: Auth.getAccessToken() }); if (response.data.code === ResultEnum.SUCCESS) { ElNotification({ title: "通知", message: response.data.msg, type: "success" }); } this.resetAllState(); }, // 重置所有状态 resetAllState() { Auth.clearAuth(); this.clearUserInfo(); usePermissionStoreHook().resetRouter(); useTagsViewStore().delAllViews(); useDictStoreHook().clearDictData(); return Promise.resolve(); }, // 刷新token refreshToken() { const refreshToken = Auth.getRefreshToken(); if (!refreshToken) { return Promise.reject(new Error("没有有效的刷新令牌")); } return new Promise((resolve, reject) => { AuthAPI.refreshToken({ refresh_token: refreshToken }).then((response) => { Auth.setTokens( response.data.data.access_token, response.data.data.refresh_token, Auth.getRememberMe() ); resolve(); }).catch((error) => { reject(error); }); }); } }, persist: true }); function useUserStoreHook() { return useUserStore(store); } const API_PATH$2 = "/system/dict"; const DictAPI = { listDictType(query) { return httpRequest({ url: `${API_PATH$2}/type/list`, method: "get", params: query }); }, optionDictType() { return httpRequest({ url: `${API_PATH$2}/type/optionselect`, method: "get" }); }, detailDictType(query) { return httpRequest({ url: `${API_PATH$2}/type/detail/${query}`, method: "get" }); }, createDictType(body) { return httpRequest({ url: `${API_PATH$2}/type/create`, method: "post", data: body }); }, updateDictType(id, body) { return httpRequest({ url: `${API_PATH$2}/type/update/${id}`, method: "put", data: body }); }, deleteDictType(body) { return httpRequest({ url: `${API_PATH$2}/type/delete`, method: "delete", data: body }); }, batchDictType(body) { return httpRequest({ url: `${API_PATH$2}/type/available/setting`, method: "patch", data: body }); }, exportDictType(body) { return httpRequest({ url: `${API_PATH$2}/type/export`, method: "post", data: body, responseType: "blob" }); }, listDictData(query) { return httpRequest({ url: `${API_PATH$2}/data/list`, method: "get", params: query }); }, detailDictData(query) { return httpRequest({ url: `${API_PATH$2}/data/detail/${query}`, method: "get" }); }, createDictData(body) { return httpRequest({ url: `${API_PATH$2}/data/create`, method: "post", data: body }); }, updateDictData(id, body) { return httpRequest({ url: `${API_PATH$2}/data/update/${id}`, method: "put", data: body }); }, deleteDictData(body) { return httpRequest({ url: `${API_PATH$2}/data/delete`, method: "delete", data: body }); }, batchDictData(body) { return httpRequest({ url: `${API_PATH$2}/data/available/setting`, method: "patch", data: body }); }, exportDictData(body) { return httpRequest({ url: `${API_PATH$2}/data/export`, method: "post", data: body, responseType: "blob" }); }, getInitDict(dict_type) { return httpRequest({ url: `${API_PATH$2}/data/info/${dict_type}`, method: "get" }); } }; const useDictStore = defineStore("dict", { state: () => ({ dictData: {}, isLoaded: false }), getters: { getDictData() { return this.dictData; }, // 获取指定类型的字典数据,确保返回数组 getDictArray() { return (type) => { return (this.dictData[type] || []).filter((item) => item.dict_value !== void 0 && item.dict_label !== void 0).map((item) => ({ dict_value: item.dict_value, dict_label: item.dict_label })); }; } }, actions: { // 批量获取字典数据 async getDict(types) { try { for (const type of types) { if (!this.dictData[type]) { const response = await DictAPI.getInitDict(type); this.dictData[type] = (response.data.data || []).filter( (item) => item.dict_value !== void 0 && item.dict_label !== void 0 ); this.isLoaded = true; } } return types.reduce( (result, type) => { result[type] = this.getDictArray(type); return result; }, {} ); } catch (error) { console.error("获取字典数据失败", error); return {}; } }, getDictLabel(type, value) { const result = this.dictData[type].find((item) => item.dict_value === value); if (!result) { return value; } const dict_data = { id: result.id, dict_value: result.dict_value, dict_label: result.dict_label, dict_type: result.dict_type, css_class: result.css_class, list_class: result.list_class, is_default: result.is_default, dict_sort: result.dict_sort, dict_type_id: result.dict_type_id, uuid: result.uuid, status: result.status, description: result.description, created_time: result.created_time, updated_time: result.updated_time }; return dict_data; }, clearDictData() { this.dictData = {}; } }, persist: true }); function useDictStoreHook() { return useDictStore(store); } const API_PATH$1 = "/system/param"; const ParamsAPI = { uploadFile(body) { return httpRequest({ url: `${API_PATH$1}/upload`, method: "post", data: body, headers: { "Content-Type": "multipart/form-data" } }); }, getInitConfig() { return httpRequest({ url: `${API_PATH$1}/info`, method: "get" }); }, listParams(query) { return httpRequest({ url: `${API_PATH$1}/list`, method: "get", params: query }); }, detailParams(query) { return httpRequest({ url: `${API_PATH$1}/detail/${query}`, method: "get" }); }, createParams(body) { return httpRequest({ url: `${API_PATH$1}/create`, method: "post", data: body }); }, updateParams(id, body) { return httpRequest({ url: `${API_PATH$1}/update/${id}`, method: "put", data: body }); }, deleteParams(body) { return httpRequest({ url: `${API_PATH$1}/delete`, method: "delete", data: body }); }, exportParams(body) { return httpRequest({ url: `${API_PATH$1}/export`, method: "post", data: body, responseType: "blob" }); } }; const useConfigStore = defineStore("config", { state: () => ({ configData: {}, // 存储系统配置 isConfigLoaded: false // 标记配置是否已加载 }), actions: { async getConfig() { const response = await ParamsAPI.getInitConfig(); response.data.data.forEach((item) => { if (item.config_value !== void 0) { this.configData[item.config_key] = item; } }); this.isConfigLoaded = true; } }, persist: true }); function useConfigStoreHook() { return useConfigStore(store); } const API_PATH = "/system/notice"; const NoticeAPI = { listNotice(query) { return httpRequest({ url: `${API_PATH}/list`, method: "get", params: query }); }, listNoticeAvailable() { return httpRequest({ url: `${API_PATH}/available`, method: "get" }); }, detailNotice(query) { return httpRequest({ url: `${API_PATH}/detail/${query}`, method: "get" }); }, createNotice(body) { return httpRequest({ url: `${API_PATH}/create`, method: "post", data: body }); }, updateNotice(id, body) { return httpRequest({ url: `${API_PATH}/update/${id}`, method: "put", data: body }); }, deleteNotice(body) { return httpRequest({ url: `${API_PATH}/delete`, method: "delete", data: body }); }, batchNotice(body) { return httpRequest({ url: `${API_PATH}/available/setting`, method: "patch", data: body }); }, exportNotice(body) { return httpRequest({ url: `${API_PATH}/export`, method: "post", data: body, responseType: "blob" }); } }; const useNoticeStore = defineStore("notice", { state: () => ({ noticeList: [], total: 0, isNoticeLoaded: false, // 已读通知ID集合(前端持久化,避免刷新后重复展示) readIds: [] }), actions: { async getNotice() { const response = await NoticeAPI.listNoticeAvailable(); const items = response.data.data.items || []; const readSet = new Set(this.readIds); const filtered = items.filter( (item) => item.id !== void 0 && !readSet.has(item.id) ); this.noticeList = filtered; this.total = filtered.length; this.isNoticeLoaded = true; }, // 标记单条通知为已读 markAsRead(id) { if (id === void 0) return; if (!this.readIds.includes(id)) { this.readIds.push(id); } this.noticeList = this.noticeList.filter((item) => item.id !== id); this.total = this.noticeList.length; }, // 标记当前列表全部为已读 markAllAsRead(ids = []) { const targets = ids.length ? ids : this.noticeList.map((item) => item.id).filter((id) => id !== void 0); const readSet = new Set(this.readIds); targets.forEach((id) => { if (!readSet.has(id)) this.readIds.push(id); }); this.noticeList = this.noticeList.filter( (item) => item.id !== void 0 && !this.readIds.includes(item.id) ); this.total = this.noticeList.length; }, clearUserInfo() { this.noticeList = []; this.total = 0; this.isNoticeLoaded = false; this.readIds = []; } }, persist: true }); function useNoticeStoreHook() { return useNoticeStore(store); } const store = createPinia(); store.use(src_default); function setupStore(app2) { app2.use(store); } async function refreshAppCaches(opts = {}) { const { dictTypes, refreshUser = true, refreshRoutes = true, refreshConfig = true, refreshNotice = true, clearTags = false, clearDictBefore = false } = opts; const userStore = useUserStoreHook(); const permStore = usePermissionStoreHook(); const dictStore = useDictStoreHook(); const noticeStore = useNoticeStoreHook(); const configStore = useConfigStoreHook(); const tagsViewStore = useTagsViewStore(store); const tasks = []; if (refreshUser) { tasks.push(userStore.getUserInfo()); } if (refreshConfig) { tasks.push(configStore.getConfig()); } if (refreshNotice) { tasks.push(noticeStore.getNotice()); } if (dictTypes && dictTypes.length > 0) { if (clearDictBefore) dictStore.clearDictData(); tasks.push(dictStore.getDict(dictTypes)); } await Promise.allSettled(tasks); if (refreshRoutes) { permStore.resetRouter(); const dynamicRoutes = await permStore.generateRoutes(); dynamicRoutes.forEach((route) => router.addRoute(route)); } if (clearTags) { await tagsViewStore.delAllViews(); } } const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "App", setup(__props) { const appStore2 = useAppStore(); const settingsStore = useSettingsStore(); const userStore = useUserStore(); const locale = computed(() => appStore2.locale); const size = computed(() => appStore2.size); const watermarkContent = computed(() => { var _a; return ((_a = userStore.basicInfo) == null ? void 0 : _a.name) || defaultSettings.watermarkContent; }); const fontColor = computed(() => { return settingsStore.theme === ThemeMode.DARK ? "rgba(255, 255, 255, .15)" : "rgba(0, 0, 0, .15)"; }); return (_ctx, _cache) => { const _component_router_view = resolveComponent("router-view"); const _component_el_watermark = ElWatermark; const _component_el_config_provider = ElConfigProvider; return openBlock(), createBlock(_component_el_config_provider, { locale: unref(locale), size: unref(size) }, { default: withCtx(() => [ createVNode(_component_el_watermark, { font: { color: unref(fontColor) }, content: unref(watermarkContent), "z-index": 9999, class: "wh-full" }, { default: withCtx(() => [ createVNode(_component_router_view) ]), _: 1 }, 8, ["font", "content"]) ]), _: 1 }, 8, ["locale", "size"]); }; } }); const hasPerm = { mounted(el, binding) { const requiredPerms = binding.value; if (!requiredPerms || typeof requiredPerms !== "string" && !Array.isArray(requiredPerms)) { throw new Error( `需要提供权限标识!例如:v-has-perm="'sys:user:add'" 或 v-has-perm="['sys:user:add', 'sys:user:edit']"` ); } const { roles } = useUserStore().basicInfo; const userPrems = useUserStore().prems; if (roles && roles.map((role) => role.code).includes(ROLE_ROOT) || requiredPerms.includes("*:*:*")) { return; } const hasAuth = Array.isArray(requiredPerms) ? requiredPerms.some((perm) => userPrems.includes(perm)) : userPrems.includes(requiredPerms); if (!hasAuth && el.parentNode) { el.parentNode.removeChild(el); } } }; function setupDirective(app2) { app2.directive("hasPerm", hasPerm); } const enLocale = { // Common section common: { confirm: "Confirm", cancel: "Cancel", reset: "Reset", save: "Save", edit: "Edit", delete: "Delete", add: "Add", clear: "Clear", export: "Export", import: "Import", query: "Query", resetQuery: "Reset Query", back: "Back", close: "Close", refresh: "Refresh", inputText: "Please enter", selectText: "Please select", startTimeText: "Start Time", endTimeText: "End Time", login: "Login", required: "This field is required", loginOut: "Logout", document: "Project Documentation", reminder: "Reminder", loginOutMessage: "Are you sure you want to log out?", ok: "OK", reload: "Reload", closeTab: "Close Tab", closeTheLeftTab: "Close Left Tabs", closeTheRightTab: "Close Right Tabs", closeOther: "Close Other Tabs", closeAll: "Close All Tabs", prevLabel: "Previous", nextLabel: "Next", skipLabel: "Skip", doneLabel: "Done", menu: "Menu", menuDes: "Menu rendered based on route structure", collapse: "Collapse/Expand", collapseDes: "Expand and collapse the menu bar", tagsView: "Tags View", tagsViewDes: "Used to record route history", tool: "Tool", toolDes: "Used to customize system settings", shrink: "Collapse", expand: "Expand", delMessage: "Delete selected data?", delWarning: "Warning", delOk: "OK", delCancel: "Cancel", delNoData: "Please select data to delete", delSuccess: "Deleted successfully", fullscreen: "Fullscreen", size: "Size", columnSetting: "Column Settings", lengthRange: "Length must be between {min} and {max} characters", notSpace: "Cannot contain spaces", notSpecialCharacters: "Cannot contain special characters", isEqual: "The two inputs are inconsistent", setting: "Settings", copySuccess: "Copy successfully", copyFailed: "Copy failed" }, // Menu internationalization route: { dashboard: "Dashboard", document: "Document" }, // 登录页面国际化 login: { themeToggle: "Theme Switch", languageToggle: "Language Switch", dark: "Dark", light: "Light", username: "Please enter Username", password: "Please enter Password", newPassword: "Please enter new Password", login: "Login", captchaCode: "Please enter Verify Code", capsLock: "Caps Lock is On", rememberMe: "Remember Me", forgetPassword: "Forget Password?", message: { username: { required: "Please enter Username" }, password: { required: "Please enter Password", min: "The password cannot be less than 6 characters", confirm: "Please confirm the password again", inconformity: "The two password entries are inconsistent" }, captchaCode: { required: "Please enter Verify Code" }, mobile: { required: "Please enter mobile number", invalid: "Invalid mobile number format", exist: "Mobile number already exists" }, email: { required: "Please enter email", invalid: "Invalid email format", exist: "Email already exists" }, name: { required: "Please enter account", invalid: "Invalid account format", min: "Account cannot be less than 2 characters" }, agree: { required: "Please agree to the User Agreement" } }, otherLoginMethods: "Other", resetPassword: "Reset password", thinkOfPasswd: "Remember your password?", register: "Register account", agree: "I have read and agree to the", userAgreement: "User Agreement", haveAccount: "Already have an account?", noAccount: "Don't have an account?", quickFill: "Quick fill", reg: "Register" }, // 导航栏国际化 navbar: { dashboard: "Dashboard", logout: "Logout", document: "Document", gitee: "Gitee", lock: "Lock", unlock: "Unlock", profile: "User Profile", config: "Config Center", tour: "Project Tour", refresh: "Refresh", close: "Close", closeLeft: "Close Left", closeRight: "Close Right", closeOther: "Close Other", closeAll: "Close All", refreshCache: "Refresh Cache" }, lock: { lockScreen: "Lock screen", lockPassword: "Lock screen password", unlock: "Click to unlock", backToLogin: "Back to login", entrySystem: "Entry the system", placeholder: "Please enter the lock screen password", message: "Lock screen password error" }, sizeSelect: { tooltip: "Layout Size", default: "Default", large: "Large", small: "Small", message: { success: "Switch Layout Size Successful!" } }, langSelect: { message: { success: "Switch Language Successful!" } }, settings: { project: "Project Settings", theme: "Theme", interface: "Interface", navigation: "Navigation", themeColor: "Theme Color", customColor: "Custom Color", showTagsView: "Show Tags View", showAppLogo: "Show App Logo", sidebarColorScheme: "Sidebar Color Scheme", showWatermark: "Show Watermark", showDesktopTools: "Desktop Tools Settings", showMenuSearch: "Show Menu Search", showFullscreen: "Show Fullscreen Toggle", showSizeSelect: "Show Layout Size", showLangSelect: "Show Language Select", showNotification: "Show Notification", classicBlue: "Classic Blue", minimalWhite: "Minimal White", copyConfig: "Copy Config", resetConfig: "Reset Default", copySuccess: "Configuration copied to clipboard", resetSuccess: "Reset to default configuration", copyDescription: "Copy config will generate current settings code, reset will restore all settings to default", confirmReset: "Are you sure to reset all settings to default? This operation cannot be undone.", applyToFile: "Apply to File", onlyCopy: "Only Copy", leftLayout: "Left Mode", topLayout: "Top Mode", mixLayout: "Mix Mode", configManagement: "Config Management", copyConfigDescription: "Generate current settings code and copy to clipboard, then overwrite src/settings.ts file", resetConfigDescription: "Restore all settings to system default values", systemTheme: "System Theme", showGuide: "Show Guide" }, error: { noPermission: `Sorry, you don't have permission to access this page.`, pageError: "Sorry, the page you visited does not exist.", networkError: "Sorry, the server reported an error.", returnToHome: "Return to home" } }; const zhCnLocale = { // 公共部分 common: { confirm: "确定", cancel: "取消", reset: "重置", save: "保存", edit: "编辑", delete: "删除", add: "添加", clear: "清除", export: "导出", import: "导入", query: "查询", resetQuery: "重置查询", back: "返回", close: "关闭", refresh: "刷新", inputText: "请输入", selectText: "请选择", startTimeText: "开始时间", endTimeText: "结束时间", login: "登录", required: "该项为必填项", loginOut: "退出系统", document: "项目文档", reminder: "温馨提示", loginOutMessage: "是否退出本系统?", ok: "确定", reload: "重新加载", closeTab: "关闭标签页", closeTheLeftTab: "关闭左侧标签页", closeTheRightTab: "关闭右侧标签页", closeOther: "关闭其它标签页", closeAll: "关闭全部标签页", prevLabel: "上一步", nextLabel: "下一步", skipLabel: "跳过", doneLabel: "结束", menu: "菜单", menuDes: "以路由的结构渲染的菜单栏", collapse: "展开缩收", collapseDes: "展开和缩放菜单栏", tagsView: "标签页", tagsViewDes: "用于记录路由历史记录", tool: "工具", toolDes: "用于设置定制系统", shrink: "收起", expand: "展开", delMessage: "是否删除所选中数据?", delWarning: "提示", delOk: "确定", delCancel: "取消", delNoData: "请选择需要删除的数据", delSuccess: "删除成功", fullscreen: "全屏", size: "尺寸", columnSetting: "列设置", lengthRange: "长度在 {min} 到 {max} 个字符", notSpace: "不能包含空格", notSpecialCharacters: "不能包含特殊字符", isEqual: "两次输入不一致", setting: "设置", copySuccess: "复制成功", copyFailed: "复制失败" }, // 菜单国际化 route: { dashboard: "首页", document: "项目文档" }, // 登录页面国际化 login: { themeToggle: "主题切换", languageToggle: "语言切换", dark: "暗黑", light: "明亮", username: "请输入账号", password: "请输入密码", newPassword: "请输入新密码", login: "登 录", captchaCode: "请输入验证码", capsLock: "大写锁定已打开", rememberMe: "记住我", forgetPassword: "忘记密码?", message: { username: { required: "请输入账号" }, password: { required: "请输入密码", min: "密码不能少于6位", confirm: "请再次确认密码", inconformity: "两次密码输入不一致" }, captchaCode: { required: "请输入验证码" }, mobile: { required: "请输入手机号", invalid: "手机号格式不正确", exist: "手机号已存在" }, email: { required: "请输入邮箱", invalid: "邮箱格式不正确", exist: "邮箱已存在" }, name: { required: "请输入名称", invalid: "名称格式不正确", min: "名称不能少于2位" }, agree: { required: "请先勾选同意用户协议" } }, otherLoginMethods: "其他", resetPassword: "重置密码", thinkOfPasswd: "想起密码?", register: "注册账号", agree: "我已同意并阅读", userAgreement: "用户协议", haveAccount: "已有账号?", noAccount: "您没有账号?", quickFill: "快速填写", reg: "注 册" }, // 导航栏国际化 navbar: { dashboard: "首页", logout: "退出登录", document: "项目文档", gitee: "项目地址", lock: "锁定屏幕", unlock: "解锁屏幕", profile: "个人中心", config: "配置中心", tour: "项目引导", refresh: "刷新", close: "关闭", closeLeft: "关闭左侧", closeRight: "关闭右侧", closeOther: "关闭其他", closeAll: "关闭所有", refreshCache: "刷新缓存" }, lock: { lockScreen: "锁定屏幕", lockPassword: "锁屏密码", unlock: "点击解锁", backToLogin: "返回登录", entrySystem: "进入系统", placeholder: "请输入锁屏密码", required: "请输入必填项", message: "锁屏密码错误" }, sizeSelect: { tooltip: "布局大小", default: "默认", large: "大型", small: "小型", message: { success: "切换布局大小成功!" } }, langSelect: { message: { success: "切换语言成功!" } }, settings: { project: "项目配置", theme: "主题设置", interface: "界面设置", navigation: "导航主题", themeColor: "主题颜色", themeColorTip: "主题颜色", customColor: "自定义颜色", darkMode: "暗黑模式", layoutSetting: "布局设置", sidebarColorScheme: "侧边栏配色", showTagsView: "显示页签", showAppLogo: "显示Logo", showWatermark: "显示水印", showDesktopTools: "桌面端工具设置", showMenuSearch: "显示菜单搜索", showFullscreen: "显示全屏切换", showSizeSelect: "显示布局大小", showLangSelect: "显示语言选择", showNotification: "显示通知", classicBlue: "经典蓝", minimalWhite: "极简白", copyConfig: "复制配置", resetConfig: "重置默认", copySuccess: "配置已复制到剪贴板", resetSuccess: "已重置为默认配置", copyDescription: "复制配置将生成当前设置的代码,重置将恢复所有设置为默认值", confirmReset: "确定要重置所有设置为默认值吗?此操作不可恢复。", applyToFile: "应用到文件", onlyCopy: "仅复制", leftLayout: "左侧模式", topLayout: "顶部模式", mixLayout: "混合模式", configManagement: "配置管理", copyConfigDescription: "生成当前设置的代码并复制到剪贴板,然后覆盖 src/settings.ts 文件", resetConfigDescription: "恢复所有设置为系统默认值", systemTheme: "系统主题", showGuide: "启动引导" }, error: { noPermission: `抱歉,您无权访问此页面。`, pageError: "抱歉,您访问的页面不存在。", networkError: "抱歉,服务器报告错误。", returnToHome: "返回首页" } }; const appStore = useAppStoreHook(); const messages = { "zh-cn": { ...zhCnLocale }, en: { ...enLocale } }; const i18n = createI18n({ legacy: false, locale: appStore.language, messages, globalInjection: true }); function setupI18n(app2) { app2.use(i18n); } function setupElIcons(app2) { for (const [key, component] of Object.entries(ElementPlusIconsVue)) { app2.component(key, component); } } NProgress.configure({ // 动画方式 easing: "ease", // 递增进度条的速度 speed: 500, // 是否显示加载ico showSpinner: false, // 自动递增间隔 trickleSpeed: 200, // 初始化时的最小百分比 minimum: 0.3 }); function setupPermission() { const whiteList = ["/login"]; router.beforeEach(async (to, from, next) => { NProgress.start(); try { const isLoggedIn = Auth.isLoggedIn(); if (isLoggedIn) { if (to.path === "/login") { next({ path: "/" }); return; } await handleAuthenticatedUser(to, from, next); } else { if (whiteList.includes(to.path)) { next(); } else { next(`/login?redirect=${encodeURIComponent(to.fullPath)}`); NProgress.done(); } } } catch (error) { console.error("Route guard error:", error); await useUserStore().resetAllState(); next("/login"); NProgress.done(); } }); router.afterEach(() => { NProgress.done(); }); } async function handleAuthenticatedUser(to, from, next) { var _a, _b; const permissionStore = usePermissionStore(); const userStore = useUserStore(); try { if (!permissionStore.isRouteGenerated) { if (!((_b = (_a = userStore.basicInfo) == null ? void 0 : _a.roles) == null ? void 0 : _b.length)) { await userStore.getUserInfo(); } const dynamicRoutes = await permissionStore.generateRoutes(); dynamicRoutes.forEach((route) => { router.addRoute(route); }); next({ ...to, replace: true }); return; } if (to.matched.length === 0) { next("/404"); return; } const title = to.params.title || to.query.title; if (title) { to.meta.title = title; } next(); } catch (error) { console.error("❌ Route guard error:", error); await useUserStore().resetAllState(); next("/login"); NProgress.done(); } router.afterEach(() => { NProgress.done(); }); } const setupPlugins = { install(app2) { setupDirective(app2); setupRouter(app2); setupStore(app2); setupI18n(app2); setupElIcons(app2); setupPermission(); app2.use(We); app2.use(element_plus_default); } }; const app = createApp(_sfc_main); app.use(setupPlugins); const setTitleAndFavicon = async () => { var _a, _b, _c; try { const configStore = useConfigStore(); await configStore.getConfig(); const webTitle = (_a = configStore.configData.sys_web_title) == null ? void 0 : _a.config_value; const webFavicon = (_b = configStore.configData.sys_web_favicon) == null ? void 0 : _b.config_value; const webLogo = (_c = configStore.configData.sys_web_logo) == null ? void 0 : _c.config_value; if (webTitle) { document.title = webTitle; } if (webFavicon) { const favicon = document.querySelector('link[rel="icon"]'); if (favicon instanceof HTMLLinkElement) { favicon.href = webFavicon; } } if (webLogo) { const loadingLogo = document.querySelector(".loading-container-logo"); if (loadingLogo instanceof HTMLImageElement) { loadingLogo.src = webLogo; } } } catch (error) { console.error("获取配置数据失败:", error); } }; app.mount("#app"); setTitleAndFavicon(); export { Auth as A, ComponentSize as C, DeviceEnum as D, LayoutMode as L, NoticeAPI as N, ParamsAPI as P, ResultEnum as R, SidebarColor as S, ThemeMode as T, UserAPI as U, __vitePreload as _, useSettingsStore as a, usePermissionStore as b, useConfigStore as c, defaultSettings as d, useNoticeStore as e, useUserStore as f, useTagsViewStore as g, refreshAppCaches as h, i18n as i, useDictStore as j, useUserStoreHook as k, httpRequest as l, DictAPI as m, AuthAPI as n, LanguageEnum as o, router as r, themeColorPresets as t, useAppStore as u };