//js 获取项目的 ip 和端口号,结果类似:http://localhost:8082
var cur = window.document.location.href;
var pathname = window.document.location.pathname;
var pos = cur.indexOf( pathname );
var localhostPath = cur.substring( 0, pos );
console.log( localhostPath );