Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
h5
/
account
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit d5b9c01f
authored
Aug 16, 2021
by
cwq0219
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
bug修复
1 parent
c1b4db3a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
216 additions
and
153 deletions
html/merchant/detail.html
html/merchant/edit.html
js/validator.js
html/merchant/detail.html
View file @
d5b9c01
...
@@ -15,9 +15,11 @@
...
@@ -15,9 +15,11 @@
.pull-right
{
.pull-right
{
float
:
right
;
float
:
right
;
}
}
.merchant-headerMsg
{
.merchant-headerMsg
{
display
:
flex
;
display
:
flex
;
}
}
.merchant-content
#secondmerchantName
{
.merchant-content
#secondmerchantName
{
margin-left
:
15px
;
margin-left
:
15px
;
width
:
250px
;
width
:
250px
;
...
@@ -33,7 +35,7 @@
...
@@ -33,7 +35,7 @@
word-break
:
break-all
;
word-break
:
break-all
;
}
}
.merchant-content
>
div
:not
(
:first-child
)
{
.merchant-content
>
div
:not
(
:first-child
)
{
margin-left
:
15px
;
margin-left
:
15px
;
height
:
20px
;
height
:
20px
;
font-size
:
12px
;
font-size
:
12px
;
...
@@ -46,16 +48,19 @@
...
@@ -46,16 +48,19 @@
.layui-form
{
.layui-form
{
margin-top
:
20px
;
margin-top
:
20px
;
}
}
.merchant-right
{
overflow-x
:
auto
;
.merchant-right
{
width
:
calc
(
100vw
-
500px
-
20px
);
overflow-x
:
auto
;
width
:
calc
(
100vw
-
500px
-
20px
);
}
}
.merchant-right
>
div
:first-child
{
position
:
relative
;
.merchant-right
>
div
:first-child
{
height
:
40px
;
position
:
relative
;
line-height
:
40px
;
height
:
40px
;
line-height
:
40px
;
}
}
.merchant-right
.companyName
{
.merchant-right
.companyName
{
display
:
inline-block
;
display
:
inline-block
;
width
:
300px
;
width
:
300px
;
height
:
36px
;
height
:
36px
;
...
@@ -69,34 +74,40 @@
...
@@ -69,34 +74,40 @@
white-space
:
nowrap
;
white-space
:
nowrap
;
word-break
:
break-all
;
word-break
:
break-all
;
}
}
.merchant-right
.layui-btn
{
.merchant-right
.layui-btn
{
position
:
absolute
;
position
:
absolute
;
right
:
0
;
right
:
0
;
}
}
.merchant-right
.layui-input-inline
{
.merchant-right
.layui-input-inline
{
position
:
absolute
;
position
:
absolute
;
right
:
80px
;
right
:
80px
;
}
}
.updateRecord
{
.updateRecord
{
text-align
:
center
;
text-align
:
center
;
color
:
#999
;
color
:
#999
;
}
}
.mb21
{
.mb21
{
margin-bottom
:
21px
;
margin-bottom
:
21px
;
}
}
.bg-detail
{
background-color
:
#fff
!important
;
.bg-detail
{
background-color
:
#fff
!important
;
}
}
.tabmutiple-content
{
.tabmutiple-content
{
margin
:
0
20px
;
margin
:
0
20px
;
}
}
.fixed-btn
{
.fixed-btn
{
position
:
fixed
;
position
:
fixed
;
bottom
:
30px
;
bottom
:
30px
;
}
}
</style>
</style>
</head>
</head>
...
@@ -194,7 +205,7 @@
...
@@ -194,7 +205,7 @@
<h3
class=
"content-title"
>
<h3
class=
"content-title"
>
功能权限
功能权限
</h3>
</h3>
<div
class=
"layui-tab tabmutiple-content"
lay-filter=
"roleAuth"
>
<div
class=
"layui-tab tabmutiple-content"
lay-filter=
"roleAuth"
>
<ul
class=
"layui-tab-title"
></ul>
<ul
class=
"layui-tab-title"
></ul>
<div
class=
"layui-tab-content"
></div>
<div
class=
"layui-tab-content"
></div>
</div>
</div>
...
@@ -205,26 +216,26 @@
...
@@ -205,26 +216,26 @@
<div
class=
"merchant-headerMsg"
>
<div
class=
"merchant-headerMsg"
>
<div
class=
"merchantImg"
><img
src=
"../../css/img/merchantImg.png"
alt=
""
></div>
<div
class=
"merchantImg"
><img
src=
"../../css/img/merchantImg.png"
alt=
""
></div>
<div
class=
"merchant-content"
>
<div
class=
"merchant-content"
>
<div
id=
"secondmerchantName"
></div>
<div
id=
"secondmerchantName"
></div>
<div>
商户号:
<span
id=
"secondmerchantId"
></span></div>
<div>
商户号:
<span
id=
"secondmerchantId"
></span></div>
<div>
您共有
<span
id=
"numberOfSubMerchants"
></span>
个子商户,共有
<span
id=
"numberOfStores"
></span>
家门店
</div>
<div>
您共有
<span
id=
"numberOfSubMerchants"
></span>
个子商户,共有
<span
id=
"numberOfStores"
></span>
家门店
</div>
</div>
</div>
</div>
</div>
<form
class=
"layui-form"
action=
""
>
<form
class=
"layui-form"
action=
""
>
<div
class=
"layui-inline"
>
<div
class=
"layui-inline"
>
<div
class=
"layui-input-inline"
>
<div
class=
"layui-input-inline"
>
<input
class=
"layui-input"
placeholder=
"请输入"
name=
"nameVal"
/>
<input
class=
"layui-input"
id=
"treeInput"
placeholder=
"请输入"
name=
"nameVal"
/>
</div>
</div>
<button
class=
"layui-btn"
>
查询
</button>
<button
type=
"button"
id=
"merchantBtn"
class=
"layui-btn"
>
查询
</button>
</div>
</div>
</form>
</form>
<ul
id=
"merchantTree"
class=
"ztree wrapper-tree"
></ul>
<ul
id=
"merchantTree"
class=
"ztree wrapper-tree"
></ul>
</div>
</div>
<div
class=
"merchant-right"
>
<div
class=
"merchant-right"
>
<div>
<div>
<span
class=
"companyName"
>
<span
id=
"merchantNameTable"
></span>
员工列表
</span>
<span
class=
"companyName"
>
<span
id=
"merchantNameTable"
></span>
员工列表
</span>
<div
class=
"layui-input-inline"
>
<div
class=
"layui-input-inline"
>
<input
class=
"layui-input"
placeholder=
"请输入员工姓名/手机号"
id=
"tableSearchForm"
/>
<input
class=
"layui-input"
placeholder=
"请输入员工姓名/手机号"
id=
"tableSearchForm"
/>
</div>
</div>
...
@@ -235,7 +246,7 @@
...
@@ -235,7 +246,7 @@
</div>
</div>
</div>
</div>
<div
class=
"layui-tab-item updateRecord"
>
<div
class=
"layui-tab-item updateRecord"
>
<span
class=
"no-data"
>
暂无记录
</span>
<span
class=
"no-data"
>
暂无记录
</span>
<!-- <ul class="layui-timeline">
<!-- <ul class="layui-timeline">
<li class="layui-timeline-item">
<li class="layui-timeline-item">
<i class="layui-icon layui-timeline-axis"></i>
<i class="layui-icon layui-timeline-axis"></i>
...
@@ -354,8 +365,9 @@
...
@@ -354,8 +365,9 @@
if
(
res
.
code
==
'0'
)
{
if
(
res
.
code
==
'0'
)
{
roleData
=
helper
.
clone
(
true
,
res
.
data
)
roleData
=
helper
.
clone
(
true
,
res
.
data
)
for
(
var
i
in
basicArr
)
{
for
(
var
i
in
basicArr
)
{
if
(
basicArr
[
i
]
==
'businessScopName'
&&
roleData
.
businessScopeCustomize
)
{
if
(
basicArr
[
i
]
==
'businessScopName'
&&
roleData
.
businessScopeCustomize
)
{
roleData
.
businessScopName
=
roleData
.
businessScopName
?
(
roleData
.
businessScopName
+
','
+
roleData
.
businessScopeCustomize
)
:
roleData
.
businessScopeCustomize
roleData
.
businessScopName
=
roleData
.
businessScopName
?
(
roleData
.
businessScopName
+
','
+
roleData
.
businessScopeCustomize
)
:
roleData
.
businessScopeCustomize
}
}
$
(
'#'
+
[
basicArr
[
i
]]).
text
(
roleData
[
basicArr
[
i
]]
?
roleData
[
basicArr
[
i
]]
:
'无'
)
$
(
'#'
+
[
basicArr
[
i
]]).
text
(
roleData
[
basicArr
[
i
]]
?
roleData
[
basicArr
[
i
]]
:
'无'
)
}
}
...
@@ -435,28 +447,45 @@
...
@@ -435,28 +447,45 @@
console
.
log
(
res
.
data
)
console
.
log
(
res
.
data
)
var
data
=
res
.
data
var
data
=
res
.
data
$
(
'#secondmerchantName'
).
text
(
data
.
merchantName
)
$
(
'#secondmerchantName'
).
text
(
data
.
merchantName
)
$
(
'#secondmerchantName'
).
attr
(
'title'
,
data
.
merchantName
);
$
(
'#secondmerchantName'
).
attr
(
'title'
,
data
.
merchantName
);
$
(
'#secondmerchantId'
).
text
(
data
.
merchantNo
)
$
(
'#secondmerchantId'
).
text
(
data
.
merchantNo
)
$
(
'#numberOfSubMerchants'
).
text
(
data
.
numberOfSubMerchants
)
$
(
'#numberOfSubMerchants'
).
text
(
data
.
numberOfSubMerchants
)
$
(
'#numberOfStores'
).
text
(
data
.
numberOfStores
)
$
(
'#numberOfStores'
).
text
(
data
.
numberOfStores
)
$
(
'#merchantNameTable'
).
text
(
data
.
merchantName
)
$
(
'#merchantNameTable'
).
text
(
data
.
merchantName
)
$
(
'#merchantNameTable'
).
attr
(
'title'
,
data
.
merchantName
+
'员工列表'
);
$
(
'#merchantNameTable'
).
attr
(
'title'
,
data
.
merchantName
+
'员工列表'
);
})
})
}
}
var
all_nodes
=
null
var
merchants
=
null
// 上下级商户 - 树
// 上下级商户 - 树
function
getSecondTree
()
{
function
getSecondTree
()
{
var
treeParams
=
{
var
treeParams
=
{
id
:
merchantId
,
id
:
merchantId
,
method
:
'cn.com.glsx.merchants.merchant.findMerchantTree'
method
:
'cn.com.glsx.merchants.merchant.findMerchantTree'
}
}
var
merchants
=
{}
request
(
treeParams
,
function
(
res
)
{
request
(
treeParams
,
function
(
res
)
{
if
(
res
.
code
==
'0'
)
{
if
(
res
.
code
==
'0'
)
{
merchants
=
tree
.
create
(
'merchantTree'
,
res
.
data
,
null
,
false
)
merchants
=
tree
.
create
(
'merchantTree'
,
res
.
data
,
null
,
false
)
merchants
.
expandAll
(
true
)
merchants
.
expandAll
(
true
)
all_nodes
=
merchants
.
getNodes
()
bindEvent
()
}
})
}
function
bindEvent
()
{
$
(
'#merchantBtn'
).
on
(
'click'
,
function
()
{
var
txt
=
$
(
'#treeInput'
).
val
()
if
(
!
txt
)
{
merchants
.
showNodes
(
all_nodes
)
}
else
{
var
show_nodes
=
merchants
.
getNodesByParamFuzzy
(
'label'
,
txt
)
merchants
.
hideNodes
(
all_nodes
)
merchants
.
showNodes
(
show_nodes
)
}
}
})
})
return
false
}
}
// 列表配置
// 列表配置
...
@@ -465,41 +494,41 @@
...
@@ -465,41 +494,41 @@
page
:
true
,
page
:
true
,
cols
:
[
cols
:
[
[{
[{
field
:
''
,
field
:
''
,
title
:
'序号'
,
title
:
'序号'
,
type
:
'numbers'
,
type
:
'numbers'
,
width
:
80
width
:
80
},
},
{
{
field
:
'staffName'
,
field
:
'staffName'
,
title
:
'员工姓名'
,
title
:
'员工姓名'
,
width
:
200
,
width
:
200
,
align
:
'center'
align
:
'center'
},
},
{
{
field
:
'roleName'
,
field
:
'roleName'
,
title
:
'角色'
,
title
:
'角色'
,
width
:
200
,
width
:
200
,
align
:
'center'
align
:
'center'
},
},
{
{
field
:
'staffPhone'
,
field
:
'staffPhone'
,
title
:
'登录账户'
,
title
:
'登录账户'
,
width
:
200
,
width
:
200
,
align
:
'center'
align
:
'center'
},
},
{
{
field
:
'createdAccount'
,
field
:
'createdAccount'
,
title
:
'创建者'
,
title
:
'创建者'
,
width
:
200
,
width
:
200
,
align
:
'center'
align
:
'center'
},
},
{
{
field
:
'createdTime'
,
field
:
'createdTime'
,
title
:
'创建时间'
,
title
:
'创建时间'
,
width
:
200
,
width
:
200
,
align
:
'center'
align
:
'center'
}
}
]
]
]
]
})
})
...
@@ -511,6 +540,7 @@
...
@@ -511,6 +540,7 @@
getSecondTable
(
subMerchantTable
,
{
getSecondTable
(
subMerchantTable
,
{
keyword
:
search
keyword
:
search
})
})
return
false
})
})
$
(
'#closeEl'
).
on
(
'click'
,
function
()
{
$
(
'#closeEl'
).
on
(
'click'
,
function
()
{
...
...
html/merchant/edit.html
View file @
d5b9c01
...
@@ -101,6 +101,13 @@
...
@@ -101,6 +101,13 @@
margin-left
:
160px
;
margin-left
:
160px
;
}
}
.form-right
{
position
:
absolute
;
right
:
0
;
top
:
0
;
transform
:
translateX
(
110%
);
}
.edit-box
#accountTypeEl
.layui-form-checked
span
,
.edit-box
#accountTypeEl
.layui-form-checked
span
,
#accountTypeEl
.layui-form-checked
:hover
span
{
#accountTypeEl
.layui-form-checked
:hover
span
{
background-color
:
#1989FA
!important
;
background-color
:
#1989FA
!important
;
...
@@ -295,14 +302,15 @@
...
@@ -295,14 +302,15 @@
<label
class=
"layui-form-label required"
>
登录账户名:
</label>
<label
class=
"layui-form-label required"
>
登录账户名:
</label>
<div
class=
"layui-input-inline"
>
<div
class=
"layui-input-inline"
>
<input
class=
"layui-input"
id=
"merchantLoginAccountEl"
name=
"merchantLoginAccount"
maxlength=
"15"
<input
class=
"layui-input"
id=
"merchantLoginAccountEl"
name=
"merchantLoginAccount"
maxlength=
"15"
placeholder=
"请输入登录账户名"
required
lay-verify=
"required"
>
placeholder=
"请输入登录账户名"
required
lay-verify=
"required
|merchantLoginAccount
"
>
</div>
</div>
</div>
</div>
<div
class=
"layui-form-item"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label required"
>
登录密码:
</label>
<label
class=
"layui-form-label required"
>
登录密码:
</label>
<div
class=
"layui-input-inline"
>
<div
class=
"layui-input-inline"
>
<input
class=
"layui-input"
type=
"password"
name=
"merchantLoginPassword"
maxlength=
"15"
<input
class=
"layui-input"
type=
"password"
id=
"password"
name=
"merchantLoginPassword"
maxlength=
"15"
placeholder=
"请输入登录密码"
required
lay-verify=
"required"
>
placeholder=
"请输入登录密码"
required
lay-verify=
"required|merchantLoginPassword"
>
<button
type=
"button"
class=
"layui-btn form-right"
id=
"resetpsw"
>
重置密码
</button>
</div>
</div>
</div>
</div>
<div
class=
"layui-form-item"
>
<div
class=
"layui-form-item"
>
...
@@ -442,6 +450,18 @@
...
@@ -442,6 +450,18 @@
editLevel
=
qs
(
'editLevel'
)
editLevel
=
qs
(
'editLevel'
)
isFactory
=
(
qs
(
'isFactory'
)
==
'true'
)
isFactory
=
(
qs
(
'isFactory'
)
==
'true'
)
step
=
qs
(
'step'
)
step
=
qs
(
'step'
)
var
pwd
=
$
(
'#password'
)
// 密码输入框
var
resetpsw
=
$
(
'#resetpsw'
)
// pwd.attr('readonly', false)
// if (id) {
// resetpsw.removeClass('hide')
// resetpsw.addClass('show')
// }
// 重置密码
resetpsw
.
on
(
'click'
,
function
()
{
pwd
.
attr
(
'readonly'
,
false
)
pwd
.
val
(
''
)
})
init
()
init
()
// helper.store.set('merchantMapObj', {
// helper.store.set('merchantMapObj', {
...
@@ -454,9 +474,22 @@
...
@@ -454,9 +474,22 @@
// console.log(validator.PHONEREG)
// console.log(validator.PHONEREG)
// 校验
// 校验
form
.
verify
({
form
.
verify
({
// merchantOrgcode: function(value) {
// merchantOrgcode: function (value) {
// var merchantType = $('#merchantTypeEl option:selected').val()
// if(value && (merchantType == '1') && !validator.checkIdCard(value)) {
// return '请填入正确的身份证'
// }
// },
// },
merchantLoginAccount
:
function
(
value
)
{
if
(
value
&&
value
.
length
<
3
)
{
return
'登录账户名请填入3-15位字符'
}
},
merchantLoginPassword
:
function
(
value
)
{
if
(
value
&&
value
.
length
<
6
)
{
return
'登录账户名请填入6-15位字符'
}
},
residentPhone
:
function
(
value
)
{
residentPhone
:
function
(
value
)
{
if
(
value
&&
!
validator
.
checkPhoneNumber
(
value
))
{
if
(
value
&&
!
validator
.
checkPhoneNumber
(
value
))
{
return
'请填入正确的驻店电话'
return
'请填入正确的驻店电话'
...
@@ -756,6 +789,9 @@
...
@@ -756,6 +789,9 @@
function
init
()
{
function
init
()
{
getChannel
()
getPeriod
()
if
(
step
==
1
)
{
if
(
step
==
1
)
{
baseIsShow
(
true
)
baseIsShow
(
true
)
treeIsShow
(
false
)
treeIsShow
(
false
)
...
@@ -808,16 +844,13 @@
...
@@ -808,16 +844,13 @@
getParentInfo
()
getParentInfo
()
}
else
{
}
else
{
$
(
'#merchantLoginAccountEl'
).
attr
(
'disabled'
,
true
)
$
(
'#merchantLoginAccountEl'
).
attr
(
'disabled'
,
true
)
$
(
'#accountLevelEl'
).
attr
(
'disabled'
,
true
)
$
(
'#accountLevelEl'
).
attr
(
'disabled'
,
true
)
}
}
}
}
}
}
if
(
isFactory
)
{
if
(
isFactory
)
{
$
(
'#subMerchantEl'
).
hide
()
$
(
'#subMerchantEl'
).
hide
()
}
}
getChannel
()
getPeriod
()
}
}
function
bindEvent
()
{
function
bindEvent
()
{
...
...
js/validator.js
View file @
d5b9c01
...
@@ -41,85 +41,85 @@ layui.define(['store'], function (exports) {
...
@@ -41,85 +41,85 @@ layui.define(['store'], function (exports) {
},
},
// 身份证验证
// 身份证验证
//
checkIdCard: function (code) {
checkIdCard
:
function
(
code
)
{
//
var city = {
var
city
=
{
//
11: '北京',
11
:
'北京'
,
//
12: '天津',
12
:
'天津'
,
//
13: '河北',
13
:
'河北'
,
//
14: '山西',
14
:
'山西'
,
//
15: '内蒙古',
15
:
'内蒙古'
,
//
21: '辽宁',
21
:
'辽宁'
,
//
22: '吉林',
22
:
'吉林'
,
//
23: '黑龙江',
23
:
'黑龙江'
,
//
31: '上海',
31
:
'上海'
,
//
32: '江苏',
32
:
'江苏'
,
//
33: '浙江',
33
:
'浙江'
,
//
34: '安徽',
34
:
'安徽'
,
//
35: '福建',
35
:
'福建'
,
//
36: '江西',
36
:
'江西'
,
//
37: '山东',
37
:
'山东'
,
//
41: '河南',
41
:
'河南'
,
//
42: '湖北',
42
:
'湖北'
,
//
43: '湖南',
43
:
'湖南'
,
//
44: '广东',
44
:
'广东'
,
//
45: '广西',
45
:
'广西'
,
//
46: '海南',
46
:
'海南'
,
//
50: '重庆',
50
:
'重庆'
,
//
51: '四川',
51
:
'四川'
,
//
52: '贵州',
52
:
'贵州'
,
//
53: '云南',
53
:
'云南'
,
//
54: '西藏',
54
:
'西藏'
,
//
61: '陕西',
61
:
'陕西'
,
//
62: '甘肃',
62
:
'甘肃'
,
//
63: '青海',
63
:
'青海'
,
//
64: '宁夏',
64
:
'宁夏'
,
//
65: '新疆',
65
:
'新疆'
,
//
71: '台湾',
71
:
'台湾'
,
//
81: '香港',
81
:
'香港'
,
//
82: '澳门',
82
:
'澳门'
,
//
91: '国外 '
91
:
'国外 '
//
}
}
//
// var tip = ''
// var tip = ''
//
var pass = true
var
pass
=
true
//
// 身份证位数为15或18位
// 身份证位数为15或18位
//
// if (![15, 18].includes(code.length)) {
// if (![15, 18].includes(code.length)) {
//
if ((code.length != 15) || (code.length != 18)) {
if
((
code
.
length
!=
15
)
||
(
code
.
length
!=
18
))
{
//
pass = false
pass
=
false
//
} else if (!code || (code.length === 18 && !/^\d{6}(18|19|20)\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test(code))) {
}
else
if
(
!
code
||
(
code
.
length
===
18
&&
!
/^
\d{6}(
18|19|20
)\d{2}(
0
[
1-9
]
|1
[
012
])(
0
[
1-9
]
|
[
12
]\d
|3
[
01
])\d{3}(\d
|X
)
$/i
.
test
(
code
)))
{
//
// tip = '身份证号格式错误'
// tip = '身份证号格式错误'
//
pass = false
pass
=
false
//
} else if (code.length === 15 && !/^\d{6}\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}$/i.test(code)) {
}
else
if
(
code
.
length
===
15
&&
!
/^
\d{6}\d{2}(
0
[
1-9
]
|1
[
012
])(
0
[
1-9
]
|
[
12
]\d
|3
[
01
])\d{3}
$/i
.
test
(
code
))
{
//
pass = false
pass
=
false
//
} else if (!city[code.substr(0, 2)]) {
}
else
if
(
!
city
[
code
.
substr
(
0
,
2
)])
{
//
// tip = '地址编码错误'
// tip = '地址编码错误'
//
pass = false
pass
=
false
//
} else {
}
else
{
//
// 18位身份证需要验证最后一位校验位
// 18位身份证需要验证最后一位校验位
//
if (code.length === 18) {
if
(
code
.
length
===
18
)
{
//
code = code.split('')
code
=
code
.
split
(
''
)
//
// ∑(ai×Wi)(mod 11)
// ∑(ai×Wi)(mod 11)
//
// 加权因子
// 加权因子
//
var factor = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2]
var
factor
=
[
7
,
9
,
10
,
5
,
8
,
4
,
2
,
1
,
6
,
3
,
7
,
9
,
10
,
5
,
8
,
4
,
2
]
//
// 校验位
// 校验位
//
var parity = [1, 0, 'X', 9, 8, 7, 6, 5, 4, 3, 2]
var
parity
=
[
1
,
0
,
'X'
,
9
,
8
,
7
,
6
,
5
,
4
,
3
,
2
]
//
var sum = 0
var
sum
=
0
//
var ai = 0
var
ai
=
0
//
var wi = 0
var
wi
=
0
//
for (var i = 0; i < 17; i++) {
for
(
var
i
=
0
;
i
<
17
;
i
++
)
{
//
ai = code[i]
ai
=
code
[
i
]
//
wi = factor[i]
wi
=
factor
[
i
]
//
sum += ai * wi
sum
+=
ai
*
wi
//
}
}
//
// var last = parity[sum % 11]
// var last = parity[sum % 11]
//
if (parity[sum % 11] != code[17]) {
if
(
parity
[
sum
%
11
]
!=
code
[
17
])
{
//
// tip = '校验位错误'
// tip = '校验位错误'
//
pass = false
pass
=
false
//
}
}
//
}
}
//
}
}
//
// if (!pass) alert(tip)
// if (!pass) alert(tip)
//
return pass
return
pass
//
}
}
}
}
exports
(
'validator'
,
validator
)
exports
(
'validator'
,
validator
)
})
})
\ No newline at end of file
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment