diff --git a/app/pages/me/profile/index.vue b/app/pages/me/profile/index.vue index 121396c..be2a0c5 100644 --- a/app/pages/me/profile/index.vue +++ b/app/pages/me/profile/index.vue @@ -43,6 +43,33 @@ const message = ref('') const avatarFileInput = ref(null) const headerIconFileInput = ref(null) +const BIO_PREVIEW_MAX_CHARS = 200 +const bioModalOpen = ref(false) +const bioDraft = ref('') + +function truncateBioSource(md: string): string { + const s = md.trim() + if (!s) { + return '' + } + if (s.length <= BIO_PREVIEW_MAX_CHARS) { + return s + } + return `${s.slice(0, BIO_PREVIEW_MAX_CHARS)}…` +} + +const bioPreviewTruncated = computed(() => truncateBioSource(state.bioMarkdown)) + +function openBioModal() { + bioDraft.value = state.bioMarkdown + bioModalOpen.value = true +} + +function applyBioFromModal(close: () => void) { + state.bioMarkdown = bioDraft.value + close() +} + function openAvatarPicker() { avatarFileInput.value?.click() } @@ -279,8 +306,21 @@ async function save() { ]" /> - - + +
+

+ {{ bioPreviewTruncated || '(未填写)' }} +

+ + 在编辑器中打开 + +
+ + + + +