Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx-business
/
ddh-equity
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 e146dcdb
authored
May 24, 2021
by
liwk
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
commit
1 parent
03dd8364
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
11 deletions
src/components/InputGroup.vue
src/views/car/step-one.vue
src/components/InputGroup.vue
View file @
e146dcd
...
...
@@ -7,10 +7,11 @@
>
<input
v-model=
"values[index]"
type=
"
text
"
type=
"
number
"
maxlength=
"1"
@
input=
"input(index)"
@
input=
"input(index
,$event
)"
:ref=
"`focus-$
{index}`"
@keydown="keydown(index,$event)"
>
</div>
</
template
>
...
...
@@ -57,7 +58,16 @@ export default {
}
},
methods
:
{
keydown
(
index
,
$event
)
{
let
{
keyCode
}
=
$event
if
(
keyCode
==
8
)
{
setTimeout
(()
=>
{
if
(
index
>
0
)
this
.
$refs
[
`focus-
${
index
-
1
}
`
][
0
].
focus
()
},
100
)
}
},
input
(
index
)
{
this
.
values
[
index
]
=
this
.
values
[
index
].
substring
(
0
,
1
)
let
{
length
}
=
this
if
(
index
<
length
-
1
&&
this
.
values
[
index
])
this
.
$refs
[
`focus-
${
index
+
1
}
`
][
0
].
focus
()
}
...
...
src/views/car/step-one.vue
View file @
e146dcd
...
...
@@ -34,7 +34,7 @@
</div>
<div
class=
"item"
>
<div
class=
"label"
>
VIN码:
</div>
<div
:class=
"['item-input',{'active':vin}]"
>
<div
:class=
"['item-input',{'active':vin}
,{'err':vinErr}
]"
>
<input
type=
"text"
maxlength=
"17"
...
...
@@ -44,7 +44,7 @@
</div>
<div
class=
"item"
>
<div
class=
"label"
>
车牌号:
</div>
<div
:class=
"['item-input',{'active':plateNumber}]"
>
<div
:class=
"['item-input',{'active':plateNumber}
,{'err':plateNumberErr}
]"
>
<input
type=
"text"
maxlength=
"10"
...
...
@@ -68,7 +68,7 @@
</
template
>
</div>
<div
:class=
"['btn',{'btn-disabled':!vin||!userName||!plateNumber}]"
:class=
"['btn',{'btn-disabled':!vin||!userName||!plateNumber
||plateNumberErr
}]"
v-show=
"vinImg"
@
click=
"submit"
@
touchstart=
"touchstart"
...
...
@@ -103,7 +103,7 @@
</div>
<div
class=
"item"
>
<div
class=
"label"
>
VIN码:
</div>
<div
:class=
"['item-input',{'active':vin}]"
>
<div
:class=
"['item-input',{'active':vin}
,{'err':vinErr}
]"
>
<input
type=
"text"
maxlength=
"17"
...
...
@@ -113,7 +113,7 @@
</div>
<div
class=
"item"
>
<div
class=
"label"
>
车牌号:
</div>
<div
:class=
"['item-input',{'active':plateNumber}]"
>
<div
:class=
"['item-input',{'active':plateNumber}
,{'err':plateNumberErr}
]"
>
<input
type=
"text"
maxlength=
"10"
...
...
@@ -123,7 +123,7 @@
</div>
</div>
<div
:class=
"['btn',{'btn-disabled':!vin||!userName||!plateNumber}]"
:class=
"['btn',{'btn-disabled':!vin||!userName||!plateNumber
|| vinErr||plateNumberErr
}]"
@
click=
"submit"
@
touchstart=
"touchstart"
@
touchend=
"touchend"
...
...
@@ -156,10 +156,27 @@ export default {
userName
:
''
,
vin
:
''
,
plateNumber
:
''
,
showInput
:
false
showInput
:
false
,
vinErr
:
false
,
plateNumberErr
:
false
}
},
mounted
()
{
},
watch
:
{
'vin'
(
n
)
{
if
(
n
)
{
let
rex
=
/^
[
A-HJ-NPR-Z
\d]{17}
$/
this
.
vinErr
=
!
rex
.
test
(
n
)
}
},
'plateNumber'
(
n
)
{
if
(
n
)
{
let
rex
=
/^
([
京津晋冀蒙辽吉黑沪苏浙皖闽赣鲁豫鄂湘粤桂琼渝川贵云藏陕甘青宁新
][
ABCDEFGHJKLMNPQRSTUVWXY
][
1-9DF
][
1-9ABCDEFGHJKLMNPQRSTUVWXYZ
]\d{3}[
1-9DF
]
|
[
京津晋冀蒙辽吉黑沪苏浙皖闽赣鲁豫鄂湘粤桂琼渝川贵云藏陕甘青宁新
][
ABCDEFGHJKLMNPQRSTUVWXY
][\d
ABCDEFGHJKLNMxPQRSTUVWXYZ
]{5})
$/
this
.
plateNumberErr
=
!
rex
.
test
(
n
)
}
}
},
methods
:
{
chooseImage
()
{
...
...
@@ -213,8 +230,8 @@ export default {
this
.
inputType
=
!
inputType
},
submit
()
{
let
{
vin
,
userName
,
plateNumber
}
=
this
if
(
!
vin
||
!
userName
||
!
plateNumber
)
return
let
{
vin
,
userName
,
plateNumber
,
vinErr
,
plateNumberErr
}
=
this
if
(
!
vin
||
!
userName
||
!
plateNumber
||
vinErr
||
plateNumberErr
)
return
this
.
showLoading
(
'校检中...'
)
car
.
checkVin
({
vin
...
...
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