Files
Enterprise-Knowledge-Base/frontend/src/views/organization/JoinOrganization.vue
T
wizardchen 4a5caf54af fix(frontend): make general-settings font picker actually work
The font picker in 常规设置 silently failed in three distinct ways:

1. Font family changes were invisible on macOS because 6 of the 7 options
   (Inter / Roboto / Segoe UI / Cascadia Code / JetBrains Mono / Fira
   Code) aren't installed by default and fell back to system SF. Swap
   the picker to a platform-aware list — Mac / Windows / Linux each see
   only the fonts their OS actually ships. The "third sans slot" now
   always serves a serif face (Georgia / Times New Roman / DejaVu
   Serif) so the difference is unambiguously visible instead of being
   three near-identical sans families.

2. Font size flipped --app-font-scale on <html>, but that variable was
   only consumed by a handful of TDesign tokens and the body reset, so
   the ~1000+ hard-coded font-size: NNpx rules across the frontend
   stayed put. Apply the multiplier via `zoom` on <html> so the whole
   document scales, then fix the 15 `100vh` rules that would overflow
   under zoom (html / body / #app are already height: 100%, so the
   descendants can use 100% too).

3. The monospace picker had no visible effect even on a working stack
   because `<t-input style="font-family: ...">` is forwarded to the
   inner <input>, but TDesign applies `font: var(--td-font-body-medium)`
   — a shorthand that resets font-family. Reach the real <input> /
   <textarea> via `:deep()` instead of inline style.

Additional polish:
- Add a live preview row under each picker so users can see the effect
  without hunting for a code block or API Info screen
- Rename "等宽字体 / Monospace Font" → "代码字体 / Code Font" to match
  VSCode / GitHub / Notion convention; the old label was jargon
- Rewrite descriptions to explain the actual purpose and scope
2026-05-07 15:07:24 +08:00

119 lines
2.6 KiB
Vue

<template>
<div class="join-page">
<div class="join-card">
<div class="join-icon">
<t-icon name="user-add" size="48px" />
</div>
<h2 class="join-title">{{ $t('organization.join.title') }}</h2>
<p v-if="loading" class="join-message">{{ $t('organization.join.joining') }}</p>
<p v-else-if="error" class="join-message error">{{ error }}</p>
<p v-else class="join-message success">{{ $t('organization.join.success') }}</p>
<t-button
v-if="!loading"
theme="primary"
@click="goToOrganizations"
>
{{ $t('organization.join.goToOrganizations') }}
</t-button>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { useI18n } from 'vue-i18n'
import { MessagePlugin } from 'tdesign-vue-next'
import { useOrganizationStore } from '@/stores/organization'
const route = useRoute()
const router = useRouter()
const { t } = useI18n()
const orgStore = useOrganizationStore()
const loading = ref(true)
const error = ref('')
onMounted(async () => {
const code = route.query.code as string
if (!code) {
error.value = t('organization.join.noCode')
loading.value = false
return
}
try {
const result = await orgStore.join(code)
if (result) {
MessagePlugin.success(t('organization.join.success'))
} else {
error.value = orgStore.error || t('organization.join.failed')
}
} catch (e: any) {
error.value = e?.message || t('organization.join.failed')
} finally {
loading.value = false
}
})
const goToOrganizations = () => {
router.push('/platform/organizations')
}
</script>
<style scoped lang="less">
.join-page {
min-height: 100%;
display: flex;
align-items: center;
justify-content: center;
background: var(--td-bg-color-container);
padding: 20px;
}
.join-card {
background: var(--td-bg-color-container);
border-radius: 16px;
padding: 48px;
text-align: center;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
max-width: 400px;
width: 100%;
}
.join-icon {
width: 80px;
height: 80px;
margin: 0 auto 24px;
border-radius: 50%;
background: var(--td-success-color-light);
display: flex;
align-items: center;
justify-content: center;
color: var(--td-success-color);
}
.join-title {
font-size: 20px;
font-weight: 600;
color: var(--td-text-color-primary);
margin: 0 0 16px;
}
.join-message {
font-size: 14px;
color: var(--td-text-color-secondary);
margin: 0 0 24px;
&.error {
color: var(--td-error-color);
}
&.success {
color: var(--td-success-color);
}
}
</style>