in.html
6.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<meta name="google" value="notranslate">
<meta name="format-detection" content="telephone=no">
<meta name="format-detection" content="email=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-control" content="no-cache">
<meta http-equiv="Cache" content="no-cache">
<meta http-equiv="Expires" content="0">
<link rel="stylesheet" href="../css/com.css">
<script src="../config.js"></script>
<script src="../js/common.js"></script>
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>入场号牌</title>
<style>
#tipResult {
display: none;
font-size: 2.2rem;
font-size: 22px;
color: #ff6f16;
margin-top: 25%;
text-align: center;
padding: 10px;
}
</style>
</head>
<body style="background-color: #f0f4f5;">
<!-- <noscript >-->
<!-- You need to enable JavaScript to run this app. -->
<!-- </noscript >-->
<section id="tipResult">车牌成功录入,请您进场!</section>
<header id="header">
<span class="phoneText" id="phoneText">请输入手机号码</span>
<div class="inputBox">
<div class="subLabel">+86 <span> |</span></div>
<input type="tel" id="inputPhoneNum" value="" onkeydown="inputDown();" placeholder="请输入手机号码" maxlength="14" onpaste=" return false" />
</div>
</header>
<footer id="footer" class="flexBoxRow" style=" flex-direction: column;">
<div class="btnOK" id="btnPayOK">确认入场</div>
<img src="../img/loading.gif" id="loading" style="display: none;"/>
</footer>
<section id="outTip" style="margin-top: 5%; padding: 10px;">
<div style="color: #3385ff;font-size:14px;">说明:<br />手机号码是出场凭证,请您牢记!</div>
</section>
<!--
This HTML file is a template. If you open it directly in the browser, you will see an empty page. You can add webfonts, meta tags, or analytics to this file. The build step will place the bundled scripts into the <body > tag. To begin the development, run `npm start` or `yarn start`. To create a production bundle, use `npm run build` or `yarn build`.
-->
<script type="text/javascript">
var queryParams = null;//?参数名称
var $btnObj = null,$btnLoad = null;
function inputDown() {
var numObj = document.getElementById("inputPhoneNum");
numObj.value = numObj.value.replace(/\D/g, '').replace(/^/, '$& ').replace(/....(?!$)/g, '$& ');
}
window.onload = function () {
//测试网址后缀
http://localhost:18879/page/in.html?plNo=P11011700C&parkingId=00&channelId=172198242&direction=0&codeType=0&expireDate=expireDate&extendData=extendData
$btnObj = document.getElementById("btnPayOK");
$btnLoad = document.getElementById("loading");
queryParams = getQueryString(window.location);//获取url参数?sign=4&token=6&codeType=888
$btnObj.onclick = btnOkClick;
}
//点击事件
function btnOkClick() {
var phoneNum = document.getElementById("inputPhoneNum").value.replace(/\s*/g, "")+'111';//去除空格
if (phoneNum == "" || phoneNum.length < 11) {
var str = "请输入正确的手机号码!";alertMsg(str);
return;
}
if (queryParams == null) {
var str = "没有接收到请求参数";alertMsg(str); console.log(str);
return;
}
$btnObj.style.display = "none";
$btnLoad.style.display = "block";
var params = queryParams;
params.carNumber = phoneNum;//增加字段:手机号
params.terminalSource = "7";//增加字段:1:任你听 3:微信公共号 4:云平台 7:H5
//var tmpParams = Object.assign(params, window.webAppH5.comParams, window.webAppH5.appIn);
var tmpParams = Object.assign(params, window.webAppH5.comParams);
//debugger;
getRequest(webAppRoot + window.webAppH5.comServer, tmpParams);
}
//保存入场信息
function getRequest(url, params) {
var btnObj = $btnObj;
var btnLoad = $btnLoad;
postRequest(url, params, function (res) {
btnLoad.style.display = "none";
btnObj.style.display = "block";
if (res.code == 0) {//进场
var str = "进场信息已录入";
alertMsg(str); console.log(str);
sucessTip();
} else {//其他情况如【该卡号场内已存在】
alertMsg(res.message);console.log(res.message);
}
}, function (err) {
var str = "网络服务出错...";
alertMsg(str); console.log(str + url);
btnLoad.style.display = "none";
btnObj.style.display = "block";
});
}
//入场成功
function sucessTip() {
var obj = ["header", "footer"];
for (var i = 0; i < obj.length; i++) {
var tmpObj=document.getElementById("" + obj[i] + "");
tmpObj.style.display = "none";
}
document.getElementById("tipResult").style.display = "block";
}
</script>
</body>
</html>