feat: 原神抽卡优化了卡池排序策略

release/desktop
moonrailgun 3 years ago
parent eae93144ae
commit fa701a845a

@ -1,14 +1,27 @@
import React from 'react';
import { Translate } from '../translate';
import { util } from 'genshin-gacha-kit';
import { OfficialGachaIndex, OfficialGachaType, util } from 'genshin-gacha-kit';
import { useAsync } from '@capital/common';
import { PillTabs, PillTabPane } from '@capital/component';
import './index.less';
import { GachaPool } from './GachaPool';
import _groupBy from 'lodash/groupBy';
import './index.less';
const GenshinPanel: React.FC = React.memo(() => {
const { value: gachaList } = useAsync(() => {
return util.getGachaIndex();
const { value: gachaList } = useAsync(async () => {
const gacha = await util.getGachaIndex();
const dict = _groupBy(gacha, 'gacha_type') as unknown as Record<
keyof OfficialGachaType,
OfficialGachaIndex[]
>;
// 顺序: 角色 -> 武器 -> 常驻 -> 新手
return [
...(dict['301'] ?? []),
...(dict['302'] ?? []),
...(dict['200'] ?? []),
...(dict['100'] ?? []),
];
}, []);
return (

Loading…
Cancel
Save