26 lines
988 B
JavaScript
26 lines
988 B
JavaScript
const url = "https://epp.only4.work/access/wechat/getUnlimitedQRCode";
|
|
const page = "pages/index/index"; // "pages/scan/entrance";
|
|
const envVersion = "develop"; // 正式版为 "release",体验版为 "trial",开发版为 "develop"
|
|
const autoColor = true;
|
|
const isHyaline = false;
|
|
const width = 500;
|
|
|
|
const image = document.getElementById('qrcode');
|
|
const refreshTimeCountDown = document.getElementById('refreshTimeCountDown');
|
|
|
|
let i = 0, refreshTime = 10 + 1;
|
|
function updateQRCode() {
|
|
if (i % refreshTime == 0) {
|
|
let scene = encodeURIComponent(`guard&${Date.now()}`);
|
|
image.src = `${url}?page=${page}&scene=${scene}&envVersion=${envVersion}&width=${width}&autoColor=${autoColor}&isHyaline=${isHyaline}`;
|
|
console.log(image.src);
|
|
refreshTimeCountDown.innerHTML = ` `
|
|
} else {
|
|
refreshTimeCountDown.textContent = `${refreshTime - i}秒后刷新`
|
|
}
|
|
i = i % refreshTime + 1;
|
|
}
|
|
|
|
updateQRCode();
|
|
setInterval(updateQRCode, 1000);
|