update translation

This commit is contained in:
sophie committed 2026-05-22 13:48:41 +08:00
1 parent 02d0c1dcd6
commit 1689347494
9 files changed
+1170 -324

No files matched your search

@@ -1,5 +1,6 @@
<script setup lang="ts">
<script setup lang="ts">
import { computed, ref, watch } from 'vue';
import { useI18n } from 'vue-i18n';
import { MessageSquareText, X } from 'lucide-vue-next';
interface Props {
@@ -20,11 +21,23 @@ const emit = defineEmits<{
(e: 'submitted'): void;
}>();
const typeOptions = ['功能建议', '问题反馈', '体验优化'];
const moduleOptions = ['知识库', '通用', '工作流', '账号权限'];
const { t } = useI18n();
const selectedType = ref<string>('功能建议');
const selectedModule = ref<string>('知识库');
const typeOptions = computed(() => [
t('feedback.type.featureSuggestion'),
t('feedback.type.issueReport'),
t('feedback.type.experienceOptimization'),
]);
const moduleOptions = computed(() => [
t('feedback.module.knowledgeBase'),
t('feedback.module.general'),
t('feedback.module.workflow'),
t('feedback.module.accountPermission'),
]);
const selectedType = ref<string>(t('feedback.type.featureSuggestion'));
const selectedModule = ref<string>(t('feedback.module.knowledgeBase'));
const content = ref('');
const submitting = ref(false);
const error = ref('');
@@ -36,8 +49,8 @@ const closeDialog = () => {
};
const resetForm = () => {
selectedType.value = '功能建议';
selectedModule.value = '知识库';
selectedType.value = t('feedback.type.featureSuggestion');
selectedModule.value = t('feedback.module.knowledgeBase');
content.value = '';
error.value = '';
submitting.value = false;
@@ -46,20 +59,19 @@ const resetForm = () => {
watch(
() => props.modelValue,
(visible) => {
if (visible) {
resetForm();
}
if (visible) resetForm();
},
);
const submitFeedback = async () => {
if (!canSubmit.value) {
error.value = '请填写反馈内容';
error.value = t('feedback.msg.fillContent');
return;
}
submitting.value = true;
error.value = '';
try {
const payload: Record<string, unknown> = {
feedback_type: selectedType.value,
@@ -67,6 +79,7 @@ const submitFeedback = async () => {
content: content.value.trim(),
source_page: props.sourcePage,
};
if (props.chatLogId !== null && props.chatLogId !== undefined) {
payload.chat_log_id = props.chatLogId;
}
@@ -82,14 +95,14 @@ const submitFeedback = async () => {
const data = await res.json().catch(() => ({}));
if (!res.ok) {
error.value = data?.error || '提交失败,请稍后重试';
error.value = data?.error || t('feedback.msg.submitFailed');
return;
}
emit('submitted');
closeDialog();
} catch {
error.value = '提交失败,请稍后重试';
error.value = t('feedback.msg.submitFailed');
} finally {
submitting.value = false;
}
@@ -103,7 +116,7 @@ const submitFeedback = async () => {
>
<div class="flex max-h-[92vh] w-full max-w-2xl flex-col rounded-2xl bg-white shadow-2xl">
<div class="flex items-center justify-between border-b border-gray-100 px-5 pb-4 pt-5 sm:px-8 sm:pb-4 sm:pt-7">
<h3 class="text-2xl font-bold text-gray-900">意见反馈</h3>
<h3 class="text-2xl font-bold text-gray-900">{{ t('feedback.title') }}</h3>
<button
@click="closeDialog"
class="rounded-lg p-1.5 text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-600"
@@ -115,7 +128,7 @@ const submitFeedback = async () => {
<div class="space-y-5 overflow-y-auto px-5 py-5 sm:px-8">
<div class="space-y-1.5">
<label class="block text-sm font-semibold text-gray-600">反馈类型</label>
<label class="block text-sm font-semibold text-gray-600">{{ t('feedback.labels.type') }}</label>
<div class="flex flex-wrap gap-3">
<button
v-for="item in typeOptions"
@@ -134,7 +147,7 @@ const submitFeedback = async () => {
</div>
<div class="space-y-1.5">
<label class="block text-sm font-semibold text-gray-600">反馈模块</label>
<label class="block text-sm font-semibold text-gray-600">{{ t('feedback.labels.module') }}</label>
<select
v-model="selectedModule"
class="w-full rounded-xl border-gray-200 bg-gray-50 px-4 py-3 text-base shadow-sm outline-none transition-all focus:border-blue-500 focus:bg-white focus:ring-2 focus:ring-blue-500/20"
@@ -144,13 +157,13 @@ const submitFeedback = async () => {
</div>
<div class="space-y-1.5">
<label class="block text-sm font-semibold text-gray-600">反馈内容<span class="ml-0.5 text-red-500">*</span></label>
<label class="block text-sm font-semibold text-gray-600">{{ t('feedback.labels.content') }}<span class="ml-0.5 text-red-500">*</span></label>
<textarea
v-model="content"
rows="5"
maxlength="2000"
class="w-full resize-none rounded-xl border-gray-200 bg-gray-50 px-4 py-3 text-base shadow-sm outline-none transition-all focus:border-blue-500 focus:bg-white focus:ring-2 focus:ring-blue-500/20"
placeholder="请描述你的问题或建议,帮助我们持续优化。"
:placeholder="t('feedback.placeholder.content')"
/>
<div class="mt-2 flex items-center justify-between">
<div v-if="error" class="text-base text-red-600">{{ error }}</div>
@@ -166,7 +179,7 @@ const submitFeedback = async () => {
class="rounded-xl px-5 py-2.5 text-base font-medium text-gray-600 transition-colors hover:bg-gray-100"
:disabled="submitting"
>
取消
{{ t('feedback.cancel') }}
</button>
<button
@click="submitFeedback"
@@ -174,7 +187,7 @@ const submitFeedback = async () => {
:disabled="!canSubmit"
>
<MessageSquareText class="h-5 w-5" />
{{ submitting ? '提交中' : '提交' }}
{{ submitting ? t('feedback.submitting') : t('feedback.submit') }}
</button>
</div>
</div>