refactor(backend): 重构后端代码 wave 3
This commit is contained in:
1 parent
affe139bf9
commit
8415653365
97 files changed
+4673
-6164
No files matched your search
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
/**
|
||||
* features/workspace/components/WorkspaceModals.vue
|
||||
* 工作台弹窗:公告详情、修改密码、快捷问题删除、意见反馈。
|
||||
* 工作台弹窗:公告详情、快捷问题删除、意见反馈。
|
||||
*/
|
||||
import { inject } from 'vue';
|
||||
import { X } from 'lucide-vue-next';
|
||||
@@ -41,77 +41,6 @@ const ws = inject(WORKSPACE_KEY)! as any;
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="ws.CHANGE_PASSWORD_ENABLED && ws.showPasswordModal"
|
||||
class="dialog-overlay z-50 items-center"
|
||||
>
|
||||
<div class="dialog-panel max-w-md">
|
||||
<div class="dialog-header">
|
||||
<h3 class="section-title">{{ $t('profile.changePassword') || 'Change Password' }}</h3>
|
||||
<button
|
||||
type="button"
|
||||
class="btn-icon-ds"
|
||||
:aria-label="$t('admin.close')"
|
||||
:disabled="ws.isChangingPassword"
|
||||
@click="ws.showPasswordModal = false"
|
||||
>
|
||||
<X class="w-5 h-5" />
|
||||
</button>
|
||||
</div>
|
||||
<form @submit.prevent="ws.handleChangePassword">
|
||||
<div class="dialog-body">
|
||||
<div>
|
||||
<label class="label-field">{{ $t('profile.currentPassword') || 'Current Password' }}</label>
|
||||
<input
|
||||
v-model="ws.passwordForm.current"
|
||||
type="password"
|
||||
class="input-field mt-1"
|
||||
:disabled="ws.isChangingPassword"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label class="label-field">{{ $t('profile.newPassword') || 'New Password' }}</label>
|
||||
<input
|
||||
v-model="ws.passwordForm.new"
|
||||
type="password"
|
||||
class="input-field mt-1"
|
||||
:disabled="ws.isChangingPassword"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label class="label-field">{{ $t('profile.confirmPassword') || 'Confirm Password' }}</label>
|
||||
<input
|
||||
v-model="ws.passwordForm.confirm"
|
||||
type="password"
|
||||
class="input-field mt-1"
|
||||
:disabled="ws.isChangingPassword"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="dialog-footer">
|
||||
<button
|
||||
type="button"
|
||||
:disabled="ws.isChangingPassword"
|
||||
@click="ws.showPasswordModal = false"
|
||||
class="btn-secondary flex-1 disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
>
|
||||
{{ $t('profile.cancel') || 'Cancel' }}
|
||||
</button>
|
||||
<button
|
||||
type="submit"
|
||||
:disabled="ws.isChangingPassword"
|
||||
class="btn-primary flex-1 disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
>
|
||||
{{ ws.isChangingPassword ? $t('profile.changingPassword') : ($t('profile.changePassword') || 'Update') }}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<DeleteConfirmDialog
|
||||
v-model="ws.showDeleteQuickQuestionDialog"
|
||||
:title="$t('workspace.quickQuestions.deleteDialog.title')"
|
||||
|
||||
@@ -15,7 +15,7 @@ import { useChatHistory } from '@/features/chat/composables/useChatHistory';
|
||||
import { useWorkspaceHome } from './useWorkspaceHome';
|
||||
import { useWorkspaceLocale } from './useWorkspaceLocale';
|
||||
import { useWorkspaceNavigation } from './useWorkspaceNavigation';
|
||||
import { useWorkspaceProfile } from './useWorkspaceProfile';
|
||||
import { useUserProfile } from '@/features/user/composables/useUserProfile';
|
||||
import { useWorkspaceSchedule } from './useWorkspaceSchedule';
|
||||
import { useWorkspaceSession } from './useWorkspaceSession';
|
||||
|
||||
@@ -44,7 +44,7 @@ export function useWorkspace() {
|
||||
});
|
||||
sessionRef.handleLogout = session.handleLogout;
|
||||
|
||||
const profile = useWorkspaceProfile(deps);
|
||||
const profile = useUserProfile(deps);
|
||||
const schedule = useWorkspaceSchedule(deps);
|
||||
const history = useChatHistory();
|
||||
|
||||
|
||||
@@ -1,190 +0,0 @@
|
||||
/**
|
||||
* features/workspace/composables/useWorkspaceProfile.ts
|
||||
* 个人中心:资料读取/编辑、主题偏好、修改密码。
|
||||
*/
|
||||
import { computed, ref } from 'vue';
|
||||
import type { ThemePreference } from '@/shared/composables/useTheme';
|
||||
import { resolveCasdoorErrorMessage } from '@/shared/utils/casdoor';
|
||||
import { getAuthHeaders } from '@/shared/utils/auth';
|
||||
import { BusinessError, requestJson } from '@/shared/api/client';
|
||||
import { CHANGE_PASSWORD_ENABLED, type WorkspaceProfileForm } from '../types/workspace.types';
|
||||
import type { WorkspaceDeps } from './workspace.deps';
|
||||
|
||||
export function useWorkspaceProfile(deps: WorkspaceDeps) {
|
||||
const { t, locale, msg, setThemePreference, appliedTheme } = deps;
|
||||
|
||||
const isProfileLoading = ref(false);
|
||||
const isProfileSaving = ref(false);
|
||||
const isChangingPassword = ref(false);
|
||||
const isProfileEditing = ref(false);
|
||||
const showPasswordModal = ref(false);
|
||||
const profileUser = ref<WorkspaceProfileForm>({
|
||||
id: 0,
|
||||
username: '',
|
||||
real_name: '',
|
||||
email: '',
|
||||
phone_number: '',
|
||||
department: '',
|
||||
role: '',
|
||||
employee_id: '',
|
||||
language: 'zh-CN',
|
||||
theme_preference: 'system' as ThemePreference,
|
||||
});
|
||||
const originalProfile = ref<WorkspaceProfileForm | null>(null);
|
||||
const passwordForm = ref({ current: '', new: '', confirm: '' });
|
||||
|
||||
const themeOptions: Array<{ value: ThemePreference; label: () => string }> = [
|
||||
{ value: 'light', label: () => t('theme.light') || 'Light' },
|
||||
{ value: 'dark', label: () => t('theme.dark') || 'Dark' },
|
||||
{ value: 'system', label: () => t('theme.system') || 'Follow System' },
|
||||
];
|
||||
|
||||
const hasProfileUnsavedChanges = computed(() => {
|
||||
if (!originalProfile.value) return false;
|
||||
return (
|
||||
profileUser.value.real_name !== originalProfile.value.real_name ||
|
||||
profileUser.value.phone_number !== originalProfile.value.phone_number ||
|
||||
profileUser.value.language !== originalProfile.value.language ||
|
||||
profileUser.value.theme_preference !== originalProfile.value.theme_preference ||
|
||||
profileUser.value.email !== originalProfile.value.email ||
|
||||
profileUser.value.employee_id !== originalProfile.value.employee_id ||
|
||||
profileUser.value.department !== originalProfile.value.department
|
||||
);
|
||||
});
|
||||
|
||||
const captureOriginalProfile = () => {
|
||||
originalProfile.value = { ...profileUser.value };
|
||||
};
|
||||
|
||||
const handleChangePasswordClick = () => {
|
||||
if (!CHANGE_PASSWORD_ENABLED) {
|
||||
msg.warning(t('profile.changePasswordContactAdmin'));
|
||||
return;
|
||||
}
|
||||
showPasswordModal.value = true;
|
||||
};
|
||||
|
||||
const fetchProfile = async () => {
|
||||
isProfileLoading.value = true;
|
||||
try {
|
||||
const data = await requestJson<Partial<WorkspaceProfileForm>>('/api/user/profile', {
|
||||
headers: getAuthHeaders(),
|
||||
});
|
||||
if (!data) {
|
||||
msg.error(t('workspace.profile.msg.loadFailed'));
|
||||
return;
|
||||
}
|
||||
profileUser.value = { ...profileUser.value, ...data };
|
||||
if (data.language) locale.value = data.language;
|
||||
if (data.theme_preference) {
|
||||
setThemePreference(data.theme_preference);
|
||||
} else {
|
||||
profileUser.value.theme_preference = appliedTheme.value;
|
||||
}
|
||||
captureOriginalProfile();
|
||||
isProfileEditing.value = false;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
msg.error(t('workspace.profile.msg.loadFailed'));
|
||||
} finally {
|
||||
isProfileLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const startProfileEditing = () => {
|
||||
isProfileEditing.value = true;
|
||||
};
|
||||
|
||||
const cancelProfileEditing = () => {
|
||||
if (originalProfile.value) {
|
||||
profileUser.value = { ...originalProfile.value };
|
||||
locale.value = profileUser.value.language;
|
||||
setThemePreference(profileUser.value.theme_preference);
|
||||
}
|
||||
isProfileEditing.value = false;
|
||||
};
|
||||
|
||||
const saveProfile = async () => {
|
||||
if (!hasProfileUnsavedChanges.value) {
|
||||
isProfileEditing.value = false;
|
||||
return;
|
||||
}
|
||||
const payload = {
|
||||
real_name: profileUser.value.real_name,
|
||||
phone_number: profileUser.value.phone_number,
|
||||
language: profileUser.value.language,
|
||||
theme_preference: profileUser.value.theme_preference,
|
||||
email: profileUser.value.email,
|
||||
employee_id: profileUser.value.employee_id,
|
||||
department: profileUser.value.department,
|
||||
};
|
||||
locale.value = profileUser.value.language;
|
||||
setThemePreference(profileUser.value.theme_preference);
|
||||
try {
|
||||
isProfileSaving.value = true;
|
||||
await requestJson('/api/user/profile', {
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json', ...getAuthHeaders() },
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
msg.success(t('workspace.profile.msg.saved'));
|
||||
captureOriginalProfile();
|
||||
isProfileEditing.value = false;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
msg.error((e as Error)?.message || t('workspace.profile.msg.saveFailed'));
|
||||
} finally {
|
||||
isProfileSaving.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const handleChangePassword = async () => {
|
||||
if (isChangingPassword.value) return;
|
||||
if (passwordForm.value.new !== passwordForm.value.confirm) {
|
||||
msg.warning(t('profile.passwordMismatch') || 'Passwords do not match');
|
||||
return;
|
||||
}
|
||||
try {
|
||||
isChangingPassword.value = true;
|
||||
await requestJson('/api/user/change-password', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json', ...getAuthHeaders() },
|
||||
body: JSON.stringify({
|
||||
current_password: passwordForm.value.current,
|
||||
new_password: passwordForm.value.new,
|
||||
}),
|
||||
});
|
||||
msg.success(t('profile.passwordChanged') || 'Password changed successfully');
|
||||
passwordForm.value = { current: '', new: '', confirm: '' };
|
||||
showPasswordModal.value = false;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
msg.error(
|
||||
resolveCasdoorErrorMessage(e as BusinessError, t) || t('workspace.profile.msg.changePasswordFailed'),
|
||||
);
|
||||
} finally {
|
||||
isChangingPassword.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
isProfileLoading,
|
||||
isProfileSaving,
|
||||
isChangingPassword,
|
||||
isProfileEditing,
|
||||
showPasswordModal,
|
||||
CHANGE_PASSWORD_ENABLED,
|
||||
handleChangePasswordClick,
|
||||
profileUser,
|
||||
originalProfile,
|
||||
passwordForm,
|
||||
themeOptions,
|
||||
hasProfileUnsavedChanges,
|
||||
captureOriginalProfile,
|
||||
fetchProfile,
|
||||
startProfileEditing,
|
||||
cancelProfileEditing,
|
||||
saveProfile,
|
||||
handleChangePassword,
|
||||
};
|
||||
}
|
||||
@@ -1,199 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
/**
|
||||
* features/workspace/pages/ProfilePage.vue
|
||||
* 个人中心:用户资料展示与编辑、语言/主题偏好、修改密码入口。
|
||||
*/
|
||||
import { inject } from 'vue';
|
||||
import {
|
||||
User, Mail, Building, CreditCard, Globe, Save, Palette,
|
||||
} from 'lucide-vue-next';
|
||||
import { WORKSPACE_KEY } from '../composables/workspace.context';
|
||||
|
||||
const ws = inject(WORKSPACE_KEY)! as any;
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="ws.isProfileLoading" class="flex justify-center py-20">
|
||||
<div class="animate-spin rounded-full h-8 w-8 border-b-2 border-brand-600"></div>
|
||||
</div>
|
||||
|
||||
<div v-else class="space-y-6">
|
||||
<div class="rounded-3xl border border-default bg-surface px-6 py-6 shadow-sm md:px-8">
|
||||
<div class="flex flex-col gap-6 lg:flex-row lg:items-start lg:justify-between">
|
||||
<div class="flex flex-1 flex-col gap-6 sm:flex-row sm:items-center sm:justify-start">
|
||||
<div class="flex h-24 w-24 shrink-0 items-center justify-center rounded-full bg-brand-100 text-4xl font-bold text-brand-600" :class="ws.isMobile ? 'h-14 w-14 text-2xl' : ''">
|
||||
{{ (ws.profileUser.real_name || ws.profileUser.username || 'U').charAt(0).toUpperCase() }}
|
||||
</div>
|
||||
<div class="grid flex-1 text-left" :class="ws.isMobile ? 'grid-cols-2 gap-x-4 gap-y-1' : 'grid-cols-1 gap-x-12 gap-y-3 sm:grid-cols-2'">
|
||||
<div :class="ws.isMobile ? '' : ''">
|
||||
<div :class="ws.isMobile ? 'text-xs text-muted' : 'text-lg font-semibold text-primary'">{{ ws.isMobile ? $t('profile.realName') : (ws.profileUser.username || '-') }}</div>
|
||||
<div v-if="ws.isMobile" class="text-sm font-medium text-primary truncate">{{ ws.profileUser.real_name || ws.profileUser.username || '-' }}</div>
|
||||
</div>
|
||||
<div>
|
||||
<div :class="ws.isMobile ? 'text-xs text-muted' : 'text-lg font-semibold text-primary'">{{ ws.isMobile ? $t('profile.employeeId') : (ws.profileUser.employee_id || '-') }}</div>
|
||||
<div v-if="ws.isMobile" class="text-sm font-medium text-primary truncate">{{ ws.profileUser.employee_id || '-' }}</div>
|
||||
</div>
|
||||
<div>
|
||||
<div :class="ws.isMobile ? 'text-xs text-muted' : 'text-lg font-semibold text-primary'">{{ ws.isMobile ? $t('profile.department') : (ws.profileUser.department || '-') }}</div>
|
||||
<div v-if="ws.isMobile" class="text-sm font-medium text-primary truncate">{{ ws.profileUser.department || '-' }}</div>
|
||||
</div>
|
||||
<div>
|
||||
<div :class="ws.isMobile ? 'text-xs text-muted' : 'text-lg font-semibold text-primary'">{{ ws.isMobile ? $t('profile.role') : (ws.profileUser.role === 'admin' ? ($t('profile.roleAdmin') || 'Administrator') : ($t('profile.roleUser') || 'User')) }}</div>
|
||||
<div v-if="ws.isMobile" class="text-sm font-medium text-primary truncate">{{ ws.profileUser.role === 'admin' ? ($t('profile.roleAdmin') || 'Administrator') : ($t('profile.roleUser') || 'User') }}</div>
|
||||
</div>
|
||||
<div :class="ws.isMobile ? 'col-span-2' : 'sm:col-span-2'">
|
||||
<div :class="ws.isMobile ? 'text-xs text-muted' : 'break-all text-lg font-semibold text-primary'">{{ ws.isMobile ? $t('profile.email') : (ws.profileUser.email || '-') }}</div>
|
||||
<div v-if="ws.isMobile" class="text-sm font-medium text-primary truncate">{{ ws.profileUser.email || '-' }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="!ws.isMobile" class="flex shrink-0 items-center gap-2 self-start lg:ml-6">
|
||||
<button @click="ws.handleChangePasswordClick" class="btn-primary px-6 py-3 text-base">
|
||||
{{ $t('profile.changePassword') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="ws.isMobile" class="mt-4 flex items-center justify-center gap-4">
|
||||
<button @click="ws.handleChangePasswordClick" class="btn-primary flex-1 py-2.5 text-sm text-center">
|
||||
{{ $t('profile.changePassword') }}
|
||||
</button>
|
||||
<button @click="ws.handleLogout" class="btn-secondary flex-1 py-2.5 text-sm text-center text-red-600 hover:bg-red-50">
|
||||
{{ $t('workspace.nav.logout') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="space-y-6">
|
||||
<div class="rounded-3xl border border-default bg-surface p-8 shadow-sm" :class="ws.isMobile ? 'p-4' : ''">
|
||||
<div class="mb-8 flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between" :class="ws.isMobile ? 'mb-4 gap-2' : ''">
|
||||
<div class="flex items-center" :class="ws.isMobile ? 'w-full justify-center gap-2' : ''">
|
||||
<h3 class="flex items-center gap-3 text-3xl font-bold text-primary" :class="ws.isMobile ? 'text-lg gap-2' : ''">
|
||||
<User class="h-6 w-6 text-brand-500" :class="ws.isMobile ? 'h-4 w-4' : ''" />
|
||||
{{ $t('profile.basicInfo') }}
|
||||
</h3>
|
||||
<button v-if="ws.isMobile && !ws.isProfileEditing" @click="ws.startProfileEditing" class="btn-secondary px-3 py-1 text-xs">
|
||||
{{ $t('profile.edit') }}
|
||||
</button>
|
||||
</div>
|
||||
<p v-if="!ws.isMobile" class="mt-2 text-sm text-muted">
|
||||
{{ ws.isProfileEditing ? $t('profile.directEditHint') : $t('profile.switchEditHint') }}
|
||||
</p>
|
||||
<div v-if="!ws.isMobile" class="flex items-center gap-2">
|
||||
<button v-if="!ws.isProfileEditing" @click="ws.startProfileEditing" class="btn-secondary px-5 py-2.5 text-sm">
|
||||
{{ $t('profile.edit') }}
|
||||
</button>
|
||||
<template v-else>
|
||||
<button @click="ws.cancelProfileEditing" class="btn-secondary px-5 py-2.5 text-sm">
|
||||
{{ $t('profile.cancel') || 'Cancel' }}
|
||||
</button>
|
||||
<button
|
||||
@click="ws.saveProfile"
|
||||
:disabled="ws.isProfileSaving || !ws.hasProfileUnsavedChanges"
|
||||
class="btn-primary px-5 py-2.5 text-sm disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
>
|
||||
<Save class="w-4 h-4" />
|
||||
<span>{{ ws.isProfileSaving ? $t('profile.saving') : $t('workspace.save') }}</span>
|
||||
</button>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid grid-cols-1 gap-5 md:grid-cols-2" :class="ws.isMobile ? 'gap-3' : ''">
|
||||
<div>
|
||||
<label class="mb-2 flex items-center gap-2 text-sm font-medium text-muted" :class="ws.isMobile ? 'text-xs mb-1' : ''">
|
||||
<User class="h-4 w-4" /> {{ $t('profile.username') }}
|
||||
</label>
|
||||
<div class="rounded-2xl border border-default bg-surface-soft px-4 py-4 text-lg font-medium text-secondary" :class="ws.isMobile ? 'px-3 py-2 text-sm rounded-xl' : ''">
|
||||
{{ ws.profileUser.username || '-' }}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="mb-2 flex items-center gap-2 text-sm font-medium text-muted" :class="ws.isMobile ? 'text-xs mb-1' : ''">
|
||||
<CreditCard class="h-4 w-4" /> {{ $t('profile.employeeId') }}
|
||||
</label>
|
||||
<input v-if="ws.isProfileEditing" v-model="ws.profileUser.employee_id" type="text" class="input-field" :class="ws.isMobile ? 'h-10 text-sm' : 'h-[58px]'" />
|
||||
<div v-else class="rounded-2xl border border-default bg-surface-soft px-4 py-4 text-lg font-medium text-secondary" :class="ws.isMobile ? 'px-3 py-2 text-sm rounded-xl' : ''">
|
||||
{{ ws.profileUser.employee_id || '-' }}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="mb-2 flex items-center gap-2 text-sm font-medium text-muted" :class="ws.isMobile ? 'text-xs mb-1' : ''">
|
||||
<User class="h-4 w-4" /> {{ $t('profile.realName') }}
|
||||
</label>
|
||||
<input v-if="ws.isProfileEditing" v-model="ws.profileUser.real_name" type="text" class="input-field" :class="ws.isMobile ? 'h-10 text-sm' : 'h-[58px]'" />
|
||||
<div v-else class="rounded-2xl border border-default bg-surface-soft px-4 py-4 text-lg font-medium text-secondary" :class="ws.isMobile ? 'px-3 py-2 text-sm rounded-xl' : ''">
|
||||
{{ ws.profileUser.real_name || '-' }}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="mb-2 flex items-center gap-2 text-sm font-medium text-muted" :class="ws.isMobile ? 'text-xs mb-1' : ''">
|
||||
<Building class="h-4 w-4" /> {{ $t('profile.department') }}
|
||||
</label>
|
||||
<input v-if="ws.isProfileEditing" v-model="ws.profileUser.department" type="text" class="input-field" :class="ws.isMobile ? 'h-10 text-sm' : 'h-[58px]'" />
|
||||
<div v-else class="rounded-2xl border border-default bg-surface-soft px-4 py-4 text-lg font-medium text-secondary" :class="ws.isMobile ? 'px-3 py-2 text-sm rounded-xl' : ''">
|
||||
{{ ws.profileUser.department || '-' }}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="mb-2 flex items-center gap-2 text-sm font-medium text-muted" :class="ws.isMobile ? 'text-xs mb-1' : ''">
|
||||
<Mail class="h-4 w-4" /> {{ $t('profile.email') }}
|
||||
</label>
|
||||
<input v-if="ws.isProfileEditing" v-model="ws.profileUser.email" type="email" class="input-field" :class="ws.isMobile ? 'h-10 text-sm' : 'h-[58px]'" />
|
||||
<div v-else class="rounded-2xl border border-default bg-surface-soft px-4 py-4 text-lg font-medium text-secondary" :class="ws.isMobile ? 'px-3 py-2 text-sm rounded-xl' : ''">
|
||||
{{ ws.profileUser.email || '-' }}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="mb-2 flex items-center gap-2 text-sm font-medium text-muted" :class="ws.isMobile ? 'text-xs mb-1' : ''">
|
||||
<Globe class="h-4 w-4" /> {{ $t('profile.phoneNumber') }}
|
||||
</label>
|
||||
<input v-if="ws.isProfileEditing" v-model="ws.profileUser.phone_number" type="text" class="input-field" :class="ws.isMobile ? 'h-10 text-sm' : 'h-[58px]'" />
|
||||
<div v-else class="rounded-2xl border border-default bg-surface-soft px-4 py-4 text-lg font-medium text-secondary" :class="ws.isMobile ? 'px-3 py-2 text-sm rounded-xl' : ''">
|
||||
{{ ws.profileUser.phone_number || '-' }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="rounded-3xl border border-default bg-surface p-8 shadow-sm">
|
||||
<h3 class="mb-6 flex items-center gap-3 text-2xl font-bold text-primary">
|
||||
<Palette class="h-5 w-5 text-brand-500" />
|
||||
{{ $t('profile.preferences') }}
|
||||
</h3>
|
||||
<div class="grid grid-cols-1 gap-6 md:grid-cols-2">
|
||||
<div>
|
||||
<label class="mb-2 block text-sm font-medium text-muted">{{ $t('workspace.languageLabel') }}</label>
|
||||
<select v-model="ws.profileUser.language" :disabled="!ws.isProfileEditing" class="input-field h-[58px]">
|
||||
<option value="en">English</option>
|
||||
<option value="zh-CN">{{ $t('workspace.lang.zhCN') }}</option>
|
||||
<option value="zh-TW">{{ $t('workspace.lang.zhTW') }}</option>
|
||||
<option value="th">ไทย</option>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label class="mb-2 block text-sm font-medium text-muted">{{ $t('profile.theme') }}</label>
|
||||
<div
|
||||
class="segment-control segment-control--cols-3 segment-control--md"
|
||||
role="radiogroup"
|
||||
:aria-label="$t('profile.theme')"
|
||||
>
|
||||
<button
|
||||
v-for="item in ws.themeOptions"
|
||||
:key="item.value"
|
||||
type="button"
|
||||
role="radio"
|
||||
:aria-checked="ws.profileUser.theme_preference === item.value"
|
||||
:disabled="!ws.isProfileEditing"
|
||||
class="segment-item"
|
||||
:class="ws.profileUser.theme_preference === item.value ? 'segment-item--active' : ''"
|
||||
@click="ws.profileUser.theme_preference = item.value"
|
||||
>
|
||||
{{ item.label() }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -2,7 +2,6 @@
|
||||
* features/workspace/types/workspace.types.ts
|
||||
* 工作台相关 TypeScript 类型与业务常量。
|
||||
*/
|
||||
import type { ThemePreference } from '@/shared/composables/useTheme';
|
||||
import type { WecomMatchField } from '@/shared/utils/wecom';
|
||||
import type { WecomLoginDialogContent } from '@/shared/utils/wecom';
|
||||
|
||||
@@ -73,19 +72,6 @@ export interface WecomBindPromptState {
|
||||
error: string;
|
||||
}
|
||||
|
||||
export interface WorkspaceProfileForm {
|
||||
id: number;
|
||||
username: string;
|
||||
real_name: string;
|
||||
email: string;
|
||||
phone_number: string;
|
||||
department: string;
|
||||
role: string;
|
||||
employee_id: string;
|
||||
language: string;
|
||||
theme_preference: ThemePreference;
|
||||
}
|
||||
|
||||
export type { ChatCrossAgentHistoryItem as WorkspaceChatHistoryItem } from '@/features/chat/types/chat.types';
|
||||
|
||||
export type { WecomLoginDialogContent };
|
||||
@@ -101,4 +87,3 @@ export const SECTION_TITLE_KEY_MAP: Record<string, string> = {
|
||||
export const DEFAULT_POST_LOGIN_AGENT_ID = 16;
|
||||
export const KB_ACCESS_DENIED_MESSAGE = '需要管理员权限才能访问知识库。';
|
||||
export const WS_SCHEDULE_FILTER_INPUT_CLASS = 'admin-table-filter-input text-xs py-1.5 px-2';
|
||||
export const CHANGE_PASSWORD_ENABLED = true;
|
||||
@@ -11,9 +11,12 @@ import { WORKSPACE_KEY } from '../composables/workspace.context';
|
||||
import WorkspaceSidebar from '../components/WorkspaceSidebar.vue';
|
||||
import WorkspaceModals from '../components/WorkspaceModals.vue';
|
||||
import { ExternalSystemLinks } from '@/features/sso';
|
||||
import UserPasswordDialog from '@/features/user/components/UserPasswordDialog.vue';
|
||||
import { USER_PROFILE_KEY, type UserProfileContext } from '@/features/user/composables/user-profile.context';
|
||||
|
||||
const ws = useWorkspace();
|
||||
provide(WORKSPACE_KEY, ws);
|
||||
provide(USER_PROFILE_KEY, ws as UserProfileContext);
|
||||
|
||||
const mobileTabs = [
|
||||
{ key: 'applications', path: WORKSPACE_PATHS.applications, icon: LayoutGrid, labelKey: 'workspace.mobileTabs.applications' },
|
||||
@@ -72,5 +75,6 @@ const mobileTabs = [
|
||||
</div>
|
||||
|
||||
<WorkspaceModals />
|
||||
<UserPasswordDialog />
|
||||
</div>
|
||||
</template>
|
||||
Reference in new issue
Block a user