门禁端网页独立出来,全屏功能修好
This commit is contained in:
parent
23dfc8288c
commit
5f4e20af66
@ -0,0 +1 @@
|
||||
编辑后右键 Compile And Reload File 修改即可生效,不用频繁重启项目
|
@ -0,0 +1,81 @@
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
html,
|
||||
body {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.container {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: #0556c6;
|
||||
display: grid;
|
||||
grid-template-columns: 3fr 4fr;
|
||||
place-items: center;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.left-container {
|
||||
text-shadow: 2px 2px 2px #00000066;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin-bottom: 30px;
|
||||
font-size: 4vw;
|
||||
}
|
||||
|
||||
h3 {
|
||||
margin-bottom: 10px;
|
||||
margin-top: 22px;
|
||||
font-size: 2vw;
|
||||
}
|
||||
|
||||
p {
|
||||
font-size: 1.4vw;
|
||||
line-height: 1.5em;
|
||||
}
|
||||
|
||||
.right-container {
|
||||
}
|
||||
|
||||
#qrcode {
|
||||
box-shadow: 0px 0px 17px 12px rgb(0 0 0 / 50%);
|
||||
border-radius: 50%;
|
||||
display: block;
|
||||
width: min(40vw, 68vh);
|
||||
height: min(40vw, 68vh);
|
||||
}
|
||||
|
||||
#refreshTimeCountDown {
|
||||
text-align: center;
|
||||
margin-top: 30px;
|
||||
font-size: 2em;
|
||||
color: #ffffff9c;
|
||||
}
|
||||
|
||||
/* 右上角按钮 */
|
||||
.ctrl-btn {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.btn {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
cursor: pointer;
|
||||
filter: invert(1) opacity(0.8);
|
||||
}
|
||||
|
||||
.btn-ctrl {
|
||||
margin-left: 2px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
#fullscreen-button {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
.full-screen-mask {
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 10;
|
||||
background-color: black;
|
||||
opacity: 0.35;
|
||||
}
|
||||
|
||||
.setting-container {
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 20;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
}
|
||||
|
||||
.setting-panel {
|
||||
width: 320px;
|
||||
height: 450px;
|
||||
background-color: white;
|
||||
border-radius: 40px;
|
||||
position: relative;
|
||||
padding: 14px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
#close-setting-button {
|
||||
position: absolute;
|
||||
right: -17px;
|
||||
top: -21px;
|
||||
transform: rotate(12deg) scale(0.9);
|
||||
transition: 0.3s;
|
||||
}
|
||||
|
||||
#close-setting-button:hover {
|
||||
transform: rotate(102deg) scale(1.1);
|
||||
}
|
||||
|
||||
.save-button-container {
|
||||
position: absolute;
|
||||
bottom: 20px;
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.save-setting-button {
|
||||
width: 120px;
|
||||
font-weight: 200;
|
||||
font-size: 1.1em;
|
||||
color: white;
|
||||
background-color: #0556C6;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
height: 32px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
const DOMSettingButton = document.getElementById("setting-button")
|
||||
const DOMFullScreenMask = document.getElementById("full-screen-mask")
|
||||
const DOMCloseSettingButton = document.getElementById("close-setting-button")
|
||||
const DOMSettingContainer = document.getElementById("setting-container")
|
||||
const DOMSettingPanel = document.querySelector(".setting-panel")
|
||||
const DOMSaveSettingButton = document.querySelector(".save-setting-button")
|
||||
|
||||
function showSettingPanel() {
|
||||
console.log("showSettingPanel")
|
||||
DOMFullScreenMask.classList.remove("hidden")
|
||||
DOMSettingContainer.classList.remove("hidden")
|
||||
}
|
||||
|
||||
function closeSettingPanel() {
|
||||
console.log("closeSettingPanel")
|
||||
DOMFullScreenMask.classList.add("hidden")
|
||||
DOMSettingContainer.classList.add("hidden")
|
||||
}
|
||||
|
||||
DOMSettingButton?.addEventListener('click', showSettingPanel)
|
||||
// DOMFullScreenMask?.addEventListener('click', closeSettingPanel)
|
||||
DOMSettingContainer?.addEventListener('click', closeSettingPanel)
|
||||
DOMCloseSettingButton?.addEventListener('click', closeSettingPanel)
|
||||
DOMSettingPanel.addEventListener('click', function (e) {
|
||||
e.stopPropagation()
|
||||
})
|
||||
DOMSaveSettingButton.addEventListener('click', function (e) {
|
||||
closeSettingPanel()
|
||||
e.stopPropagation()
|
||||
})
|
@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg viewBox="0 0 1102 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="215" height="200"><path d="M701.597538 511.842462l366.119385-366.119385a57.974154 57.974154 0 0 0 0-82.077539l-41.038769-41.038769a57.974154 57.974154 0 0 0-82.077539 0L578.481231 388.726154 212.283077 22.528a57.974154 57.974154 0 0 0-82.077539 0l-41.117538 41.117538a57.974154 57.974154 0 0 0 0 82.077539l366.119385 366.119385-366.119385 366.119384a58.131692 58.131692 0 0 0 0 82.156308l41.038769 41.038769a57.974154 57.974154 0 0 0 82.077539 0l366.119384-366.119385 366.119385 366.119385a57.974154 57.974154 0 0 0 82.077538 0l41.03877-41.038769a58.131692 58.131692 0 0 0 0-82.156308L701.597538 511.842462z"></path></svg>
|
After Width: | Height: | Size: 886 B |
@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M692.705882 24.094118h240.941177c36.141176 0 60.235294 24.094118 60.235294 60.235294s-24.094118 60.235294-60.235294 60.235294h-240.941177c-36.141176 0-60.235294-24.094118-60.235294-60.235294s24.094118-60.235294 60.235294-60.235294z"></path><path d="M933.647059 24.094118c36.141176 0 60.235294 24.094118 60.235294 60.235294v240.941176c0 36.141176-24.094118 60.235294-60.235294 60.235294s-60.235294-24.094118-60.235294-60.235294v-240.941176c0-36.141176 24.094118-60.235294 60.235294-60.235294z"></path><path d="M915.576471 96.376471c18.070588 24.094118 18.070588 60.235294 0 84.329411l-246.964706 246.964706c-24.094118 24.094118-60.235294 24.094118-84.329412 0-24.094118-24.094118-24.094118-60.235294 0-84.329412l246.964706-246.964705c24.094118-18.070588 60.235294-18.070588 84.329412 0zM90.352941 867.388235h240.941177c36.141176 0 60.235294 24.094118 60.235294 60.235294s-24.094118 60.235294-60.235294 60.235295H90.352941c-36.141176 0-60.235294-24.094118-60.235294-60.235295s24.094118-60.235294 60.235294-60.235294z"></path><path d="M90.352941 626.447059c36.141176 0 60.235294 24.094118 60.235294 60.235294v240.941176c0 36.141176-24.094118 60.235294-60.235294 60.235295s-60.235294-24.094118-60.235294-60.235295v-240.941176c0-36.141176 24.094118-60.235294 60.235294-60.235294z"></path><path d="M102.4 909.552941c-24.094118-24.094118-24.094118-60.235294 0-84.329412l246.964706-246.964705c24.094118-24.094118 60.235294-24.094118 84.329412 0 24.094118 24.094118 24.094118 60.235294 0 84.329411l-246.964706 246.964706c-24.094118 18.070588-60.235294 18.070588-84.329412 0zM90.352941 24.094118h240.941177c36.141176 0 60.235294 24.094118 60.235294 60.235294s-24.094118 60.235294-60.235294 60.235294H90.352941c-36.141176 0-60.235294-24.094118-60.235294-60.235294s24.094118-60.235294 60.235294-60.235294z"></path><path d="M90.352941 24.094118c36.141176 0 60.235294 24.094118 60.235294 60.235294v240.941176c0 36.141176-24.094118 60.235294-60.235294 60.235294s-60.235294-24.094118-60.235294-60.235294v-240.941176c0-36.141176 24.094118-60.235294 60.235294-60.235294z"></path><path d="M102.4 96.376471c-18.070588 24.094118-18.070588 60.235294 0 84.329411l246.964706 246.964706c24.094118 24.094118 60.235294 24.094118 84.329412 0 24.094118-24.094118 24.094118-60.235294 0-84.329412L186.729412 96.376471c-24.094118-18.070588-60.235294-18.070588-84.329412 0zM692.705882 867.388235h240.941177c36.141176 0 60.235294 24.094118 60.235294 60.235294s-24.094118 60.235294-60.235294 60.235295h-240.941177c-36.141176 0-60.235294-24.094118-60.235294-60.235295s24.094118-60.235294 60.235294-60.235294z"></path><path d="M933.647059 626.447059c36.141176 0 60.235294 24.094118 60.235294 60.235294v240.941176c0 36.141176-24.094118 60.235294-60.235294 60.235295s-60.235294-24.094118-60.235294-60.235295v-240.941176c0-36.141176 24.094118-60.235294 60.235294-60.235294z"></path><path d="M915.576471 909.552941c24.094118-24.094118 24.094118-60.235294 0-84.329412l-246.964706-246.964705c-24.094118-24.094118-60.235294-24.094118-84.329412 0-24.094118 24.094118-24.094118 60.235294 0 84.329411l246.964706 246.964706c24.094118 18.070588 60.235294 18.070588 84.329412 0z"></path></svg>
|
After Width: | Height: | Size: 3.4 KiB |
@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M512.5 390.6c-29.9 0-57.9 11.6-79.1 32.8-21.1 21.2-32.8 49.2-32.8 79.1 0 29.9 11.7 57.9 32.8 79.1 21.2 21.1 49.2 32.8 79.1 32.8 29.9 0 57.9-11.7 79.1-32.8 21.1-21.2 32.8-49.2 32.8-79.1 0-29.9-11.7-57.9-32.8-79.1-21.2-21.2-49.2-32.8-79.1-32.8z"></path><path d="M924.8 626.1l-65.4-55.9c3.1-19 4.7-38.4 4.7-57.7s-1.6-38.8-4.7-57.7l65.4-55.9c10.1-8.6 13.8-22.6 9.3-35.2l-0.9-2.6c-18.1-50.4-44.8-96.8-79.6-137.7l-1.8-2.1c-8.6-10.1-22.5-13.9-35.1-9.5l-81.2 28.9c-30-24.6-63.4-44-99.6-57.5l-15.7-84.9c-2.4-13.1-12.7-23.3-25.8-25.7l-2.7-0.5c-52-9.4-106.8-9.4-158.8 0l-2.7 0.5c-13.1 2.4-23.4 12.6-25.8 25.7l-15.8 85.3c-35.9 13.6-69.1 32.9-98.9 57.3l-81.8-29.1c-12.5-4.4-26.5-0.7-35.1 9.5l-1.8 2.1c-34.8 41.1-61.5 87.4-79.6 137.7l-0.9 2.6c-4.5 12.5-0.8 26.5 9.3 35.2l66.2 56.5c-3.1 18.8-4.6 38-4.6 57 0 19.2 1.5 38.4 4.6 57l-66 56.5c-10.1 8.6-13.8 22.6-9.3 35.2l0.9 2.6c18.1 50.3 44.8 96.8 79.6 137.7l1.8 2.1c8.6 10.1 22.5 13.9 35.1 9.5l81.8-29.1c29.8 24.5 63 43.9 98.9 57.3l15.8 85.3c2.4 13.1 12.7 23.3 25.8 25.7l2.7 0.5c26.1 4.7 52.7 7.1 79.4 7.1 26.7 0 53.4-2.4 79.4-7.1l2.7-0.5c13.1-2.4 23.4-12.6 25.8-25.7l15.7-84.9c36.2-13.6 69.6-32.9 99.6-57.5l81.2 28.9c12.5 4.4 26.5 0.7 35.1-9.5l1.8-2.1c34.8-41.1 61.5-87.4 79.6-137.7l0.9-2.6c4.3-12.4 0.6-26.3-9.5-35z m-412.3 52.2c-97.1 0-175.8-78.7-175.8-175.8s78.7-175.8 175.8-175.8 175.8 78.7 175.8 175.8-78.7 175.8-175.8 175.8z"></path></svg>
|
After Width: | Height: | Size: 1.6 KiB |
@ -0,0 +1,55 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<!-- https://developer.mozilla.org/zh-CN/docs/Web/HTTP/CSP -->
|
||||
<!-- <meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'"> -->
|
||||
<!-- Electron -->
|
||||
<!-- <meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src *; img-src *; connect-src *;"> -->
|
||||
<title>社区疫情防控系统 - 门禁端</title>
|
||||
<link rel="stylesheet" href="./assets/css/index.css" />
|
||||
<link rel="stylesheet" href="./assets/css/setting-panel.css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="ctrl-btn">
|
||||
<img class="btn btn-ctrl" id="setting-button" src="./assets/svg/setting.svg" alt="">
|
||||
<img class="btn btn-ctrl" id="fullscreen-button" src="./assets/svg/fullscreen.svg" alt="">
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class="left-container">
|
||||
<h1>进出社区请扫码</h1>
|
||||
<h3>社区居民</h3>
|
||||
<p>1. 打开 微信 > 扫一扫,扫描右侧小程序码</p>
|
||||
<p>2. 点击确认进入,门即开启</p>
|
||||
|
||||
<h3>外来访客</h3>
|
||||
<p>1. 打开 微信 > 扫一扫,扫描右侧小程序码</p>
|
||||
<p>2. 填写进入申请表</p>
|
||||
|
||||
<h3>长期租客</h3>
|
||||
<p>1. 请联系管理员为你添加进出权限</p>
|
||||
</div>
|
||||
<div class="right-container">
|
||||
<img id="qrcode" src="">
|
||||
<p id="refreshTimeCountDown"></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="full-screen-mask" class="full-screen-mask"></div>
|
||||
<div id="setting-container" class="setting-container">
|
||||
<div class="setting-panel">
|
||||
<!-- 关闭按钮 -->
|
||||
<img id="close-setting-button" class="btn" src="./assets/svg/close.svg" alt="">
|
||||
|
||||
<div class="save-button-container" style="text-align: center;">
|
||||
<button class="save-setting-button">保 存</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="./renderer.js" type="module"></script>
|
||||
<script src="./assets/js/setting-panel.js" type="module"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -0,0 +1,71 @@
|
||||
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
|
||||
|
||||
// 获取 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 urlParams = getUrlParams()
|
||||
console.log("urlParams", urlParams)
|
||||
|
||||
// 是否在 electron 中
|
||||
const inElectron = urlParams['inElectron']
|
||||
|
||||
// 当前的门禁端
|
||||
let gateId = urlParams['gateId'] || ""
|
||||
|
||||
if (!gateId) {
|
||||
// 弹出选择框
|
||||
}
|
||||
|
||||
// 点击全屏
|
||||
document.getElementById("fullscreen-button").addEventListener("click", function () {
|
||||
if (document.fullscreenElement) {
|
||||
document.exitFullscreen();
|
||||
} else {
|
||||
if(inElectron) {
|
||||
// electron 中
|
||||
const message = JSON.stringify({
|
||||
action: 'fullscreen'
|
||||
});
|
||||
window.parent.postMessage(message, '*');
|
||||
} else {
|
||||
// 浏览器中
|
||||
document.body.requestFullscreen()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
// 页面上的元素
|
||||
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)
|
9
client-entrance-guard/README.md
Normal file
9
client-entrance-guard/README.md
Normal file
@ -0,0 +1,9 @@
|
||||
|
||||
打包需要管理员运行终端
|
||||
用 npm run package 即可
|
||||
|
||||
|
||||
npm run make 打包到后面会报错
|
||||
分为两步
|
||||
1. npm run package
|
||||
2. 生成一个可分发文件
|
@ -2,64 +2,14 @@
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
html,
|
||||
body {
|
||||
height: 100%;
|
||||
color: white;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.container {
|
||||
iframe {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: #0556c6;
|
||||
display: grid;
|
||||
grid-template-columns: 3fr 4fr;
|
||||
/* align-items: center; */
|
||||
place-items: center;
|
||||
/* justify-items: center; */
|
||||
/* place-content: center; */
|
||||
}
|
||||
|
||||
.left-container {
|
||||
text-shadow: 2px 2px 2px #00000066;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin-bottom: 30px;
|
||||
font-size: 4vw;
|
||||
}
|
||||
|
||||
h3 {
|
||||
margin-bottom: 10px;
|
||||
margin-top: 22px;
|
||||
font-size: 2vw;
|
||||
}
|
||||
|
||||
p {
|
||||
font-size: 1.4vw;
|
||||
line-height: 1.5em;
|
||||
}
|
||||
|
||||
.right-container {
|
||||
}
|
||||
|
||||
#qrcode {
|
||||
box-shadow: 0px 0px 17px 12px rgb(0 0 0 / 50%);
|
||||
border-radius: 50%;
|
||||
display: block;
|
||||
width: min(40vw, 68vh);
|
||||
height: min(40vw, 68vh);
|
||||
}
|
||||
|
||||
#refreshTimeCountDown {
|
||||
text-align: center;
|
||||
margin-top: 30px;
|
||||
font-size: 2em;
|
||||
color: #ffffff9c;
|
||||
}
|
||||
|
||||
/* #fullscreen-button {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
} */
|
||||
|
@ -5,33 +5,13 @@
|
||||
<meta charset="UTF-8">
|
||||
<!-- https://developer.mozilla.org/zh-CN/docs/Web/HTTP/CSP -->
|
||||
<!-- <meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'"> -->
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src *; img-src *; connect-src *;">
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src *; script-src *; img-src *; connect-src *;">
|
||||
<title>社区疫情防控系统 - 门禁端</title>
|
||||
<link rel="stylesheet" href="./index.css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="left-container">
|
||||
<h1>进出社区请扫码</h1>
|
||||
|
||||
<h3>社区居民</h3>
|
||||
<p>1. 打开 微信 > 扫一扫,扫描右侧小程序码</p>
|
||||
<p>2. 点击确认进入,门即开启</p>
|
||||
|
||||
<h3>外来访客</h3>
|
||||
<p>1. 打开 微信 > 扫一扫,扫描右侧小程序码</p>
|
||||
<p>2. 填写进入申请表</p>
|
||||
|
||||
<h3>长期租客</h3>
|
||||
<p>1. 请联系管理员为你添加进出权限</p>
|
||||
</div>
|
||||
<div class="right-container">
|
||||
<img id="qrcode" src="">
|
||||
<p id="refreshTimeCountDown"></p>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <button id="fullscreen-button">全屏</button> -->
|
||||
<iframe src="https://epp.only4.work/access/index.html?inElectron=true" frameborder="0"></iframe>
|
||||
<script src="./renderer.js" type="module"></script>
|
||||
</body>
|
||||
|
||||
|
@ -1,25 +0,0 @@
|
||||
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);
|
@ -1,10 +1,11 @@
|
||||
const { app, BrowserWindow } = require('electron')
|
||||
const { app, BrowserWindow, ipcMain, Menu, globalShortcut } = require('electron')
|
||||
const { platform } = require('node:process')
|
||||
const path = require('path')
|
||||
|
||||
console.log(`This platform is ${platform}`);
|
||||
|
||||
const createWindow = () => {
|
||||
// 创建窗口
|
||||
const mainWindow = new BrowserWindow({
|
||||
width: 1080,
|
||||
minWidth: 760,
|
||||
@ -15,13 +16,25 @@ const createWindow = () => {
|
||||
},
|
||||
})
|
||||
|
||||
// 加载 HTML
|
||||
mainWindow.loadFile('html/index.html')
|
||||
|
||||
// 隐藏菜单栏
|
||||
// let menu = Menu.getApplicationMenu()
|
||||
Menu.setApplicationMenu(null)
|
||||
|
||||
// 全屏逻辑
|
||||
// mainWindow.fullScreen = true;
|
||||
ipcMain.on('toggle-fullscreen', () => {
|
||||
mainWindow.setFullScreen(!mainWindow.isFullScreen())
|
||||
})
|
||||
|
||||
// 配置ESC键退出全屏
|
||||
globalShortcut.register('ESC', () => {
|
||||
mainWindow.setFullScreen(false);
|
||||
})
|
||||
|
||||
// 调试窗口
|
||||
// mainWindow.webContents.openDevTools()
|
||||
}
|
||||
|
||||
|
@ -1,13 +1,23 @@
|
||||
// import { remote } from 'electron'
|
||||
const { ipcRenderer } = require('electron')
|
||||
|
||||
// const setFullScreen = remote.getCurrentWindow().setFullScreen
|
||||
// const isFullScreen = remote.getCurrentWindow().isFullScreen
|
||||
// window.setFullScreen = setFullScreen
|
||||
// window.isFullScreen = isFullScreen
|
||||
window.addEventListener('message', function (e) {
|
||||
// 获取消息内容 data
|
||||
const { data } = e;
|
||||
console.log("[electron preload]", data)
|
||||
try {
|
||||
let message = JSON.parse(data);
|
||||
console.log(message)
|
||||
switch (message.action) {
|
||||
case 'fullscreen':
|
||||
ipcRenderer.send('toggle-fullscreen')
|
||||
break
|
||||
}
|
||||
} catch (err) {
|
||||
console.log("err", err)
|
||||
}
|
||||
})
|
||||
|
||||
window.addEventListener('DOMContentLoaded', () => {
|
||||
// document.getElementById("fullscreen-button").onclick = function () {
|
||||
// alert(1)
|
||||
// window.setFullScreen(!window.isFullScreen)
|
||||
// }
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user