diff --git a/public/serverConfig.json b/public/serverConfig.json index 4c2b240..7d28a5b 100644 --- a/public/serverConfig.json +++ b/public/serverConfig.json @@ -3,6 +3,7 @@ "Title": "PureAdmin", "FixedHeader": true, "HiddenSideBar": false, + "MultiTagsCache": false, "KeepAlive": true, "Locale": "zh", "Layout": "vertical", diff --git a/src/assets/iconfont/iconfont.css b/src/assets/iconfont/iconfont.css index 09ee987..efdec40 100644 --- a/src/assets/iconfont/iconfont.css +++ b/src/assets/iconfont/iconfont.css @@ -1,8 +1,8 @@ @font-face { font-family: "iconfont"; /* Project id 2208059 */ - src: url("iconfont.woff2?t=1636197082361") format("woff2"), - url("iconfont.woff?t=1636197082361") format("woff"), - url("iconfont.ttf?t=1636197082361") format("truetype"); + src: url("iconfont.woff2?t=1638023560828") format("woff2"), + url("iconfont.woff?t=1638023560828") format("woff"), + url("iconfont.ttf?t=1638023560828") format("truetype"); } .iconfont { @@ -13,6 +13,10 @@ -moz-osx-font-smoothing: grayscale; } +.team-icontabs::before { + content: "\e63e"; +} + .team-iconlogo::before { content: "\e620"; } diff --git a/src/assets/iconfont/iconfont.js b/src/assets/iconfont/iconfont.js index e180203..994bf8f 100644 --- a/src/assets/iconfont/iconfont.js +++ b/src/assets/iconfont/iconfont.js @@ -2,17 +2,17 @@ var l, t, e, + h, i, - a, - n = - '', - h = (h = document.getElementsByTagName("script"))[ - h.length - 1 + a = + '', + n = (n = document.getElementsByTagName("script"))[ + n.length - 1 ].getAttribute("data-injectcss"), o = function (c, l) { l.parentNode.insertBefore(c, l); }; - if (h && !c.__iconfont__svg__cssinject__) { + if (n && !c.__iconfont__svg__cssinject__) { c.__iconfont__svg__cssinject__ = !0; try { document.write( @@ -22,21 +22,21 @@ console && console.log(c); } } - function d() { - a || ((a = !0), e()); - } function v() { + i || ((i = !0), e()); + } + function d() { try { - i.documentElement.doScroll("left"); + h.documentElement.doScroll("left"); } catch (c) { - return void setTimeout(v, 50); + return void setTimeout(d, 50); } - d(); + v(); } (l = function () { var c, l; - ((l = document.createElement("div")).innerHTML = n), - (n = null), + ((l = document.createElement("div")).innerHTML = a), + (a = null), (c = l.getElementsByTagName("svg")[0]) && (c.setAttribute("aria-hidden", "true"), (c.style.position = "absolute"), @@ -55,10 +55,10 @@ document.addEventListener("DOMContentLoaded", t, !1)) : document.attachEvent && ((e = l), - (i = c.document), - (a = !1), - v(), - (i.onreadystatechange = function () { - "complete" == i.readyState && ((i.onreadystatechange = null), d()); + (h = c.document), + (i = !1), + d(), + (h.onreadystatechange = function () { + "complete" == h.readyState && ((h.onreadystatechange = null), v()); })); })(window); diff --git a/src/assets/iconfont/iconfont.json b/src/assets/iconfont/iconfont.json index 58756c7..8c8b9b4 100644 --- a/src/assets/iconfont/iconfont.json +++ b/src/assets/iconfont/iconfont.json @@ -6,6 +6,13 @@ "description": "pure-admin", "glyphs": [ { + "icon_id": "20594647", + "name": "标签页", + "font_class": "tabs", + "unicode": "e63e", + "unicode_decimal": 58942 + }, + { "icon_id": "22129506", "name": "水能", "font_class": "logo", diff --git a/src/assets/iconfont/iconfont.ttf b/src/assets/iconfont/iconfont.ttf index 9950e08..24eb3de 100644 Binary files a/src/assets/iconfont/iconfont.ttf and b/src/assets/iconfont/iconfont.ttf differ diff --git a/src/assets/iconfont/iconfont.woff b/src/assets/iconfont/iconfont.woff index 7e29e73..2944d51 100644 Binary files a/src/assets/iconfont/iconfont.woff and b/src/assets/iconfont/iconfont.woff differ diff --git a/src/assets/iconfont/iconfont.woff2 b/src/assets/iconfont/iconfont.woff2 index 29ba680..5b03730 100644 Binary files a/src/assets/iconfont/iconfont.woff2 and b/src/assets/iconfont/iconfont.woff2 differ diff --git a/src/components/ReIcon/index.ts b/src/components/ReIcon/index.ts index 41bf519..0d2b770 100644 --- a/src/components/ReIcon/index.ts +++ b/src/components/ReIcon/index.ts @@ -3,39 +3,53 @@ import icon from "./src/Icon.vue"; import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; import { iconComponents } from "/@/plugins/element-plus"; -export const Icon = Object.assign(icon, { - install(app: App) { - app.component(icon.name, icon); - } -}); - -export default { - Icon -}; /** * find icon component * @param icon icon图标 * @returns component */ export function findIconReg(icon: string) { - const faReg = /^fa-/; + // fontawesome + const faReg = /^FA-/; + // iconfont + const iFReg = /^IF-/; + // typeof icon === "function" 属于SVG if (faReg.test(icon)) { - return findIcon(icon.split(faReg)[1]); + const text = icon.split(faReg)[1]; + return findIcon( + text.slice(0, text.indexOf(" ")), + "FA", + text.slice(text.indexOf(" ") + 1, text.length) + ); + } else if (iFReg.test(icon)) { + return findIcon(icon.split(iFReg)[1], "IF"); + } else if (typeof icon === "function") { + return findIcon(icon, "SVG"); } else { - return findIcon(icon, false); + return findIcon(icon, "EL"); } } -export function findIcon(icon: String, isFa: Boolean = true) { - if (isFa) { + +// 支持fontawesome、iconfont、element-plus/icons、自定义svg +export function findIcon(icon: String, type = "EL", property?: string) { + if (type === "FA") { return defineComponent({ name: "FaIcon", - data() { - return { icon: icon }; + setup() { + return { icon, property }; }, components: { FontAwesomeIcon }, - template: `` + template: `` }); - } else { + } else if (type === "IF") { + return defineComponent({ + name: "IfIcon", + data() { + return { icon: `iconfont ${icon}` }; + }, + template: `` + }); + } else if (type === "EL") { const components = iconComponents.filter( component => component.name === icon ); @@ -44,5 +58,17 @@ export function findIcon(icon: String, isFa: Boolean = true) { } else { return null; } + } else if (type === "SVG") { + return icon; } } + +export const Icon = Object.assign(icon, { + install(app: App) { + app.component(icon.name, icon); + } +}); + +export default { + Icon +}; diff --git a/src/layout/components/setting/index.vue b/src/layout/components/setting/index.vue index 37ee7a8..dffdc64 100644 --- a/src/layout/components/setting/index.vue +++ b/src/layout/components/setting/index.vue @@ -17,6 +17,7 @@ import { debounce } from "/@/utils/debounce"; import { themeColorsType } from "../../types"; import { useAppStoreHook } from "/@/store/modules/app"; import { storageLocal, storageSession } from "/@/utils/storage"; +import { useMultiTagsStoreHook } from "/@/store/modules/multiTags"; import { toggleTheme } from "@zougt/vite-plugin-theme-preprocessor/dist/browser-utils"; const router = useRouter(); @@ -135,6 +136,18 @@ function onReset() { storageSession.clear(); toggleClass(false, "html-grey", document.querySelector("html")); toggleClass(false, "html-weakness", document.querySelector("html")); + useMultiTagsStoreHook().handleTags("equal", [ + { + path: "/welcome", + parentPath: "/", + meta: { + title: "message.hshome", + icon: "el-icon-s-home", + i18n: true, + showLink: true + } + } + ]); router.push("/login"); } diff --git a/src/layout/components/tag/index.vue b/src/layout/components/tag/index.vue index a7e358b..9daf274 100644 --- a/src/layout/components/tag/index.vue +++ b/src/layout/components/tag/index.vue @@ -1,18 +1,3 @@ - -