mobileclient/packkey/libs.js

35 lines
933 B
JavaScript

/**
* 结算 埋点方法
* @param {string} key
* @param {number} settlementType
*/
const settlementFun = (token, settlementType) => {
let obj_yz_data = JSON.parse(sessionStorage.getItem("bm_auth"));
if (obj_yz_data && obj_yz_data.settlement_data.is_settlement) {
return;
}
let params = {
token,
type: settlementType
};
req.axiosPost("/key/settlement/create", params).then((res) => {
console.log("点 =>", res);
if (res.code === 200) {
// 接口请求成功后,就不能再请求接口了
let obj_sy = JSON.parse(sessionStorage.getItem("bm_auth"));
obj_sy.settlement_data.is_settlement = true;
sessionStorage.setItem("bm_auth", JSON.stringify(obj_sy));
}
});
};
// 兼容IOS 返回
const locationReplace = (url) => {
if (history.replaceState) {
history.replaceState(null, document.title, url);
history.go(0);
} else {
location.replace(url);
}
};