diff --git a/components/DeviceStatusCard.vue b/components/DeviceStatusCard.vue index 287a12a..0e5624e 100644 --- a/components/DeviceStatusCard.vue +++ b/components/DeviceStatusCard.vue @@ -2,7 +2,7 @@ 设备信息 - {{ getOperator(deviceInfo.currentIccid) }} + {{ deviceInfo.carrier_name || '-' }} @@ -54,10 +54,6 @@ defineEmits(['authentication']); - const getOperator = (iccid) => { - return '中国电信'; - }; - const getSignalText = (rssi) => rssi || '强'; const statusText = computed(() => { diff --git a/pages/index/index.vue b/pages/index/index.vue index 5af4918..16e8e2f 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -229,9 +229,9 @@ // 流量信息已由 TrafficCard 组件独立获取,这里不再处理 // 当前卡信息 + let currentCard = null; if (data.cards && data.cards.length > 0) { - // 找到当前卡 - const currentCard = data.cards.find(card => card.is_current) || data.cards[0]; + currentCard = data.cards.find(card => card.is_current) || ''; deviceInfo.currentIccid = currentCard.iccid || '-'; // 卡列表 @@ -245,6 +245,15 @@ deviceInfo.mchList = []; } + // 运营商信息 + const carrierTypeMap = { + CMCC: '中国移动', + CUCC: '中国联通', + CTCC: '中国电信', + CBN: '中国广电' + }; + deviceInfo.carrier_name = (currentCard && carrierTypeMap[currentCard.carrier_type]) || '-'; + // 设备实时信息 if (data.device_realtime) { const rt = data.device_realtime; diff --git a/store/user.js b/store/user.js index e5f8f4a..9ddd223 100644 --- a/store/user.js +++ b/store/user.js @@ -36,7 +36,7 @@ export const useUserStore = () => { }; const setUserInfo = (userInfo) => { - state.userInfo = userInfo; + Object.assign(state.userInfo, userInfo); uni.setStorageSync('userInfo', userInfo); };