修复门禁端全屏显示的问题
This commit is contained in:
@@ -18,6 +18,27 @@ window.gateList = []
|
||||
// 当前大门
|
||||
window.currentGate = null
|
||||
|
||||
// 获取 Url 参数
|
||||
function getUrlParams() {
|
||||
let params = {}
|
||||
location.search.substring(1).split("&").map(param => {
|
||||
let a = param.indexOf("=")
|
||||
if (a < 0)
|
||||
params[param] = ''
|
||||
else
|
||||
params[param.substring(0, a)] = decodeURIComponent(param.substring(a + 1))
|
||||
})
|
||||
// console.log(params)
|
||||
return params
|
||||
}
|
||||
|
||||
// 获取 url 参数
|
||||
let urlParams = getUrlParams()
|
||||
console.log("urlParams", urlParams)
|
||||
|
||||
// 是否在 electron 中
|
||||
const inElectron = urlParams['inElectron']
|
||||
|
||||
// 点击全屏
|
||||
document.getElementById("fullscreen-button").addEventListener("click", function () {
|
||||
if (document.fullscreenElement) {
|
||||
@@ -36,20 +57,6 @@ document.getElementById("fullscreen-button").addEventListener("click", function
|
||||
}
|
||||
})
|
||||
|
||||
// 获取 Url 参数
|
||||
function getUrlParams() {
|
||||
let params = {}
|
||||
location.search.substring(1).split("&").map(param => {
|
||||
let a = param.indexOf("=")
|
||||
if (a < 0)
|
||||
params[param] = ''
|
||||
else
|
||||
params[param.substring(0, a)] = decodeURIComponent(param.substring(a + 1))
|
||||
})
|
||||
// console.log(params)
|
||||
return params
|
||||
}
|
||||
|
||||
// 定时更新页面上的小程序码
|
||||
let i = 0, refreshTime = 10 + 1
|
||||
|
||||
@@ -101,12 +108,6 @@ async function getGateList() {
|
||||
}
|
||||
|
||||
window.onload = async function () {
|
||||
// 获取 url 参数
|
||||
let urlParams = getUrlParams()
|
||||
console.log("urlParams", urlParams)
|
||||
|
||||
// 是否在 electron 中
|
||||
const inElectron = urlParams['inElectron']
|
||||
|
||||
// 当前的门禁端
|
||||
let gateId = urlParams['gateId'] || ""
|
||||
@@ -135,7 +136,11 @@ window.onload = async function () {
|
||||
// 弹出选择框
|
||||
window.showSettingPanel && window.showSettingPanel()
|
||||
} else {
|
||||
document.querySelector('#gate-name').textContent = window.currentGate.name
|
||||
// 显示大门名称及状态
|
||||
document.querySelector('#gate-name').innerHTML = `
|
||||
<span>${window.currentGate.name}</span>
|
||||
<span style="font-weight: bold; color: ${window.currentGate.open ? '#40f940' : 'red'};">${window.currentGate.open ? '允许通行' : '禁止通行'}</span>`
|
||||
|
||||
// 开始更新图片
|
||||
updateQRCode()
|
||||
setInterval(updateQRCode, 1000)
|
||||
|
Reference in New Issue
Block a user