feat: localize notifications and student check-in

This commit is contained in:
biss committed 2026-11-01 20:48:57 +08:00
1 parent a3b4fc86ee
commit cbcd41182c
5 files changed
+130 -128

No files matched your search

+95 -95
View File
@@ -76,15 +76,15 @@ const recipientFilters = reactive({
keyword: '',
})
const categories: Record<string, { label: string; className: string }> = {
General: { label: '一般通知', className: 'general' },
Approval: { label: '审核待办', className: 'approval' },
Schedule: { label: '课程变动', className: 'schedule' },
Grade: { label: '成绩通知', className: 'grade' },
Attendance: { label: '考勤消息', className: 'attendance' },
CourseSelection: { label: '选课消息', className: 'selection' },
Warning: { label: '学业预警', className: 'warning' },
}
const categories = computed<Record<string, { label: string; className: string }>>(() => ({
General: { label: t('notificationBatch.k0'), className: 'general' },
Approval: { label: t('notificationBatch.k1'), className: 'approval' },
Schedule: { label: t('notificationBatch.k2'), className: 'schedule' },
Grade: { label: t('notificationBatch.k3'), className: 'grade' },
Attendance: { label: t('notificationBatch.k4'), className: 'attendance' },
CourseSelection: { label: t('notificationBatch.k5'), className: 'selection' },
Warning: { label: t('notificationBatch.k6'), className: 'warning' },
}))
const selectedTask = computed(() =>
composer.value?.teachingTasks?.find(
@@ -102,15 +102,15 @@ const audienceName = computed(() => {
if (composer.value?.audienceType === 'TeachingTask') {
return selectedTask.value
? `${selectedTask.value.taskNumber} · ${selectedTask.value.courseName}`
: '请选择教学班'
: t('notificationBatch.k7')
}
if (recipientMode.value === 'Filtered') return '当前筛选结果'
if (recipientMode.value === 'Filtered') return t('notificationBatch.k8')
if (recipientMode.value === 'Selected') {
return selectedRecipients.value.length
? `指定的 ${selectedRecipients.value.length} 名收件人`
: '尚未选择收件人'
? t('notificationBatch.k71', { count: selectedRecipients.value.length })
: t('notificationBatch.k9')
}
return composer.value?.audienceName ?? '正在读取发信范围'
return composer.value?.audienceName ?? t('notificationBatch.k10')
})
const visibleClasses = computed(() =>
(composer.value?.administrativeClasses ?? []).filter(
@@ -129,11 +129,11 @@ const editorTextLength = computed(() => {
})
function categoryLabel(value: string) {
return categories[value]?.label ?? '系统消息'
return categories.value[value]?.label ?? t('notificationBatch.k11')
}
function categoryClass(value: string) {
return categories[value]?.className ?? 'general'
return categories.value[value]?.className ?? 'general'
}
async function load(reset = false) {
@@ -300,7 +300,7 @@ function toggleRecipient(recipient: any) {
}
const maximum = composer.value?.maximumSelectedRecipients ?? 500
if (selectedRecipients.value.length >= maximum) {
ElMessage.warning(`单次最多指定 ${maximum} 名收件人`)
ElMessage.warning(t('notificationBatch.k72', { count: maximum }))
return
}
selectedRecipients.value = [...selectedRecipients.value, recipient]
@@ -346,7 +346,7 @@ async function markAllRead() {
notification.isRead = true
})
unreadCount.value = 0
ElMessage.success('全部消息已标为已读')
ElMessage.success(t('notificationBatch.k12'))
} catch (error) {
ElMessage.error(apiErrorMessage(error))
} finally {
@@ -356,31 +356,31 @@ async function markAllRead() {
async function sendMessage() {
if (!messageForm.title.trim()) {
ElMessage.warning('请填写消息标题')
ElMessage.warning(t('notificationBatch.k13'))
return
}
if (!editorTextLength.value) {
ElMessage.warning('请填写消息正文')
ElMessage.warning(t('notificationBatch.k14'))
return
}
if (composer.value?.audienceType === 'TeachingTask' &&
!messageForm.teachingTaskId) {
ElMessage.warning('请选择接收消息的教学班')
ElMessage.warning(t('notificationBatch.k15'))
return
}
if (!recipientCount.value) {
ElMessage.warning('当前范围内没有可接收消息的账号')
ElMessage.warning(t('notificationBatch.k16'))
return
}
try {
await ElMessageBox.confirm(
`消息将发送给“${audienceName.value}”的 ${recipientCount.value} 个账号,发送后不可撤回。`,
'确认发送消息',
t('notificationBatch.k73', { audience: audienceName.value, count: recipientCount.value }),
t('notificationBatch.k17'),
{
type: 'warning',
confirmButtonText: '确认发送',
cancelButtonText: '继续编辑',
confirmButtonText: t('notificationBatch.k18'),
cancelButtonText: t('notificationBatch.k19'),
},
)
sending.value = true
@@ -405,7 +405,7 @@ async function sendMessage() {
? selectedRecipients.value.map(item => item.id)
: [],
})
ElMessage.success(`已发送给 ${data.recipientCount} 个账号`)
ElMessage.success(t('notificationBatch.k74', { count: data.recipientCount }))
messageForm.title = ''
messageForm.content = ''
selectedRecipients.value = []
@@ -426,13 +426,13 @@ onMounted(() => load())
<div class="page-stack message-center">
<section class="page-intro message-intro">
<div>
<span class="section-kicker">消息中心</span>
<h2>消息中心</h2>
<p>系统通知、审核待办、课程变动与成绩消息统一汇总,重要信息不再散落在业务页面。</p>
<span class="section-kicker">{{ t('notificationBatch.k20') }}</span>
<h2>{{ t('notificationBatch.k20') }}</h2>
<p>{{ t('notificationBatch.k21') }}</p>
</div>
<div class="intro-actions">
<div class="unread-summary" :class="{ quiet: !unreadCount }">
<span>未读消息</span>
<span>{{ t('notificationBatch.k22') }}</span>
<b>{{ unreadCount }}</b>
</div>
<el-button
@@ -441,31 +441,31 @@ onMounted(() => load())
:icon="EditPen"
@click="changeTab('compose')"
>
发消息
{{ t('notificationBatch.k23') }}
</el-button>
<el-button
:icon="Check"
:loading="markingAllRead"
:disabled="!unreadCount"
:title="unreadCount ? '将全部未读消息标为已读' : '当前没有未读消息'"
:title="unreadCount ? t('notificationBatch.k24') : t('notificationBatch.k25')"
@click="markAllRead"
>
全部已读
{{ t('notificationBatch.k26') }}
</el-button>
<el-button v-if="activeTab !== 'settings'" :icon="Refresh" @click="activeTab === 'sent' ? loadSent() : load()">
刷新
{{ t('notificationBatch.k27') }}
</el-button>
</div>
</section>
<section class="center-switcher" aria-label="消息中心功能">
<section class="center-switcher" :aria-label="t('notificationBatch.k28')">
<button
type="button"
:class="{ active: activeTab === 'inbox' }"
@click="changeTab('inbox')"
>
<el-icon><Bell /></el-icon>
收件箱
{{ t('notificationBatch.k29') }}
<span v-if="unreadCount">{{ unreadCount }}</span>
</button>
<button
@@ -475,7 +475,7 @@ onMounted(() => load())
@click="changeTab('compose')"
>
<el-icon><Promotion /></el-icon>
发消息
{{ t('notificationBatch.k23') }}
</button>
<button
v-if="canSend"
@@ -484,7 +484,7 @@ onMounted(() => load())
@click="changeTab('sent')"
>
<el-icon><Message /></el-icon>
已发送
{{ t('notificationBatch.k30') }}
</button>
<button
type="button"
@@ -492,7 +492,7 @@ onMounted(() => load())
@click="changeTab('settings')"
>
<el-icon><Setting /></el-icon>
通知设置
{{ t('notificationBatch.k31') }}
</button>
</section>
@@ -515,11 +515,11 @@ onMounted(() => load())
v-model="keyword"
clearable
:prefix-icon="Search"
placeholder="搜索标题或正文"
:placeholder="t('notificationBatch.k32')"
@keyup.enter="load(true)"
@clear="load(true)"
/>
<el-checkbox v-model="unreadOnly" @change="load(true)">仅看未读</el-checkbox>
<el-checkbox v-model="unreadOnly" @change="load(true)">{{ t('notificationBatch.k33') }}</el-checkbox>
</section>
<section v-loading="loading" class="message-list">
@@ -541,8 +541,8 @@ onMounted(() => load())
<header>
<div class="message-labels">
<span class="category-label">{{ categoryLabel(notification.category) }}</span>
<span v-if="notification.isManual" class="manual-label">人工发送</span>
<span v-if="!notification.isRead" class="unread-label">未读</span>
<span v-if="notification.isManual" class="manual-label">{{ t('notificationBatch.k34') }}</span>
<span v-if="!notification.isRead" class="unread-label">{{ t('notificationBatch.k35') }}</span>
</div>
<time>{{ new Date(notification.createdAt).toLocaleString(getDisplayLocale()) }}</time>
</header>
@@ -554,27 +554,27 @@ onMounted(() => load())
/>
</div>
<footer>
<span>来自 {{ notification.senderName }}</span>
<span>{{ t('notificationBatch.k75', { name: notification.senderName }) }}</span>
<span v-if="notification.audienceName">
接收范围:{{ notification.audienceName }}
{{ t('notificationBatch.k76', { audience: notification.audienceName }) }}
</span>
<span v-if="notification.linkUrl" class="open-link">查看详情 →</span>
<span v-if="notification.linkUrl" class="open-link">{{ t('notificationBatch.k36') }}</span>
</footer>
</div>
</article>
<el-empty
v-if="!loading && !notifications.length"
:description="unreadOnly ? '当前筛选范围内没有未读消息' : '当前筛选范围内没有消息'"
:description="unreadOnly ? t('notificationBatch.k37') : t('notificationBatch.k38')"
/>
</section>
<div v-if="inboxCursors.length || inboxHasMore" class="message-pager">
<el-button :disabled="!inboxCursors.length || loading" @click="previousInboxPage">
上一批
{{ t('notificationBatch.k39') }}
</el-button>
<span>第 {{ page }} 批</span>
<span>{{ t('notificationBatch.k77', { page: page }) }}</span>
<el-button type="primary" :disabled="!inboxHasMore || loading" @click="nextInboxPage">
下一批
{{ t('notificationBatch.k40') }}
</el-button>
</div>
</template>
@@ -586,14 +586,14 @@ onMounted(() => load())
>
<header class="compose-overview">
<div>
<span class="panel-kicker">发送范围</span>
<h3>编写并发送消息</h3>
<p>收件范围始终受当前账号的数据权限约束,发送后不可撤回。</p>
<span class="panel-kicker">{{ t('notificationBatch.k41') }}</span>
<h3>{{ t('notificationBatch.k42') }}</h3>
<p>{{ t('notificationBatch.k43') }}</p>
</div>
<div class="delivery-summary">
<span>{{ audienceName }}</span>
<b>{{ recipientCount }}</b>
<small>个接收账号</small>
<small>{{ t('notificationBatch.k44') }}</small>
</div>
</header>
@@ -604,7 +604,7 @@ onMounted(() => load())
<el-icon><User /></el-icon>
<span>01</span>
</div>
<h3>选择收件人</h3>
<h3>{{ t('notificationBatch.k45') }}</h3>
</div>
<template v-if="isAdministratorComposer">
@@ -612,9 +612,9 @@ onMounted(() => load())
:model-value="recipientMode"
class="recipient-mode"
:options="[
{ label: '权限范围群发', value: 'Scope' },
{ label: '按条件群发', value: 'Filtered' },
{ label: '指定收件人', value: 'Selected' },
{ label: t('notificationBatch.k46'), value: 'Scope' },
{ label: t('notificationBatch.k47'), value: 'Filtered' },
{ label: t('notificationBatch.k48'), value: 'Selected' },
]"
@change="changeRecipientMode"
/>
@@ -622,8 +622,8 @@ onMounted(() => load())
<div v-if="recipientMode !== 'Scope'" class="recipient-filter">
<div class="filter-heading">
<el-icon><Filter /></el-icon>
<span>筛选候选账号</span>
<small>共 {{ recipientTotal }} 个匹配账号</small>
<span>{{ t('notificationBatch.k49') }}</span>
<small>{{ t('notificationBatch.k78', { count: recipientTotal }) }}</small>
</div>
<div class="filter-grid">
<el-select
@@ -644,7 +644,7 @@ onMounted(() => load())
<el-select
v-model="recipientFilters.role"
clearable
placeholder="全部身份"
:placeholder="t('notificationBatch.k50')"
@change="loadRecipients(true)"
>
<el-option
@@ -665,14 +665,14 @@ onMounted(() => load())
v-for="item in visibleClasses"
:key="item.id"
:value="item.id"
:label="`${item.grade}级 · ${item.name}`"
:label="t('notificationBatch.k79', { year: item.grade, name: item.name })"
/>
</el-select>
<el-select
v-model="recipientFilters.teachingTaskId"
clearable
filterable
placeholder="全部教学班"
:placeholder="t('notificationBatch.k51')"
@change="loadRecipients(true)"
>
<el-option
@@ -686,12 +686,12 @@ onMounted(() => load())
v-model="recipientFilters.keyword"
clearable
:prefix-icon="Search"
placeholder="姓名、学号、工号或账号"
:placeholder="t('notificationBatch.k52')"
@keyup.enter="loadRecipients(true)"
@clear="loadRecipients(true)"
/>
<el-button :icon="Search" @click="loadRecipients(true)">
查询
{{ t('notificationBatch.k53') }}
</el-button>
</div>
</div>
@@ -699,7 +699,7 @@ onMounted(() => load())
<div v-if="recipientMode === 'Scope'" class="scope-notice">
<strong>{{ composer.audienceName }}</strong>
<span>
将覆盖当前权限范围内全部已启用账号;如无需群发,请切换到条件筛选或指定收件人。
{{ t('notificationBatch.k54') }}
</span>
</div>
@@ -731,20 +731,20 @@ onMounted(() => load())
</small>
</span>
<span class="recipient-meta">
{{ recipient.collegeName || '校级账号' }}
{{ recipient.collegeName || t('notificationBatch.k55') }}
</span>
<span v-if="recipientMode === 'Selected'" class="recipient-check">
{{ isRecipientSelected(recipient) ? '已选择' : '选择' }}
{{ isRecipientSelected(recipient) ? t('notificationBatch.k56') : t('notificationBatch.k57') }}
</span>
</button>
<el-empty
v-if="!recipientLoading && !recipientItems.length"
description="没有符合条件的可用账号"
:description="t('notificationBatch.k58')"
/>
</div>
<div v-if="recipientCursors.length || recipientHasMore" class="cursor-pager">
<el-button size="small" :disabled="!recipientCursors.length || recipientLoading" @click="previousRecipientPage">{{ t('businessLabels.previous') }}</el-button>
<span>第 {{ recipientPage }} 批</span>
<span>{{ t('notificationBatch.k77', { page: recipientPage }) }}</span>
<el-button size="small" type="primary" :disabled="!recipientHasMore || recipientLoading" @click="nextRecipientPage">{{ t('businessLabels.next') }}</el-button>
</div>
</div>
@@ -754,8 +754,8 @@ onMounted(() => load())
class="selected-recipient-strip"
>
<header>
<b>已选 {{ selectedRecipients.length }} 人</b>
<button type="button" @click="selectedRecipients = []">清空</button>
<b>{{ t('notificationBatch.k80', { count: selectedRecipients.length }) }}</b>
<button type="button" @click="selectedRecipients = []">{{ t('notificationBatch.k59') }}</button>
</header>
<div>
<span
@@ -765,14 +765,14 @@ onMounted(() => load())
{{ recipient.displayName }}
<button
type="button"
:aria-label="`移除 ${recipient.displayName}`"
:aria-label="t('notificationBatch.k81', { name: recipient.displayName })"
@click="removeSelectedRecipient(recipient.id)"
>
×
</button>
</span>
<small v-if="selectedRecipients.length > 12">
另有 {{ selectedRecipients.length - 12 }} 人
{{ t('notificationBatch.k82', { count: selectedRecipients.length - 12 }) }}
</small>
</div>
</div>
@@ -780,28 +780,28 @@ onMounted(() => load())
<el-form-item
v-else
label="接收教学班"
:label="t('notificationBatch.k60')"
required
>
<el-select
v-model="messageForm.teachingTaskId"
filterable
placeholder="选择本人任教的教学班"
:placeholder="t('notificationBatch.k61')"
>
<el-option
v-for="task in composer?.teachingTasks ?? []"
:key="task.id"
:value="task.id"
:label="`${task.taskNumber} · ${task.courseName}(${task.recipientCount} 人)`"
:label="`${task.taskNumber} · ${task.courseName} (${t('notificationBatch.k83', { count: task.recipientCount })})`"
>
<div class="task-option">
<span>{{ task.taskNumber }} · {{ task.courseName }}</span>
<small>{{ task.termName }} · {{ task.recipientCount }} 人</small>
<small>{{ task.termName }} · {{ t('notificationBatch.k83', { count: task.recipientCount }) }}</small>
</div>
</el-option>
</el-select>
<small class="field-help">
任课教师只能向本人所带教学班的有效学生账号发送消息。
{{ t('notificationBatch.k62') }}
</small>
</el-form-item>
</section>
@@ -812,40 +812,40 @@ onMounted(() => load())
<el-icon><EditPen /></el-icon>
<span>02</span>
</div>
<h3>编辑消息内容</h3>
<h3>{{ t('notificationBatch.k63') }}</h3>
</div>
<div class="compose-heading">
<div>
<span>普通通知</span>
<small>成绩、选课等业务通知仍由对应流程自动发送</small>
<span>{{ t('notificationBatch.k64') }}</span>
<small>{{ t('notificationBatch.k65') }}</small>
</div>
</div>
<el-form-item label="消息标题" required>
<el-form-item :label="t('notificationBatch.k66')" required>
<el-input
v-model="messageForm.title"
maxlength="200"
show-word-limit
placeholder="用一句话说明需要关注的事项"
:placeholder="t('notificationBatch.k67')"
/>
</el-form-item>
<el-form-item label="消息正文" required class="editor-form-item">
<el-form-item :label="t('notificationBatch.k68')" required class="editor-form-item">
<NotificationRichTextEditor
v-model="messageForm.content"
/>
<div class="editor-footnote">
<span>支持表格、超链接和外链图片;图片请填写 HTTPS 地址,不上传本地文件。</span>
<span>{{ t('notificationBatch.k69') }}</span>
<b :class="{ warning: messageForm.content.length > 18000 }">
{{ editorTextLength }} 字 · 源码 {{ messageForm.content.length }}/20000
{{ t('notificationBatch.k84', { chars: editorTextLength, length: messageForm.content.length }) }}
</b>
</div>
</el-form-item>
<div class="compose-actions">
<span>
将发送给 <b>{{ recipientCount }}</b> 个账号
{{ t('notificationBatch.k85', { count: recipientCount }) }}
<small>{{ audienceName }}</small>
</span>
<el-button
@@ -854,7 +854,7 @@ onMounted(() => load())
:loading="sending"
@click="sendMessage"
>
确认发送
{{ t('notificationBatch.k18') }}
</el-button>
</div>
</el-form>
@@ -874,19 +874,19 @@ onMounted(() => load())
<RichMessageContent :content="item.content" rich />
<footer>
<span>{{ item.audienceName }}</span>
<b>{{ item.recipientCount }} 个接收账号</b>
<b>{{ t('notificationBatch.k86', { count: item.recipientCount }) }}</b>
</footer>
</article>
<el-empty v-if="!loading && !sentMessages.length" description="还没有发送记录" />
<el-empty v-if="!loading && !sentMessages.length" :description="t('notificationBatch.k70')" />
</section>
<div v-if="sentCursors.length || sentHasMore" class="message-pager">
<el-button :disabled="!sentCursors.length || loading" @click="previousSentPage">
上一批
{{ t('notificationBatch.k39') }}
</el-button>
<span>第 {{ sentPage }} 批</span>
<span>{{ t('notificationBatch.k77', { page: sentPage }) }}</span>
<el-button type="primary" :disabled="!sentHasMore || loading" @click="nextSentPage">
下一批
{{ t('notificationBatch.k40') }}
</el-button>
</div>
</template>
+30 -32
View File
@@ -32,15 +32,15 @@ const appealDialog = ref(false)
const appealTarget = ref<any>(null)
const appealReason = ref('')
const statusLabels: Record<string, string> = {
Present: '出勤', Absent: '缺勤', Late: '迟到', Leave: '请假', Excused: '免修',
}
const statusLabels = computed<Record<string, string>>(() => ({
Present: t('businessLabels.present'), Absent: t('businessLabels.absent'), Late: t('businessLabels.late'), Leave: t('businessLabels.leave'), Excused: t('attendanceBatch.k11'),
}))
const statusColors: Record<string, 'success' | 'danger' | 'warning' | 'info' | undefined> = {
Present: 'success', Absent: 'danger', Late: 'warning', Leave: 'info', Excused: undefined,
}
const appealStatusLabels: Record<string, string> = {
None: '', Pending: '申诉中', Approved: '已通过', Rejected: '已驳回',
}
const appealStatusLabels = computed<Record<string, string>>(() => ({
None: '', Pending: t('studentAttendanceExtra.k0'), Approved: t('studentAttendanceExtra.k1'), Rejected: t('studentAttendanceExtra.k2'),
}))
function getOrCreateAttendanceDeviceId() {
const storageKey = 'jiaowu_attendance_device_id'
@@ -171,12 +171,12 @@ async function scanCheckInCode() {
try {
const result = await CapacitorBarcodeScanner.scanBarcode({
hint: CapacitorBarcodeScannerTypeHint.QR_CODE,
scanInstructions: '请扫描教师展示的课堂签到二维码',
scanInstructions: t('studentAttendanceExtra.k3'),
cameraDirection: CapacitorBarcodeScannerCameraDirection.BACK,
scanOrientation: CapacitorBarcodeScannerScanOrientation.ADAPTIVE,
cancelButtonAccessibilityLabel: '取消扫码',
torchButtonOnAccessibilityLabel: '关闭手电筒',
torchButtonOffAccessibilityLabel: '打开手电筒',
cancelButtonAccessibilityLabel: t('studentAttendanceExtra.k4'),
torchButtonOnAccessibilityLabel: t('studentAttendanceExtra.k5'),
torchButtonOffAccessibilityLabel: t('studentAttendanceExtra.k6'),
})
const token = extractCheckInToken(result.ScanResult)
if (!token) {
@@ -211,10 +211,10 @@ function formatServerTime(value: string) {
function remainingLabel(activity: any) {
if (!activity?.checkInEndsAt) return ''
const remaining = serverUtcTime(activity.checkInEndsAt) - now.value
if (remaining <= 0) return '签到已结束'
if (remaining <= 0) return t('studentAttendanceExtra.k7')
const minutes = Math.floor(remaining / 60000)
const seconds = Math.floor((remaining % 60000) / 1000)
return `${minutes}分${String(seconds).padStart(2, '0')}秒后结束`
return t('studentAttendanceExtra.k8', { minutes, seconds: String(seconds).padStart(2, '0') })
}
async function confirmQrCheckIn() {
@@ -226,7 +226,7 @@ async function confirmQrCheckIn() {
token,
...deviceAuditPayload(),
})
ElMessage.success(data.alreadyCheckedIn ? '你已完成本次签到' : '签到成功')
ElMessage.success(data.alreadyCheckedIn ? t('studentAttendanceExtra.k9') : t('studentAttendanceExtra.k10'))
await router.replace({ path: route.path, query: {} })
await load()
} catch (error) {
@@ -273,20 +273,18 @@ async function locationCheckIn(activity: any) {
...deviceAuditPayload(),
})
ElMessage.success(data.alreadyCheckedIn
? '你已完成本次签到'
: `签到成功${data.checkInDistanceMeters === null
? ''
: `,距签到点约 ${Math.round(data.checkInDistanceMeters)} 米`}`)
? t('studentAttendanceExtra.k9')
: data.checkInDistanceMeters == null ? t('studentAttendanceExtra.k10') : t('studentAttendanceExtra.k11', { distance: Math.round(data.checkInDistanceMeters) }))
await load()
} catch (error: any) {
if (!error?.response) {
const message = error?.code === 1
? isNativeApp
? '定位权限被拒绝,请在系统设置中允许本应用获取精确位置。'
: '定位权限被拒绝,请在浏览器中允许本网站获取位置。'
? t('studentAttendanceExtra.k12')
: t('studentAttendanceExtra.k13')
: error?.code === 3
? '获取位置超时,请移到信号较好的位置后重试。'
: '无法获取当前位置,请检查手机定位服务后重试。'
? t('studentAttendanceExtra.k14')
: t('studentAttendanceExtra.k15')
ElMessage.error(message)
} else {
ElMessage.error(apiErrorMessage(error))
@@ -320,7 +318,7 @@ function canAppeal(record: any) {
}
function formatRate(value: number | null) {
return value === null ? '暂无' : `${value.toFixed(1)}%`
return value === null ? t('studentAttendanceExtra.k16') : `${value.toFixed(1)}%`
}
function rateTone(value: number | null) {
@@ -333,7 +331,7 @@ function rateTone(value: number | null) {
function recordDate(value: string) {
const date = new Date(value)
return {
month: `${date.getMonth() + 1}月`,
month: new Intl.DateTimeFormat(getDisplayLocale(), { month: 'short' }).format(date),
day: String(date.getDate()).padStart(2, '0'),
}
}
@@ -385,13 +383,13 @@ onUnmounted(() => {
<div class="ticket-course">
<span>{{ scannedActivity.courseCode }} · {{ scannedActivity.taskNumber }}</span>
<strong>{{ scannedActivity.courseName }}</strong>
<p>{{ scannedActivity.sheetName }} · 扫码签到</p>
<p>{{ scannedActivity.sheetName }} · {{ t('studentAttendanceExtra.k17') }}</p>
</div>
<div class="ticket-time">
<Clock />
<b>{{ remainingLabel(scannedActivity) }}</b>
<small v-if="scannedActivity.checkInAt">
已于 {{ formatServerTime(scannedActivity.checkInAt) }} 签到
{{ t('studentAttendanceExtra.k18', { time: formatServerTime(scannedActivity.checkInAt) }) }}
</small>
<small v-else>{{ t('attendanceBatch.k5') }}</small>
</div>
@@ -401,7 +399,7 @@ onUnmounted(() => {
:disabled="!scannedActivity.isOpen || Boolean(scannedActivity.checkInAt)"
:loading="checkInTargetId === scannedActivity.sheetId"
@click="confirmQrCheckIn"
>{{ scannedActivity.checkInAt ? '已签到' : scannedActivity.isOpen ? '确认签到' : '签到已结束' }}</el-button>
>{{ scannedActivity.checkInAt ? t('studentAttendanceExtra.k19') : scannedActivity.isOpen ? t('studentAttendanceExtra.k20') : t('studentAttendanceExtra.k7') }}</el-button>
</article>
<div v-if="openActivities.length" class="location-list">
@@ -410,12 +408,12 @@ onUnmounted(() => {
<div>
<span>{{ activity.courseCode }} · {{ activity.taskNumber }}</span>
<strong>{{ activity.courseName }}</strong>
<p>{{ activity.sheetName }} · {{ activity.locationRadiusMeters }} 米范围内</p>
<p>{{ activity.sheetName }} · {{ t('studentAttendanceExtra.k21', { radius: activity.locationRadiusMeters }) }}</p>
</div>
<div class="location-clock">
<b>{{ remainingLabel(activity) }}</b>
<small v-if="activity.checkInAt">
已于 {{ formatServerTime(activity.checkInAt) }} 签到
{{ t('studentAttendanceExtra.k18', { time: formatServerTime(activity.checkInAt) }) }}
</small>
<small v-else>{{ t('attendanceBatch.k6') }}</small>
</div>
@@ -425,7 +423,7 @@ onUnmounted(() => {
:disabled="Boolean(activity.checkInAt)"
:loading="checkInTargetId === activity.sheetId"
@click="locationCheckIn(activity)"
>{{ activity.checkInAt ? '已签到' : '定位并签到' }}</el-button>
>{{ activity.checkInAt ? t('studentAttendanceExtra.k19') : t('studentAttendanceExtra.k22') }}</el-button>
</article>
</div>
</section>
@@ -435,7 +433,7 @@ onUnmounted(() => {
<strong>{{ t('attendanceBatch.k7') }}</strong>
<span>{{ t('attendanceBatch.k8') }}</span>
</div>
<span>{{ courseGroups.length }} 门课程 · {{ records.length }} 次点名</span>
<span>{{ t('studentAttendanceExtra.k23', { courses: courseGroups.length, sessions: records.length }) }}</span>
</section>
<section v-loading="loading" class="course-archive">
@@ -444,12 +442,12 @@ onUnmounted(() => {
<div class="course-identity">
<span>{{ course.courseCode }} · {{ course.taskNumber }}</span>
<h3>{{ course.courseName }}</h3>
<small>{{ course.teacherNames.join('、') || '任课教师未登记' }}</small>
<small>{{ course.teacherNames.join(t('academicPlanning.separator')) || t('studentAttendanceExtra.k24') }}</small>
</div>
<div class="course-rate" :class="rateTone(course.attendanceRate)">
<span>{{ t('attendanceBatch.k9') }}</span>
<strong>{{ formatRate(course.attendanceRate) }}</strong>
<small>{{ course.attendedCount }} / {{ course.requiredCount }} 次到课</small>
<small>{{ t('studentAttendanceExtra.k25', { attended: course.attendedCount, required: course.requiredCount }) }}</small>
</div>
</header>