Skip to content

Commit

Permalink
😊update theme
Browse files Browse the repository at this point in the history
  • Loading branch information
OwOxxx committed Mar 28, 2024
1 parent 0841d10 commit eb15c16
Show file tree
Hide file tree
Showing 24 changed files with 201 additions and 199 deletions.
10 changes: 8 additions & 2 deletions src/components/common/app-loading.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,13 @@ import { hexToRgba } from "@/utils"
const SYSTEM_NAME = "WindAdmin"
const setting = JSON.parse(localStorage.getItem("setting") || "{}")
const themeColor = setting.themeColor || "#1890ff"
const themeColor = setting.themeColor || "#5ac8fa"
const setThemeByCache = () => {
document.documentElement.style.setProperty("--theme-color", themeColor)
document.documentElement.style.setProperty("--menu-color-hover", hexToRgba(themeColor, 0.3))
document.documentElement.style.setProperty("--tabbar-color-hover", hexToRgba(themeColor, 0.2))
}
setThemeByCache()
</script>

<style lang="scss" scoped>
Expand All @@ -65,7 +71,7 @@ const themeColor = setting.themeColor || "#1890ff"
stop-color: v-bind(hexToRgba(themeColor, 0.5));
}
.system_name {
color: v-bind(hexToRgba(themeColor, 0.8));
color: v-bind(hexToRgba(themeColor, 0.8));
}
.halvan {
animation: Snurra1 10s infinite linear;
Expand Down
2 changes: 1 addition & 1 deletion src/components/svg-icon/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default defineComponent({
},
color: {
type: String,
default: "#333",
default: "var(--text-color)",
},
},
computed: {
Expand Down
38 changes: 17 additions & 21 deletions src/layouts/breadcrumb/Breadcrumb.vue
Original file line number Diff line number Diff line change
@@ -1,38 +1,34 @@
<script lang="ts" setup>
import { ArrowRight } from '@element-plus/icons-vue'
import { useVisitedViewStore } from '@/store';
const visitedViewStore = useVisitedViewStore();
import { ArrowRight } from "@element-plus/icons-vue"
import { useVisitedViewStore } from "@/store"
const visitedViewStore = useVisitedViewStore()
</script>

<template>
<div class="breadcrumb">
<el-breadcrumb :separator-icon="ArrowRight">
<TransitionGroup name="list">
<el-breadcrumb-item v-for="item in visitedViewStore.breadcrumbList" :key="item.path">{{ item.meta ? item.meta.title : item.title
}}</el-breadcrumb-item>
</TransitionGroup>
</el-breadcrumb>
</div>
<div class="breadcrumb">
<el-breadcrumb :separator-icon="ArrowRight">
<TransitionGroup name="list">
<el-breadcrumb-item v-for="item in visitedViewStore.breadcrumbList" :key="item.path">
{{ item.meta ? item.meta.title : item.title }}
</el-breadcrumb-item>
</TransitionGroup>
</el-breadcrumb>
</div>
</template>

<style lang="scss" scoped>
.list-enter-active,
.list-leave-active {
transition: all 0.5s ease;
transition: all 0.5s ease;
}
.list-enter-from,
.list-leave-to {
opacity: 0;
transform: translateX(30px);
opacity: 0;
transform: translateX(30px);
}
.list-leave-active {
position: absolute;
position: absolute;
}
</style>
</style>
10 changes: 5 additions & 5 deletions src/layouts/logo/Logo.vue
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
<script lang="ts" setup>
import { useVisitedViewStore,useSettingStore } from "@/store"
import defaultThemeColor from "@/assets/themes/index"
import { useSettingStore } from "@/store"
const settingStore = useSettingStore()
</script>

<template>
<div class="Logo">
<div class="logo-img">
<SvgIcon :name="'logo'" :color="settingStore.themeColor" class="text-26" />
<SvgIcon :name="'logo'" :color="'var(--theme-color)'" class="text-26" />
</div>
<div class="title transition duration-300 ease-in-out" v-if="!settingStore.isCollapse">
<h2 :style="{ color: settingStore.themeColor }" class="text">Admin 管理系统</h2>
<h2 class="text">Admin 管理系统</h2>
</div>
</div>
</template>
Expand All @@ -32,7 +31,8 @@ const settingStore = useSettingStore()
.title {
padding: 0 10px;
.text {
@apply text-16px font-bold text-primary transition duration-300 ease-in-out;
color: var(--theme-color);
@apply text-16px font-bold transition duration-300 ease-in-out;
}
}
}
Expand Down
15 changes: 12 additions & 3 deletions src/layouts/setting/SystemSet.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@ import { ref, watchEffect, watch, computed } from "vue"
import { useSettingStore } from "@/store"
import themeColorConfig from "@/assets/themes/themeColor.json"
import OtherColor from "@/assets/themes/color.json"
import { useDark, useToggle } from "@vueuse/core"
const isDark = useDark({
selector: "html",
attribute: "color-scheme",
valueDark: "dark",
valueLight: "light",
})
const toggleDark = useToggle(isDark)
const colorDialogV = ref(false)
const activeTab = ref("红色系")
Expand Down Expand Up @@ -53,7 +62,7 @@ const animateModeList = [
inactive-value="light"
active-action-icon="Moon"
inactive-action-icon="Sunny"
@change="settingStore.setThemeBg"
@change="toggleDark()"
style="--el-switch-on-color: #18181c; --el-switch-off-color: #dadada"></el-switch>
</el-col>
</el-row>
Expand All @@ -63,7 +72,7 @@ const animateModeList = [
</el-col>
<el-col style="display: flex; justify-content: center; height: 80px">
<el-radio-group v-model="settingStore.layoutTheme" @change="settingStore.setThemeType">
<el-radio label="classic" class="radio" style="height: 100%">
<el-radio value="classic" class="radio" style="height: 100%">
<el-row style="height: 40px; width: 50px">
<el-col
:span="6"
Expand All @@ -74,7 +83,7 @@ const animateModeList = [
</el-row>
<el-row justify="center">左右</el-row>
</el-radio>
<el-radio label="topb" class="radio">
<el-radio value="topb" class="radio">
<el-row style="height: 40px; width: 50px">
<el-col
:span="24"
Expand Down
7 changes: 3 additions & 4 deletions src/layouts/sidebar/MenuItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import router from "@/router"
import { ref, onMounted, computed } from "vue"
import { useSettingStore, useVisitedViewStore } from "@/store"
import defaultThemeColor from "@/assets/themes/index"
import { isExternal } from "@/utils"
const settingStore = useSettingStore()
Expand All @@ -23,8 +22,8 @@ const activeMenuBg = computed(() => {
const setThemeColor = computed(() => {
return router.currentRoute.value.path === props.item.path
? settingStore.themeColor
: defaultThemeColor[settingStore.themeBg].menuTextColor
? 'var(--theme-color)'
: 'var(--text-color)'
})
const visitedViewStore = useVisitedViewStore()
Expand Down Expand Up @@ -78,7 +77,7 @@ const handleClick = item => {
z-index: 1;
margin: 3px 8px;
border-radius: 5px;
background-color: v-bind(activeMenuBg);
background-color: var(--menu-color-hover);
}
.is-active::before {
@extend #before;
Expand Down
9 changes: 1 addition & 8 deletions src/layouts/sidebar/MenuScroll.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<script setup lang="ts">
import defaultThemeColor from "@/assets/themes/index"
import { ref, computed, onMounted } from "vue"
import { useRouter } from "vue-router"
Expand Down Expand Up @@ -31,7 +29,6 @@ const activeMenu = computed(() => {
return router.currentRoute.value.path
})
console.log(defaultThemeColor)
onMounted(() => {})
</script>

Expand All @@ -46,9 +43,7 @@ onMounted(() => {})
:mode="mode"
:collapse-transition="false"
:ellipsis="false"
popper-effect="dark"
:background-color="defaultThemeColor[settingStore.themeBg].menuColor"
:text-color="defaultThemeColor[settingStore.themeBg].menuTextColor">
popper-effect="dark">
<slot></slot>
</el-menu>
</el-scrollbar>
Expand All @@ -71,9 +66,7 @@ onMounted(() => {})
width: 100%;
height: 100%;
border: none;
background: transparent;
transition: all 0.3s;
.el-sub-menu {
background: inherit !important;
}
Expand Down
18 changes: 4 additions & 14 deletions src/layouts/sidebar/MenuSub.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
<script lang="ts" setup>
import { computed } from "vue"
import { useSettingStore, useVisitedViewStore } from "@/store"
import defaultThemeColor from "@/assets/themes/index"
import { useRouter } from "vue-router"
const router = useRouter()
const settingStore = useSettingStore()
import { useVisitedViewStore } from "@/store"
const visitedViewStore = useVisitedViewStore()
const props = defineProps({
Expand All @@ -16,14 +10,10 @@ const props = defineProps({
},
})
const activeMenuBg = computed(() => {
return settingStore.getMenuActiveBg()
})
const setThemeColor = computed(() => {
return visitedViewStore.breadcrumbList.some(item => item.path === props.item.path)
? settingStore.themeColor
: defaultThemeColor[settingStore.themeBg].menuTextColor
? "var(--theme-color)"
: "var(--text-color)"
})
</script>

Expand Down Expand Up @@ -57,7 +47,7 @@ const setThemeColor = computed(() => {
z-index: 1;
margin: 4px 8px;
border-radius: 5px;
background-color: v-bind(activeMenuBg) !important;
background-color: var(--menu-color-hover);
}
:deep(.el-sub-menu__title) {
Expand Down
14 changes: 3 additions & 11 deletions src/layouts/tabbar/TabBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,6 @@ useTabBarEvent()
const activeTableTabsValue = ref("/index/home")
const activeMenuBg = computed(() => {
return settingStore.getMenuActiveBg(0.1)
})
const activeColor = computed(() => {
return settingStore.themeColor
})
watch(
router.currentRoute,
newValue => {
Expand Down Expand Up @@ -164,14 +156,14 @@ const closeTab = (type, event) => {
height: 30px;
font-size: 12px;
border-radius: 5px;
background-color: v-bind(activeMenuBg);
background-color: var(--tabbar-color-hover);
border: none;
&:hover {
color: v-bind(activeColor);
color: var(--theme-color);
}
}
.is-active {
color: v-bind(activeColor);
color: var(--theme-color);
}
}
}
Expand Down
9 changes: 5 additions & 4 deletions src/layouts/themes/ClassicTheme.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script setup lang="ts">
import defaultThemeColor from "@/assets/themes/index"
import { useSettingStore } from "@/store"
const settingStore = useSettingStore()
Expand All @@ -11,14 +10,14 @@ import TabBar from "@/layouts/tabbar/TabBar.vue"
import Collapse from "@/layouts/toolbar/Collapse.vue"
import Logo from "@/layouts/logo/Logo.vue"
import Breadcrumb from "@/layouts/breadcrumb/Breadcrumb.vue"
</script>

<template>
<div id="container_sub">
<aside
class="aside"
:class="[settingStore.isCollapse ? 'close-status' : 'open-status']"
:style="{ backgroundColor: defaultThemeColor[settingStore.themeBg].menuColor }">
:class="[settingStore.isCollapse ? 'close-status' : 'open-status']">
<div class="aside_head">
<Logo />
</div>
Expand Down Expand Up @@ -71,7 +70,8 @@ import Breadcrumb from "@/layouts/breadcrumb/Breadcrumb.vue"
aside {
height: 100%;
border-right: 0.5px solid #ebeef5;
background-color: var(--bg-color);
border-right: 0.5px solid var(--border-color-lightest);
overflow: hidden;
.aside_head {
Expand All @@ -92,6 +92,7 @@ main {
display: flex;
height: $head-height;
border-bottom: 0.5px solid #ebeef5;
background-color: var(--bg-color);
.left {
min-width: 210px;
Expand Down
7 changes: 2 additions & 5 deletions src/layouts/themes/TopBLayout.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<script lang="ts" setup>
import { watch } from "vue"
import { useSettingStore } from "@/store"
import defaultThemeColor from "@/assets/themes/index"
const settingStore = useSettingStore()
import ToolBar from "@/layouts/toolbar/ToolBar.vue"
Expand All @@ -26,9 +24,7 @@ watch(

<template>
<div id="container_sub">
<div
class="main_head"
:style="{ backgroundColor: defaultThemeColor[settingStore.themeBg].menuColor }">
<div class="main_head">
<div class="left">
<Logo />
</div>
Expand Down Expand Up @@ -61,6 +57,7 @@ watch(
display: flex;
height: $head-height;
border-bottom: 0.5px solid #ebeef5;
background-color: var(--bg-color);
.left {
}
Expand Down
4 changes: 2 additions & 2 deletions src/layouts/toolbar/Collapse.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ const activeMenuBg = computed(() => {
vertical-align: middle;
&:hover {
cursor: pointer;
fill: v-bind(activeMenuBg) !important;
stroke: v-bind(activeMenuBg) !important;
fill: var(--theme-color) !important;
stroke: var(--theme-color) !important;
}
}
}
Expand Down
Loading

0 comments on commit eb15c16

Please sign in to comment.