rt-sim-training-client/src/jmapNew/utils/handlePath.js
2020-03-11 10:53:09 +08:00

26 lines
853 B
JavaScript

export function getPrdType() {
let prdType = '';
const path = window.location.href;
if (path.includes('?')) {
const arr = window.location.href.split('?')[1].split('&');
arr.forEach(elem => {
if (elem.split('=')[0] === 'prdType') {
prdType = elem.split('=')[1];
}
});
}
return prdType;
}
export function isShowThePrdType (prdType, showConditions) {
if (showConditions === '01' || (showConditions === '02' && prdType === '02') || (showConditions === '03' && prdType === '01')) {
return true;
} else if (!showConditions) {
return true; // 兼容老数据没有showConditions
}
}
export function isPreviewOrMapDraw() {
const path = window.location.href;
return path.indexOf('map/draw') !== -1 || path.indexOf('mapPreviewNew') !== -1;
}