fix: 修改index数据来源
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 44s

This commit is contained in:
sexygoat
2026-04-14 10:50:48 +08:00
parent 1a407924de
commit 5fa2b6dacf
4 changed files with 108 additions and 56 deletions

View File

@@ -35,7 +35,7 @@
<script setup>
import { reactive, ref, onMounted } from 'vue';
import { deviceApi, assetApi } from '@/api/index.js';
import { deviceApi } from '@/api/index.js';
import { useUserStore } from '@/store/index.js';
const userStore = useUserStore();
@@ -56,11 +56,15 @@
const loadCards = async () => {
try {
const data = await assetApi.getInfo(userStore.state.identifier);
const data = await deviceApi.getCards(userStore.state.identifier);
if (data.cards && data.cards.length > 0) {
mchList.splice(0, mchList.length, ...data.cards.map(card => ({
...card,
category: card.carrier_name.includes('电信') ? '124' : card.carrier_name.includes('联通') ? '125' : '126'
iccid: card.iccid,
carrier_name: card.carrier_name,
is_current: card.is_active,
real_name_status: card.real_name_status,
slot_position: card.slot_position,
category: getCarrierCategory(card.carrier_name)
})));
}
} catch (e) {
@@ -68,6 +72,14 @@
}
};
const getCarrierCategory = (carrierName) => {
if (!carrierName) return '126';
if (carrierName.includes('电信')) return '124';
if (carrierName.includes('联通')) return '125';
if (carrierName.includes('移动')) return '126';
return '126';
};
const switchOperator = async (item) => {
switching.value = true;
try {