diff --git a/apps/common/template/email_template.html b/apps/common/template/email_template.html index 3ac7e1474..0647d3cb9 100644 --- a/apps/common/template/email_template.html +++ b/apps/common/template/email_template.html @@ -55,7 +55,7 @@
Promise> = () => { + return get(`${prefix}/info`) +} + +/** + * 更新外观设置 + * @param 参数 + * * formData { + * theme + * icon + * loginLogo + * loginImage + * title + * slogan + * } + */ +const postThemeInfo: (data: any, loading?: Ref) => Promise> = ( + data, + loading +) => { + return post(`${prefix}/update`, data, undefined, loading) +} + +export default { + getThemeInfo, + postThemeInfo +} diff --git a/ui/src/assets/MaxKB-logo.svg b/ui/src/assets/MaxKB-logo.svg deleted file mode 100644 index 326c901d0..000000000 --- a/ui/src/assets/MaxKB-logo.svg +++ /dev/null @@ -1 +0,0 @@ -MaxKB \ No newline at end of file diff --git a/ui/src/assets/logo.png b/ui/src/assets/logo.png deleted file mode 100644 index 7d9781edb..000000000 Binary files a/ui/src/assets/logo.png and /dev/null differ diff --git a/ui/src/assets/logo/MaxKB-logo-currentColor.svg b/ui/src/assets/logo/MaxKB-logo-currentColor.svg new file mode 100644 index 000000000..94281645f --- /dev/null +++ b/ui/src/assets/logo/MaxKB-logo-currentColor.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/ui/src/assets/logo/MaxKB-logo.svg b/ui/src/assets/logo/MaxKB-logo.svg new file mode 100644 index 000000000..beb86aa51 --- /dev/null +++ b/ui/src/assets/logo/MaxKB-logo.svg @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ui/src/assets/logo/logo-currentColor.svg b/ui/src/assets/logo/logo-currentColor.svg new file mode 100644 index 000000000..5f50e4cf3 --- /dev/null +++ b/ui/src/assets/logo/logo-currentColor.svg @@ -0,0 +1 @@ +MaxKB \ No newline at end of file diff --git a/ui/src/assets/logo/logo.svg b/ui/src/assets/logo/logo.svg new file mode 100644 index 000000000..2e601bb46 --- /dev/null +++ b/ui/src/assets/logo/logo.svg @@ -0,0 +1 @@ +MaxKB \ No newline at end of file diff --git a/ui/src/assets/login.jpg b/ui/src/assets/theme/default.jpg similarity index 100% rename from ui/src/assets/login.jpg rename to ui/src/assets/theme/default.jpg diff --git a/ui/src/assets/theme/green.jpg b/ui/src/assets/theme/green.jpg new file mode 100644 index 000000000..937e8a03c Binary files /dev/null and b/ui/src/assets/theme/green.jpg differ diff --git a/ui/src/assets/theme/orange.jpg b/ui/src/assets/theme/orange.jpg new file mode 100644 index 000000000..05d8420f4 Binary files /dev/null and b/ui/src/assets/theme/orange.jpg differ diff --git a/ui/src/assets/theme/purple.jpg b/ui/src/assets/theme/purple.jpg new file mode 100644 index 000000000..843a42585 Binary files /dev/null and b/ui/src/assets/theme/purple.jpg differ diff --git a/ui/src/assets/theme/red.jpg b/ui/src/assets/theme/red.jpg new file mode 100644 index 000000000..cabf84f6f Binary files /dev/null and b/ui/src/assets/theme/red.jpg differ diff --git a/ui/src/components/ai-chat/component/ParagraphCard.vue b/ui/src/components/ai-chat/component/ParagraphCard.vue index 104e66242..a1a47696a 100644 --- a/ui/src/components/ai-chat/component/ParagraphCard.vue +++ b/ui/src/components/ai-chat/component/ParagraphCard.vue @@ -23,8 +23,8 @@ {{ data?.document_name }} -
- +
+ @@ -52,7 +52,7 @@ const props = defineProps({ } @media only screen and (max-width: 768px) { .paragraph-source-card-height { - height: 285px; - } + height: 285px; + } } diff --git a/ui/src/components/card-box/index.vue b/ui/src/components/card-box/index.vue index c320fc783..dfcde8a02 100644 --- a/ui/src/components/card-box/index.vue +++ b/ui/src/components/card-box/index.vue @@ -4,7 +4,7 @@
- + diff --git a/ui/src/components/card-checkbox/index.vue b/ui/src/components/card-checkbox/index.vue index fad15107c..b008aa9c8 100644 --- a/ui/src/components/card-checkbox/index.vue +++ b/ui/src/components/card-checkbox/index.vue @@ -12,7 +12,7 @@ - + diff --git a/ui/src/components/icons/index.ts b/ui/src/components/icons/index.ts index b9e3ddfda..c14811734 100644 --- a/ui/src/components/icons/index.ts +++ b/ui/src/components/icons/index.ts @@ -955,7 +955,7 @@ export const iconMap: any = { ]) } }, - 'app-minify': { + 'app-magnify': { iconReader: () => { return h('i', [ h( @@ -976,7 +976,7 @@ export const iconMap: any = { ]) } }, - 'app-magnify': { + 'app-minify': { iconReader: () => { return h('i', [ h( @@ -1071,5 +1071,5 @@ export const iconMap: any = { ) ]) } - }, + } } diff --git a/ui/src/components/index.ts b/ui/src/components/index.ts index ddd152fa0..33f111892 100644 --- a/ui/src/components/index.ts +++ b/ui/src/components/index.ts @@ -19,6 +19,8 @@ import InfiniteScroll from './infinite-scroll/index.vue' import AutoTooltip from './auto-tooltip/index.vue' import MdEditor from './markdown/MdEditor.vue' import MdPreview from './markdown/MdPreview.vue' +import LogoFull from './logo/LogoFull.vue' +import LogoIcon from './logo/LogoIcon.vue' export default { install(app: App) { @@ -42,5 +44,7 @@ export default { app.component(AutoTooltip.name, AutoTooltip) app.component(MdPreview.name, MdPreview) app.component(MdEditor.name, MdEditor) + app.component(LogoFull.name, LogoFull) + app.component(LogoIcon.name, LogoIcon) } } diff --git a/ui/src/components/login-container/index.vue b/ui/src/components/login-container/index.vue index 63495c293..07145339a 100644 --- a/ui/src/components/login-container/index.vue +++ b/ui/src/components/login-container/index.vue @@ -1,7 +1,9 @@ diff --git a/ui/src/components/logo/LogoIcon.vue b/ui/src/components/logo/LogoIcon.vue new file mode 100644 index 000000000..51d47db82 --- /dev/null +++ b/ui/src/components/logo/LogoIcon.vue @@ -0,0 +1,59 @@ + + + diff --git a/ui/src/components/tags-input/index.vue b/ui/src/components/tags-input/index.vue index 77a375535..156827ce1 100644 --- a/ui/src/components/tags-input/index.vue +++ b/ui/src/components/tags-input/index.vue @@ -28,12 +28,6 @@
{{ item.username }}
-
+ + diff --git a/ui/src/layout/components/breadcrumb/index.vue b/ui/src/layout/components/breadcrumb/index.vue index c884d5b09..d8d62ccdf 100644 --- a/ui/src/layout/components/breadcrumb/index.vue +++ b/ui/src/layout/components/breadcrumb/index.vue @@ -36,7 +36,7 @@ > - +
{{ current?.name }}
@@ -228,7 +228,7 @@ onMounted(() => { border-radius: 4px; &:hover { background: var(--el-color-primary-light-9); - color: var(--el-menu-active-color); + color: var(--el-color-primary); } } &__footer { diff --git a/ui/src/layout/components/index.ts b/ui/src/layout/components/index.ts index 7b1d22e32..c6d38f7c4 100644 --- a/ui/src/layout/components/index.ts +++ b/ui/src/layout/components/index.ts @@ -1,3 +1,4 @@ export { default as Sidebar } from './sidebar/index.vue' export { default as AppMain } from './app-main/index.vue' export { default as TopBar } from './top-bar/index.vue' +export { default as AppHeader } from './app-header/index.vue' diff --git a/ui/src/layout/components/sidebar/SidebarItem.vue b/ui/src/layout/components/sidebar/SidebarItem.vue index 93e49fb75..8601d6327 100644 --- a/ui/src/layout/components/sidebar/SidebarItem.vue +++ b/ui/src/layout/components/sidebar/SidebarItem.vue @@ -50,6 +50,8 @@ const { params: { id, type } } = route as any + + function showMenu() { if (isWorkFlow(type)) { return props.menu.name !== 'AppHitTest' @@ -84,14 +86,14 @@ const menuIcon = computed(() => { border-radius: 4px; &:hover { background: none; - color: var(--el-menu-active-color); + color: var(--el-color-primary); } } :deep(.el-sub-menu__title) { padding: 13px 12px 13px 16px !important; &:hover { background: none; - color: var(--el-menu-active-color); + color: var(--el-color-primary); } } .el-sub-menu { @@ -100,7 +102,7 @@ const menuIcon = computed(() => { } } .el-menu-item.is-active { - color: var(--el-menu-active-color); + color: var(--el-color-primary); background: var(--el-color-primary-light-9); } } diff --git a/ui/src/layout/components/top-bar/avatar/AboutDialog.vue b/ui/src/layout/components/top-bar/avatar/AboutDialog.vue index 24b2adb94..7b2bd2373 100644 --- a/ui/src/layout/components/top-bar/avatar/AboutDialog.vue +++ b/ui/src/layout/components/top-bar/avatar/AboutDialog.vue @@ -1,16 +1,16 @@ diff --git a/ui/src/layout/layout-template/DetailLayout.vue b/ui/src/layout/layout-template/DetailLayout.vue index 31ace597b..9e1a6c201 100644 --- a/ui/src/layout/layout-template/DetailLayout.vue +++ b/ui/src/layout/layout-template/DetailLayout.vue @@ -12,15 +12,7 @@ - diff --git a/ui/src/layout/layout-template/SystemLayout.vue b/ui/src/layout/layout-template/SystemLayout.vue index 85887bcd7..27ede72ff 100644 --- a/ui/src/layout/layout-template/SystemLayout.vue +++ b/ui/src/layout/layout-template/SystemLayout.vue @@ -1,8 +1,6 @@ - diff --git a/ui/src/layout/layout-template/index.scss b/ui/src/layout/layout-template/index.scss new file mode 100644 index 000000000..56bff011c --- /dev/null +++ b/ui/src/layout/layout-template/index.scss @@ -0,0 +1,23 @@ +.app-layout { + background-color: var(--app-layout-bg-color); + height: 100%; +} + +.app-main { + position: relative; + height: 100%; + padding: var(--app-header-height) 0 0 !important; + box-sizing: border-box; + overflow: auto; +} + +.sidebar-container { + box-sizing: border-box; + transition: width 0.28s; + width: var(--sidebar-width); + min-width: var(--sidebar-width); + background-color: var(--sidebar-bg-color); +} +.view-container { + width: calc(100% - var(--sidebar-width)); +} diff --git a/ui/src/main.ts b/ui/src/main.ts index 277a2fc26..a93fe9ea9 100644 --- a/ui/src/main.ts +++ b/ui/src/main.ts @@ -4,7 +4,6 @@ import * as ElementPlusIcons from '@element-plus/icons-vue' import zhCn from 'element-plus/dist/locale/zh-cn.mjs' import { createApp } from 'vue' import { store } from '@/stores' -import theme from '@/theme' import directives from '@/directives' import App from './App.vue' import router from '@/router' @@ -56,8 +55,6 @@ app.use(ElementPlus, { locale: zhCn }) -app.use(theme) - app.use(router) app.use(i18n) app.use(Components) diff --git a/ui/src/router/modules/setting.ts b/ui/src/router/modules/setting.ts index 719aef797..357c133de 100644 --- a/ui/src/router/modules/setting.ts +++ b/ui/src/router/modules/setting.ts @@ -4,7 +4,7 @@ import { Role, ComplexPermission } from '@/utils/permission/type' const settingRouter = { path: '/setting', name: 'setting', - meta: { icon: 'Setting', title: '系统设置', permission: 'SETTING:READ' }, + meta: { icon: 'Setting', title: '系统管理', permission: 'SETTING:READ' }, redirect: () => { if (hasPermission(new Role('ADMIN'), 'AND')) { return '/user' @@ -59,7 +59,7 @@ const settingRouter = { meta: { icon: 'app-setting', iconActive: 'app-setting-active', - title: '系统设置', + title: '系统管理', activeMenu: '/setting', parentPath: '/setting', parentName: 'setting', diff --git a/ui/src/stores/modules/user.ts b/ui/src/stores/modules/user.ts index 1f9bd14de..ca5f05275 100644 --- a/ui/src/stores/modules/user.ts +++ b/ui/src/stores/modules/user.ts @@ -1,6 +1,9 @@ import { defineStore } from 'pinia' import type { User } from '@/api/type/user' import UserApi from '@/api/user' +import ThemeApi from '@/api/theme' +import { useElementPlusTheme } from 'use-element-plus-theme' +const { changeTheme } = useElementPlusTheme() export interface userStateTypes { userType: number // 1 系统操作者 2 对话用户 @@ -10,6 +13,7 @@ export interface userStateTypes { accessToken?: string XPACK_LICENSE_IS_VALID: false isXPack: false + themeInfo: any } const useUserStore = defineStore({ @@ -20,9 +24,17 @@ const useUserStore = defineStore({ token: '', version: '', XPACK_LICENSE_IS_VALID: false, - isXPack: false + isXPack: false, + themeInfo: null }), actions: { + isDefaultTheme() { + return !this.themeInfo?.theme || this.themeInfo?.theme === '#3370FF' + }, + setTheme(data: any) { + changeTheme(data?.['theme']) + this.themeInfo = data + }, isExpire() { return this.isXPack && !this.XPACK_LICENSE_IS_VALID }, @@ -78,6 +90,18 @@ const useUserStore = defineStore({ }) }, + async theme() { + return await ThemeApi.getThemeInfo().then((ok) => { + this.themeInfo = ok.data + changeTheme(this.themeInfo['theme']) + window.document.title = this.themeInfo['title'] || 'MaxKB' + const link = document.querySelector('link[rel="icon"]') as any + if (link) { + link['href'] = this.themeInfo['icon'] || '/favicon.ico' + } + }) + }, + async profile() { return UserApi.profile().then((ok) => { this.userInfo = ok.data diff --git a/ui/src/styles/app.scss b/ui/src/styles/app.scss index f8d0f5baa..1068aaba4 100644 --- a/ui/src/styles/app.scss +++ b/ui/src/styles/app.scss @@ -369,8 +369,8 @@ h5 { /* tag */ .default-tag { - background: var(--tag-default-bg); - color: var(--tag-default-color); + background: var(--el-color-primary-light-7); + color: var(--el-color-primary); border: none; } .success-tag { @@ -390,6 +390,12 @@ h5 { border-color: #e0d7f0; } +.blue-tag { + background: #ebf1ff; + color: #3370ff; + border-color: #d6e2ff; +} + /* card 无边框无阴影 灰色背景 */ @@ -455,6 +461,9 @@ h5 { .avatar-purple { background: #7f3bf5; } +.avatar-blue { + background: #3370ff; +} .success { color: var(--el-color-success); @@ -651,3 +660,29 @@ h5 { border: 1px solid var(--el-color-primary); } } + +.app-card { + background: #fff; + border-radius: 8px; + box-shadow: 0px 2px 4px 0px rgba(31, 35, 41, 0.12); +} + +.app-radio-button-group { + border: 1px solid var(--app-border-color-dark); + border-radius: var(--el-border-radius-base); + .el-radio-button { + padding: 3px; + } + .el-radio-button__inner { + border: none !important; + border-radius: var(--el-border-radius-base) !important; + padding: 5px 8px; + font-weight: 400; + } + .el-radio-button__original-radio:checked + .el-radio-button__inner { + color: var(--el-color-primary); + background: var(--el-color-primary-light-9); + border: none; + box-shadow: none; + } +} diff --git a/ui/src/styles/element-plus.scss b/ui/src/styles/element-plus.scss index 2a21411d2..feea925b9 100644 --- a/ui/src/styles/element-plus.scss +++ b/ui/src/styles/element-plus.scss @@ -1,6 +1,5 @@ :root { - --el-color-primary: #3370ff; - --el-color-primary-light-9: rgba(51, 112, 255, 0.1); + --el-color-primary: #3370FF; --el-menu-item-height: 45px; --el-box-shadow-light: 0px 2px 4px 0px rgba(31, 35, 41, 0.12); --el-border-color: #dee0e3; diff --git a/ui/src/styles/variables.scss b/ui/src/styles/variables.scss index ef092ca6a..5fdad42fe 100644 --- a/ui/src/styles/variables.scss +++ b/ui/src/styles/variables.scss @@ -14,8 +14,8 @@ --app-header-height: 56px; --app-header-padding: 0 20px; --app-header-bg-color: linear-gradient(90deg, #ebf1ff 24.34%, #e5fbf8 56.18%, #f2ebfe 90.18%); - --app-logo-color: linear-gradient(180deg, #3370ff 0%, #7f3bf5 100%); - --app-avatar-gradient-color: linear-gradient(270deg, #9258f7 0%, #3370ff 100%); + --app-logo-color: linear-gradient(180deg, #3370FF 0%, #7f3bf5 100%); + --app-avatar-gradient-color: linear-gradient(270deg, #9258f7 0%, #3370FF 100%); /* 计算高度 */ --app-main-height: calc(100vh - var(--app-header-height) - var(--app-view-padding) * 2 - 40px); diff --git a/ui/src/theme/defaultInferData.ts b/ui/src/theme/defaultInferData.ts deleted file mode 100644 index acc50ce22..000000000 --- a/ui/src/theme/defaultInferData.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { InferData } from "./type"; -const inferData: Array = [ - { - key: "primary", - value: "#3370FF", - }, - { key: "success", value: "#67c23a" }, - { key: "warning", value: "#e6a23c" }, - { key: "danger", value: "#f56c6c" }, - { key: "error", value: "#F54A45" }, - { key: "info", value: "#909399" }, -]; -export default inferData; diff --git a/ui/src/theme/defaultKeyValueData.ts b/ui/src/theme/defaultKeyValueData.ts deleted file mode 100644 index 694ad0f02..000000000 --- a/ui/src/theme/defaultKeyValueData.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { KeyValueData } from './type' -const keyValueData: KeyValueData = { - '--el-header-padding': '0px' -} -export default keyValueData diff --git a/ui/src/theme/index.ts b/ui/src/theme/index.ts deleted file mode 100644 index 451558c92..000000000 --- a/ui/src/theme/index.ts +++ /dev/null @@ -1,281 +0,0 @@ -import type { - ThemeSetting, - InferData, - KeyValueData, - UpdateInferData, - UpdateKeyValueData -} from './type' -import { TinyColor } from '@ctrl/tinycolor' -// 引入默认推断数据 -import inferData from './defaultInferData' -// 引入默认keyValue数据 -import keyValueData from './defaultKeyValueData' -// 引入设置对象 -import setting from './setting' -import type { App } from 'vue' -declare global { - interface ChildNode { - innerText: string - } -} -class Theme { - /** - * 主题设置 - */ - themeSetting: ThemeSetting - /** - * 键值数据 - */ - keyValue: KeyValueData - /** - * 外推数据 - */ - inferData: Array - /** - *是否是第一次初始化 - */ - isFirstWriteStyle: boolean - /** - * 混色白 - */ - colorWhite: string - /** - * 混色黑 - */ - colorBlack: string - - constructor(themeSetting: ThemeSetting, keyValue: KeyValueData, inferData: Array) { - this.themeSetting = themeSetting - this.keyValue = keyValue - this.inferData = inferData - this.isFirstWriteStyle = true - this.colorWhite = '#ffffff' - this.colorBlack = '#000000' - this.initDefaultTheme() - } - - /** - * 拼接 - * @param setting 主题设置 - * @param names 需要拼接的所有值 - * @returns 拼接后的数据 - */ - getVarName = (setting: ThemeSetting, ...names: Array) => { - return ( - setting.startDivision + setting.namespace + setting.division + names.join(setting.division) - ) - } - - /** - * 转换外推数据 - * @param setting 主题设置对象 - * @param inferData 外推数据 - * @returns - */ - mapInferMainStyle = (setting: ThemeSetting, inferData: InferData) => { - const key: string = this.getVarName( - setting, - inferData.setting ? inferData.setting.type : setting.colorInferSetting.type, - inferData.key - ) - return { - [key]: inferData.value, - ...this.mapInferDataStyle(setting, inferData) - } - } - /** - * 转换外推数据 - * @param setting 设置 - * @param inferData 外推数据 - */ - mapInferData = (setting: ThemeSetting, inferData: Array) => { - return inferData - .map((itemData) => { - return this.mapInferMainStyle(setting, itemData) - }) - .reduce((pre, next) => { - return { ...pre, ...next } - }, {}) - } - /** - * 转换外推数据 - * @param setting 主题设置对象 - * @param inferData 外推数据 - * @returns - */ - mapInferDataStyle = (setting: ThemeSetting, inferData: InferData) => { - const inferSetting = inferData.setting ? inferData.setting : setting.colorInferSetting - if (inferSetting.type === 'color') { - return Object.keys(inferSetting) - .map((key: string) => { - if (key === 'light' || key === 'dark') { - return inferSetting[key] - .map((l: any) => { - const varName = this.getVarName( - setting, - inferSetting.type, - inferData.key, - key, - l.toString() - ) - return { - [varName]: new TinyColor(inferData.value) - .mix(key === 'light' ? this.colorWhite : this.colorBlack, l * 10) - .toHexString() - } - }) - .reduce((pre: any, next: any) => { - return { ...pre, ...next } - }, {}) - } - return {} - }) - .reduce((pre, next) => { - return { ...pre, ...next } - }, {}) - } - return {} - } - - /** - * - * @param themeSetting 主题设置 - * @param keyValueData 键值数据 - * @returns 映射后的键值数据 - */ - mapKeyValue = (themeSetting: ThemeSetting, keyValueData: KeyValueData) => { - return Object.keys(keyValueData) - .map((key: string) => { - return { - [this.updateKeyBySetting(key, themeSetting)]: keyValueData[key] - } - }) - .reduce((pre, next) => { - return { ...pre, ...next } - }, {}) - } - /** - * 根据配置文件修改Key - * @param key key - * @param themeSetting 主题设置 - * @returns - */ - updateKeyBySetting = (key: string, themeSetting: ThemeSetting) => { - return key.startsWith(themeSetting.startDivision) - ? key - : key.startsWith(themeSetting.namespace) - ? themeSetting.startDivision + key - : key.startsWith(themeSetting.division) - ? themeSetting.startDivision + themeSetting.namespace - : themeSetting.startDivision + themeSetting.namespace + themeSetting.division + key - } - /** - * - * @param setting 主题设置 - * @param keyValue 主题键值对数据 - * @param inferData 外推数据 - * @returns 合并后的键值对数据 - */ - tokeyValueStyle = () => { - return { - ...this.mapInferData(this.themeSetting, this.inferData), - ...this.mapKeyValue(this.themeSetting, this.keyValue) - } - } - - /** - * 将keyValue对象转换为S - * @param keyValue - * @returns - */ - toString = (keyValue: KeyValueData) => { - const inner = Object.keys(keyValue) - .map((key: string) => { - return key + ':' + keyValue[key] + ';' - }) - .join('') - return `@charset "UTF-8";:root{${inner}}` - } - - /** - * - * @param elNewStyle 新的变量样式 - */ - writeNewStyle = (elNewStyle: string) => { - if (this.isFirstWriteStyle) { - const style = document.createElement('style') - style.innerText = elNewStyle - document.head.appendChild(style) - this.isFirstWriteStyle = false - } else { - if (document.head.lastChild) { - document.head.lastChild.innerText = elNewStyle - } - } - } - - /** - * 修改数据并且写入dom - * @param updateInferData 平滑数据修改 - * @param updateKeyvalueData keyValue数据修改 - */ - updateWrite = (updateInferData?: UpdateInferData, updateKeyvalueData?: UpdateKeyValueData) => { - this.update(updateInferData, updateKeyvalueData) - const newStyle = this.tokeyValueStyle() - const newStyleString = this.toString(newStyle) - this.writeNewStyle(newStyleString) - } - - /** - * 修改数据 - * @param inferData - * @param keyvalueData - */ - update = (updateInferData?: UpdateInferData, updateKeyvalueData?: UpdateKeyValueData) => { - if (updateInferData) { - this.updateInferData(updateInferData) - } - if (updateKeyvalueData) { - this.updateOrCreateKeyValueData(updateKeyvalueData) - } - } - - /** - * 修改外推数据 外推数据只能修改,不能新增 - * @param inferData - */ - updateInferData = (updateInferData: UpdateInferData) => { - Object.keys(updateInferData).forEach((key) => { - const findInfer = this.inferData.find((itemInfer) => { - return itemInfer.key === key - }) - if (findInfer) { - findInfer.value = updateInferData[key] - } else { - this.inferData.push({ key, value: updateInferData[key] }) - } - }) - } - - /** - * 初始化默认主题 - */ - initDefaultTheme = () => { - this.updateWrite() - } - /** - * 修改KeyValue数据 - * @param keyvalueData keyValue数据 - */ - updateOrCreateKeyValueData = (updateKeyvalueData: UpdateKeyValueData) => { - Object.keys(updateKeyvalueData).forEach((key) => { - const newKey = this.updateKeyBySetting(key, this.themeSetting) - this.keyValue[newKey] = updateKeyvalueData[newKey] - }) - } -} - -const install = (app: App) => { - app.config.globalProperties.theme = new Theme(setting, keyValueData, inferData) -} -export default { install } diff --git a/ui/src/theme/setting.ts b/ui/src/theme/setting.ts deleted file mode 100644 index f801463fb..000000000 --- a/ui/src/theme/setting.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type { ThemeSetting } from "./type"; -const setting: ThemeSetting = { - namespace: "el", - division: "-", - startDivision: "--", - colorInferSetting: { - light: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], - dark: [2], - type: "color", - }, -}; -export default setting; diff --git a/ui/src/theme/type.ts b/ui/src/theme/type.ts deleted file mode 100644 index 76e9ffb22..000000000 --- a/ui/src/theme/type.ts +++ /dev/null @@ -1,71 +0,0 @@ -interface ThemeSetting { - /** - *element-ui Namespace - */ - namespace: string; - /** - * 数据分隔符 - */ - division: string; - /** - * 前缀 - */ - startDivision: string; - /** - * 颜色外推设置 - */ - colorInferSetting: ColorInferSetting; -} - -/** - * 颜色混和设置 - */ -interface ColorInferSetting { - /** - * 与白色混 - */ - light: Array; - /** - * 与黑色混 - */ - dark: Array; - /** - * 类型 - */ - type: string; -} - -/** - * 平滑数据 - */ -interface KeyValueData { - [propName: string]: string; -} -type UpdateInferData = KeyValueData; - -type UpdateKeyValueData = KeyValueData; -/** - *平滑数据 - */ -interface InferData { - /** - * 设置 - */ - setting?: ColorInferSetting | any; - /** - * 健 - */ - key: string; - /** - * 值 - */ - value: string; -} - -export type { - KeyValueData, - InferData, - ThemeSetting, - UpdateInferData, - UpdateKeyValueData, -}; diff --git a/ui/src/utils/theme.ts b/ui/src/utils/theme.ts new file mode 100644 index 000000000..51674cbe3 --- /dev/null +++ b/ui/src/utils/theme.ts @@ -0,0 +1,44 @@ +export const themeList = [ + { + label: '默认', + value: '#3370FF', + loginBackground: 'default' + }, + { + label: '活力橙', + value: '#FF8800', + loginBackground: 'orange' + }, + { + label: '松石绿', + value: '#00B69D', + loginBackground: 'green' + }, + { + label: '商务蓝', + value: '#4954E6', + loginBackground: 'default' + }, + { + label: '神秘紫', + value: '#7F3BF5', + loginBackground: 'purple' + }, + { + label: '胭脂红', + value: '#F01D94', + loginBackground: 'red' + } +] + +export function getThemeImg(val: string) { + return themeList.filter((v) => v.value === val)?.[0]?.loginBackground || 'default' +} + +export const defaultSetting = { + icon: '', + loginLogo: '', + loginImage: '', + title: 'MaxKB', + slogan: '欢迎使用 MaxKB 智能知识库' +} diff --git a/ui/src/views/application-workflow/index.vue b/ui/src/views/application-workflow/index.vue index 9a851c5d1..906249748 100644 --- a/ui/src/views/application-workflow/index.vue +++ b/ui/src/views/application-workflow/index.vue @@ -64,7 +64,7 @@
diff --git a/ui/src/views/application/ApplicationSetting.vue b/ui/src/views/application/ApplicationSetting.vue index b1d591ddb..a120d245e 100644 --- a/ui/src/views/application/ApplicationSetting.vue +++ b/ui/src/views/application/ApplicationSetting.vue @@ -220,7 +220,7 @@ - +
diff --git a/ui/src/views/application/CreateAndSetting.vue b/ui/src/views/application/CreateAndSetting.vue index fece1bbd3..d9de0349d 100644 --- a/ui/src/views/application/CreateAndSetting.vue +++ b/ui/src/views/application/CreateAndSetting.vue @@ -218,7 +218,7 @@ - +
diff --git a/ui/src/views/application/index.vue b/ui/src/views/application/index.vue index f73431d0f..bce33ba5b 100644 --- a/ui/src/views/application/index.vue +++ b/ui/src/views/application/index.vue @@ -64,7 +64,7 @@
高级编排 - 简单配置 + 简单配置