inquiry.html
6.29 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8>
<meta name=viewport content="width=device-width,initial-scale=1,user-scalable=0">
<title>保单便捷查询</title>
<style>
* {
margin: 0;
padding: 0;
font-size:14px;
}
.logo{
padding:10px;
}
.mini_head{
border-bottom:2px solid #ed5d43;
padding:0 10px;
}
.mini_head .h2{
background:#ED5D43;
color:#fff;
font-weight:normal;
text-align:center;
display:inline-block;
padding:8px 20px;
font-size:14px;
}
.cell_group{
padding:10px;
}
.cell_line{
display: flex;
box-sizing: border-box;
border-bottom:1px solid #d8d8d8;
padding:5px 10px;
}
.cell_line .name{
width:80px;
line-height:30px;
}
.cell_line .input_box{
flex:1;
}
.cell_line .code_box{
flex:1;
font-family:Arial;
font-style:italic;
background:#D8B7E3;
text-align:center;
letter-spacing:10px;
font-weight:bolder;
cursor:pointer;
text-align:center;
font-size:20px;
line-height:30px;
}
.a_input{
width:100%;
border:0;
outline: none;
line-height:30px;
}
.btn_group{
padding:10px;
}
.btn_group a{
display:block;
background:#ED5D43;
color:#fff;
text-decoration:none;
padding:10px;
border-radius:4px;
text-align:center;
}
</style>
</head>
<body>
<div class="page_wrapper">
<!-- logo 开始 -->
<div class="logo">
<img src="" alt="" />
</div>
<!-- logo end -->
<!-- 保单查询头部 开始 -->
<div class="mini_head">
<h2 class="h2">保单查询</h2>
</div>
<!-- 保单查询头部 end -->
<!-- 保单查询输入区域 开始 -->
<div class="cell_group">
<div class="cell_line">
<div class="name">保单凭证</div>
<div class="input_box">
<input type="text" class="a_input" placeholder="请输入保单凭证" id="inputNumber" />
</div>
</div>
<div class="cell_line">
<div class="name">验证码</div>
<div class="input_box">
<input type="text" class="a_input" maxlength="4" placeholder="请输入验证码" id="code" />
</div>
<div class="code_box" id="codeBox"></div>
</div>
</div>
<!-- 保单查询输入区域 end -->
<!-- 按钮区域 开始 -->
<div class="btn_group">
<a href="javascript:void(0)" id="serchButton">确认查询</a>
</div>
<!-- 按钮区域 end -->
</div>
</body>
<script type="text/javascript" src="../static/js/zepto.min.js"></script>
<script type="text/javascript" src="../static/layer_mobile/layer.js"></script>
<script type="text/javascript">
$(function () {
$.getUrlParam = function (name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]); return null;
}
console.log()
var logoUlr = $.getUrlParam('companyCode')
$('.logo img').attr('src', '../static/images/'+ logoUlr +'.png')
})
Zepto(function($) {
var inquiry = {};
/**
* 绑定event事件
*/
inquiry.bindEvent = function() {
$('#serchButton').on('click', function() {
inquiry.serch();
})
$('#codeBox').on('click',function(){
inquiry.createCode();
})
}
/**
* 生成验证码
*/
inquiry.createCode = function(length) {
var code = "";
var codeLength = length ? parseInt(length) : 4; //验证码的长度
////所有候选组成验证码的字符,当然也可以用中文的
var codeChars = new Array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
'u', 'v',
'w', 'x', 'y', 'z',
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
'U', 'V',
'W', 'X', 'Y', 'Z');
//循环组成验证码的字符串
for (var i = 0; i < codeLength; i++) {
//获取随机验证码下标
var charNum = Math.floor(Math.random() * 62);
//组合成指定字符验证码
code += codeChars[charNum];
}
$('#codeBox').html(code);
inquiry.code = code;
return code;
};
/**
* 初始化函数
*/
inquiry.init = function() {
inquiry.bindEvent();
inquiry.createCode();
}
/**
* 查询
*/
inquiry.serch = function() {
var num = $('#inputNumber').val();
var code = $('#code').val();
if (!num) {
layer.open({
content: '请输入保单凭证',
btn: '关闭'
});
return false;
}
if (!code) {
layer.open({
content: '请输入验证码',
btn: '关闭'
});
return false;
}
if (code.toUpperCase() != (inquiry.code).toUpperCase()) {
layer.open({
content: '验证码错误',
btn: '关闭'
});
inquiry.createCode();
return false;
}
var mLoading = layer.open({
type: 2,
content: '加载中'
});
$.ajax({
type: 'GET',
url: '/web-dj-mobile/qrCodeQuery/' + num,
dataType: 'json',
success: function(res) {
layer.close(mLoading)
if (res.returnCode == 0) {
sessionStorage.setItem('inquiry',JSON.stringify(res.data));
window.location.href = "detail.html?code=" + num
} else {
layer.open({
content: res.message || '保单不存在',
btn: '关闭'
});
}
}
})
}
inquiry.init();
})
</script>
</html>