上下山扫码登记

mster
zzq 2 years ago
commit d097fed9b0

5
.idea/.gitignore vendored

@ -0,0 +1,5 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptLibraryMappings">
<file url="PROJECT" libraries="{jquery}" />
</component>
</project>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/微信H5部分.iml" filepath="$PROJECT_DIR$/.idea/微信H5部分.iml" />
</modules>
</component>
</project>

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
<excludeFolder url="file://$MODULE_DIR$/temp" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="jquery" level="application" />
</component>
</module>

BIN
bg.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

@ -0,0 +1,94 @@
/* eslint no-extend-native: 0 */
(function () {
// Defining locale
Date.shortMonths = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
Date.longMonths = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
Date.shortDays = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
Date.longDays = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
// Defining patterns
var replaceChars = {
// Day
d: function () { var d = this.getDate(); return (d < 10 ? '0' : '') + d },
D: function () { return Date.shortDays[this.getDay()] },
j: function () { return this.getDate() },
l: function () { return Date.longDays[this.getDay()] },
N: function () { var N = this.getDay(); return (N === 0 ? 7 : N) },
S: function () { var S = this.getDate(); return (S % 10 === 1 && S !== 11 ? 'st' : (S % 10 === 2 && S !== 12 ? 'nd' : (S % 10 === 3 && S !== 13 ? 'rd' : 'th'))) },
w: function () { return this.getDay() },
z: function () { var d = new Date(this.getFullYear(), 0, 1); return Math.ceil((this - d) / 86400000) },
// Week
W: function () {
var target = new Date(this.valueOf())
var dayNr = (this.getDay() + 6) % 7
target.setDate(target.getDate() - dayNr + 3)
var firstThursday = target.valueOf()
target.setMonth(0, 1)
if (target.getDay() !== 4) {
target.setMonth(0, 1 + ((4 - target.getDay()) + 7) % 7)
}
var retVal = 1 + Math.ceil((firstThursday - target) / 604800000)
return (retVal < 10 ? '0' + retVal : retVal)
},
// Month
F: function () { return Date.longMonths[this.getMonth()] },
m: function () { var m = this.getMonth(); return (m < 9 ? '0' : '') + (m + 1) },
M: function () { return Date.shortMonths[this.getMonth()] },
n: function () { return this.getMonth() + 1 },
t: function () {
var year = this.getFullYear()
var nextMonth = this.getMonth() + 1
if (nextMonth === 12) {
year = year++
nextMonth = 0
}
return new Date(year, nextMonth, 0).getDate()
},
// Year
L: function () { var L = this.getFullYear(); return (L % 400 === 0 || (L % 100 !== 0 && L % 4 === 0)) },
o: function () { var d = new Date(this.valueOf()); d.setDate(d.getDate() - ((this.getDay() + 6) % 7) + 3); return d.getFullYear() },
Y: function () { return this.getFullYear() },
y: function () { return ('' + this.getFullYear()).substr(2) },
// Time
a: function () { return this.getHours() < 12 ? 'am' : 'pm' },
A: function () { return this.getHours() < 12 ? 'AM' : 'PM' },
B: function () { return Math.floor((((this.getUTCHours() + 1) % 24) + this.getUTCMinutes() / 60 + this.getUTCSeconds() / 3600) * 1000 / 24) },
g: function () { return this.getHours() % 12 || 12 },
G: function () { return this.getHours() },
h: function () { var h = this.getHours(); return ((h % 12 || 12) < 10 ? '0' : '') + (h % 12 || 12) },
H: function () { var H = this.getHours(); return (H < 10 ? '0' : '') + H },
i: function () { var i = this.getMinutes(); return (i < 10 ? '0' : '') + i },
s: function () { var s = this.getSeconds(); return (s < 10 ? '0' : '') + s },
v: function () { var v = this.getMilliseconds(); return (v < 10 ? '00' : (v < 100 ? '0' : '')) + v },
// Timezone
e: function () { return Intl.DateTimeFormat().resolvedOptions().timeZone },
I: function () {
var DST = null
for (var i = 0; i < 12; ++i) {
var d = new Date(this.getFullYear(), i, 1)
var offset = d.getTimezoneOffset()
if (DST === null) DST = offset
else if (offset < DST) { DST = offset; break } else if (offset > DST) break
}
return (this.getTimezoneOffset() === DST) | 0
},
O: function () { var O = this.getTimezoneOffset(); return (-O < 0 ? '-' : '+') + (Math.abs(O / 60) < 10 ? '0' : '') + Math.floor(Math.abs(O / 60)) + (Math.abs(O % 60) === 0 ? '00' : ((Math.abs(O % 60) < 10 ? '0' : '')) + (Math.abs(O % 60))) },
P: function () { var P = this.getTimezoneOffset(); return (-P < 0 ? '-' : '+') + (Math.abs(P / 60) < 10 ? '0' : '') + Math.floor(Math.abs(P / 60)) + ':' + (Math.abs(P % 60) === 0 ? '00' : ((Math.abs(P % 60) < 10 ? '0' : '')) + (Math.abs(P % 60))) },
T: function () { var tz = this.toLocaleTimeString(navigator.language, {timeZoneName: 'short'}).split(' '); return tz[tz.length - 1] },
Z: function () { return -this.getTimezoneOffset() * 60 },
// Full Date/Time
c: function () { return this.format('Y-m-d\\TH:i:sP') },
r: function () { return this.toString() },
U: function () { return Math.floor(this.getTime() / 1000) }
}
// Simulates PHP's date function
Date.prototype.format = function (format) {
var date = this
return format.replace(/(\\?)(.)/g, function (_, esc, chr) {
return (esc === '' && replaceChars[chr]) ? replaceChars[chr].call(date) : chr
})
}
}).call(this)

@ -0,0 +1,325 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>进下山人员信息登记</title>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
<script src="./utils.js"></script>
<script src="./date.format.js"></script>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Helvetica Neue', sans-serif;
background-color: #F4F5F7;
}
.top {
width: 100%;
height: 200px;
background-color: #029561;
}
h1 {
text-align: center;
color: #ffffff;
font-size: 30px;
font-weight: bold;
text-shadow: 1px 1px 1px #ccc;
margin-top: -122px;
}
form {
border-radius: 21px 21px 0 0;
box-sizing: border-box;
padding: 18px;
width: 100%;
background-color: #F4F5F7;
margin: 45px auto 0;
}
.form-item {
display: flex;
height: 60px;
box-sizing: border-box;
background-color: #ffffff;
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.08);
border: 3px solid #FFFFFF;
backdrop-filter: blur(10px);
align-items: center;
justify-content: space-between;
margin-bottom: 13px;
padding: 0 20px;
}
label {
font-size: 15px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: bold;
color: #2A2A2A;
line-height: 21px;
letter-spacing: 1px;
}
input[type="text"],
input[type="tel"],
input[type="number"],
input[type="datetime-local"] {
padding: 12px 10px;
border-radius: 5px;
border: none;
font-size: 16px;
color: #2a2a2a;
text-align: right;
box-sizing: border-box;
}
input:focus {
outline: none;
}
input[type="text"]::-webkit-input-placeholder {
color: #aab2bd;
font-size: 15px;
}
input[type="tel"]::-webkit-input-placeholder {
color: #aab2bd;
font-size: 15px;
}
input[type="number"]::-webkit-input-placeholder {
color: #aab2bd;
font-size: 15px;
}
input[type="submit"] {
width: 98%;
height: 49px;
margin-top: 40px;
background: #029561;
border-radius: 49px;
border: none;
font-size: 17px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #FFFFFF;
}
input[type="submit"]:hover {
background-color: #005400;
}
.xieyi {
display: none;
width: 100%;
height: 100%;
overflow: scroll;
background: #fff;
position: fixed;
top: 0;
padding: 20px;
}
.xieyi>p {
width: 100%;
height: 75%;
margin-top: 20px;
overflow: scroll;
}
.selectview{
border: none;
font-size: 16px;
outline: none;
}
</style>
</head>
<body>
<div class="top">
</div>
<h1>进下山人员信息登记</h1>
<form>
<div class="form-item">
<label for="name">姓 名*</label>
<input type="text" id="name" name="name" placeholder="请输入姓名" required>
</div>
<div class="form-item">
<label for="phone">手机号码*</label>
<input type="tel" id="phone" name="phone" placeholder="请输入手机号" required>
</div>
<div class="form-item">
<label for="idCard">身份证号*</label>
<input type="text" id="idCard" name="idCard" placeholder="请输入身份证号" required>
</div>
<div class="form-item">
<label for="address">联系地址*</label>
<input type="text" id="address" name="address" placeholder="请输入联系地址" required>
</div>
<div class="form-item">
<label for="reason">登记类型*</label>
<select class="selectview" id="testSelect" οnchange="selectChange()">
<option value="1">进山</option>
<option value="2">下山</option>
</select>
</div>
<div class="form-item" id="inreason">
<label for="reason">进山原因</label>
<input type="text" id="reason" name="reason" placeholder="请输入进山原因">
</div>
<!-- <div class="form-item">
<label for="datatime">离开时间*</label>
<input type="datetime-local" id="datatime" name="datatime" placeholder="请选择离开时间" required>
</div> -->
<!-- <p><input type="checkbox" id="check" /> <span id="yuedu">同意并阅读协议</span></p> -->
<input type="submit" value="登记">
</form>
<div class="xieyi" id="xieyi">
<h2 style="text-align: center;">进山保证</h2>
<p> &emsp; 为有效防止森林火灾,维护生态平衡和公共安全,营造一个绿色、和谐的生产、生活环境,需作如下森林防火承诺:<br>
&emsp;一、严格遵守《森林防火条例》、《临沂市人民政府森林防火指挥部禁火令》、《临沂市人民政府通告》等森林防火法律、法规,做到知法、守法、懂法,决不以身试法。在护林防火期(每年11月1日至次年5月31日为护林防火期其中3月1日至5月31日为戒严期元宵节、清明节为防火关键期内自觉执行有关规定坚决不在野外用火。<br>
&emsp;二、严格执行森林防火”五不准”,并坚决做到:<br>
&emsp;&emsp;1、不携带火种进山入林;<br>
&emsp;&emsp;2、不在坟头烧香烧纸、燃放烟花爆竹;<br>
&emsp;&emsp;3、不在林区及周边焚烧地边杂草、农作物秸秆;<br>
&emsp;&emsp;4、不在林区吸烟、野炊、燃放可移动火源;<br>
&emsp;&emsp;5、不违法、违规在林区实施爆破和实弹演练<br>
&emsp;三、管好自家人,对小孩、老人及痴、呆、傻等理智不健全和精神病人的野外活动加强监护;主动对进入本村的陌生人、路过进山通道的车辆和人员,进行森林防火劝导,促其不在野外用火和乱扔烟头。<br>
&emsp;四、一旦发现山坡或林区有火情,及时反映,或立即拨打电话向镇(街、区)森林防火指挥部及有关部门反映,报告起火地点、火势大小等内容,并积极参加扑救。
<br>
&emsp;以上承诺若有违反,需接受公安机关和林业部门的处罚,同时承担相应法律责任。
</p>
<input type="submit" class="guanbi" value="关闭">
</div>
</body>
<script>
let message = new $message()
let urlParams = getUrlParse(window.location.search)
if (!urlParams.siteId) {
message('URL参数错误')
}
$("#testSelect").change(function(){
if($("#testSelect").val() == 1){
$("#inreason").show()
}else{
$("#inreason").hide()
document.getElementById('reason').value = ""
}
});
// 获取表单元素
const form = document.querySelector('form');
const nameInput = document.getElementById('name');
const phoneInput = document.getElementById('phone');
const idCardInput = document.getElementById('idCard');
const addressInput = document.getElementById('address');
const reasonInput = document.getElementById('reason');
const testSelect = document.getElementById('testSelect');
const check = document.getElementById('check');
const xieyi = document.getElementById('xieyi');
// 从localStorage里读取数据
const name = localStorage.getItem('name');
const phone = localStorage.getItem('phone');
const idCard = localStorage.getItem('idCard');
const address = localStorage.getItem('address');
const reason = localStorage.getItem('reason');
const testSelects = localStorage.getItem('testSelects');
// 将数据填充到表单里
nameInput.value = name;
phoneInput.value = phone;
idCardInput.value = idCard;
addressInput.value = address;
reasonInput.value = reason;
testSelect.value = testSelects || 1;
if(testSelects == 2){
$("#inreason").hide()
}
// 监听表单提交事件
form.addEventListener('submit', function (event) {
event.preventDefault(); // 阻止表单默认提交行为
var $check = $("#check");
// 获取填写的数据
const name = nameInput.value;
const phone = phoneInput.value;
const idCard = idCardInput.value;
const address = addressInput.value;
const reason = reasonInput.value;
const registrationType = testSelect.value;
// 存储到localStorage
localStorage.setItem('name', name);
localStorage.setItem('phone', phone);
localStorage.setItem('idCard', idCard);
localStorage.setItem('address', address);
localStorage.setItem('reason', reason);
localStorage.setItem('testSelects', registrationType);
// 时间格式转换
// let date = new Date(datatime)
// let s = date.format('Y-m-d H:i')
// 表单验证
let IDCardReg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
if (!/[\u4E00-\u9FA5]/.test(name) || /[ ,\\`,\\~,\\!,\\@,\#,\\$,\\%,\\^,\\+,\\*,\\&,\\\\,\\/,\\?,\\|,\\:,\\.,\\<,\\>,\\{,\\},\\(,\\),\\',\\;,\\=,\"]/g.test(name) || /[0-9]/.test(name)) {
message('名字格式输入错误')
} else if (!/^1[3|4|5|6|7|8|9][0-9]{9}$/.test(phone)) {
message('请输入正确手机号')
} else if (!IDCardReg.test(idCard)) {
message('请输入正确身份证号')
} else {
// if ($check.is(':checked')) { //利用jquery方法实现
// 提交
postMessage({
"id": 0,
"userName": name,
"phone": phone,
"inType": 1,
"cardNo": idCard,
"userAddress": address,
"siteId": urlParams.siteId,
'reason': reason,
// 'outTime': s,
'registrationType': registrationType
})
// } else {
// message("请勾选并仔细阅读协议!");
// }
}
});
function postMessage(data) {
// console.log(data);
$.ajax({
method: 'POST',
url: `${URL}/api/FireCodeH/AddEnteringInfo`,
contentType: 'application/json;charset=utf-8',
data: JSON.stringify(data),
success: function (response) {
if (response.code === 200) {
// 跳转到欢迎页面
window.location.href = `welcome.html?siteId=${data.siteId}`
} else {
message("未知错误")
}
}
})
}
$("#yuedu").click(function () {
$('#xieyi').toggle()
});
$(".guanbi").click(function () {
xieyi.style.display = 'none'
});
</script>
</html>

BIN
tc.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

@ -0,0 +1,66 @@
const URL = "http://123.132.248.154:9224"
/*
*消息弹框
* @ var message = new $message()
* @ message(options,newclass)
* @ options Object||string {message:'message',time:2000} || 'message'
* @ newclass string class类名
*/
function $message() {
this.time = 2000;
this.timer = null;
this.newDiv = null;
this.message = "";
this.fn = function (options, newclass) {
if (typeof options === 'string') {
this.message = options;
this.time = 2000;
} else if (typeof options === 'object') {
this.time = options.time || 2000;
this.message = options.message;
} else {
return
}
this.newDiv = document.createElement("div")
this.newDiv.className = "message"
this.newDiv.className += newclass || "";
//自定义样式 可以注释掉行间样式
this.newDiv.style =
'position:absolute;left: 50%;top: 50%;-webkit-transform: translate(-50%, -50%);transform: translate(-50%, -50%);background-color: rgba(0, 0, 0, 0.8);color: #fff;padding: .6rem;font-size: 1rem;border-radius: .4rem;text-align: center;zIndex:2250';
document.body.appendChild(this.newDiv);
this.newDiv.innerHTML = this.message;
this.closes = function () {
console.log(this)
this.newDiv.parentNode.removeChild(this.newDiv);
clearTimeout(this.timer);
this.timer = null;
}
this.timer = setTimeout(this.closes.bind(this), this.time);
}
return this.fn.bind(this);
}
function getUrlParse(str = window.location.search) {
const reg = /([^?&=]+)=([^&]+)/g
const params = {}
str.replace(reg, (_, k, v) => params[k] = v)
return params
}
function getNowDate() {
let myDate = new Date;
let year = myDate.getFullYear(); //获取当前年
let mon = myDate.getMonth() + 1; //获取当前月
let date = myDate.getDate(); //获取当前日
let hours = myDate.getHours(); //获取当前小时
let minutes = myDate.getMinutes(); //获取当前分钟
let seconds = myDate.getSeconds(); //获取当前秒
let now = year + "年" + mon + "月" + date + "日 " + hours + ":" + minutes
return now;
}

@ -0,0 +1,138 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>登记成功</title>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
<script src="./utils.js"></script>
<style>
* {
margin: 0;
padding: 0;
list-style: none;
}
body {
background-color: #F4F5F7;
}
.bg {
position: relative;
width: 100%;
}
.notify {
position: absolute;
left: 50%;
top: 10%;
transform: translate(-50%);
box-sizing: border-box;
display: flex;
flex-direction: column;
align-items: center;
font-size: 15px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #0F5230;
line-height: 25px;
background-image: url("tc.png");
background-size: 100% 100%;
width: 281px;
height: 194px;
padding: 40px 10px 0 10px;
}
.notify span {
text-align: center;
padding: 8px;
height: 124px;
overflow-y: scroll;
}
.info {
position: relative;
width: 100%;
height: 268px;
border-radius: 13px 13px 0 0;
margin-top: -25px;
background-color: #F4F5F7;
box-sizing: border-box;
padding: 23px 13px;
}
.info > div {
width: calc(100vw - 26px);
background-color: #FFFFFF;
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.08);
border: 1px solid #FFFFFF;
backdrop-filter: blur(5px);
padding: 26px;
box-sizing: border-box;
border-radius: 8px;
}
.info > div > ul {
height: 50px;
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 1px solid #F4F5F7;
}
</style>
</head>
<body>
<img class="bg" src="bg.jpg" alt="">
<div class="notify">
<span id="notify">
当前风高物燥,极易引发森林火灾,
请您不要在林区及周边用火、吸烟。
不带火种入山,不在林区用火。
</span>
</div>
<div class="info">
<div>
<ul>
<li>进山人员</li>
<li id="name"></li>
</ul>
<ul>
<li>进山时间</li>
<li id="time"></li>
</ul>
<ul>
<li>登记站点</li>
<li id="site"></li>
</ul>
</div>
</div>
</body>
<script>
let message = new $message()
let urlParams = getUrlParse(window.location.search)
let notify = document.getElementById('notify');
let name = document.getElementById('name');
let time = document.getElementById('time');
let site = document.getElementById('site');
if (!urlParams.siteId) {
message('URL参数错误')
}
$.ajax({
method: 'GET',
url: `${URL}/api/FireCodeApp/GetSiteInfo?siteId=${urlParams.siteId}`,
contentType: 'application/json;charset=utf-8',
success: function (response) {
if (response.code === 200) {
let res = response.result
site.innerHTML = res.siteName
time.innerHTML = getNowDate()
name.innerHTML = localStorage.getItem('name');
notify.innerHTML = res.slogan || '当前风高物燥,极易引发森林火灾,<br>请您不要在林区及周边用火、吸烟。<br>不带火种入山,不在林区用火。'
} else {
message("未知错误")
}
}
})
</script>
</html>
Loading…
Cancel
Save