Merge branch 'dev' into test
This commit is contained in:
commit
fe8659c62e
16 files changed
+285
-93
No files matched your search
@@ -10,7 +10,9 @@ import { useI18n } from 'vue-i18n';
|
||||
import {
|
||||
BookOpen,
|
||||
CheckCircle2,
|
||||
ChevronDown,
|
||||
ChevronRight,
|
||||
ChevronUp,
|
||||
ClipboardCheck,
|
||||
Edit,
|
||||
FileQuestion,
|
||||
@@ -105,6 +107,19 @@ const directVideoResources = computed(() => contentResources.value.filter((resou
|
||||
resource.resource_type === 'agent_guide'
|
||||
&& videoGuideCandidates.value.some((guide) => guide.id === resource.agent_guide_id)
|
||||
)));
|
||||
// 培训视频上传列表默认收起:超过阈值仅展示前 N 条,底部按钮可展开查看全部,避免视频过多时页面过长
|
||||
const DIRECT_VIDEO_PREVIEW_COUNT = 3;
|
||||
const isDirectVideoExpanded = ref(false);
|
||||
const hasMoreDirectVideos = computed(() => directVideoResources.value.length > DIRECT_VIDEO_PREVIEW_COUNT);
|
||||
const directVideoVisibleResources = computed(() => (
|
||||
hasMoreDirectVideos.value && !isDirectVideoExpanded.value
|
||||
? directVideoResources.value.slice(0, DIRECT_VIDEO_PREVIEW_COUNT)
|
||||
: directVideoResources.value
|
||||
));
|
||||
/** 切换培训视频上传列表展开/收起:收起仅保留前 N 条,其余视频仍在表单资源中参与保存。 */
|
||||
const toggleDirectVideoExpanded = () => {
|
||||
isDirectVideoExpanded.value = !isDirectVideoExpanded.value;
|
||||
};
|
||||
const contentResources = computed(() => form.value.resources.filter((resource) => resource.resource_type !== 'inline_questions'));
|
||||
const trainingLevels: TrainingLevel[] = ['company', 'department', 'team'];
|
||||
const guideGroups = computed(() => {
|
||||
@@ -452,6 +467,8 @@ const selectConfig = (config: TrainingConfig) => {
|
||||
questionJsonText.value = JSON.stringify(questions, null, 2);
|
||||
questionSourceVersionId.value = null;
|
||||
questionParseMeta.value = null;
|
||||
// 切换培训类型时培训视频上传列表恢复默认收起,避免上一配置的展开状态带入
|
||||
isDirectVideoExpanded.value = false;
|
||||
void loadLeanTask();
|
||||
};
|
||||
|
||||
@@ -740,6 +757,8 @@ const uploadTrainingVideo = async (event: Event) => {
|
||||
required_duration: 0,
|
||||
sort_order: form.value.resources.length,
|
||||
});
|
||||
// 新上传的视频排在列表末尾,自动展开避免用户以为上传失败找不到新视频
|
||||
isDirectVideoExpanded.value = true;
|
||||
msg.success(t('admin.trainingConfig.messages.videoUploaded'));
|
||||
} catch (error) {
|
||||
msg.error(error instanceof Error ? error.message : t('admin.trainingConfig.messages.videoUploadFailed'));
|
||||
@@ -945,11 +964,19 @@ onMounted(() => void load());
|
||||
</div>
|
||||
<div class="space-y-3 p-4 md:p-5">
|
||||
<div v-if="!directVideoResources.length" class="rounded-xl border border-dashed border-default bg-surface-soft/50 px-3 py-8 text-center text-xs text-muted">{{ t('admin.trainingConfig.directVideo.empty') }}</div>
|
||||
<div v-for="(resource, index) in directVideoResources" v-else :key="resource.id || `direct-video-${index}`" class="grid gap-3 rounded-xl border border-default bg-white p-4 md:grid-cols-[minmax(0,1fr)_180px_auto] md:items-end">
|
||||
<div class="flex min-w-0 items-center gap-2 text-sm font-medium text-primary"><Video class="h-4 w-4 shrink-0 text-violet-500" /><span class="truncate">{{ resource.title || videoGuideCandidates.find((guide) => guide.id === resource.agent_guide_id)?.file_name || t('admin.trainingConfig.directVideo.unnamed') }}</span></div>
|
||||
<label class="label-field">{{ t('admin.trainingConfig.fields.requiredDuration') }}<input v-model.number="resource.required_duration" type="number" min="0" class="input-field mt-2" /></label>
|
||||
<button class="btn-danger btn-sm" type="button" @click="removeResource(resource)"><Trash2 class="h-4 w-4" />{{ t('admin.delete') }}</button>
|
||||
</div>
|
||||
<!-- 培训视频上传列表默认收起:超过阈值仅展示前 N 条,底部可展开查看全部 -->
|
||||
<template v-else>
|
||||
<div v-for="(resource, index) in directVideoVisibleResources" :key="resource.id || `direct-video-${index}`" class="grid gap-3 rounded-xl border border-default bg-white p-4 md:grid-cols-[minmax(0,1fr)_180px_auto] md:items-end">
|
||||
<div class="flex min-w-0 items-center gap-2 text-sm font-medium text-primary"><Video class="h-4 w-4 shrink-0 text-violet-500" /><span class="truncate">{{ resource.title || videoGuideCandidates.find((guide) => guide.id === resource.agent_guide_id)?.file_name || t('admin.trainingConfig.directVideo.unnamed') }}</span></div>
|
||||
<label class="label-field">{{ t('admin.trainingConfig.fields.requiredDuration') }}<input v-model.number="resource.required_duration" type="number" min="0" class="input-field mt-2" /></label>
|
||||
<button class="btn-danger btn-sm" type="button" @click="removeResource(resource)"><Trash2 class="h-4 w-4" />{{ t('admin.delete') }}</button>
|
||||
</div>
|
||||
<button v-if="hasMoreDirectVideos" class="flex w-full items-center justify-center gap-1.5 rounded-xl border border-dashed border-default bg-surface-soft/50 px-3 py-2.5 text-xs font-medium text-secondary transition hover:bg-surface-soft" type="button" @click="toggleDirectVideoExpanded">
|
||||
<ChevronDown v-if="!isDirectVideoExpanded" class="h-4 w-4" />
|
||||
<ChevronUp v-else class="h-4 w-4" />
|
||||
{{ isDirectVideoExpanded ? t('admin.trainingConfig.directVideo.collapseList') : t('admin.trainingConfig.directVideo.expandAll', { count: directVideoResources.length }) }}
|
||||
</button>
|
||||
</template>
|
||||
</div>
|
||||
</article>
|
||||
<article
|
||||
|
||||
@@ -1,16 +1,57 @@
|
||||
<script setup lang="ts">
|
||||
/**
|
||||
* features/user/views/UserProfilePage.vue
|
||||
* 閻劑鈧棑绱扮仦鏇犮仛閸滃瞼绱潏鎴濈秼閸撳秶鏁ら幋鐤カ閺傛瑣鈧浇顕㈢懛鈧?娑撳顣介崑蹇撱偨閿涘苯鑻熼幓鎰返娣囶喗鏁肩€靛棛鐖滈崗銉ュ經閵? * 娓氭繆绂嗛敍姝秙er-profile.context閵嗕勾ucide 閸ョ偓鐖i妴涔倁e i18n閵? * 闁槒绶敍姘矝閻?/workspace/profile 鐠侯垳鏁遍幍鑳祰閿涘奔绲炬い鐢告桨閸滃奔绗熼崝鈥崇秺鐏?user feature閵? */
|
||||
import { inject } from 'vue';
|
||||
* 用途:工作台个人中心,展示与编辑当前用户资料、语言/主题偏好,并提供修改密码入口。
|
||||
* 依赖:workspace.context(WORKSPACE_KEY)、lucide 图标、vue-i18n。
|
||||
* 逻辑:路由 /workspace/profile 懒加载本页;资料状态由 useWorkspaceProfile 经工作台注入,避免与工作台分叉。
|
||||
*/
|
||||
import { computed, inject } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import {
|
||||
User, Mail, Building, CreditCard, Globe, Save, Palette,
|
||||
} from 'lucide-vue-next';
|
||||
import { WORKSPACE_KEY } from '@/features/workspace/composables/workspace.context';
|
||||
|
||||
// 个人资料与改密状态由工作台 useWorkspaceProfile 编排,经 WORKSPACE_KEY 注入。
|
||||
// 这里复用同一份 ws 上下文(含 profileUser/主题/移动端/登出能力),避免与工作台状态分叉。
|
||||
const { t } = useI18n();
|
||||
const userProfile = inject(WORKSPACE_KEY)!;
|
||||
|
||||
/** 只读字段值:与 input-field 同高,正文统一 14px。 */
|
||||
const fieldValueClass = 'flex min-h-11 items-center rounded-xl border border-default bg-surface-soft px-4 text-sm font-medium text-secondary';
|
||||
/** 表单标签:与分区标题区分层级,全页统一 14px。 */
|
||||
const fieldLabelClass = 'mb-1.5 flex items-center gap-1.5 text-sm font-medium text-muted';
|
||||
|
||||
/**
|
||||
* 头像字母:取姓名或用户名首字,供身份卡展示。
|
||||
*/
|
||||
const avatarLetter = computed(() => {
|
||||
const source = userProfile.profileUser.real_name || userProfile.profileUser.username || 'U';
|
||||
return source.charAt(0).toUpperCase();
|
||||
});
|
||||
|
||||
/**
|
||||
* 身份主标题:优先真实姓名,缺失时回退用户名。
|
||||
*/
|
||||
const displayName = computed(() => {
|
||||
return userProfile.profileUser.real_name || userProfile.profileUser.username || '-';
|
||||
});
|
||||
|
||||
/**
|
||||
* 角色展示文案。
|
||||
*/
|
||||
const roleLabel = computed(() => {
|
||||
return userProfile.profileUser.role === 'admin' ? t('profile.roleAdmin') : t('profile.roleUser');
|
||||
});
|
||||
|
||||
/**
|
||||
* 身份副标题:用户名(与主标题不同时)、部门、角色用间隔点拼接,空项省略。
|
||||
*/
|
||||
const identityMeta = computed(() => {
|
||||
const username = userProfile.profileUser.username;
|
||||
const showUsername = Boolean(username && username !== displayName.value);
|
||||
return [showUsername ? username : '', userProfile.profileUser.department, roleLabel.value]
|
||||
.filter(Boolean)
|
||||
.join(' · ');
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -19,151 +60,186 @@ const userProfile = inject(WORKSPACE_KEY)!;
|
||||
</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="userProfile.isMobile ? 'h-14 w-14 text-2xl' : ''">
|
||||
{{ (userProfile.profileUser.real_name || userProfile.profileUser.username || 'U').charAt(0).toUpperCase() }}
|
||||
<div class="rounded-2xl border border-default bg-surface px-5 py-5 shadow-sm md:px-6">
|
||||
<div class="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
|
||||
<div class="flex min-w-0 items-center gap-4">
|
||||
<div
|
||||
class="flex h-14 w-14 shrink-0 items-center justify-center rounded-full bg-brand-100 text-xl font-semibold text-brand-600 md:h-16 md:w-16 md:text-2xl"
|
||||
>
|
||||
{{ avatarLetter }}
|
||||
</div>
|
||||
<div class="grid flex-1 text-left" :class="userProfile.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="userProfile.isMobile ? '' : ''">
|
||||
<div :class="userProfile.isMobile ? 'text-xs text-muted' : 'text-lg font-semibold text-primary'">{{ userProfile.isMobile ? $t('profile.realName') : (userProfile.profileUser.username || '-') }}</div>
|
||||
<div v-if="userProfile.isMobile" class="text-sm font-medium text-primary truncate">{{ userProfile.profileUser.real_name || userProfile.profileUser.username || '-' }}</div>
|
||||
</div>
|
||||
<div>
|
||||
<div :class="userProfile.isMobile ? 'text-xs text-muted' : 'text-lg font-semibold text-primary'">{{ userProfile.isMobile ? $t('profile.employeeId') : (userProfile.profileUser.employee_id || '-') }}</div>
|
||||
<div v-if="userProfile.isMobile" class="text-sm font-medium text-primary truncate">{{ userProfile.profileUser.employee_id || '-' }}</div>
|
||||
</div>
|
||||
<div>
|
||||
<div :class="userProfile.isMobile ? 'text-xs text-muted' : 'text-lg font-semibold text-primary'">{{ userProfile.isMobile ? $t('profile.department') : (userProfile.profileUser.department || '-') }}</div>
|
||||
<div v-if="userProfile.isMobile" class="text-sm font-medium text-primary truncate">{{ userProfile.profileUser.department || '-' }}</div>
|
||||
</div>
|
||||
<div>
|
||||
<div :class="userProfile.isMobile ? 'text-xs text-muted' : 'text-lg font-semibold text-primary'">{{ userProfile.isMobile ? $t('profile.role') : (userProfile.profileUser.role === 'admin' ? ($t('profile.roleAdmin') || 'Administrator') : ($t('profile.roleUser') || 'User')) }}</div>
|
||||
<div v-if="userProfile.isMobile" class="text-sm font-medium text-primary truncate">{{ userProfile.profileUser.role === 'admin' ? ($t('profile.roleAdmin') || 'Administrator') : ($t('profile.roleUser') || 'User') }}</div>
|
||||
</div>
|
||||
<div :class="userProfile.isMobile ? 'col-span-2' : 'sm:col-span-2'">
|
||||
<div :class="userProfile.isMobile ? 'text-xs text-muted' : 'break-all text-lg font-semibold text-primary'">{{ userProfile.isMobile ? $t('profile.email') : (userProfile.profileUser.email || '-') }}</div>
|
||||
<div v-if="userProfile.isMobile" class="text-sm font-medium text-primary truncate">{{ userProfile.profileUser.email || '-' }}</div>
|
||||
<div class="min-w-0 space-y-0.5">
|
||||
<div class="truncate text-lg font-semibold text-primary">{{ displayName }}</div>
|
||||
<div v-if="identityMeta" class="truncate text-sm text-muted">{{ identityMeta }}</div>
|
||||
<div v-if="userProfile.profileUser.email" class="break-all text-sm text-muted">
|
||||
{{ userProfile.profileUser.email }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="!userProfile.isMobile" class="flex shrink-0 items-center gap-2 self-start lg:ml-6">
|
||||
<button @click="userProfile.handleChangePasswordClick" class="btn-primary px-6 py-3 text-base">
|
||||
<div v-if="!userProfile.isMobile" class="shrink-0">
|
||||
<button type="button" class="btn-primary btn-sm" @click="userProfile.handleChangePasswordClick">
|
||||
{{ $t('profile.changePassword') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="userProfile.isMobile" class="mt-4 flex items-center justify-center gap-4">
|
||||
<button @click="userProfile.handleChangePasswordClick" class="btn-primary flex-1 py-2.5 text-sm text-center">
|
||||
<div v-if="userProfile.isMobile" class="mt-4 flex items-center gap-3">
|
||||
<button
|
||||
type="button"
|
||||
class="btn-primary btn-sm flex-1"
|
||||
@click="userProfile.handleChangePasswordClick"
|
||||
>
|
||||
{{ $t('profile.changePassword') }}
|
||||
</button>
|
||||
<button @click="userProfile.handleLogout" class="btn-secondary flex-1 py-2.5 text-sm text-center text-red-600 hover:bg-red-50">
|
||||
<button
|
||||
type="button"
|
||||
class="btn-secondary btn-sm flex-1 text-red-600 hover:bg-red-50"
|
||||
@click="userProfile.handleLogout"
|
||||
>
|
||||
{{ $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="userProfile.isMobile ? 'p-4' : ''">
|
||||
<div class="mb-8 flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between" :class="userProfile.isMobile ? 'mb-4 gap-2' : ''">
|
||||
<div class="flex items-center" :class="userProfile.isMobile ? 'w-full justify-center gap-2' : ''">
|
||||
<h3 class="flex items-center gap-3 text-3xl font-bold text-primary" :class="userProfile.isMobile ? 'text-lg gap-2' : ''">
|
||||
<User class="h-6 w-6 text-brand-500" :class="userProfile.isMobile ? 'h-4 w-4' : ''" />
|
||||
<div class="rounded-2xl border border-default bg-surface p-5 shadow-sm md:p-6">
|
||||
<div class="mb-5 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
|
||||
<div class="flex items-center gap-2" :class="userProfile.isMobile ? 'w-full justify-between' : ''">
|
||||
<h3 class="section-title flex items-center gap-2">
|
||||
<User class="h-5 w-5 text-brand-500" />
|
||||
{{ $t('profile.basicInfo') }}
|
||||
</h3>
|
||||
<button v-if="userProfile.isMobile && !userProfile.isProfileEditing" @click="userProfile.startProfileEditing" class="btn-secondary px-3 py-1 text-xs">
|
||||
<button
|
||||
v-if="userProfile.isMobile && !userProfile.isProfileEditing"
|
||||
type="button"
|
||||
class="btn-secondary btn-sm"
|
||||
@click="userProfile.startProfileEditing"
|
||||
>
|
||||
{{ $t('profile.edit') }}
|
||||
</button>
|
||||
</div>
|
||||
<p v-if="!userProfile.isMobile" class="mt-2 text-sm text-muted">
|
||||
<p v-if="!userProfile.isMobile" class="section-desc">
|
||||
{{ userProfile.isProfileEditing ? $t('profile.directEditHint') : $t('profile.switchEditHint') }}
|
||||
</p>
|
||||
<div v-if="!userProfile.isMobile" class="flex items-center gap-2">
|
||||
<button v-if="!userProfile.isProfileEditing" @click="userProfile.startProfileEditing" class="btn-secondary px-5 py-2.5 text-sm">
|
||||
<button
|
||||
v-if="!userProfile.isProfileEditing"
|
||||
type="button"
|
||||
class="btn-secondary btn-sm"
|
||||
@click="userProfile.startProfileEditing"
|
||||
>
|
||||
{{ $t('profile.edit') }}
|
||||
</button>
|
||||
<template v-else>
|
||||
<button @click="userProfile.cancelProfileEditing" class="btn-secondary px-5 py-2.5 text-sm">
|
||||
{{ $t('profile.cancel') || 'Cancel' }}
|
||||
<button type="button" class="btn-secondary btn-sm" @click="userProfile.cancelProfileEditing">
|
||||
{{ $t('profile.cancel') }}
|
||||
</button>
|
||||
<button
|
||||
@click="userProfile.saveProfile"
|
||||
type="button"
|
||||
class="btn-primary btn-sm disabled:cursor-not-allowed disabled:opacity-50"
|
||||
:disabled="userProfile.isProfileSaving || !userProfile.hasProfileUnsavedChanges"
|
||||
class="btn-primary px-5 py-2.5 text-sm disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
@click="userProfile.saveProfile"
|
||||
>
|
||||
<Save class="w-4 h-4" />
|
||||
<Save class="h-4 w-4" />
|
||||
<span>{{ userProfile.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="userProfile.isMobile ? 'gap-3' : ''">
|
||||
<div class="grid grid-cols-1 gap-4 md:grid-cols-2">
|
||||
<div>
|
||||
<label class="mb-2 flex items-center gap-2 text-sm font-medium text-muted" :class="userProfile.isMobile ? 'text-xs mb-1' : ''">
|
||||
<label :class="fieldLabelClass">
|
||||
<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="userProfile.isMobile ? 'px-3 py-2 text-sm rounded-xl' : ''">
|
||||
<div :class="fieldValueClass">
|
||||
{{ userProfile.profileUser.username || '-' }}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="mb-2 flex items-center gap-2 text-sm font-medium text-muted" :class="userProfile.isMobile ? 'text-xs mb-1' : ''">
|
||||
<label :class="fieldLabelClass">
|
||||
<CreditCard class="h-4 w-4" /> {{ $t('profile.employeeId') }}
|
||||
</label>
|
||||
<input v-if="userProfile.isProfileEditing" v-model="userProfile.profileUser.employee_id" type="text" class="input-field" :class="userProfile.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="userProfile.isMobile ? 'px-3 py-2 text-sm rounded-xl' : ''">
|
||||
<input
|
||||
v-if="userProfile.isProfileEditing"
|
||||
v-model="userProfile.profileUser.employee_id"
|
||||
type="text"
|
||||
class="input-field text-sm"
|
||||
>
|
||||
<div v-else :class="fieldValueClass">
|
||||
{{ userProfile.profileUser.employee_id || '-' }}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="mb-2 flex items-center gap-2 text-sm font-medium text-muted" :class="userProfile.isMobile ? 'text-xs mb-1' : ''">
|
||||
<label :class="fieldLabelClass">
|
||||
<User class="h-4 w-4" /> {{ $t('profile.realName') }}
|
||||
</label>
|
||||
<input v-if="userProfile.isProfileEditing" v-model="userProfile.profileUser.real_name" type="text" class="input-field" :class="userProfile.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="userProfile.isMobile ? 'px-3 py-2 text-sm rounded-xl' : ''">
|
||||
<input
|
||||
v-if="userProfile.isProfileEditing"
|
||||
v-model="userProfile.profileUser.real_name"
|
||||
type="text"
|
||||
class="input-field text-sm"
|
||||
>
|
||||
<div v-else :class="fieldValueClass">
|
||||
{{ userProfile.profileUser.real_name || '-' }}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="mb-2 flex items-center gap-2 text-sm font-medium text-muted" :class="userProfile.isMobile ? 'text-xs mb-1' : ''">
|
||||
<label :class="fieldLabelClass">
|
||||
<Building class="h-4 w-4" /> {{ $t('profile.department') }}
|
||||
</label>
|
||||
<input v-if="userProfile.isProfileEditing" v-model="userProfile.profileUser.department" type="text" class="input-field" :class="userProfile.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="userProfile.isMobile ? 'px-3 py-2 text-sm rounded-xl' : ''">
|
||||
<input
|
||||
v-if="userProfile.isProfileEditing"
|
||||
v-model="userProfile.profileUser.department"
|
||||
type="text"
|
||||
class="input-field text-sm"
|
||||
>
|
||||
<div v-else :class="fieldValueClass">
|
||||
{{ userProfile.profileUser.department || '-' }}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="mb-2 flex items-center gap-2 text-sm font-medium text-muted" :class="userProfile.isMobile ? 'text-xs mb-1' : ''">
|
||||
<label :class="fieldLabelClass">
|
||||
<Mail class="h-4 w-4" /> {{ $t('profile.email') }}
|
||||
</label>
|
||||
<input v-if="userProfile.isProfileEditing" v-model="userProfile.profileUser.email" type="email" class="input-field" :class="userProfile.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="userProfile.isMobile ? 'px-3 py-2 text-sm rounded-xl' : ''">
|
||||
<input
|
||||
v-if="userProfile.isProfileEditing"
|
||||
v-model="userProfile.profileUser.email"
|
||||
type="email"
|
||||
class="input-field text-sm"
|
||||
>
|
||||
<div v-else :class="fieldValueClass">
|
||||
{{ userProfile.profileUser.email || '-' }}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="mb-2 flex items-center gap-2 text-sm font-medium text-muted" :class="userProfile.isMobile ? 'text-xs mb-1' : ''">
|
||||
<label :class="fieldLabelClass">
|
||||
<Globe class="h-4 w-4" /> {{ $t('profile.phoneNumber') }}
|
||||
</label>
|
||||
<input v-if="userProfile.isProfileEditing" v-model="userProfile.profileUser.phone_number" type="text" class="input-field" :class="userProfile.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="userProfile.isMobile ? 'px-3 py-2 text-sm rounded-xl' : ''">
|
||||
<input
|
||||
v-if="userProfile.isProfileEditing"
|
||||
v-model="userProfile.profileUser.phone_number"
|
||||
type="text"
|
||||
class="input-field text-sm"
|
||||
>
|
||||
<div v-else :class="fieldValueClass">
|
||||
{{ userProfile.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">
|
||||
<div class="rounded-2xl border border-default bg-surface p-5 shadow-sm md:p-6">
|
||||
<h3 class="section-title mb-5 flex items-center gap-2">
|
||||
<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 class="grid grid-cols-1 gap-4 md:grid-cols-2">
|
||||
<div>
|
||||
<label class="mb-2 block text-sm font-medium text-muted">{{ $t('workspace.languageLabel') }}</label>
|
||||
<select v-model="userProfile.profileUser.language" :disabled="!userProfile.isProfileEditing" class="input-field h-[58px]">
|
||||
<label class="mb-1.5 block text-sm font-medium text-muted">{{ $t('workspace.languageLabel') }}</label>
|
||||
<select
|
||||
v-model="userProfile.profileUser.language"
|
||||
class="select-field text-sm"
|
||||
:disabled="!userProfile.isProfileEditing"
|
||||
>
|
||||
<option value="en">English</option>
|
||||
<option value="zh-CN">{{ $t('workspace.lang.zhCN') }}</option>
|
||||
<option value="zh-TW">{{ $t('workspace.lang.zhTW') }}</option>
|
||||
@@ -171,7 +247,7 @@ const userProfile = inject(WORKSPACE_KEY)!;
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label class="mb-2 block text-sm font-medium text-muted">{{ $t('profile.theme') }}</label>
|
||||
<label class="mb-1.5 block text-sm font-medium text-muted">{{ $t('profile.theme') }}</label>
|
||||
<div
|
||||
class="segment-control segment-control--cols-3 segment-control--md"
|
||||
role="radiogroup"
|
||||
@@ -182,9 +258,9 @@ const userProfile = inject(WORKSPACE_KEY)!;
|
||||
:key="item.value"
|
||||
type="button"
|
||||
role="radio"
|
||||
class="segment-item"
|
||||
:aria-checked="userProfile.profileUser.theme_preference === item.value"
|
||||
:disabled="!userProfile.isProfileEditing"
|
||||
class="segment-item"
|
||||
:class="userProfile.profileUser.theme_preference === item.value ? 'segment-item--active' : ''"
|
||||
@click="userProfile.profileUser.theme_preference = item.value"
|
||||
>
|
||||
@@ -194,7 +270,6 @@ const userProfile = inject(WORKSPACE_KEY)!;
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -5063,7 +5063,9 @@
|
||||
"upload": "Upload Video",
|
||||
"uploading": "Uploading...",
|
||||
"empty": "No training videos uploaded",
|
||||
"unnamed": "Unnamed video"
|
||||
"unnamed": "Unnamed video",
|
||||
"expandAll": "Expand all videos ({count})",
|
||||
"collapseList": "Collapse list"
|
||||
},
|
||||
"lean": {
|
||||
"weekKey": "Task week (Monday)",
|
||||
|
||||
@@ -10,8 +10,10 @@
|
||||
"email": "Email",
|
||||
"phoneNumber": "Phone Number",
|
||||
"theme": "Theme",
|
||||
"role": "Role",
|
||||
"roleAdmin": "Administrator",
|
||||
"roleUser": "User",
|
||||
"saving": "Saving...",
|
||||
"unsavedChanges": "You have unsaved changes",
|
||||
"editHint": "Switch to edit mode to update profile details",
|
||||
"switchEditHint": "Switch to edit mode to update profile details",
|
||||
|
||||
@@ -4932,7 +4932,9 @@
|
||||
"upload": "อัปโหลดวิดีโอ",
|
||||
"uploading": "กำลังอัปโหลด...",
|
||||
"empty": "ยังไม่มีวิดีโอการฝึกอบรม",
|
||||
"unnamed": "วิดีโอไม่มีชื่อ"
|
||||
"unnamed": "วิดีโอไม่มีชื่อ",
|
||||
"expandAll": "แสดงวิดีโอทั้งหมด ({count})",
|
||||
"collapseList": "ย่อรายการ"
|
||||
},
|
||||
"lean": {
|
||||
"weekKey": "สัปดาห์ภารกิจ (วันจันทร์)",
|
||||
|
||||
@@ -10,8 +10,10 @@
|
||||
"email": "อีเมล",
|
||||
"phoneNumber": "เบอร์โทรศัพท์",
|
||||
"theme": "ธีม",
|
||||
"role": "บทบาท",
|
||||
"roleAdmin": "ผู้ดูแลระบบ",
|
||||
"roleUser": "ผู้ใช้",
|
||||
"saving": "กำลังบันทึก...",
|
||||
"unsavedChanges": "คุณมีการเปลี่ยนแปลงที่ยังไม่ได้บันทึก",
|
||||
"editHint": "สลับไปที่โหมดแก้ไขเพื่ออัปเดตรายละเอียดโปรไฟล์",
|
||||
"switchEditHint": "สลับไปที่โหมดแก้ไขเพื่ออัปเดตรายละเอียดโปรไฟล์",
|
||||
|
||||
@@ -5090,7 +5090,9 @@
|
||||
"upload": "上传视频",
|
||||
"uploading": "上传中...",
|
||||
"empty": "暂未上传培训视频",
|
||||
"unnamed": "未命名视频"
|
||||
"unnamed": "未命名视频",
|
||||
"expandAll": "展开全部视频(共 {count} 个)",
|
||||
"collapseList": "收起列表"
|
||||
},
|
||||
"lean": {
|
||||
"weekKey": "任务周(周一)",
|
||||
|
||||
@@ -10,8 +10,10 @@
|
||||
"email": "邮箱",
|
||||
"phoneNumber": "手机号",
|
||||
"theme": "主题",
|
||||
"role": "角色",
|
||||
"roleAdmin": "管理员",
|
||||
"roleUser": "普通用户",
|
||||
"saving": "保存中...",
|
||||
"unsavedChanges": "您有未保存的更改",
|
||||
"editHint": "切换到编辑模式以更新个人资料",
|
||||
"switchEditHint": "切换到编辑模式以更新个人资料",
|
||||
|
||||
@@ -4937,7 +4937,9 @@
|
||||
"upload": "上傳影片",
|
||||
"uploading": "上傳中...",
|
||||
"empty": "尚未上傳培訓影片",
|
||||
"unnamed": "未命名影片"
|
||||
"unnamed": "未命名影片",
|
||||
"expandAll": "展開全部影片(共 {count} 個)",
|
||||
"collapseList": "收合列表"
|
||||
},
|
||||
"lean": {
|
||||
"weekKey": "任務週(週一)",
|
||||
|
||||
@@ -10,8 +10,10 @@
|
||||
"email": "郵箱",
|
||||
"phoneNumber": "手機號",
|
||||
"theme": "主題",
|
||||
"role": "角色",
|
||||
"roleAdmin": "管理員",
|
||||
"roleUser": "用戶",
|
||||
"saving": "儲存中...",
|
||||
"unsavedChanges": "您有尚未保存的變更",
|
||||
"editHint": "切換到編輯模式以更新個人資料",
|
||||
"switchEditHint": "切換到編輯模式以更新個人資料",
|
||||
|
||||
Reference in new issue
Block a user