feat: 外观设置
This commit is contained in:
parent
ab08767059
commit
97104cc492
@ -37,6 +37,7 @@
|
|||||||
"pinia": "^2.1.6",
|
"pinia": "^2.1.6",
|
||||||
"pinyin-pro": "^3.18.2",
|
"pinyin-pro": "^3.18.2",
|
||||||
"screenfull": "^6.0.2",
|
"screenfull": "^6.0.2",
|
||||||
|
"use-element-plus-theme": "^0.0.5",
|
||||||
"vue": "^3.3.4",
|
"vue": "^3.3.4",
|
||||||
"vue-clipboard3": "^2.0.0",
|
"vue-clipboard3": "^2.0.0",
|
||||||
"vue-i18n": "^9.13.1",
|
"vue-i18n": "^9.13.1",
|
||||||
|
|||||||
@ -235,7 +235,7 @@ onMounted(() => {
|
|||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
&:hover {
|
&:hover {
|
||||||
background: var(--el-color-primary-light-9);
|
background: var(--el-color-primary-light-9);
|
||||||
color: var(--el-menu-active-color);
|
color: var(--el-color-primary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
&__footer {
|
&__footer {
|
||||||
|
|||||||
@ -50,6 +50,8 @@ const {
|
|||||||
params: { id, type }
|
params: { id, type }
|
||||||
} = route as any
|
} = route as any
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function showMenu() {
|
function showMenu() {
|
||||||
if (isWorkFlow(type)) {
|
if (isWorkFlow(type)) {
|
||||||
return props.menu.name !== 'AppHitTest'
|
return props.menu.name !== 'AppHitTest'
|
||||||
@ -84,14 +86,14 @@ const menuIcon = computed(() => {
|
|||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
&:hover {
|
&:hover {
|
||||||
background: none;
|
background: none;
|
||||||
color: var(--el-menu-active-color);
|
color: var(--el-color-primary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
:deep(.el-sub-menu__title) {
|
:deep(.el-sub-menu__title) {
|
||||||
padding: 13px 12px 13px 16px !important;
|
padding: 13px 12px 13px 16px !important;
|
||||||
&:hover {
|
&:hover {
|
||||||
background: none;
|
background: none;
|
||||||
color: var(--el-menu-active-color);
|
color: var(--el-color-primary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.el-sub-menu {
|
.el-sub-menu {
|
||||||
@ -100,7 +102,7 @@ const menuIcon = computed(() => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.el-menu-item.is-active {
|
.el-menu-item.is-active {
|
||||||
color: var(--el-menu-active-color);
|
color: var(--el-color-primary);
|
||||||
background: var(--el-color-primary-light-9);
|
background: var(--el-color-primary-light-9);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,7 @@ export interface commonTypes {
|
|||||||
paginationConfig: any | null
|
paginationConfig: any | null
|
||||||
search: any
|
search: any
|
||||||
device: string
|
device: string
|
||||||
|
theme: string
|
||||||
}
|
}
|
||||||
|
|
||||||
const useCommonStore = defineStore({
|
const useCommonStore = defineStore({
|
||||||
@ -17,9 +18,16 @@ const useCommonStore = defineStore({
|
|||||||
// 搜索和分页缓存
|
// 搜索和分页缓存
|
||||||
paginationConfig: {},
|
paginationConfig: {},
|
||||||
search: {},
|
search: {},
|
||||||
device: DeviceType.Desktop
|
device: DeviceType.Desktop,
|
||||||
|
theme: ''
|
||||||
}),
|
}),
|
||||||
actions: {
|
actions: {
|
||||||
|
isDefaultTheme() {
|
||||||
|
this.theme === '#3370ff'
|
||||||
|
},
|
||||||
|
setTheme(val: string) {
|
||||||
|
this.theme = val
|
||||||
|
},
|
||||||
saveBreadcrumb(data: any) {
|
saveBreadcrumb(data: any) {
|
||||||
this.breadcrumb = data
|
this.breadcrumb = data
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
:root {
|
:root {
|
||||||
--el-color-primary: #3370ff;
|
--el-color-primary: #3370ff;
|
||||||
--el-color-primary-light-9: rgba(51, 112, 255, 0.1);
|
|
||||||
--el-menu-item-height: 45px;
|
--el-menu-item-height: 45px;
|
||||||
--el-box-shadow-light: 0px 2px 4px 0px rgba(31, 35, 41, 0.12);
|
--el-box-shadow-light: 0px 2px 4px 0px rgba(31, 35, 41, 0.12);
|
||||||
--el-border-color: #dee0e3;
|
--el-border-color: #dee0e3;
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
<el-radio-group
|
<el-radio-group
|
||||||
v-model="themeForm.theme"
|
v-model="themeForm.theme"
|
||||||
class="app-radio-button-group"
|
class="app-radio-button-group"
|
||||||
@change="themeColorChange"
|
@change="changeTheme"
|
||||||
>
|
>
|
||||||
<template v-for="(item, index) in themeList" :key="index">
|
<template v-for="(item, index) in themeList" :key="index">
|
||||||
<el-radio-button :label="item.label" :value="item.value" />
|
<el-radio-button :label="item.label" :value="item.value" />
|
||||||
@ -23,7 +23,7 @@
|
|||||||
<el-button type="primary" link> 恢复默认 </el-button>
|
<el-button type="primary" link> 恢复默认 </el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="theme-preview">
|
<div class="theme-preview">
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="8">
|
||||||
<el-col :span="16">
|
<el-col :span="16">
|
||||||
<LoginPreview />
|
<LoginPreview />
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -91,16 +91,18 @@
|
|||||||
</div>
|
</div>
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
<div class="theme-setting__operate w-full p-16-24">
|
<div class="theme-setting__operate w-full p-16-24">
|
||||||
<el-button>放弃更新</el-button>
|
<el-button @click="resetTheme">放弃更新</el-button>
|
||||||
<el-button type="primary"> 保存并应用 </el-button>
|
<el-button type="primary"> 保存并应用 </el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, reactive } from 'vue'
|
import { ref, reactive, watch } from 'vue'
|
||||||
import type { FormInstance, FormRules } from 'element-plus'
|
import type { FormInstance, FormRules } from 'element-plus'
|
||||||
import LoginPreview from './LoginPreview.vue'
|
import LoginPreview from './LoginPreview.vue'
|
||||||
|
import { useElementPlusTheme } from 'use-element-plus-theme'
|
||||||
|
|
||||||
const themeList = [
|
const themeList = [
|
||||||
{
|
{
|
||||||
label: '默认',
|
label: '默认',
|
||||||
@ -148,7 +150,21 @@ const rules = reactive<FormRules>({
|
|||||||
slogan: [{ required: true, message: '请输入欢迎语', trigger: 'blur' }]
|
slogan: [{ required: true, message: '请输入欢迎语', trigger: 'blur' }]
|
||||||
})
|
})
|
||||||
|
|
||||||
const themeColorChange = (val: string) => {}
|
const { changeTheme } = useElementPlusTheme(themeForm.value.theme)
|
||||||
|
|
||||||
|
function resetTheme() {
|
||||||
|
themeForm.value.theme = '#3370FF'
|
||||||
|
changeTheme(themeForm.value.theme)
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => themeForm.value.theme,
|
||||||
|
(val) => {
|
||||||
|
if (val) {
|
||||||
|
console.log(val)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user