This commit is contained in:
Sunwuyuan
2025-12-28 13:17:07 +08:00
2 changed files with 47 additions and 5 deletions
+8
View File
@@ -172,3 +172,11 @@ dist
vite.config.*.timestamp-*.mjs
*.timestamp-*
# Auto-generated TypeScript declaration files
auto-imports.d.ts
components.d.ts
typed-router.d.ts
# Package lock files (using pnpm)
package-lock.json
+39 -5
View File
@@ -8,12 +8,24 @@
height="100%"
@click="fetchSentence"
>
<v-card-text class="pa-6 d-flex flex-column justify-center" style="height: 100%">
<div class="text-h6 font-weight-medium mb-4 serif-font" style="white-space: pre-wrap; line-height: 1.6;">
<v-card-text
class="pa-6 d-flex flex-column justify-center"
style="height: 100%"
>
<div
class="font-weight-medium mb-4 serif-font"
:style="contentStyle"
>
{{ sentence }}
</div>
<div class="text-subtitle-2 text-medium-emphasis text-right serif-font">
<span v-if="author" class="mr-2">{{ author }}</span>
<div
class="text-medium-emphasis serif-font"
:style="authorStyle"
>
<span
v-if="author"
class="mr-2"
>{{ author }}</span>
<span v-if="origin">《{{ origin }}》</span>
</div>
</v-card-text>
@@ -38,6 +50,9 @@ const GLOBAL_SENSITIVE_WORDS_ENCODED = [
// 解码敏感词列表
const GLOBAL_SENSITIVE_WORDS = GLOBAL_SENSITIVE_WORDS_ENCODED.map(word => Base64.decode(word))
// 一言字体大小比例(75%的全局字体大小)
const HITOKOTO_FONT_RATIO = 0.75
export default {
name: 'HitokotoCard',
data() {
@@ -53,7 +68,25 @@ export default {
origin: '',
loading: false,
timer: null,
unwatch: null
unwatch: null,
fontSize: 28 // Will be updated in mounted()
}
},
computed: {
contentStyle() {
return {
'font-size': `${this.fontSize * HITOKOTO_FONT_RATIO}px`,
'white-space': 'pre-wrap',
'line-height': '1.6',
'text-align': 'left'
}
},
authorStyle() {
const AUTHOR_FONT_RATIO = 0.6 // Author font size is 60% of the main font size
return {
'font-size': `${this.fontSize * HITOKOTO_FONT_RATIO * AUTHOR_FONT_RATIO}px`,
'text-align': 'left'
}
}
},
async mounted() {
@@ -78,6 +111,7 @@ export default {
loadLocalSettings() {
this.enabled = SettingsManager.getSetting('hitokoto.enabled')
this.refreshInterval = SettingsManager.getSetting('hitokoto.refreshInterval')
this.fontSize = SettingsManager.getSetting('font.size')
},
async loadKvSettings() {
try {