var pathArray = window.location.pathname.split('/');
var secondLevelLocation = pathArray[1];
var loginUrl = window.location.protocol + "//" + window.location.host + "/"+ secondLevelLocation;
转载于:https://www.cnblogs.com/itniwota/p/8075296.html