UNPKG

press-next

Version:

Vue3 组件库,支持 Composition API

38 lines (29 loc) 916 B
import { getGpScheme, DEFAULT_OPEN_LINK, encodeQuery } from './scheme-base'; export function getOpenLink(getUrlPara: ((key: string) => string)) { const { href } = window.location; const isChildPage = href.includes('views/match/single-match-detail'); const isMatchListPage = href.includes('views/match-list/match-list'); const childId = getUrlPara('childId'); const parentId = getUrlPara('parentId'); const siteId = getUrlPara('siteId'); let openLink = DEFAULT_OPEN_LINK; if (isChildPage && siteId && childId && parentId) { openLink = getGpScheme({ query: encodeQuery({ childId, siteId, parentId, }), path: 'views/match/single-match-detail', }); } if (isMatchListPage && siteId) { openLink = getGpScheme({ query: encodeQuery({ siteId, }), path: 'views/match-list/match-list', }); } return openLink; }