Skip to content

Commit fbffbf9

Browse files
committed
feat(前端): 添加字体设置功能并优化界面样式
- 新增字体选择功能,支持默认、JetBrains Mono和霞鹜文楷三种字体 - 重构多个页面布局和样式,统一滚动条隐藏风格 - 优化卡片、表格等组件的视觉表现和交互效果 - 添加全局CSS变量和暗色模式适配 - 移除冗余组件和代码,提升代码整洁度
1 parent 6b9524a commit fbffbf9

29 files changed

Lines changed: 3643 additions & 2161 deletions

frontend/components.d.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ declare module 'vue' {
1717
EbookInfo: typeof import('./src/components/EbookInfo.vue')['default']
1818
ElAlert: typeof import('element-plus/es')['ElAlert']
1919
ElAvatar: typeof import('element-plus/es')['ElAvatar']
20-
ElBadge: typeof import('element-plus/es')['ElBadge']
2120
ElBreadcrumb: typeof import('element-plus/es')['ElBreadcrumb']
2221
ElBreadcrumbItem: typeof import('element-plus/es')['ElBreadcrumbItem']
2322
ElButton: typeof import('element-plus/es')['ElButton']
@@ -46,8 +45,9 @@ declare module 'vue' {
4645
ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
4746
ElOption: typeof import('element-plus/es')['ElOption']
4847
ElPagination: typeof import('element-plus/es')['ElPagination']
49-
ElPopover: typeof import('element-plus/es')['ElPopover']
5048
ElProgress: typeof import('element-plus/es')['ElProgress']
49+
ElRadio: typeof import('element-plus/es')['ElRadio']
50+
ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
5151
ElRate: typeof import('element-plus/es')['ElRate']
5252
ElResult: typeof import('element-plus/es')['ElResult']
5353
ElRow: typeof import('element-plus/es')['ElRow']
@@ -58,8 +58,6 @@ declare module 'vue' {
5858
ElSpace: typeof import('element-plus/es')['ElSpace']
5959
ElSubMenu: typeof import('element-plus/es')['ElSubMenu']
6060
ElSwitch: typeof import('element-plus/es')['ElSwitch']
61-
ElTable: typeof import('element-plus/es')['ElTable']
62-
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
6361
ElTabPane: typeof import('element-plus/es')['ElTabPane']
6462
ElTabs: typeof import('element-plus/es')['ElTabs']
6563
ElTag: typeof import('element-plus/es')['ElTag']

frontend/src/App.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,17 @@ import { ElConfigProvider } from 'element-plus'
66
import 'element-plus/es/components/message/style/css'
77
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
88
import { themeStore } from './stores/theme'
9+
import { settingStore } from './stores/setting'
910
import { playerStore } from './stores/player'
1011
import { AudioDetailAlias } from '../wailsjs/go/backend/App'
12+
import { setFontFamily } from './utils/utils'
1113
1214
// 初始化主题
1315
const store = themeStore()
16+
const sStore = settingStore()
1417
onMounted(() => {
1518
store.initTheme()
19+
setFontFamily(sStore.setting.fontFamily || 'default')
1620
})
1721
1822
const pStore = playerStore()
@@ -171,7 +175,7 @@ body {
171175
}
172176
173177
.el-main {
174-
overflow-y: scroll;
178+
overflow: hidden;
175179
color: var(--text-color-secondary);
176180
width: 100%;
177181
height: 100%;

frontend/src/assets/css/font.css

Lines changed: 111 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,115 @@
1+
/* 霞鹜文楷 - CDN 引入 */
2+
@import url('https://cdn.jsdelivr.net/npm/lxgw-wenkai-lite-webfont@1.1.0/style.css');
3+
4+
/* JetBrains Mono */
5+
@font-face {
6+
font-family: "JetBrainsMono";
7+
font-style: normal;
8+
font-weight: 100;
9+
src: url("../fonts/JetBrainsMono-Thin.woff2") format("woff2");
10+
}
11+
12+
@font-face {
13+
font-family: "JetBrainsMono";
14+
font-style: italic;
15+
font-weight: 100;
16+
src: url("../fonts/JetBrainsMono-ThinItalic.woff2") format("woff2");
17+
}
18+
19+
@font-face {
20+
font-family: "JetBrainsMono";
21+
font-style: normal;
22+
font-weight: 200;
23+
src: url("../fonts/JetBrainsMono-ExtraLight.woff2") format("woff2");
24+
}
25+
26+
@font-face {
27+
font-family: "JetBrainsMono";
28+
font-style: italic;
29+
font-weight: 200;
30+
src: url("../fonts/JetBrainsMono-ExtraLightItalic.woff2") format("woff2");
31+
}
32+
33+
@font-face {
34+
font-family: "JetBrainsMono";
35+
font-style: normal;
36+
font-weight: 300;
37+
src: url("../fonts/JetBrainsMono-Light.woff2") format("woff2");
38+
}
39+
40+
@font-face {
41+
font-family: "JetBrainsMono";
42+
font-style: italic;
43+
font-weight: 300;
44+
src: url("../fonts/JetBrainsMono-LightItalic.woff2") format("woff2");
45+
}
46+
147
@font-face {
248
font-family: "JetBrainsMono";
349
font-style: normal;
450
font-weight: 400;
5-
src: url("../fonts/JetBrainsMono-Regular.woff2");
6-
}
51+
src: url("../fonts/JetBrainsMono-Regular.woff2") format("woff2");
52+
}
53+
54+
@font-face {
55+
font-family: "JetBrainsMono";
56+
font-style: italic;
57+
font-weight: 400;
58+
src: url("../fonts/JetBrainsMono-Italic.woff2") format("woff2");
59+
}
60+
61+
@font-face {
62+
font-family: "JetBrainsMono";
63+
font-style: normal;
64+
font-weight: 500;
65+
src: url("../fonts/JetBrainsMono-Medium.woff2") format("woff2");
66+
}
67+
68+
@font-face {
69+
font-family: "JetBrainsMono";
70+
font-style: italic;
71+
font-weight: 500;
72+
src: url("../fonts/JetBrainsMono-MediumItalic.woff2") format("woff2");
73+
}
74+
75+
@font-face {
76+
font-family: "JetBrainsMono";
77+
font-style: normal;
78+
font-weight: 600;
79+
src: url("../fonts/JetBrainsMono-SemiBold.woff2") format("woff2");
80+
}
81+
82+
@font-face {
83+
font-family: "JetBrainsMono";
84+
font-style: italic;
85+
font-weight: 600;
86+
src: url("../fonts/JetBrainsMono-SemiBoldItalic.woff2") format("woff2");
87+
}
88+
89+
@font-face {
90+
font-family: "JetBrainsMono";
91+
font-style: normal;
92+
font-weight: 700;
93+
src: url("../fonts/JetBrainsMono-Bold.woff2") format("woff2");
94+
}
95+
96+
@font-face {
97+
font-family: "JetBrainsMono";
98+
font-style: italic;
99+
font-weight: 700;
100+
src: url("../fonts/JetBrainsMono-BoldItalic.woff2") format("woff2");
101+
}
102+
103+
@font-face {
104+
font-family: "JetBrainsMono";
105+
font-style: normal;
106+
font-weight: 800;
107+
src: url("../fonts/JetBrainsMono-ExtraBold.woff2") format("woff2");
108+
}
109+
110+
@font-face {
111+
font-family: "JetBrainsMono";
112+
font-style: italic;
113+
font-weight: 800;
114+
src: url("../fonts/JetBrainsMono-ExtraBoldItalic.woff2") format("woff2");
115+
}

frontend/src/assets/css/global.css

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
/* Global CSS Variables - Fresh Efficiency Theme */
2+
:root {
3+
/* Fonts */
4+
--font-family-base: 'PingFang SC', 'Helvetica Neue', Helvetica, 'Hiragino Sans GB', 'Microsoft YaHei', '微软雅黑', Arial, sans-serif;
5+
--font-family-mono: 'JetBrainsMono', ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
6+
--font-family-wenkai: "LXGW WenKai Lite", sans-serif;
7+
8+
/* Colors */
9+
--primary-color: #409EFF;
10+
--accent-color: #FF6B00;
11+
--success-color: #67C23A;
12+
--warning-color: #E6A23C;
13+
--danger-color: #F56C6C;
14+
15+
/* Backgrounds */
16+
--bg-color: #f5f7fa;
17+
--card-bg-light: #ffffff;
18+
--card-bg-dark: #1d1e1f;
19+
20+
/* Text */
21+
--text-primary: #303133;
22+
--text-regular: #606266;
23+
--text-secondary: #909399;
24+
--text-placeholder: #C0C4CC;
25+
26+
/* Fill */
27+
--fill-color: #ecf5ff;
28+
--fill-color-light: #f5f7fa;
29+
--fill-color-dark: #e6e8eb;
30+
31+
/* Element Plus Overrides */
32+
--el-menu-bg-color: var(--card-bg);
33+
--el-menu-text-color: var(--text-primary);
34+
--el-menu-hover-bg-color: var(--fill-color-light);
35+
--el-menu-active-color: var(--primary-color);
36+
--el-color-primary: var(--primary-color);
37+
--el-bg-color: var(--bg-color);
38+
--el-bg-color-overlay: var(--card-bg);
39+
--el-fill-color-light: var(--fill-color-light);
40+
41+
/* Aliases for compatibility */
42+
--card-bg: var(--card-bg-light);
43+
--card-hover-bg: #ffffff;
44+
--menu-bg: var(--card-bg-light);
45+
--menu-hover-bg: var(--fill-color-light);
46+
47+
--text-tertiary: #C0C4CC;
48+
49+
/* Borders & Shadows */
50+
--border-radius-base: 12px;
51+
--border-radius-small: 8px;
52+
--border-radius-round: 20px;
53+
--border-soft: #EBEEF5;
54+
55+
--shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.05);
56+
--shadow-medium: 0 6px 16px rgba(0, 0, 0, 0.08);
57+
--shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.12);
58+
59+
/* Transitions */
60+
--transition-base: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
61+
--transition-fast: all 0.2s ease-in-out;
62+
}
63+
64+
/* Dark Mode Variables */
65+
html.theme-dark {
66+
--bg-color: #141414;
67+
--card-bg-light: #1d1e1f;
68+
--card-hover-bg: #2b2d30;
69+
--fill-color: #2a3d54;
70+
--fill-color-light: #262727;
71+
--fill-color-dark: #1f2022;
72+
73+
--text-primary: #E5EAF3;
74+
--text-regular: #A3A6AD;
75+
--text-secondary: #8D9095;
76+
--text-tertiary: #6C6E72;
77+
--text-placeholder: #6C6E72;
78+
79+
--border-soft: #4C4D4F;
80+
81+
--shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.3);
82+
--shadow-medium: 0 6px 16px rgba(0, 0, 0, 0.4);
83+
--shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.5);
84+
}
85+
86+
body {
87+
font-family: var(--font-family-base);
88+
background-color: var(--bg-color);
89+
color: var(--text-primary);
90+
margin: 0;
91+
padding: 0;
92+
-webkit-font-smoothing: antialiased;
93+
-moz-osx-font-smoothing: grayscale;
94+
}
95+
96+
/* Global Scrollbar Styling - Hidden for cleanliness */
97+
::-webkit-scrollbar {
98+
width: 0 !important;
99+
height: 0 !important;
100+
display: none !important;
101+
}
102+
103+
/* Element Plus Component Overrides for "Fresh Efficiency" Look */
104+
105+
/* Buttons */
106+
.el-button {
107+
border-radius: var(--border-radius-small);
108+
font-weight: 500;
109+
transition: var(--transition-fast);
110+
}
111+
112+
.el-button:not(.is-circle) {
113+
padding: 8px 16px;
114+
}
115+
116+
/* Cards */
117+
.el-card {
118+
border-radius: var(--border-radius-base);
119+
border: none !important; /* Remove default border */
120+
box-shadow: var(--shadow-soft) !important;
121+
background-color: var(--card-bg-light);
122+
transition: var(--transition-base);
123+
overflow: visible !important; /* Allow hover effects to pop out if needed */
124+
}
125+
126+
/* Menus */
127+
.el-menu {
128+
border-right: none !important;
129+
background-color: transparent !important;
130+
}
131+
132+
.el-menu-item {
133+
border-radius: var(--border-radius-small);
134+
margin: 4px 8px;
135+
height: 48px;
136+
line-height: 48px;
137+
}
138+
139+
.el-menu-item.is-active {
140+
background-color: var(--fill-color-light) !important;
141+
color: var(--accent-color) !important;
142+
font-weight: 600;
143+
}
144+
145+
.el-menu-item:hover {
146+
background-color: var(--fill-color-light) !important;
147+
}
148+
149+
/* Dialogs */
150+
.el-dialog {
151+
border-radius: var(--border-radius-base);
152+
box-shadow: var(--shadow-hover) !important;
153+
overflow: hidden; /* Ensure content respects border radius */
154+
}
155+
156+
.el-dialog__header {
157+
padding: 20px;
158+
margin-right: 0;
159+
border-bottom: 1px solid var(--fill-color-light);
160+
}
161+
162+
.el-dialog__footer {
163+
padding: 20px;
164+
border-top: 1px solid var(--fill-color-light);
165+
}
166+
167+
/* Inputs */
168+
.el-input__wrapper {
169+
border-radius: var(--border-radius-small);
170+
box-shadow: 0 0 0 1px var(--text-placeholder) inset !important;
171+
}
172+
173+
.el-input__wrapper:hover {
174+
box-shadow: 0 0 0 1px var(--text-secondary) inset !important;
175+
}
176+
177+
.el-input__wrapper.is-focus {
178+
box-shadow: 0 0 0 1px var(--primary-color) inset !important;
179+
}
180+
181+
/* Tags */
182+
.el-tag {
183+
border-radius: 4px;
184+
border: none;
185+
}

frontend/src/components/AudioInfo.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@
3434
<p class="author-info" v-html="audioInfo.detail.agency_detail.intro?.replaceAll('\n','<br/>')"></p><br />
3535
<span class="price">{{ audioInfo.detail.audio_price }}元</span>
3636
<el-tag class="ml-2" type="warning" v-if="audioInfo.detail.is_vip == true" round>
37-
<el-icon><HotWater /></el-icon>会员免费</el-tag>
37+
会员免费</el-tag>
3838
<el-tag class="ml-2" type="info" v-if="audioInfo.detail.in_bookrack == true" round>
39-
<el-icon><HotWater /></el-icon>已加入书架</el-tag>
39+
已加入书架</el-tag>
4040
<el-tag class="ml-2" type="success" v-if="audioInfo.detail.tag?.length >0" round>
4141
{{ audioInfo.detail.tag.join(",") }}</el-tag>
4242
</el-row>

frontend/src/components/EbookInfo.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<p class="author-info" v-html="ebookInfo.author_info?.replaceAll('\n','<br/>')"></p><br />
2525
<span class="price">{{ ebookInfo.price }}元</span>
2626
<el-tag class="ml-2" type="warning" v-if="ebookInfo.is_vip_book==1" round>
27-
<el-icon><HotWater /></el-icon>会员免费</el-tag>
27+
会员免费</el-tag>
2828
<el-tag class="ml-2" type="info" v-if="ebookInfo.read_time">阅读总时长:{{secondToHour(ebookInfo.read_time)}}</el-tag>
2929
<el-button v-if="ebookInfo.is_on_bookshelf==false" class="primary-action" @click="ebookShelfAdd(ebookInfo.enid)">
3030
<el-icon><Plus /></el-icon>加入书架

0 commit comments

Comments
 (0)