code refactor

This commit is contained in:
MaysWind
2023-06-23 14:16:37 +08:00
parent a5424afc38
commit 099b710eb1
2 changed files with 7 additions and 26 deletions
+1 -20
View File
@@ -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 { export default {
allAccountIcons: allAccountIcons, allAccountIcons: allAccountIcons,
defaultAccountIconId: defaultAccountIconId, defaultAccountIconId: defaultAccountIconId,
defaultAccountIcon: allAccountIcons[defaultAccountIconId], defaultAccountIcon: allAccountIcons[defaultAccountIconId],
allCategoryIcons: allCategoryIcons, allCategoryIcons: allCategoryIcons,
defaultCategoryIconId: defaultCategoryIconId, defaultCategoryIconId: defaultCategoryIconId,
defaultCategoryIcon: allCategoryIcons[defaultCategoryIconId], defaultCategoryIcon: allCategoryIcons[defaultCategoryIconId]
deviceIcons: deviceIcons,
}; };
+6 -6
View File
@@ -196,19 +196,19 @@ export default {
const ua = parseUserAgent(token.userAgent); const ua = parseUserAgent(token.userAgent);
if (!ua || !ua.device) { if (!ua || !ua.device) {
return iconConstants.deviceIcons.desktop.f7Icon; return 'device_desktop';
} }
if (ua.device.type === 'mobile') { if (ua.device.type === 'mobile') {
return iconConstants.deviceIcons.mobile.f7Icon; return 'device_phone_portrait';
} else if (ua.device.type === 'wearable') { } else if (ua.device.type === 'wearable') {
return iconConstants.deviceIcons.wearable.f7Icon; return 'device_phone_portrait';
} else if (ua.device.type === 'tablet') { } else if (ua.device.type === 'tablet') {
return iconConstants.deviceIcons.tablet.f7Icon; return 'device_tablet_portrait';
} else if (ua.device.type === 'smarttv') { } else if (ua.device.type === 'smarttv') {
return iconConstants.deviceIcons.tv.f7Icon; return 'tv';
} else { } else {
return iconConstants.deviceIcons.desktop.f7Icon; return 'device_desktop';
} }
}, },
getTokenDomId(tokenId) { getTokenDomId(tokenId) {