Files
device-voice-h5/components/DeviceStatusCard.vue
2026-04-11 14:42:14 +08:00

77 lines
2.3 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view class="card device-status-card">
<view class="card-header mb-md flex-row-sb">
<view class="title">设备信息</view>
<view class="tag-apple tag-success">{{ getOperator(deviceInfo.currentIccid) }}</view>
</view>
<view class="device-info flex-col-g16">
<view class="info-row flex-row-sb">
<view class="info-label">
<view class="subtitle">当前卡: {{ deviceInfo.currentIccid }}</view>
</view>
<view class="info-values flex-row-g20" @tap="$emit('authentication')">
<view class="tag-apple" :class="isRealName ? 'tag-success' : 'tag-warning'">
{{ isRealName ? "已实名" : "未实名" }}
</view>
</view>
</view>
<view class="info-row flex-row-sb">
<view class="info-label">
<view class="subtitle">到期时间{{ deviceInfo.expireDate }}</view>
</view>
<view class="info-values flex-row-g20">
<view class="tag-apple tag-primary">{{ deviceInfo.statusStr }}</view>
</view>
</view>
</view>
<view class="device-metrics flex-row-sb mt-md">
<view class="metric-item flex-col-center">
<view class="caption mb-xs">信号强度</view>
<view class="metric-value">{{ getSignalText(deviceInfo.rssi) }}</view>
</view>
<view class="metric-item flex-col-center">
<view class="caption mb-xs">设备电量</view>
<view class="metric-value">{{ deviceInfo.battery }} %</view>
</view>
<view class="metric-item flex-col-center">
<view class="caption mb-xs">连接数量</view>
<view class="metric-value">{{ deviceInfo.connCnt }} </view>
</view>
</view>
</view>
</template>
<script setup>
defineProps({
deviceInfo: { type: Object, default: () => ({}) },
isRealName: { type: Boolean, default: false },
opratorList: { type: Array, default: () => [] }
});
defineEmits(['authentication']);
const getOperator = (iccid) => {
return '中国电信';
};
const getSignalText = (rssi) => rssi || '强';
</script>
<style scoped lang="scss">
.device-status-card {
.info-row {
padding: var(--space-sm) 0;
border-bottom: 1rpx solid var(--gray-200);
&:last-child { border-bottom: none; }
.info-label { min-width: 200rpx; }
.info-values { flex: 1; justify-content: flex-end; }
}
.device-metrics {
background: var(--gray-100);
border-radius: var(--radius-small);
padding: 20rpx;
.metric-item { flex: 1; }
}
}
</style>