This commit is contained in:
@@ -76,6 +76,14 @@
|
||||
|
||||
const getSlotIcon = (slotPosition) => slotIconMap[Number(slotPosition)] || slotIconMap[1];
|
||||
|
||||
const sortBySlotPosition = (cards) => cards.sort((left, right) => {
|
||||
const leftSlot = Number(left.slot_position);
|
||||
const rightSlot = Number(right.slot_position);
|
||||
const normalizedLeft = Number.isFinite(leftSlot) && leftSlot > 0 ? leftSlot : Number.MAX_SAFE_INTEGER;
|
||||
const normalizedRight = Number.isFinite(rightSlot) && rightSlot > 0 ? rightSlot : Number.MAX_SAFE_INTEGER;
|
||||
return normalizedLeft - normalizedRight;
|
||||
});
|
||||
|
||||
const copyIccid = (value) => {
|
||||
if (!value) return;
|
||||
uni.setClipboardData({
|
||||
@@ -90,13 +98,14 @@
|
||||
const assetData = await assetApi.getInfo(userStore.state.identifier);
|
||||
|
||||
if (assetData.asset_type === 'device') {
|
||||
list.splice(0, list.length, ...(assetData.cards || []).map(card => ({
|
||||
const cards = (assetData.cards || []).map(card => ({
|
||||
iccid: card.iccid,
|
||||
carrier_type: card.carrier_type,
|
||||
slot_position: card.slot_position,
|
||||
isDevice: true,
|
||||
isRealName: card.real_name_status === 1
|
||||
})));
|
||||
}));
|
||||
list.splice(0, list.length, ...sortBySlotPosition(cards));
|
||||
} else if (assetData.iccid) {
|
||||
list.splice(0, list.length, {
|
||||
iccid: assetData.iccid,
|
||||
|
||||
@@ -89,6 +89,14 @@
|
||||
|
||||
const getSlotIcon = (slotPosition) => slotIconMap[Number(slotPosition)] || slotIconMap[1];
|
||||
|
||||
const sortBySlotPosition = (cards) => cards.sort((left, right) => {
|
||||
const leftSlot = Number(left.slot_position);
|
||||
const rightSlot = Number(right.slot_position);
|
||||
const normalizedLeft = Number.isFinite(leftSlot) && leftSlot > 0 ? leftSlot : Number.MAX_SAFE_INTEGER;
|
||||
const normalizedRight = Number.isFinite(rightSlot) && rightSlot > 0 ? rightSlot : Number.MAX_SAFE_INTEGER;
|
||||
return normalizedLeft - normalizedRight;
|
||||
});
|
||||
|
||||
const copyIccid = (value) => {
|
||||
if (!value) return;
|
||||
uni.setClipboardData({
|
||||
@@ -107,7 +115,7 @@
|
||||
// 是设备,调用设备卡列表接口
|
||||
const data = await deviceApi.getCards(userStore.state.identifier);
|
||||
if (data.cards && data.cards.length > 0) {
|
||||
mchList.splice(0, mchList.length, ...data.cards.map(card => ({
|
||||
const cards = data.cards.map(card => ({
|
||||
iccid: card.iccid,
|
||||
carrier_type: card.carrier_type,
|
||||
carrier_name: card.carrier_name,
|
||||
@@ -115,7 +123,8 @@
|
||||
real_name_status: card.real_name_status,
|
||||
network_status: card.network_status,
|
||||
slot_position: card.slot_position
|
||||
})));
|
||||
}));
|
||||
mchList.splice(0, mchList.length, ...sortBySlotPosition(cards));
|
||||
}
|
||||
} else {
|
||||
// 不是设备(单卡),直接使用 asset info 数据,只有一个卡
|
||||
|
||||
Reference in New Issue
Block a user