From f8690a0b730c0adcc9fac6d52f147c623b190a20 Mon Sep 17 00:00:00 2001 From: xiaoxian521 <1923740402@qq.com> Date: Sun, 15 Dec 2024 23:29:37 +0800 Subject: [PATCH 1/5] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=BD=BF=E7=94=A8?= =?UTF-8?q?`this`=E8=AF=AD=E6=B3=95=E6=97=B6=E6=97=A0=E6=B3=95=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E4=BB=A3=E7=A0=81=E6=8F=90=E7=A4=BA=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E5=B9=B6=E6=9B=B4=E6=96=B0`pinia`=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E8=AF=AD=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ReTreeLine/index.ts | 4 ++-- src/store/modules/app.ts | 3 +-- src/store/modules/epTheme.ts | 3 +-- src/store/modules/multiTags.ts | 7 +++---- src/store/modules/permission.ts | 5 ++--- src/store/modules/settings.ts | 3 +-- src/store/modules/user.ts | 3 +-- src/utils/print.ts | 8 ++++++++ tsconfig.json | 3 ++- types/global-components.d.ts | 1 + 10 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/components/ReTreeLine/index.ts b/src/components/ReTreeLine/index.ts index 80a396538..c486c8d7a 100644 --- a/src/components/ReTreeLine/index.ts +++ b/src/components/ReTreeLine/index.ts @@ -90,9 +90,9 @@ export default defineComponent({ ]; // 取得每一层的当前节点是不是在当前层级列表的最后一个 const lastnodeArr = []; - let currentNode = this.node; + let currentNode: any = this.node; while (currentNode) { - let parentNode = currentNode.parent; + let parentNode: any = currentNode.parent; // 兼容element-plus的 el-tree-v2 (Virtualized Tree 虚拟树) if (currentNode.level === 1 && !currentNode.parent) { // el-tree-v2的第一层node是没有parent的,必需 treeData 创建一个parent diff --git a/src/store/modules/app.ts b/src/store/modules/app.ts index ea928304c..c9284dac0 100644 --- a/src/store/modules/app.ts +++ b/src/store/modules/app.ts @@ -8,8 +8,7 @@ import { responsiveStorageNameSpace } from "../utils"; -export const useAppStore = defineStore({ - id: "pure-app", +export const useAppStore = defineStore("pure-app", { state: (): appType => ({ sidebar: { opened: diff --git a/src/store/modules/epTheme.ts b/src/store/modules/epTheme.ts index fa73effd4..e6f62d203 100644 --- a/src/store/modules/epTheme.ts +++ b/src/store/modules/epTheme.ts @@ -6,8 +6,7 @@ import { responsiveStorageNameSpace } from "../utils"; -export const useEpThemeStore = defineStore({ - id: "pure-epTheme", +export const useEpThemeStore = defineStore("pure-epTheme", { state: () => ({ epThemeColor: storageLocal().getItem( diff --git a/src/store/modules/multiTags.ts b/src/store/modules/multiTags.ts index fee223402..5d1b669c8 100644 --- a/src/store/modules/multiTags.ts +++ b/src/store/modules/multiTags.ts @@ -14,8 +14,7 @@ import { } from "../utils"; import { usePermissionStoreHook } from "./permission"; -export const useMultiTagsStore = defineStore({ - id: "pure-multiTags", +export const useMultiTagsStore = defineStore("pure-multiTags", { state: () => ({ // 存储标签页信息(路由信息) multiTags: storageLocal().getItem( @@ -24,12 +23,12 @@ export const useMultiTagsStore = defineStore({ ? storageLocal().getItem( `${responsiveStorageNameSpace()}tags` ) - : [ + : ([ ...routerArrays, ...usePermissionStoreHook().flatteningRoutes.filter( v => v?.meta?.fixedTag ) - ], + ] as any), multiTagsCache: storageLocal().getItem( `${responsiveStorageNameSpace()}configure` )?.multiTagsCache diff --git a/src/store/modules/permission.ts b/src/store/modules/permission.ts index 2ddca781a..97bc7cd9b 100644 --- a/src/store/modules/permission.ts +++ b/src/store/modules/permission.ts @@ -12,8 +12,7 @@ import { } from "../utils"; import { useMultiTagsStoreHook } from "./multiTags"; -export const usePermissionStore = defineStore({ - id: "pure-permission", +export const usePermissionStore = defineStore("pure-permission", { state: () => ({ // 静态路由生成的菜单 constantMenus, @@ -31,7 +30,7 @@ export const usePermissionStore = defineStore({ filterTree(ascending(this.constantMenus.concat(routes))) ); this.flatteningRoutes = formatFlatteningRoutes( - this.constantMenus.concat(routes) + this.constantMenus.concat(routes) as any ); }, cacheOperate({ mode, name }: cacheType) { diff --git a/src/store/modules/settings.ts b/src/store/modules/settings.ts index 7f810f7f1..05c980718 100644 --- a/src/store/modules/settings.ts +++ b/src/store/modules/settings.ts @@ -1,8 +1,7 @@ import { defineStore } from "pinia"; import { type setType, store, getConfig } from "../utils"; -export const useSettingStore = defineStore({ - id: "pure-setting", +export const useSettingStore = defineStore("pure-setting", { state: (): setType => ({ title: getConfig().Title, fixedHeader: getConfig().FixedHeader, diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index fac9f929c..0429847f7 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -16,8 +16,7 @@ import { import { useMultiTagsStoreHook } from "./multiTags"; import { type DataInfo, setToken, removeToken, userKey } from "@/utils/auth"; -export const useUserStore = defineStore({ - id: "pure-user", +export const useUserStore = defineStore("pure-user", { state: (): userType => ({ // 头像 avatar: storageLocal().getItem>(userKey)?.avatar ?? "", diff --git a/src/utils/print.ts b/src/utils/print.ts index 0d33bb677..5f6db1805 100644 --- a/src/utils/print.ts +++ b/src/utils/print.ts @@ -9,6 +9,7 @@ const Print = function (dom, options?: object): PrintFunction { options = options || {}; // @ts-expect-error if (!(this instanceof Print)) return new Print(dom, options); + // @ts-expect-error this.conf = { styleStr: "", // Elements that need to dynamically get and set the height @@ -18,19 +19,26 @@ const Print = function (dom, options?: object): PrintFunction { // Callback after printing printDoneCallBack: null }; + // @ts-expect-error for (const key in this.conf) { if (key && options.hasOwnProperty(key)) { + // @ts-expect-error this.conf[key] = options[key]; } } if (typeof dom === "string") { + // @ts-expect-error this.dom = document.querySelector(dom); } else { + // @ts-expect-error this.dom = this.isDOM(dom) ? dom : dom.$el; } + // @ts-expect-error if (this.conf.setDomHeightArr && this.conf.setDomHeightArr.length) { + // @ts-expect-error this.setDomHeight(this.conf.setDomHeightArr); } + // @ts-expect-error this.init(); }; diff --git a/tsconfig.json b/tsconfig.json index 5dd960a4e..fdbd4a668 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,10 +4,11 @@ "module": "ESNext", "moduleResolution": "bundler", "strict": false, + "strictFunctionTypes": false, + "noImplicitThis": true, "jsx": "preserve", "importHelpers": true, "experimentalDecorators": true, - "strictFunctionTypes": false, "skipLibCheck": true, "esModuleInterop": true, "isolatedModules": true, diff --git a/types/global-components.d.ts b/types/global-components.d.ts index f07958a6e..238f62cf0 100644 --- a/types/global-components.d.ts +++ b/types/global-components.d.ts @@ -120,6 +120,7 @@ declare module "vue" { } interface ComponentCustomProperties { + $storage: ResponsiveStorage; $message: (typeof import("element-plus"))["ElMessage"]; $notify: (typeof import("element-plus"))["ElNotification"]; $msgbox: (typeof import("element-plus"))["ElMessageBox"]; From bbdd44a9178be01a5ce2b0371b1cac47e3ee22b2 Mon Sep 17 00:00:00 2001 From: xiaoxian521 <1923740402@qq.com> Date: Thu, 19 Dec 2024 17:29:45 +0800 Subject: [PATCH 2/5] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E6=BB=91?= =?UTF-8?q?=E5=9D=97=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- locales/en.yaml | 1 + locales/zh-CN.yaml | 1 + src/components/ReText/src/index.vue | 2 +- src/layout/components/lay-footer/index.vue | 2 +- src/router/modules/components.ts | 16 +++-- .../components/slider/components/Base.vue | 64 +++++++++++++++++++ .../components/slider/components/Input.vue | 24 +++++++ .../components/slider/components/Marks.vue | 43 +++++++++++++ .../slider/components/Placement.vue | 40 ++++++++++++ .../components/slider/components/Range.vue | 24 +++++++ .../components/slider/components/Size.vue | 23 +++++++ .../components/slider/components/Step.vue | 45 +++++++++++++ .../components/slider/components/Vertical.vue | 24 +++++++ .../components/slider/components/index.ts | 8 +++ src/views/components/slider/index.vue | 56 ++++++++++++++++ src/views/components/text.vue | 2 +- src/views/components/upload/form.vue | 2 +- src/views/table/virtual/list.vue | 2 +- src/views/table/virtual/pageList.vue | 2 +- src/views/table/virtual/treeList.vue | 2 +- .../vue-flow/layouting/animationEdge.vue | 2 +- src/views/vue-flow/layouting/icon.vue | 2 +- src/views/vue-flow/layouting/index.vue | 2 +- src/views/vue-flow/layouting/processNode.vue | 2 +- 24 files changed, 375 insertions(+), 16 deletions(-) create mode 100644 src/views/components/slider/components/Base.vue create mode 100644 src/views/components/slider/components/Input.vue create mode 100644 src/views/components/slider/components/Marks.vue create mode 100644 src/views/components/slider/components/Placement.vue create mode 100644 src/views/components/slider/components/Range.vue create mode 100644 src/views/components/slider/components/Size.vue create mode 100644 src/views/components/slider/components/Step.vue create mode 100644 src/views/components/slider/components/Vertical.vue create mode 100644 src/views/components/slider/components/index.ts create mode 100644 src/views/components/slider/index.vue diff --git a/locales/en.yaml b/locales/en.yaml index 2aa5a24cf..2f3b01ef6 100644 --- a/locales/en.yaml +++ b/locales/en.yaml @@ -92,6 +92,7 @@ menus: pureDraggable: Draggable pureSplitPane: Split Pane pureText: Text Ellipsis + pureSlider: Slider pureElButton: Button pureButton: Button Animation pureCheckButton: Check Button diff --git a/locales/zh-CN.yaml b/locales/zh-CN.yaml index 0287a0955..7b039f33e 100644 --- a/locales/zh-CN.yaml +++ b/locales/zh-CN.yaml @@ -92,6 +92,7 @@ menus: pureDraggable: 拖拽 pureSplitPane: 切割面板 pureText: 文本省略 + pureSlider: 滑块 pureElButton: 按钮 pureCheckButton: 可选按钮 pureButton: 按钮动效 diff --git a/src/components/ReText/src/index.vue b/src/components/ReText/src/index.vue index ecaebdbb8..eddf70ba1 100644 --- a/src/components/ReText/src/index.vue +++ b/src/components/ReText/src/index.vue @@ -1,4 +1,4 @@ - + + + + diff --git a/src/views/components/slider/components/Input.vue b/src/views/components/slider/components/Input.vue new file mode 100644 index 000000000..78928d3ca --- /dev/null +++ b/src/views/components/slider/components/Input.vue @@ -0,0 +1,24 @@ + + + + + diff --git a/src/views/components/slider/components/Marks.vue b/src/views/components/slider/components/Marks.vue new file mode 100644 index 000000000..b3867296e --- /dev/null +++ b/src/views/components/slider/components/Marks.vue @@ -0,0 +1,43 @@ + + + + + diff --git a/src/views/components/slider/components/Placement.vue b/src/views/components/slider/components/Placement.vue new file mode 100644 index 000000000..5d0999929 --- /dev/null +++ b/src/views/components/slider/components/Placement.vue @@ -0,0 +1,40 @@ + + + + + diff --git a/src/views/components/slider/components/Range.vue b/src/views/components/slider/components/Range.vue new file mode 100644 index 000000000..bf17ea3a7 --- /dev/null +++ b/src/views/components/slider/components/Range.vue @@ -0,0 +1,24 @@ + + + + + diff --git a/src/views/components/slider/components/Size.vue b/src/views/components/slider/components/Size.vue new file mode 100644 index 000000000..c31c382f4 --- /dev/null +++ b/src/views/components/slider/components/Size.vue @@ -0,0 +1,23 @@ + + + + + diff --git a/src/views/components/slider/components/Step.vue b/src/views/components/slider/components/Step.vue new file mode 100644 index 000000000..3783af8e2 --- /dev/null +++ b/src/views/components/slider/components/Step.vue @@ -0,0 +1,45 @@ + + + + + diff --git a/src/views/components/slider/components/Vertical.vue b/src/views/components/slider/components/Vertical.vue new file mode 100644 index 000000000..c5e11922b --- /dev/null +++ b/src/views/components/slider/components/Vertical.vue @@ -0,0 +1,24 @@ + + + + + diff --git a/src/views/components/slider/components/index.ts b/src/views/components/slider/components/index.ts new file mode 100644 index 000000000..ad8ac28a4 --- /dev/null +++ b/src/views/components/slider/components/index.ts @@ -0,0 +1,8 @@ +export { default as Base } from "./Base.vue"; +export { default as Step } from "./Step.vue"; +export { default as Size } from "./Size.vue"; +export { default as Input } from "./Input.vue"; +export { default as Range } from "./Range.vue"; +export { default as Marks } from "./Marks.vue"; +export { default as Vertical } from "./Vertical.vue"; +export { default as Placement } from "./Placement.vue"; diff --git a/src/views/components/slider/index.vue b/src/views/components/slider/index.vue new file mode 100644 index 000000000..8ab1134cd --- /dev/null +++ b/src/views/components/slider/index.vue @@ -0,0 +1,56 @@ + + + diff --git a/src/views/components/text.vue b/src/views/components/text.vue index 20f609da5..fa4f4236c 100644 --- a/src/views/components/text.vue +++ b/src/views/components/text.vue @@ -1,4 +1,4 @@ - diff --git a/locales/en.yaml b/locales/en.yaml index 2f3b01ef6..4ff4ebaa6 100644 --- a/locales/en.yaml +++ b/locales/en.yaml @@ -76,6 +76,7 @@ menus: pureLoginLog: Login Log pureOperationLog: Operation Log pureSystemLog: System Log + pureMarkdown: Markdown pureEditor: Editor pureAbnormal: Abnormal Page pureFourZeroFour: "404" diff --git a/locales/zh-CN.yaml b/locales/zh-CN.yaml index 7b039f33e..22602cd1a 100644 --- a/locales/zh-CN.yaml +++ b/locales/zh-CN.yaml @@ -76,6 +76,7 @@ menus: pureLoginLog: 登录日志 pureOperationLog: 操作日志 pureSystemLog: 系统日志 + pureMarkdown: Markdown pureEditor: 编辑器 pureAbnormal: 异常页面 pureFourZeroFour: "404" diff --git a/package.json b/package.json index 06b783706..6b690f05f 100644 --- a/package.json +++ b/package.json @@ -90,6 +90,7 @@ "typeit": "^8.8.7", "v-contextmenu": "^3.2.0", "v3-infinite-loading": "^1.3.2", + "vditor": "^3.10.8", "version-rocket": "^1.7.4", "vue": "^3.5.13", "vue-i18n": "^10.0.5", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0444628b2..68cd65884 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -137,6 +137,9 @@ importers: v3-infinite-loading: specifier: ^1.3.2 version: 1.3.2 + vditor: + specifier: ^3.10.8 + version: 3.10.8 version-rocket: specifier: ^1.7.4 version: 1.7.4 @@ -946,16 +949,16 @@ packages: resolution: {integrity: sha512-6GT1BJ852gZ0gItNZN2krX5QAmea+cmdjMvsWohArAZ3GmHdnNANEcF9JjPXAMRtQ6Ux5E269ymamg/+WU6tQA==} engines: {node: '>= 16'} - '@intlify/message-compiler@11.0.0-beta.2': - resolution: {integrity: sha512-/cJHP1n45Zlf9tbm/hudLrUwXzJZngR9OMTQk32H1S4lBjM2996wzKTHuLbaJJlJZNTTjnfWZUHPb+F6sE6p1Q==} + '@intlify/message-compiler@11.0.0-rc.1': + resolution: {integrity: sha512-TGw2uBfuTFTegZf/BHtUQBEKxl7Q/dVGLoqRIdw8lFsp9g/53sYn5iD+0HxIzdYjbWL6BTJMXCPUHp9PxDTRPw==} engines: {node: '>= 16'} '@intlify/shared@10.0.5': resolution: {integrity: sha512-bmsP4L2HqBF6i6uaMqJMcFBONVjKt+siGluRq4Ca4C0q7W2eMaVZr8iCgF9dKbcVXutftkC7D6z2SaSMmLiDyA==} engines: {node: '>= 16'} - '@intlify/shared@11.0.0-beta.2': - resolution: {integrity: sha512-N6ngJfFaVA0l2iLtx/SymgHOBW4wiS5Pyue7YmY/G+mrGjesi+S+U+u/Xlv6pZa/YIBfeM4QB07lI7rz1YqKLg==} + '@intlify/shared@11.0.0-rc.1': + resolution: {integrity: sha512-8tR1xe7ZEbkabTuE/tNhzpolygUn9OaYp9yuYAF4MgDNZg06C3Qny80bes2/e9/Wm3aVkPUlCw6WgU7mQd0yEg==} engines: {node: '>= 16'} '@intlify/unplugin-vue-i18n@6.0.1': @@ -2445,6 +2448,9 @@ packages: didyoumean@1.2.2: resolution: {integrity: sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==} + diff-match-patch@1.0.5: + resolution: {integrity: sha512-IayShXAgj/QMXgB0IWmKx+rOPuGMhqm5w6jvFxmVenXKIzRqTAAsbBPT3kWQeGANj3jGgvcvv4yK6SxqYmikgw==} + diff-sequences@27.5.1: resolution: {integrity: sha512-k1gCAXAsNgLwEL+Y8Wvl+M6oEFj5bgazfZULpS5CneoPPXRaCCW7dm+q21Ky2VEE5X+VeRDBVg1Pcvvsr4TtNQ==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} @@ -4909,6 +4915,9 @@ packages: resolution: {integrity: sha512-FGtKtv3xIpR6BYhvgH8MI/y78oT7d8Au3ww4QIxymrCtZEh5b8gCw2siywE+puhEmuWKDtmfrvF5UlB298ut3w==} engines: {node: '>=10.12.0'} + vditor@3.10.8: + resolution: {integrity: sha512-u9npjvMuGJVk0QGbpqiGAmvgiR4QvMVpNQYrvFYZ/yWDtTFLZrHmLxuUbtswotR6KY10u5kVuaoSEoBGGWQGjQ==} + version-rocket@1.7.4: resolution: {integrity: sha512-YTQ7zMq7UuMfNpC/DxP+d+hlhLeDEFFi1dmWGiYXsDA8x4mN1X/NQuPPdOsUjh1UG/owWNjdTQhSqJyWxwrQeQ==} hasBin: true @@ -5852,8 +5861,8 @@ snapshots: '@intlify/bundle-utils@10.0.0(vue-i18n@10.0.5(vue@3.5.13(typescript@5.6.3)))': dependencies: - '@intlify/message-compiler': 11.0.0-beta.2 - '@intlify/shared': 11.0.0-beta.2 + '@intlify/message-compiler': 11.0.0-rc.1 + '@intlify/shared': 11.0.0-rc.1 acorn: 8.14.0 escodegen: 2.1.0 estree-walker: 2.0.2 @@ -5874,14 +5883,14 @@ snapshots: '@intlify/shared': 10.0.5 source-map-js: 1.2.1 - '@intlify/message-compiler@11.0.0-beta.2': + '@intlify/message-compiler@11.0.0-rc.1': dependencies: - '@intlify/shared': 11.0.0-beta.2 + '@intlify/shared': 11.0.0-rc.1 source-map-js: 1.2.1 '@intlify/shared@10.0.5': {} - '@intlify/shared@11.0.0-beta.2': {} + '@intlify/shared@11.0.0-rc.1': {} '@intlify/unplugin-vue-i18n@6.0.1(@vue/compiler-dom@3.5.13)(eslint@9.16.0(jiti@2.4.1))(rollup@4.28.1)(typescript@5.6.3)(vue-i18n@10.0.5(vue@3.5.13(typescript@5.6.3)))(vue@3.5.13(typescript@5.6.3))': dependencies: @@ -7619,6 +7628,8 @@ snapshots: didyoumean@1.2.2: {} + diff-match-patch@1.0.5: {} + diff-sequences@27.5.1: {} dijkstrajs@1.0.3: {} @@ -10425,6 +10436,10 @@ snapshots: convert-source-map: 1.9.0 source-map: 0.7.4 + vditor@3.10.8: + dependencies: + diff-match-patch: 1.0.5 + version-rocket@1.7.4: dependencies: axios: 1.7.9 diff --git a/src/router/enums.ts b/src/router/enums.ts index 78719faf9..01e034ceb 100644 --- a/src/router/enums.ts +++ b/src/router/enums.ts @@ -17,14 +17,15 @@ const home = 0, // 平台规定只有 home 路由的 rank 才能为 0 ,所以 monitor = 14, tabs = 15, about = 16, - editor = 17, - flowchart = 18, - formdesign = 19, - board = 20, - ppt = 21, - mind = 22, - guide = 23, - menuoverflow = 24; + markdown = 17, + editor = 18, + flowchart = 19, + formdesign = 20, + board = 21, + ppt = 22, + mind = 23, + guide = 24, + menuoverflow = 25; export { home, @@ -44,6 +45,7 @@ export { monitor, tabs, about, + markdown, editor, flowchart, formdesign, diff --git a/src/router/modules/able.ts b/src/router/modules/able.ts index b90bad22b..dc4868632 100644 --- a/src/router/modules/able.ts +++ b/src/router/modules/able.ts @@ -15,8 +15,7 @@ export default { name: "MqttClient", component: () => import("@/views/able/mqtt-client.vue"), meta: { - title: $t("menus.pureMqtt"), - extraIcon: "IF-pure-iconfont-new svg" + title: $t("menus.pureMqtt") } }, { diff --git a/src/router/modules/form.ts b/src/router/modules/form.ts index 63980491e..4f5afa785 100644 --- a/src/router/modules/form.ts +++ b/src/router/modules/form.ts @@ -15,8 +15,7 @@ export default { name: "SchemaForm", component: () => import("@/views/schema-form/index.vue"), meta: { - title: $t("menus.pureSchemaForm"), - extraIcon: "IF-pure-iconfont-new svg" + title: $t("menus.pureSchemaForm") } } ] diff --git a/src/router/modules/ganttastic.ts b/src/router/modules/ganttastic.ts index 1b68b7251..a9bcd70a1 100644 --- a/src/router/modules/ganttastic.ts +++ b/src/router/modules/ganttastic.ts @@ -15,8 +15,7 @@ export default { name: "Ganttastic", component: () => import("@/views/ganttastic/index.vue"), meta: { - title: $t("menus.pureGanttastic"), - extraIcon: "IF-pure-iconfont-new svg" + title: $t("menus.pureGanttastic") } } ] diff --git a/src/router/modules/markdown.ts b/src/router/modules/markdown.ts new file mode 100644 index 000000000..bff0c2b60 --- /dev/null +++ b/src/router/modules/markdown.ts @@ -0,0 +1,23 @@ +import { $t } from "@/plugins/i18n"; +import { markdown } from "@/router/enums"; + +export default { + path: "/markdown", + redirect: "/markdown/index", + meta: { + icon: "ri:markdown-line", + title: $t("menus.pureMarkdown"), + rank: markdown + }, + children: [ + { + path: "/markdown/index", + name: "Markdown", + component: () => import("@/views/markdown/index.vue"), + meta: { + title: $t("menus.pureMarkdown"), + extraIcon: "IF-pure-iconfont-new svg" + } + } + ] +} satisfies RouteConfigsTable; diff --git a/src/router/modules/table.ts b/src/router/modules/table.ts index 56b279f00..b7752c985 100644 --- a/src/router/modules/table.ts +++ b/src/router/modules/table.ts @@ -31,8 +31,7 @@ export default { name: "PureTableEdit", component: () => import("@/views/table/edit.vue"), meta: { - title: $t("menus.pureTableEdit"), - extraIcon: "IF-pure-iconfont-new svg" + title: $t("menus.pureTableEdit") } }, { @@ -40,8 +39,7 @@ export default { name: "VxeTable", component: () => import("@/views/table/virtual.vue"), meta: { - title: $t("menus.pureVxeTable"), - extraIcon: "IF-pure-iconfont-new svg" + title: $t("menus.pureVxeTable") } } ] diff --git a/src/router/modules/vueflow.ts b/src/router/modules/vueflow.ts index 7f01685e5..02f3892fd 100644 --- a/src/router/modules/vueflow.ts +++ b/src/router/modules/vueflow.ts @@ -14,8 +14,7 @@ export default { name: "VueFlow", component: () => import("@/views/vue-flow/layouting/index.vue"), meta: { - title: "vue-flow", - extraIcon: "IF-pure-iconfont-new svg" + title: "vue-flow" } } ] diff --git a/src/views/markdown/components/Vditor.vue b/src/views/markdown/components/Vditor.vue new file mode 100644 index 000000000..c59dbedeb --- /dev/null +++ b/src/views/markdown/components/Vditor.vue @@ -0,0 +1,105 @@ + + + diff --git a/src/views/markdown/index.vue b/src/views/markdown/index.vue new file mode 100644 index 000000000..9061bbbc6 --- /dev/null +++ b/src/views/markdown/index.vue @@ -0,0 +1,59 @@ + + + From 6d2630018158e91f1263a3456241dd696eeb308e Mon Sep 17 00:00:00 2001 From: xiaoming <1923740402@qq.com> Date: Tue, 24 Dec 2024 09:14:43 +0800 Subject: [PATCH 4/5] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E7=BC=96=E8=BE=91=E5=99=A8=E7=A4=BA=E4=BE=8B=20(#1194?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/optimize.ts | 2 + locales/en.yaml | 1 + locales/zh-CN.yaml | 1 + package.json | 3 + pnpm-lock.yaml | 41 ++++++++ .../lay-notice/components/NoticeItem.vue | 2 +- src/router/enums.ts | 20 ++-- src/router/modules/codemirror.ts | 23 +++++ src/views/able/video-frame/index.vue | 2 +- src/views/codemirror/index.vue | 96 +++++++++++++++++++ src/views/components/json-editor.vue | 12 +-- src/views/components/swiper.vue | 2 +- src/views/list/card/components/ListCard.vue | 2 +- src/views/monitor/logs/login/index.vue | 2 +- src/views/monitor/logs/operation/index.vue | 2 +- src/views/monitor/logs/system/index.vue | 2 +- src/views/monitor/online/index.vue | 2 +- src/views/system/role/index.vue | 2 +- src/views/system/user/index.vue | 2 +- 19 files changed, 189 insertions(+), 30 deletions(-) create mode 100644 src/router/modules/codemirror.ts create mode 100644 src/views/codemirror/index.vue diff --git a/build/optimize.ts b/build/optimize.ts index 1f3b9da85..d06f0d8fe 100644 --- a/build/optimize.ts +++ b/build/optimize.ts @@ -23,6 +23,7 @@ const include = [ "vue-tippy", "cropperjs", "jsbarcode", + "codemirror", "pinyin-pro", "sortablejs", "swiper/vue", @@ -43,6 +44,7 @@ const include = [ "@howdyjs/mouse-menu", "@logicflow/extension", "vue-virtual-scroller", + "codemirror-editor-vue3", "@amap/amap-jsapi-loader", "el-table-infinite-scroll", "vue-waterfall-plugin-next", diff --git a/locales/en.yaml b/locales/en.yaml index 4ff4ebaa6..e0f81c91d 100644 --- a/locales/en.yaml +++ b/locales/en.yaml @@ -76,6 +76,7 @@ menus: pureLoginLog: Login Log pureOperationLog: Operation Log pureSystemLog: System Log + pureCodeMirror: CodeMirror pureMarkdown: Markdown pureEditor: Editor pureAbnormal: Abnormal Page diff --git a/locales/zh-CN.yaml b/locales/zh-CN.yaml index 22602cd1a..422484349 100644 --- a/locales/zh-CN.yaml +++ b/locales/zh-CN.yaml @@ -76,6 +76,7 @@ menus: pureLoginLog: 登录日志 pureOperationLog: 操作日志 pureSystemLog: 系统日志 + pureCodeMirror: 代码编辑器 pureMarkdown: Markdown pureEditor: 编辑器 pureAbnormal: 异常页面 diff --git a/package.json b/package.json index 6b690f05f..26bbd2d9d 100644 --- a/package.json +++ b/package.json @@ -65,6 +65,8 @@ "animate.css": "^4.1.1", "axios": "^1.7.9", "china-area-data": "^5.0.1", + "codemirror": "^5", + "codemirror-editor-vue3": "^2.8.0", "cropperjs": "^1.6.2", "dayjs": "^1.11.13", "echarts": "^5.5.1", @@ -119,6 +121,7 @@ "@iconify-icons/ri": "^1.2.10", "@iconify/vue": "^4.2.0", "@intlify/unplugin-vue-i18n": "^6.0.1", + "@types/codemirror": "^5.60.15", "@types/dagre": "^0.7.52", "@types/intro.js": "^5.1.5", "@types/js-cookie": "^3.0.6", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 68cd65884..9357bc256 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -62,6 +62,12 @@ importers: china-area-data: specifier: ^5.0.1 version: 5.0.1 + codemirror: + specifier: ^5 + version: 5.65.18 + codemirror-editor-vue3: + specifier: ^2.8.0 + version: 2.8.0(codemirror@5.65.18)(diff-match-patch@1.0.5)(vue@3.5.13(typescript@5.6.3)) cropperjs: specifier: ^1.6.2 version: 1.6.2 @@ -219,6 +225,9 @@ importers: '@intlify/unplugin-vue-i18n': specifier: ^6.0.1 version: 6.0.1(@vue/compiler-dom@3.5.13)(eslint@9.16.0(jiti@2.4.1))(rollup@4.28.1)(typescript@5.6.3)(vue-i18n@10.0.5(vue@3.5.13(typescript@5.6.3)))(vue@3.5.13(typescript@5.6.3)) + '@types/codemirror': + specifier: ^5.60.15 + version: 5.60.15 '@types/dagre': specifier: ^0.7.52 version: 0.7.52 @@ -1441,6 +1450,9 @@ packages: '@types/babel__traverse@7.20.6': resolution: {integrity: sha512-r1bzfrm0tomOI8g1SzvCaQHo6Lcv6zu0EA+W2kHrt8dyrHQxGzBBL4kdkzIS+jBMV+EYcMAEAqXqYaLJq5rOZg==} + '@types/codemirror@5.60.15': + resolution: {integrity: sha512-dTOvwEQ+ouKJ/rE9LT1Ue2hmP6H1mZv5+CCnNWu2qtiOe2LQa9lCprEY20HxiDmV/Bxh+dXjywmy5aKvoGjULA==} + '@types/conventional-commits-parser@5.0.1': resolution: {integrity: sha512-7uz5EHdzz2TqoMfV7ee61Egf5y6NkcO4FB/1iCCQnbeiI1F3xzv3vK5dBCXUCLQgGYS+mUeigK1iKQzvED+QnQ==} @@ -1507,6 +1519,9 @@ packages: '@types/stack-utils@2.0.3': resolution: {integrity: sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==} + '@types/tern@0.23.9': + resolution: {integrity: sha512-ypzHFE/wBzh+BlH6rrBgS5I/Z7RD21pGhZ2rltb/+ZrVM1awdZwjx7hE5XfuYgHWk9uvV5HLZN3SloevCAp3Bw==} + '@types/tinycolor2@1.4.6': resolution: {integrity: sha512-iEN8J0BoMnsWBqjVbWH/c0G0Hh7O21lpR2/+PrvAVgWdzL7eexIFm4JN/Wn10PTcmNdtS6U67r499mlWMXOxNw==} @@ -2128,6 +2143,16 @@ packages: code-inspector-plugin@0.18.2: resolution: {integrity: sha512-LKOhA4YsoUZ6Dq4OQKP7G+kPcfeYGLoIQz7EDG4yoL5mqSu+uWR+0QvzoDc4HGXQ0jpkzEwlatbH6fBlbPiwKQ==} + codemirror-editor-vue3@2.8.0: + resolution: {integrity: sha512-ebYGNhBpLmQNLguXzNyMMkn6K8v3lcS5/Ncvdn6YS4bLGEHE67MfsJIS/WV0L7I6WavUuFlY/Rs/AJKChIwSwg==} + peerDependencies: + codemirror: ^5 + diff-match-patch: ^1.0.5 + vue: ^3.x + + codemirror@5.65.18: + resolution: {integrity: sha512-Gaz4gHnkbHMGgahNt3CA5HBk5lLQBqmD/pBgeB4kQU6OedZmqMBjlRF0LSrp2tJ4wlLNPm2FfaUd1pDy0mdlpA==} + codepage@1.15.0: resolution: {integrity: sha512-3g6NUTPd/YtuuGrhMnOMRjFc+LJw/bnMp3+0r/Wcz3IXUuCosKRJvMphm5+Q+bvTVGcJJuRvVLuYba+WojaFaA==} engines: {node: '>=0.8'} @@ -6432,6 +6457,10 @@ snapshots: dependencies: '@babel/types': 7.26.3 + '@types/codemirror@5.60.15': + dependencies: + '@types/tern': 0.23.9 + '@types/conventional-commits-parser@5.0.1': dependencies: '@types/node': 20.17.9 @@ -6490,6 +6519,10 @@ snapshots: '@types/stack-utils@2.0.3': {} + '@types/tern@0.23.9': + dependencies: + '@types/estree': 1.0.6 + '@types/tinycolor2@1.4.6': {} '@types/web-animations-js@2.2.16': {} @@ -7328,6 +7361,14 @@ snapshots: transitivePeerDependencies: - supports-color + codemirror-editor-vue3@2.8.0(codemirror@5.65.18)(diff-match-patch@1.0.5)(vue@3.5.13(typescript@5.6.3)): + dependencies: + codemirror: 5.65.18 + diff-match-patch: 1.0.5 + vue: 3.5.13(typescript@5.6.3) + + codemirror@5.65.18: {} + codepage@1.15.0: {} collect-v8-coverage@1.0.2: {} diff --git a/src/layout/components/lay-notice/components/NoticeItem.vue b/src/layout/components/lay-notice/components/NoticeItem.vue index 823d9cd8a..378b40d6b 100644 --- a/src/layout/components/lay-notice/components/NoticeItem.vue +++ b/src/layout/components/lay-notice/components/NoticeItem.vue @@ -112,7 +112,7 @@ function hoverDescription(event, description) { max-width: 238px; } - diff --git a/src/views/components/json-editor.vue b/src/views/components/json-editor.vue index 53817f9a4..848b7914a 100644 --- a/src/views/components/json-editor.vue +++ b/src/views/components/json-editor.vue @@ -84,17 +84,7 @@ watch( > vue-json-pretty - (支持大数据量)。 - - - 当然还有一款代码编辑器推荐(这里就不做演示了),采用开源的 - - codemirror6 - + (支持大数据量) -