首页样式

This commit is contained in:
wangyilin 2025-04-28 15:45:26 +08:00
parent 4ca7e4d8ed
commit 459af79ca4
5 changed files with 60 additions and 11 deletions

31
src/assets/main.scss Normal file
View File

@ -0,0 +1,31 @@
/* 亮色模式 */
:root {
--bg-color: #ffffff;
--text-color: rgba(0, 0, 0, .85);
--border-top: #f0f0f0;
--border-color:#eee;
--border-bottom:#eee;
--font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
}
/* 暗黑模式 */
:root.dark,
:root[data-theme="dark"] {
--bg-color: #232324;
--border-color: #2e2e30;
--border-bottom:#484849;
--text-color: rgba(255, 255, 255, .7);
--border-top: #121111;
--color: #fff;
}
/* 应用变量 */
body {
background-color: var(--bg-color);
color: var(--text-color);
font-family: var(--font-family);
border-top: 1px solid var(--border-top);
border-color: var(--border-color);
border-bottom: var(--border-bottom);
transition: all 0.3s ease; /* 平滑过渡效果 */
}

View File

@ -149,7 +149,7 @@
.dark { .dark {
.l-content { .l-content {
background-color: #1e1e1e; // background-color: black; //
} }
} }
</style> </style>

View File

@ -6,6 +6,7 @@ import "animate.css";
import App from "./App.vue"; import App from "./App.vue";
import router from "./router"; import router from "./router";
import "./assets/scss/common.scss"; import "./assets/scss/common.scss";
import './assets/main.scss'
// import { initEnums, } from "@/utils/emnus"; // import { initEnums, } from "@/utils/emnus";
// initEnums(); // initEnums();

View File

@ -5,6 +5,18 @@ export const useSettingsStore = defineStore(
"setting", "setting",
() => { () => {
const isDark = ref(false); const isDark = ref(false);
watch(isDark, (newVal) => {
// 控制根元素 class
if (newVal) {
document.documentElement.classList.add('dark');
document.documentElement.setAttribute('data-theme', 'dark');
} else {
document.documentElement.classList.remove('dark');
document.documentElement.setAttribute('data-theme', 'light');
}
}, { immediate: true }); // 立即执行一次初始化
const theme = computed<GlobalTheme | null>(() => const theme = computed<GlobalTheme | null>(() =>
isDark.value ? darkTheme : null isDark.value ? darkTheme : null
); );

View File

@ -167,18 +167,20 @@
]) ])
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.home{ .home{
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
//align-items: center; //align-items: center;
font-size: 14px; font-size: 14px;
font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif; font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
.homeItem{ .homeItem {
width: 100%; width: 100%;
background: #ffffff; background: var(--bg-color);
margin-bottom: 10px; margin-bottom: 10px;
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, .05); box-shadow: 0 1px 2px 0 rgba(0, 0, 0, .05);
padding: 10px 15px; padding: 10px 15px;
color:var(--text-color);
.homeItemIndex{ .homeItemIndex{
margin-bottom: 10px; margin-bottom: 10px;
line-height: 1.6; line-height: 1.6;
@ -198,17 +200,18 @@
} }
.home2Item{ .home2Item{
width: 100%; width: 100%;
background: #ffffff; background: var(--bg-color);
margin-bottom: 10px; margin-bottom: 10px;
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, .05); box-shadow: 0 1px 2px 0 rgba(0, 0, 0, .05);
padding: 10px 15px; padding: 10px 15px;
color:var(--text-color);
.header-wrapper { .header-wrapper {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
cursor: pointer; cursor: pointer;
} }
.fold-button { .fold-button {
display: flex; display: flex;
align-items: center; align-items: center;
@ -226,7 +229,7 @@
} }
.fold-content { .fold-content {
border-top: 1px solid #f0f0f0; border-top: var(--border-top);
.fold-content_item{ .fold-content_item{
margin-top: 15px; margin-top: 15px;
display: flex; display: flex;
@ -236,11 +239,11 @@
padding: 10px; padding: 10px;
min-height: 90px; min-height: 90px;
border-radius: 5px; border-radius: 5px;
border-color: #eee; border-color: var(--border-color);
border-width: 1px; border-width: 1px;
border-style: solid; border-style: solid;
background-color: #fff; background: var(--bg-color);
color: #666; color:var(--text-color);
box-shadow: 1px 1px 4px rgb(0 0 0 / 8%); box-shadow: 1px 1px 4px rgb(0 0 0 / 8%);
width: 22%; width: 22%;
margin-right: 5px; margin-right: 5px;
@ -249,6 +252,7 @@
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
color:var(--color);
.content{ .content{
font-weight: bold; font-weight: bold;
font-size: 16px !important; font-size: 16px !important;
@ -266,7 +270,7 @@
margin: 10px 0; margin: 10px 0;
padding: 0; padding: 0;
border: none !important; border: none !important;
border-bottom: 1px solid #eee !important; border-bottom: 1px solid var(--border-bottom) !important;
clear: both; clear: both;
background: 0 0 background: 0 0
} }
@ -296,9 +300,10 @@
.home3Item{ .home3Item{
margin-bottom: 15px; margin-bottom: 15px;
border-radius: 2px; border-radius: 2px;
background-color: #fff; background: var(--bg-color);
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, .05); box-shadow: 0 1px 2px 0 rgba(0, 0, 0, .05);
padding: 10px 15px; padding: 10px 15px;
color:var(--text-color);
} }
} }