在需要跳转得页面通过url拼接需要传递得参数
window.location.href = "../html/trainingOrghome.html?" + "accountTypeId="+2+"&openid="+openid+"&nickname="+nickname+"&headimgurl="+headimgurl
跳转后得页面用getQueryString方法获取参数
function getQueryString(name) {
console.log('.......')
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (r != null && r[2] != "false")
return unescape(r[2]);
return false;
}
let openID = getQueryString('openid');
let accountTypeId = getQueryString('accountTypeId');
let nickname = getQueryString('nickname');
let headimgurl = getQueryString('headimgurl');