fix:单卡设备显示字段
Some checks failed
构建并部署前端到生产环境 / build-and-deploy (push) Has been cancelled

This commit is contained in:
sexygoat
2026-05-21 14:44:10 +08:00
parent dcc8c0ccd6
commit f9fead83cf
2 changed files with 13 additions and 6 deletions

View File

@@ -216,6 +216,12 @@
return dateStr.split('T')[0] || '-'; return dateStr.split('T')[0] || '-';
}; };
const resolveCurrentCard = (cards = []) => {
if (cards.length === 1) return cards[0];
if (cards.length > 1) return cards.find(card => card.is_current) || null;
return null;
};
const loadAssetInfo = async () => { const loadAssetInfo = async () => {
const identifier = userStore.state.identifier; const identifier = userStore.state.identifier;
if (!identifier) return; if (!identifier) return;
@@ -236,20 +242,21 @@
deviceInfo.expireDate = formatDate(data.current_package_expires_at); deviceInfo.expireDate = formatDate(data.current_package_expires_at);
deviceInfo.iccid = data.iccid || '-'; deviceInfo.iccid = data.iccid || '-';
deviceInfo.walletBalance = data.wallet_balance ?? 0; deviceInfo.walletBalance = data.wallet_balance ?? 0;
isRealName.value = data.real_name_status === 1; const currentCard = resolveCurrentCard(data.cards || []);
realNameStatus.value = data.real_name_status === 1 ? '已实名' : '未实名'; const realNameStatusCode = currentCard?.real_name_status ?? data.real_name_status;
isRealName.value = realNameStatusCode === 1;
realNameStatus.value = realNameStatusCode === 1 ? '已实名' : '未实名';
boundPhone.value = data.bound_phone || ''; boundPhone.value = data.bound_phone || '';
alreadyBindPhone.value = !!data.bound_phone; alreadyBindPhone.value = !!data.bound_phone;
// 流量信息已由 TrafficCard 组件独立获取,这里不再处理 // 流量信息已由 TrafficCard 组件独立获取,这里不再处理
// 当前卡信息 // 当前卡信息
let currentCard = null;
if (data.cards && data.cards.length > 0) { if (data.cards && data.cards.length > 0) {
currentCard = data.cards.find(card => card.is_current) || ''; deviceInfo.currentIccid = currentCard?.iccid || '-';
deviceInfo.currentIccid = currentCard.iccid || '-';
// 卡列表 // 卡列表
deviceInfo.mchList = data.cards.map(card => ({
deviceInfo.mchList = data.cards.map(card => ({ deviceInfo.mchList = data.cards.map(card => ({
iccidMark: card.iccid || '-', iccidMark: card.iccid || '-',
category: card.slot_position, category: card.slot_position,

View File

@@ -1,3 +1,3 @@
export const BASE_URL = 'https://cmp-api.boss160.cn'; export const BASE_URL = 'https://cmp-api.xm-iot.cn';
export const APP_TYPE = 'official_account'; export const APP_TYPE = 'official_account';