From 4575d12071e517595ed3a9800bbe2cdae34e0a78 Mon Sep 17 00:00:00 2001 From: ks3356143 <314298729@qq.com> Date: Mon, 12 Aug 2024 19:34:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cdTMP/package-lock.json | 58 ++++++++++++------- cdTMP/package.json | 8 +-- cdTMP/src/App.vue | 17 +++++- cdTMP/src/components/ma-editor/index.vue | 29 +++++++--- cdTMP/src/hooks/fetchData.js | 2 +- cdTMP/src/layout/components/navbar.vue | 11 ++-- cdTMP/src/store/modules/app.js | 11 ++-- .../src/views/dashboard/usermanage/index.vue | 19 +++++- .../components/cpns/st-announced.vue | 4 +- .../views/datamanage/dictmanage/dataList.vue | 11 ++-- .../src/views/datamanage/dictmanage/index.vue | 6 +- cdTMP/src/views/login.vue | 25 +++++++- 12 files changed, 139 insertions(+), 62 deletions(-) diff --git a/cdTMP/package-lock.json b/cdTMP/package-lock.json index f0e2e30..665ef45 100644 --- a/cdTMP/package-lock.json +++ b/cdTMP/package-lock.json @@ -29,13 +29,13 @@ "vue": "^3.4.37", "vue-clipboard3": "^2.0.0", "vue-color-kit": "^1.0.6", - "vue-echarts": "^6.5.5", + "vue-echarts": "^6.7.3", "vue-router": "^4.4.3", "vuedraggable": "^2.24.3" }, "devDependencies": { "@types/lodash": "^4.14.195", - "@types/node": "^22.1.0", + "@types/node": "^22.2.0", "@types/nprogress": "^0.2.3", "@types/qs": "^6.9.15", "@vitejs/plugin-vue": "^5.1.2", @@ -43,8 +43,8 @@ "@vue/babel-plugin-jsx": "^1.1.1", "autoprefixer": "^10.4.20", "browserslist": "^4.23.0", - "caniuse-lite": "^1.0.30001591", - "eslint": "^9.8.0", + "caniuse-lite": "^1.0.30001651", + "eslint": "^9.9.0", "eslint-plugin-vue": "^9.27.0", "less": "^4.2.0", "less-loader": "^12.2.0", @@ -1013,9 +1013,9 @@ } }, "node_modules/@eslint/js": { - "version": "9.8.0", - "resolved": "https://registry.npmmirror.com/@eslint/js/-/js-9.8.0.tgz", - "integrity": "sha512-MfluB7EUfxXtv3i/++oh89uzAr4PDI4nn201hsp+qaXqsjAWzinlZEHEfPgAX4doIlKvPG/i0A9dpKxOLII8yA==", + "version": "9.9.0", + "resolved": "https://registry.npmmirror.com/@eslint/js/-/js-9.9.0.tgz", + "integrity": "sha512-hhetes6ZHP3BlXLxmd8K2SNgkhNSi+UcecbnwWKwpP7kyi/uC75DJ1lOOBO3xrC4jyojtGE3YxKZPHfk4yrgug==", "dev": true, "license": "MIT", "engines": { @@ -1415,9 +1415,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "22.1.0", - "resolved": "https://registry.npmmirror.com/@types/node/-/node-22.1.0.tgz", - "integrity": "sha512-AOmuRF0R2/5j1knA3c6G3HOk523Ga+l+ZXltX8SF1+5oqcXijjfTd8fY3XRZqSihEu9XhtQnKYLmkFaoxgsJHw==", + "version": "22.2.0", + "resolved": "https://registry.npmmirror.com/@types/node/-/node-22.2.0.tgz", + "integrity": "sha512-bm6EG6/pCpkxDf/0gDNDdtDILMOHgaQBVOJGdwsqClnxA3xL6jtMv76rLBc006RVMWbmaf0xbmom4Z/5o2nRkQ==", "dev": true, "license": "MIT", "dependencies": { @@ -2259,9 +2259,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001649", - "resolved": "https://registry.npmmirror.com/caniuse-lite/-/caniuse-lite-1.0.30001649.tgz", - "integrity": "sha512-fJegqZZ0ZX8HOWr6rcafGr72+xcgJKI9oWfDW5DrD7ExUtgZC7a7R7ZYmZqplh7XDocFdGeIFn7roAxhOeYrPQ==", + "version": "1.0.30001651", + "resolved": "https://registry.npmmirror.com/caniuse-lite/-/caniuse-lite-1.0.30001651.tgz", + "integrity": "sha512-9Cf+Xv1jJNe1xPZLGuUXLNkE1BoDkqRqYyFJ9TDYSqhduqA4hu4oR9HluGoWYQC/aj8WHjsGVV+bwkh0+tegRg==", "dev": true, "funding": [ { @@ -2689,9 +2689,9 @@ } }, "node_modules/eslint": { - "version": "9.8.0", - "resolved": "https://registry.npmmirror.com/eslint/-/eslint-9.8.0.tgz", - "integrity": "sha512-K8qnZ/QJzT2dLKdZJVX6W4XOwBzutMYmt0lqUS+JdXgd+HTYFlonFgkJ8s44d/zMPPCnOOk0kMWCApCPhiOy9A==", + "version": "9.9.0", + "resolved": "https://registry.npmmirror.com/eslint/-/eslint-9.9.0.tgz", + "integrity": "sha512-JfiKJrbx0506OEerjK2Y1QlldtBxkAlLxT5OEcRF8uaQ86noDe2k31Vw9rnSWv+MXZHj7OOUV/dA0AhdLFcyvA==", "dev": true, "license": "MIT", "dependencies": { @@ -2699,7 +2699,7 @@ "@eslint-community/regexpp": "^4.11.0", "@eslint/config-array": "^0.17.1", "@eslint/eslintrc": "^3.1.0", - "@eslint/js": "9.8.0", + "@eslint/js": "9.9.0", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.3.0", "@nodelib/fs.walk": "^1.2.8", @@ -2738,6 +2738,14 @@ }, "funding": { "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "jiti": "*" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + } } }, "node_modules/eslint-plugin-vue": { @@ -3981,7 +3989,8 @@ "node_modules/monaco-editor": { "version": "0.33.0", "resolved": "https://registry.npmmirror.com/monaco-editor/-/monaco-editor-0.33.0.tgz", - "integrity": "sha512-VcRWPSLIUEgQJQIE0pVT8FcGBIgFoxz7jtqctE+IiCxWugD0DwgyQBcZBhdSrdMC84eumoqMZsGl2GTreOzwqw==" + "integrity": "sha512-VcRWPSLIUEgQJQIE0pVT8FcGBIgFoxz7jtqctE+IiCxWugD0DwgyQBcZBhdSrdMC84eumoqMZsGl2GTreOzwqw==", + "license": "MIT" }, "node_modules/ms": { "version": "2.1.2", @@ -5345,22 +5354,27 @@ } }, "node_modules/vue-echarts": { - "version": "6.5.5", - "resolved": "https://registry.npmmirror.com/vue-echarts/-/vue-echarts-6.5.5.tgz", - "integrity": "sha512-KJD1MSyoMQ33q8M4hM45OYeSC+t7LzesIXQOrkRSXv4xhOi0iN+6yEjQuIuqRB9zZGCT2J4bK3eQ+1ttdz4Uag==", + "version": "6.7.3", + "resolved": "https://registry.npmmirror.com/vue-echarts/-/vue-echarts-6.7.3.tgz", + "integrity": "sha512-vXLKpALFjbPphW9IfQPOVfb1KjGZ/f8qa/FZHi9lZIWzAnQC1DgnmEK3pJgEkyo6EP7UnX6Bv/V3Ke7p+qCNXA==", "hasInstallScript": true, + "license": "MIT", "dependencies": { "resize-detector": "^0.3.0", - "vue-demi": "^0.13.2" + "vue-demi": "^0.13.11" }, "peerDependencies": { "@vue/composition-api": "^1.0.5", + "@vue/runtime-core": "^3.0.0", "echarts": "^5.4.1", "vue": "^2.6.12 || ^3.1.1" }, "peerDependenciesMeta": { "@vue/composition-api": { "optional": true + }, + "@vue/runtime-core": { + "optional": true } } }, diff --git a/cdTMP/package.json b/cdTMP/package.json index d9386e1..ba62d91 100644 --- a/cdTMP/package.json +++ b/cdTMP/package.json @@ -32,13 +32,13 @@ "vue": "^3.4.37", "vue-clipboard3": "^2.0.0", "vue-color-kit": "^1.0.6", - "vue-echarts": "^6.5.5", + "vue-echarts": "^6.7.3", "vue-router": "^4.4.3", "vuedraggable": "^2.24.3" }, "devDependencies": { "@types/lodash": "^4.14.195", - "@types/node": "^22.1.0", + "@types/node": "^22.2.0", "@types/nprogress": "^0.2.3", "@types/qs": "^6.9.15", "@vitejs/plugin-vue": "^5.1.2", @@ -46,8 +46,8 @@ "@vue/babel-plugin-jsx": "^1.1.1", "autoprefixer": "^10.4.20", "browserslist": "^4.23.0", - "caniuse-lite": "^1.0.30001591", - "eslint": "^9.8.0", + "caniuse-lite": "^1.0.30001651", + "eslint": "^9.9.0", "eslint-plugin-vue": "^9.27.0", "less": "^4.2.0", "less-loader": "^12.2.0", diff --git a/cdTMP/src/App.vue b/cdTMP/src/App.vue index ced46e8..cc49fb3 100644 --- a/cdTMP/src/App.vue +++ b/cdTMP/src/App.vue @@ -3,6 +3,21 @@ - + diff --git a/cdTMP/src/components/ma-editor/index.vue b/cdTMP/src/components/ma-editor/index.vue index 6155a0b..e210d38 100644 --- a/cdTMP/src/components/ma-editor/index.vue +++ b/cdTMP/src/components/ma-editor/index.vue @@ -36,6 +36,7 @@ import "tinymce/plugins/searchreplace" // 查找替换 import "tinymce/plugins/table" // 表格 // import "tinymce/plugins/visualblocks" //显示元素范围 import "tinymce/plugins/visualchars" // 显示不可见字符 +import { storeToRefs } from "pinia" // import "tinymce/plugins/wordcount" // 字数统计 const appStore = useAppStore() @@ -45,7 +46,7 @@ const props = defineProps({ height: { type: Number, default: 200 }, id: { type: String, - default: () => "tinymce" + new Date().getTime().toString() + "-" + Math.random().toString(16).substring(2,10) + default: () => "tinymce" + new Date().getTime().toString() + "-" + Math.random().toString(16).substring(2, 10) }, plugins: { type: [String, Array], @@ -73,7 +74,9 @@ let content = computed({ const list = ref([]) -// 辅助函数:遍历元素和子元素的style样式 +/** + * 辅助函数:遍历元素和子元素的style样式 + */ function cleanStyles(element) { element.removeAttribute("style") // 移除元素自身的style属性 element.removeAttribute("class") // 移除元素自身的class属性 @@ -84,7 +87,9 @@ function cleanStyles(element) { } } -// 辅助函数:将元素中span变为text节点 +/** + * 辅助函数:将元素中span变为text节点 + */ function removeUnwantedSpansAndMore(element) { // 所有span变为字符串 const spans = element.querySelectorAll("span") @@ -106,7 +111,9 @@ function removeUnwantedSpansAndMore(element) { } } -// 辅助函数:去掉注释节点 +/** + * 辅助函数:去掉注释节点 + */ function removeCommentNodes(node) { const childNodes = node.childNodes // 遍历子节点 @@ -120,18 +127,24 @@ function removeCommentNodes(node) { } } +// 解构pinia中app仓库中的主题响应式数据 +const { theme } = storeToRefs(appStore) + const initConfig = reactive({ menubar: false, // 菜单栏显隐 language_url: "/tinymce/i18n/zh_CN.js", language: "zh_CN", - skin_url: "/tinymce/skins/ui/tinymce-5", + skin_url: "/tinymce/skins/ui/tinymce-5" + (theme.value === "dark" ? "-dark" : ""), height: props.height, toolbar_mode: "wrap", plugins: props.plugins, toolbar: props.toolbar, skeletonScreen: true, branding: false, - content_css: "/tinymce/skins/content/default/content.css", + content_css: + theme.value === "dark" + ? "/tinymce/skins/content/dark/content.css" + : "/tinymce/skins/content/default/content.css", // selector: "#textarea1", // 下面自定义样式选中的区域为编辑区 content_style: "body {line-height:1.5;font-size:14px;} p {margin:2px 0px;}", // 这里可以设置自定义样式 // paste_as_text: false, // 粘贴文字只能是纯文本 @@ -175,7 +188,9 @@ watch( ) watch( () => content.value, - (vl) => emit("change", vl) + (vl) => { + emit("change", vl) + } ) diff --git a/cdTMP/src/hooks/fetchData.js b/cdTMP/src/hooks/fetchData.js index a3c1bdd..6b15438 100644 --- a/cdTMP/src/hooks/fetchData.js +++ b/cdTMP/src/hooks/fetchData.js @@ -1,7 +1,7 @@ import { ref } from "vue" /** - * 该hook传入一个远程数据储存默认值,以及请求远程数据的函数 + * 该hook传入一个远程数据储存默认值以及请求服务器的异步函数,以及请求远程数据的函数 */ const useFetchData = (defaultValue = {}, fetDataFunc) => { const loadingData = ref(defaultValue) // 远程请求的数据 diff --git a/cdTMP/src/layout/components/navbar.vue b/cdTMP/src/layout/components/navbar.vue index a294214..d44b47e 100644 --- a/cdTMP/src/layout/components/navbar.vue +++ b/cdTMP/src/layout/components/navbar.vue @@ -22,7 +22,9 @@
@@ -101,14 +103,13 @@ import { useFullscreen } from "@vueuse/core" import useUser from "@/hooks/logout" import { Message } from "@arco-design/web-vue" import Menu from "@/layout/components/menu.vue" -import { useRouter } from "vue-router" +import { useRouter, useRoute } from "vue-router" const router = useRouter() +const route = useRoute() const appStore = useAppStore() // 切换暗黑主题 const handleChangeTheme = () => { - document.body.hasAttribute("arco-theme") - ? document.body.removeAttribute("arco-theme") - : document.body.setAttribute("arco-theme", "dark") + appStore.toggleTheme() } // title管理-默认在后台 const props = defineProps({ diff --git a/cdTMP/src/store/modules/app.js b/cdTMP/src/store/modules/app.js index 01f4485..f132917 100644 --- a/cdTMP/src/store/modules/app.js +++ b/cdTMP/src/store/modules/app.js @@ -23,13 +23,14 @@ const useAppStore = defineStore("app", { this.$patch(partial) }, // 改变主题 - toggleTheme(dark) { - if (dark) { - this.theme = "dark" - document.body.setAttribute("arco-theme", "dark") - } else { + toggleTheme() { + const currentTheme = document.body.getAttribute("arco-theme") + if (currentTheme === "dark") { this.theme = "light" document.body.setAttribute("arco-theme", "light") + } else { + this.theme = "dark" + document.body.setAttribute("arco-theme", "dark") } }, // 切换用户设备 diff --git a/cdTMP/src/views/dashboard/usermanage/index.vue b/cdTMP/src/views/dashboard/usermanage/index.vue index bd63830..95365ce 100644 --- a/cdTMP/src/views/dashboard/usermanage/index.vue +++ b/cdTMP/src/views/dashboard/usermanage/index.vue @@ -17,7 +17,7 @@ diff --git a/cdTMP/src/views/datamanage/dictmanage/dataList.vue b/cdTMP/src/views/datamanage/dictmanage/dataList.vue index b66ca49..26f2370 100644 --- a/cdTMP/src/views/datamanage/dictmanage/dataList.vue +++ b/cdTMP/src/views/datamanage/dictmanage/dataList.vue @@ -1,5 +1,5 @@