[门禁端&后端&小程序] 完成门禁端;完成小程序扫码跳转页面;完成后端获取不限制的小程序场景码接口
This commit is contained in:
65
client-entrance-guard/html/index.css
Normal file
65
client-entrance-guard/html/index.css
Normal file
@@ -0,0 +1,65 @@
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
html,
|
||||
body {
|
||||
height: 100%;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.container {
|
||||
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;
|
||||
} */
|
@@ -3,17 +3,36 @@
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'">
|
||||
<title>Hello World!</title>
|
||||
<!-- 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 *;">
|
||||
<title>社区疫情防控系统 - 门禁端</title>
|
||||
<link rel="stylesheet" href="./index.css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Hello World!</h1>
|
||||
We are using Node.js <span id="node-version"></span>,
|
||||
Chromium <span id="chrome-version"></span>,
|
||||
and Electron <span id="electron-version"></span>.
|
||||
<script src="./renderer.js"></script>
|
||||
<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> -->
|
||||
<script src="./renderer.js" type="module"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
@@ -1 +1,24 @@
|
||||
// alert('111');
|
||||
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 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}&autoColor=${autoColor}&isHyaline=${isHyaline}`;
|
||||
console.log(image.src);
|
||||
refreshTimeCountDown.innerHTML = ` `
|
||||
} else {
|
||||
refreshTimeCountDown.textContent = `${refreshTime - i}秒后刷新`
|
||||
}
|
||||
i = i % refreshTime + 1;
|
||||
}
|
||||
|
||||
updateQRCode();
|
||||
setInterval(updateQRCode, 1000);
|
||||
|
@@ -6,16 +6,23 @@ console.log(`This platform is ${platform}`);
|
||||
|
||||
const createWindow = () => {
|
||||
const mainWindow = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600,
|
||||
width: 1080,
|
||||
minWidth: 760,
|
||||
height: 720,
|
||||
minHeight: 480,
|
||||
webPreferences: {
|
||||
preload: path.join(__dirname, 'preload.js')
|
||||
},
|
||||
})
|
||||
|
||||
mainWindow.loadFile('html/index.html')
|
||||
// mainWindow.fullScreen = true;
|
||||
//配置ESC键退出全屏
|
||||
globalShortcut.register('ESC', () => {
|
||||
mainWindow.setFullScreen(false);
|
||||
})
|
||||
|
||||
mainWindow.webContents.openDevTools()
|
||||
// mainWindow.webContents.openDevTools()
|
||||
}
|
||||
|
||||
app.whenReady().then(() => {
|
||||
|
@@ -1,10 +1,13 @@
|
||||
window.addEventListener('DOMContentLoaded', () => {
|
||||
const replaceText = (selector, text) => {
|
||||
const element = document.getElementById(selector)
|
||||
if (element) element.innerText = text
|
||||
}
|
||||
// import { remote } from 'electron'
|
||||
|
||||
for (const dependency of ['chrome', 'node', 'electron']) {
|
||||
replaceText(`${dependency}-version`, process.versions[dependency])
|
||||
}
|
||||
// const setFullScreen = remote.getCurrentWindow().setFullScreen
|
||||
// const isFullScreen = remote.getCurrentWindow().isFullScreen
|
||||
// window.setFullScreen = setFullScreen
|
||||
// window.isFullScreen = isFullScreen
|
||||
|
||||
window.addEventListener('DOMContentLoaded', () => {
|
||||
// document.getElementById("fullscreen-button").onclick = function () {
|
||||
// alert(1)
|
||||
// window.setFullScreen(!window.isFullScreen)
|
||||
// }
|
||||
})
|
||||
|
Reference in New Issue
Block a user