All checks were successful
Build and Deploy Front / deploy (push) Successful in 4m11s
地图支持全屏漫游、美国邮编港口与中国城市口岸图层;同步入出库扫码与培训手册等改动。 Co-authored-by: Cursor <cursoragent@cursor.com>
305 lines
7.1 KiB
Vue
305 lines
7.1 KiB
Vue
<script lang="ts" setup>
|
|
import { computed } from 'vue'
|
|
import { useTrainingProgress } from './useTrainingProgress'
|
|
import { ROLE_WEEK_FOCUS } from './checklist-items'
|
|
|
|
defineOptions({ name: 'TrainingRolePicker' })
|
|
|
|
const props = withDefaults(
|
|
defineProps<{
|
|
/** 非总览页:只显示当前岗 + 进度 + 快捷切岗 */
|
|
compact?: boolean
|
|
}>(),
|
|
{ compact: false },
|
|
)
|
|
|
|
const { role, roles, roleMeta, percent, doneCount, totalCount } = useTrainingProgress()
|
|
|
|
const weekLabel: Record<string, string> = {
|
|
basics: '物流基础',
|
|
week1: '第1周',
|
|
week2: '第2周',
|
|
week3: '第3周',
|
|
week4: '第4周',
|
|
practice: '练习包',
|
|
exam: '验收',
|
|
}
|
|
|
|
const focusWeeks = computed(() =>
|
|
(ROLE_WEEK_FOCUS[role.value] || []).map((k) => weekLabel[k] || k),
|
|
)
|
|
|
|
function selectRole(key: typeof role.value) {
|
|
role.value = key
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<div class="role-picker" :class="{ 'is-compact': props.compact }">
|
|
<template v-if="props.compact">
|
|
<div class="role-picker__compact">
|
|
<div class="role-picker__compact-left">
|
|
<span class="role-picker__eyebrow">当前岗</span>
|
|
<span class="role-picker__compact-name">{{ roleMeta.label }}</span>
|
|
<span class="role-picker__compact-progress">{{ doneCount }}/{{ totalCount }} · {{ percent }}%</span>
|
|
</div>
|
|
<a-dropdown trigger="click" position="br">
|
|
<a-button size="small">切换岗位</a-button>
|
|
<template #content>
|
|
<a-doption
|
|
v-for="r in roles"
|
|
:key="r.key"
|
|
@click="selectRole(r.key)"
|
|
>
|
|
{{ r.label }}{{ role === r.key ? ' ✓' : '' }}
|
|
</a-doption>
|
|
</template>
|
|
</a-dropdown>
|
|
</div>
|
|
</template>
|
|
|
|
<template v-else>
|
|
<div class="role-picker__top">
|
|
<div class="role-picker__identity">
|
|
<span class="role-picker__eyebrow">岗位轨</span>
|
|
<h3 class="role-picker__title">{{ roleMeta.label }}</h3>
|
|
<p class="role-picker__summary">{{ roleMeta.summary }}</p>
|
|
</div>
|
|
<div class="role-picker__meter" :title="`已完成 ${doneCount} / ${totalCount}`">
|
|
<a-progress
|
|
type="circle"
|
|
:percent="percent"
|
|
:width="52"
|
|
:stroke-width="6"
|
|
:color="'var(--app-primary-color)'"
|
|
track-color="var(--color-fill-3)"
|
|
/>
|
|
<div class="role-picker__meter-text">
|
|
<span class="role-picker__meter-num">{{ doneCount }}/{{ totalCount }}</span>
|
|
<span class="role-picker__meter-hint">本岗进度</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="role-picker__roles" role="radiogroup" aria-label="选择岗位">
|
|
<button
|
|
v-for="r in roles"
|
|
:key="r.key"
|
|
type="button"
|
|
class="role-picker__chip"
|
|
:class="{ 'is-active': role === r.key }"
|
|
:aria-checked="role === r.key"
|
|
role="radio"
|
|
@click="selectRole(r.key)"
|
|
>
|
|
{{ r.label }}
|
|
</button>
|
|
</div>
|
|
|
|
<div v-if="focusWeeks.length" class="role-picker__focus">
|
|
<span class="role-picker__focus-label">建议学习</span>
|
|
<div class="role-picker__focus-tags">
|
|
<span v-for="w in focusWeeks" :key="w" class="role-picker__tag">{{ w }}</span>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</div>
|
|
</template>
|
|
|
|
<style lang="less" scoped>
|
|
.role-picker {
|
|
margin: 0 0 20px;
|
|
padding: 16px 18px;
|
|
background: var(--color-fill-1);
|
|
border: 1px solid var(--color-border-2);
|
|
border-radius: 8px;
|
|
|
|
&.is-compact {
|
|
margin-bottom: 12px;
|
|
padding: 10px 12px;
|
|
}
|
|
}
|
|
|
|
.role-picker__compact {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
gap: 12px;
|
|
}
|
|
|
|
.role-picker__compact-left {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
align-items: baseline;
|
|
gap: 8px;
|
|
min-width: 0;
|
|
}
|
|
|
|
.role-picker__compact-name {
|
|
font-size: 14px;
|
|
font-weight: 600;
|
|
color: var(--color-text-1);
|
|
}
|
|
|
|
.role-picker__compact-progress {
|
|
font-size: 12px;
|
|
color: var(--color-text-3);
|
|
font-variant-numeric: tabular-nums;
|
|
}
|
|
|
|
.role-picker__top {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
gap: 16px;
|
|
}
|
|
|
|
.role-picker__identity {
|
|
min-width: 0;
|
|
flex: 1;
|
|
}
|
|
|
|
.role-picker__eyebrow {
|
|
display: inline-block;
|
|
font-size: 11px;
|
|
font-weight: 500;
|
|
letter-spacing: 0.04em;
|
|
color: var(--color-text-3);
|
|
line-height: 1.2;
|
|
}
|
|
|
|
.role-picker__title {
|
|
margin: 4px 0 0;
|
|
font-size: 16px;
|
|
font-weight: 600;
|
|
line-height: 1.35;
|
|
color: var(--color-text-1);
|
|
}
|
|
|
|
.role-picker__summary {
|
|
margin: 4px 0 0;
|
|
font-size: 12px;
|
|
line-height: 1.5;
|
|
color: var(--color-text-3);
|
|
}
|
|
|
|
.role-picker__meter {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 10px;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.role-picker__meter-text {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 2px;
|
|
}
|
|
|
|
.role-picker__meter-num {
|
|
font-size: 13px;
|
|
font-weight: 600;
|
|
color: var(--color-text-1);
|
|
font-variant-numeric: tabular-nums;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.role-picker__meter-hint {
|
|
font-size: 11px;
|
|
color: var(--color-text-3);
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.role-picker__roles {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
gap: 8px;
|
|
margin-top: 14px;
|
|
}
|
|
|
|
.role-picker__chip {
|
|
height: 32px;
|
|
padding: 0 12px;
|
|
border-radius: 4px;
|
|
border: 1px solid var(--color-border-2);
|
|
background: var(--color-bg-2);
|
|
color: var(--color-text-2);
|
|
font-size: 13px;
|
|
line-height: 30px;
|
|
cursor: pointer;
|
|
transition:
|
|
border-color 0.15s ease,
|
|
background 0.15s ease,
|
|
color 0.15s ease;
|
|
|
|
&:hover {
|
|
border-color: color-mix(in srgb, var(--app-primary-color) 45%, var(--color-border-2));
|
|
color: var(--color-text-1);
|
|
}
|
|
|
|
&.is-active {
|
|
border-color: var(--app-primary-color);
|
|
background: color-mix(in srgb, var(--app-primary-color) 12%, #fff);
|
|
color: var(--app-primary-color);
|
|
font-weight: 600;
|
|
}
|
|
}
|
|
|
|
.role-picker__focus {
|
|
display: flex;
|
|
align-items: flex-start;
|
|
gap: 10px;
|
|
margin-top: 12px;
|
|
padding-top: 12px;
|
|
border-top: 1px dashed var(--color-border-2);
|
|
}
|
|
|
|
.role-picker__focus-label {
|
|
flex-shrink: 0;
|
|
margin-top: 2px;
|
|
font-size: 12px;
|
|
color: var(--color-text-3);
|
|
line-height: 22px;
|
|
}
|
|
|
|
.role-picker__focus-tags {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
gap: 6px;
|
|
min-width: 0;
|
|
}
|
|
|
|
.role-picker__tag {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
height: 22px;
|
|
padding: 0 8px;
|
|
border-radius: 4px;
|
|
background: var(--color-fill-2);
|
|
color: var(--color-text-2);
|
|
font-size: 12px;
|
|
line-height: 22px;
|
|
}
|
|
|
|
@media (max-width: 640px) {
|
|
.role-picker__top {
|
|
align-items: flex-start;
|
|
}
|
|
|
|
.role-picker__meter {
|
|
flex-direction: column;
|
|
align-items: flex-end;
|
|
gap: 4px;
|
|
}
|
|
|
|
.role-picker__meter-text {
|
|
align-items: flex-end;
|
|
}
|
|
|
|
.role-picker__focus {
|
|
flex-direction: column;
|
|
gap: 6px;
|
|
}
|
|
}
|
|
</style>
|