UNPKG

press-next

Version:

Vue3 组件库,支持 Composition API

48 lines (40 loc) 1.54 kB
import { getLabelSymbol, getLabelName } from '../common/gp-match/label/label'; import { getRewardList } from '../common/gp-match/reward/game-reward'; // const getChildMatchType = (childInfo: Record<string, any>) => { // if (childInfo?.match_rule_cfg?.pubg_rule_cfg) { // const func = childInfo?.match_rule_cfg.pubg_rule_cfg.join_func; // if (func == 1) { // return '团体赛'; // } if (func == 2) { // return '个人赛'; // } // } // return ''; // }; const getTagList = (childInfo: Record<string, any>) => { // const matchTypeDesc = getChildMatchType(childInfo); const joinNum = childInfo.join_num || 0; const isMobileJoin = !childInfo.match_rule_cfg?.pubg_rule_cfg?.device_cfg; return [ // matchTypeDesc, joinNum ? `报名人数 ${joinNum}` : '', isMobileJoin ? '手机参赛' : '', ].filter(Boolean); }; export function parseMatchItem(item: Record<string, any> = {}, siteInfo: Record<string, any> = {}) { const childInfo = item.child_info || {}; const labelName = getLabelName(item); const labelSymbol = getLabelSymbol(labelName) || 'isLabelUnknown'; const normalTagList = getTagList(childInfo); const prizeList = getRewardList(childInfo.general_reward_desc || ''); return { ...item, labelName, [labelSymbol]: true, normalTagList, prizeList, childPic: childInfo.logo_pic || siteInfo?.mobile_pic_url_array || '', childName: childInfo.child_name || '', isMobileJoin: !childInfo.match_rule_cfg?.pubg_rule_cfg?.device_cfg, }; }