shangfutong-ui/jeepay-ui-uapp-cashier/index.js

22 lines
1.1 KiB
JavaScript

console.log(window.location,'windowlocationwindowlocation')
console.log(window.location.pathname.split('/pages/hub/'),'46541651651651615')
let pathname = window.location.pathname.split('/pages/hub/').slice(-1)[0]
let pathnameList = pathname.split("/")
let pathnameString = window.location.pathname
console.log(pathnameList[1],'pathnameString')
if (pathnameList.length >= 2) {
let parameterToRemove = pathnameList[1]
pathnameString = pathnameString.replace(parameterToRemove, "");
}
console.log(pathnameString,'pathnameStringpathnameString')
// 支持多服务商码牌地址
if(/^\/cashier\/(.+)\/pages\/hub\/(default|h5|lite)\/$\//.test(window.location.pathname)){
console.log(pathnameList,'windowlocationwindowlocation')
window.location.href= '/cashier/pages/hub/' + pathnameList[0] + window.location.search
}
if(/\/pages\/hub\/(default|h5|lite)\/$/.test(pathnameString)){
console.log(pathnameList,'windowlocationwindowlocation')
window.location.href= '/cashier/pages/hub/' + pathnameList[0] + window.location.search
}