From b1cf9ee4212c3567099100dd0e9159d4d55e1e73 Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Fri, 14 Jan 2022 15:37:31 +0800 Subject: [PATCH] refactor: theme setting page (halo-dev/console#380) * refactor: theme setting page Signed-off-by: Ryan Wang * feat: add theme descriptions Signed-off-by: Ryan Wang * refactor: local upgrade component Signed-off-by: Ryan Wang * refactor: theme descriptions Signed-off-by: Ryan Wang * chore: bump admin-api deps --- package.json | 2 +- pnpm-lock.yaml | 33 +- src/components/Input/AttachmentInput.vue | 47 +++ src/components/index.js | 4 +- src/config/router.config.js | 14 +- src/core/lazy_lib/components_use.js | 4 +- src/layouts/PageView.vue | 2 + src/views/interface/ThemeList.vue | 130 ++------ src/views/interface/ThemeSetting.vue | 286 ++++++++++++++++++ .../components/ThemeDeleteConfirmModal.vue | 85 ++++++ .../components/ThemeLocalUpgradeModal.vue | 56 ++++ src/views/system/About.vue | 15 +- 12 files changed, 546 insertions(+), 132 deletions(-) create mode 100644 src/components/Input/AttachmentInput.vue create mode 100644 src/views/interface/ThemeSetting.vue create mode 100644 src/views/interface/components/ThemeDeleteConfirmModal.vue create mode 100644 src/views/interface/components/ThemeLocalUpgradeModal.vue diff --git a/package.json b/package.json index af27f3ddc6..a008e56bc2 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "@codemirror/basic-setup": "^0.19.0", "@codemirror/lang-html": "^0.19.3", "@codemirror/lang-java": "^0.19.1", - "@halo-dev/admin-api": "^1.0.0-alpha.44", + "@halo-dev/admin-api": "^1.0.0-alpha.46", "ant-design-vue": "^1.7.8", "crypto-js": "^4.1.1", "dayjs": "^1.10.7", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f86088da98..60f65a197c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5,7 +5,7 @@ specifiers: '@codemirror/basic-setup': ^0.19.0 '@codemirror/lang-html': ^0.19.3 '@codemirror/lang-java': ^0.19.1 - '@halo-dev/admin-api': ^1.0.0-alpha.44 + '@halo-dev/admin-api': ^1.0.0-alpha.46 '@vue/cli-plugin-babel': ^3.12.1 '@vue/cli-plugin-eslint': ^4.5.15 '@vue/cli-plugin-unit-jest': ^4.5.15 @@ -54,7 +54,7 @@ dependencies: '@codemirror/basic-setup': 0.19.0 '@codemirror/lang-html': 0.19.3 '@codemirror/lang-java': 0.19.1 - '@halo-dev/admin-api': 1.0.0-alpha.44 + '@halo-dev/admin-api': 1.0.0-alpha.46 ant-design-vue: 1.7.8_9065e7474e033a8e4b95615fc8e6c36c crypto-js: 4.1.1 dayjs: 1.10.7 @@ -1348,32 +1348,33 @@ packages: purgecss: 2.3.0 dev: true - /@halo-dev/admin-api/1.0.0-alpha.44: - resolution: {integrity: sha512-nCJsx4gDxCjkoGJKsBpcgLhAUc8RYrqKMGM1VSi9t64xTFdXDjIJgtcIQuBgJ0b4R58JIp6A6ti5S764vz4BDA==} + /@halo-dev/admin-api/1.0.0-alpha.46: + resolution: {integrity: sha512-OlDZm2/L/9IKlhCjWWFO1KkqxfEip/nMZrqavMQXghcHomWBqxvMttB4P1vg+0xmoZh65uYhl3De6VSIbL2FsQ==} engines: {node: '>=12'} dependencies: - '@halo-dev/rest-api-client': 1.0.0-alpha.44 + '@halo-dev/rest-api-client': 1.0.0-alpha.46 + tslib: 2.3.1 transitivePeerDependencies: - debug dev: false - /@halo-dev/logger/1.0.0-alpha.44: - resolution: {integrity: sha512-ORHP6pj8wLb+mwsk+pYqvH9tqNWTr+96AiZgtSMcdwojA1KupFSVzHN0aqpk8HeGfSrBNbMz4VT6ey+OVnWrcQ==} + /@halo-dev/logger/1.0.0-alpha.46: + resolution: {integrity: sha512-iBLa55wq6i++9l2L4w1X0vY5mMmqOFBbzjvTNv9TcG2ssUNXL1s0uRgasjvlQAI5EDfvmHhth/RW4ACPM+EUnQ==} engines: {node: '>=12.0.0'} dependencies: tslib: 2.3.1 dev: false - /@halo-dev/rest-api-client/1.0.0-alpha.44: - resolution: {integrity: sha512-fCzh7ihLpI7hrq0S2M9YjROTvoTT5JeEOqv5O/hon4bTfpBqEb7REjjYMONR8lJNgmEI9wzviEhn7Xxg7nX/vA==} + /@halo-dev/rest-api-client/1.0.0-alpha.46: + resolution: {integrity: sha512-kv88fszMZe26KAVfZXzjIvqZV6wsMWCxMtoWgk9F8DkYs3kQt9n+98g5azmtFgZh2RYh3O4einjcFOUQ44yRxg==} engines: {node: '>=12'} dependencies: - '@halo-dev/logger': 1.0.0-alpha.44 + '@halo-dev/logger': 1.0.0-alpha.46 axios: 0.24.0 form-data: 4.0.0 js-base64: 3.7.2 - qs: 6.10.1 - store: 2.0.12 + qs: 6.10.3 + tslib: 2.3.1 transitivePeerDependencies: - debug dev: false @@ -9403,8 +9404,8 @@ packages: engines: {node: '>=0.6.0', teleport: '>=0.2.0'} dev: true - /qs/6.10.1: - resolution: {integrity: sha512-M528Hph6wsSVOBiYUnGf+K/7w0hNshs/duGsNXPUCLH5XAqjEtiPGwNONLV0tBH8NoGb0mvD5JubnUTrujKDTg==} + /qs/6.10.3: + resolution: {integrity: sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==} engines: {node: '>=0.6'} dependencies: side-channel: 1.0.4 @@ -10351,10 +10352,6 @@ packages: engines: {node: '>=0.10.0'} dev: true - /store/2.0.12: - resolution: {integrity: sha1-jFNOKguDH3K3X8XxEZhXxE711ZM=} - dev: false - /stream-browserify/2.0.2: resolution: {integrity: sha512-nX6hmklHs/gr2FuxYDltq8fJA1GDlxKQCz8O/IM4atRqBH8OORmBNgfvW5gG10GT/qQ9u0CzIvr2X5Pkt6ntqg==} dependencies: diff --git a/src/components/Input/AttachmentInput.vue b/src/components/Input/AttachmentInput.vue new file mode 100644 index 0000000000..0aee3f3e71 --- /dev/null +++ b/src/components/Input/AttachmentInput.vue @@ -0,0 +1,47 @@ + + diff --git a/src/components/index.js b/src/components/index.js index 8c171da053..ceaa6f510a 100644 --- a/src/components/index.js +++ b/src/components/index.js @@ -7,6 +7,7 @@ import AttachmentSelectDrawer from './Attachment/AttachmentSelectDrawer' import AttachmentUploadModal from './Attachment/AttachmentUploadModal' import ReactiveButton from './Button/ReactiveButton' import PostTag from './Post/PostTag' +import AttachmentInput from './Input/AttachmentInput' const _components = { Ellipsis, @@ -15,7 +16,8 @@ const _components = { AttachmentSelectDrawer, AttachmentUploadModal, ReactiveButton, - PostTag + PostTag, + AttachmentInput } const components = {} diff --git a/src/config/router.config.js b/src/config/router.config.js index 24a0d7aa88..5d7a8b14b7 100644 --- a/src/config/router.config.js +++ b/src/config/router.config.js @@ -141,16 +141,22 @@ export const asyncRouterMap = [ meta: { title: '主题', hiddenHeaderContent: false } }, { - path: '/interface/menus', - name: 'MenuList', - component: () => import('@/views/interface/MenuList'), - meta: { title: '菜单', hiddenHeaderContent: false } + path: '/interface/themes/setting', + name: 'ThemeSetting', + component: () => import('@/views/interface/ThemeSetting'), + meta: { title: '主题设置', hiddenHeaderContent: false } }, { path: '/interface/themes/edit', name: 'ThemeEdit', component: () => import('@/views/interface/ThemeEdit'), meta: { title: '主题编辑', hiddenHeaderContent: false } + }, + { + path: '/interface/menus', + name: 'MenuList', + component: () => import('@/views/interface/MenuList'), + meta: { title: '菜单设置', hiddenHeaderContent: false } } ] }, diff --git a/src/core/lazy_lib/components_use.js b/src/core/lazy_lib/components_use.js index b84f58bb8b..b11cc16044 100644 --- a/src/core/lazy_lib/components_use.js +++ b/src/core/lazy_lib/components_use.js @@ -52,7 +52,8 @@ import { TimePicker, Tooltip, Tree, - TreeSelect + TreeSelect, + Descriptions } from 'ant-design-vue' Vue.use(Affix) @@ -106,6 +107,7 @@ Vue.use(Steps) Vue.use(Empty) Vue.use(Result) Vue.use(Space) +Vue.use(Descriptions) // message config message.config({ diff --git a/src/layouts/PageView.vue b/src/layouts/PageView.vue index 4fcfd6c8c0..caf63d00b9 100644 --- a/src/layouts/PageView.vue +++ b/src/layouts/PageView.vue @@ -6,6 +6,7 @@ + @@ -15,6 +16,7 @@ + diff --git a/src/views/interface/ThemeList.vue b/src/views/interface/ThemeList.vue index 99354b3a8e..4f6c95a086 100644 --- a/src/views/interface/ThemeList.vue +++ b/src/views/interface/ThemeList.vue @@ -29,7 +29,7 @@ 启用 -
+
设置
@@ -49,7 +49,7 @@ - 从主题包更新 + 本地更新 @@ -125,63 +125,36 @@
- - - - - -

确定删除【{{ themeDeleteModal.selected.name }}】主题?

- - 同时删除主题配置 - -
+ + + + diff --git a/src/views/interface/components/ThemeDeleteConfirmModal.vue b/src/views/interface/components/ThemeDeleteConfirmModal.vue new file mode 100644 index 0000000000..c34300aa87 --- /dev/null +++ b/src/views/interface/components/ThemeDeleteConfirmModal.vue @@ -0,0 +1,85 @@ + + diff --git a/src/views/interface/components/ThemeLocalUpgradeModal.vue b/src/views/interface/components/ThemeLocalUpgradeModal.vue new file mode 100644 index 0000000000..c45cc01b0b --- /dev/null +++ b/src/views/interface/components/ThemeLocalUpgradeModal.vue @@ -0,0 +1,56 @@ + + diff --git a/src/views/system/About.vue b/src/views/system/About.vue index 83f23f6385..1eb46881db 100644 --- a/src/views/system/About.vue +++ b/src/views/system/About.vue @@ -27,6 +27,7 @@
  • 版本:{{ environments.version }}
  • 数据库:{{ environments.database }}
  • 运行模式:{{ environments.mode }}
  • +
  • 启用主题:{{ activatedTheme.name }}
  • 启动时间:{{ environments.startTime | moment }}
  • { - this.environments = response.data - }) + const { data } = await apiClient.getEnvironment() + this.environments = data this.checkServerUpdate() }, + async handleGetActivatedTheme() { + const { data } = await apiClient.theme.getActivatedTheme() + this.activatedTheme = data + }, handleCopyEnvironments() { const text = `版本:${this.environments.version} 数据库:${this.environments.database} 运行模式:${this.environments.mode} +启用主题:${this.activatedTheme.name} User Agent:${navigator.userAgent}` this.$copyText(text) .then(message => {