JS实现普通报表缓存上一次浏览器查询参数
// 监测到浏览器页面关闭时将参数栏所有控件当前所选的值保存到localStorage中,将fr_name参数encodeURL后转为Base64编码作为缓存的key值window.onbeforeunload = function() { localStorage.setItem(btoa(encodeURI(fr_name)), _g().getParameterContainer().getSelectValue());};// 页面初始化后,根据key值读取缓存值,若存在则将对应的值赋值给对应的控件setTimeout(function() {var storage = localStorage.getItem(btoa(encodeURI(fr_name)));if (storage) {var storageJson = JSON.parse(storage);for (var key in storageJson) { _g().getParameterContainer().getWidgetByName(key).setValue(storageJson[key]); } };}, 10);
将access_token保存到localStorage中,代码参考上面的即可
FR.ajax({
url: "https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=ID&corpsecret=SECRET",
complete: function(res) {
alert(res.access_token);
}
});