From 099b710eb1b427c28bfa97ff85d3108a3f8a717c Mon Sep 17 00:00:00 2001 From: MaysWind Date: Fri, 23 Jun 2023 14:16:37 +0800 Subject: [PATCH] code refactor --- src/consts/icon.js | 21 +-------------------- src/views/mobile/users/SessionListPage.vue | 12 ++++++------ 2 files changed, 7 insertions(+), 26 deletions(-) diff --git a/src/consts/icon.js b/src/consts/icon.js index 82213601..56869839 100644 --- a/src/consts/icon.js +++ b/src/consts/icon.js @@ -830,30 +830,11 @@ const allCategoryIcons = { } }; -const deviceIcons = { - mobile: { - f7Icon: 'device_phone_portrait' - }, - tablet: { - f7Icon: 'device_tablet_portrait' - }, - wearable: { - f7Icon: 'device_phone_portrait' - }, - desktop: { - f7Icon: 'device_desktop' - }, - tv: { - f7Icon: 'tv' - } -}; - export default { allAccountIcons: allAccountIcons, defaultAccountIconId: defaultAccountIconId, defaultAccountIcon: allAccountIcons[defaultAccountIconId], allCategoryIcons: allCategoryIcons, defaultCategoryIconId: defaultCategoryIconId, - defaultCategoryIcon: allCategoryIcons[defaultCategoryIconId], - deviceIcons: deviceIcons, + defaultCategoryIcon: allCategoryIcons[defaultCategoryIconId] }; diff --git a/src/views/mobile/users/SessionListPage.vue b/src/views/mobile/users/SessionListPage.vue index e058c74f..e6124aa8 100644 --- a/src/views/mobile/users/SessionListPage.vue +++ b/src/views/mobile/users/SessionListPage.vue @@ -196,19 +196,19 @@ export default { const ua = parseUserAgent(token.userAgent); if (!ua || !ua.device) { - return iconConstants.deviceIcons.desktop.f7Icon; + return 'device_desktop'; } if (ua.device.type === 'mobile') { - return iconConstants.deviceIcons.mobile.f7Icon; + return 'device_phone_portrait'; } else if (ua.device.type === 'wearable') { - return iconConstants.deviceIcons.wearable.f7Icon; + return 'device_phone_portrait'; } else if (ua.device.type === 'tablet') { - return iconConstants.deviceIcons.tablet.f7Icon; + return 'device_tablet_portrait'; } else if (ua.device.type === 'smarttv') { - return iconConstants.deviceIcons.tv.f7Icon; + return 'tv'; } else { - return iconConstants.deviceIcons.desktop.f7Icon; + return 'device_desktop'; } }, getTokenDomId(tokenId) {