优化
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<view v-if="user" class="page-shell portal-page scanner-test-page">
|
||||
<PortalHeader title="广播扫码测试" :user="user" />
|
||||
<PortalHeader :title="$t('scanner.title')" :user="user" />
|
||||
<view class="scanner-test-content">
|
||||
<view class="scanner-status" :class="`scanner-status-${status}`" role="status">
|
||||
<view class="scanner-status-dot"></view>
|
||||
@@ -11,19 +11,19 @@
|
||||
</view>
|
||||
|
||||
<view class="scanner-result" :class="{ 'scanner-result-received': lastValue }">
|
||||
<text class="scanner-result-label">最近收到</text>
|
||||
<text class="scanner-result-value">{{ lastValue || '等待扫描' }}</text>
|
||||
<text class="scanner-result-meta">{{ lastValue ? `${lastTime} · 本页第 ${scanCount} 次` : '按下 PDA 硬件扫描键' }}</text>
|
||||
<text class="scanner-result-label">{{ $t('scanner.latest') }}</text>
|
||||
<text class="scanner-result-value">{{ lastValue || $t('scanner.waiting') }}</text>
|
||||
<text class="scanner-result-meta">{{ lastValue ? `${lastTime} · ${$t('scanner.count', { count: scanCount })}` : $t('scanner.hardwareHint') }}</text>
|
||||
</view>
|
||||
|
||||
<view class="scanner-config">
|
||||
<view class="scanner-config-row"><text class="scanner-config-label">Action</text><text class="scanner-config-value">{{ action }}</text></view>
|
||||
<view class="scanner-config-row"><text class="scanner-config-label">Extra 标签</text><text class="scanner-config-value">{{ extra }}</text></view>
|
||||
<view class="scanner-config-row"><text class="scanner-config-label">{{ $t('scanner.extra') }}</text><text class="scanner-config-value">{{ extra }}</text></view>
|
||||
</view>
|
||||
|
||||
<view class="scanner-history-head">
|
||||
<text class="scanner-history-title">接收记录</text>
|
||||
<button class="scanner-clear" :disabled="!history.length" @tap="clearHistory">清空</button>
|
||||
<text class="scanner-history-title">{{ $t('scanner.records') }}</text>
|
||||
<button class="scanner-clear" :disabled="!history.length" @tap="clearHistory">{{ $t('scanner.clear') }}</button>
|
||||
</view>
|
||||
<view v-if="history.length" class="scanner-history">
|
||||
<view v-for="item in history" :key="item.id" class="scanner-history-item">
|
||||
@@ -31,7 +31,7 @@
|
||||
<view class="scanner-history-main"><text class="scanner-history-value">{{ item.value }}</text><text class="scanner-history-time">{{ item.time }}</text></view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else class="scanner-empty"><text>暂无广播数据</text></view>
|
||||
<view v-else class="scanner-empty"><text>{{ $t('scanner.empty') }}</text></view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -57,14 +57,14 @@
|
||||
},
|
||||
computed: {
|
||||
statusTitle() {
|
||||
if (this.status === 'error') return '接收器启动失败'
|
||||
if (this.status === 'unsupported') return '当前环境不支持广播'
|
||||
return this.lastValue ? '已收到扫描广播' : '接收器已启动'
|
||||
if (this.status === 'error') return this.$t('scanner.errorTitle')
|
||||
if (this.status === 'unsupported') return this.$t('scanner.unsupportedTitle')
|
||||
return this.$t(this.lastValue ? 'scanner.receivedTitle' : 'scanner.waitingTitle')
|
||||
},
|
||||
statusDetail() {
|
||||
if (this.status === 'error') return '请检查 PDA 扫描服务设置后重新进入页面'
|
||||
if (this.status === 'unsupported') return '请在 Android App 真机中测试'
|
||||
return this.lastValue ? '继续扫描可验证连续接收' : '正在等待硬件扫描结果'
|
||||
if (this.status === 'error') return this.$t('scanner.errorDetail')
|
||||
if (this.status === 'unsupported') return this.$t('scanner.unsupportedDetail')
|
||||
return this.$t(this.lastValue ? 'scanner.receivedDetail' : 'scanner.waitingDetail')
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
|
||||
Reference in New Issue
Block a user