Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx
/
scrm-wx-merchant-activity
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 ec0b5cdc
authored
Dec 15, 2022
by
李伟康
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
车牌组件增加粘贴功能
1 parent
353e454e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
4 deletions
src/components/LicensePlate.vue
src/config/env.development.js
src/components/LicensePlate.vue
View file @
ec0b5cd
...
@@ -42,6 +42,16 @@
...
@@ -42,6 +42,16 @@
</div>
</div>
</template>
</template>
</div>
</div>
<
template
v-if=
"showPasteButton"
>
<button
class=
"paste"
@
click=
"paste"
@
touchstart=
"touchstart"
@
touchend=
"touchend"
>
一键粘贴
</button>
</
template
>
</div>
</div>
<div
class=
"license-plate-bottom"
>
<div
class=
"license-plate-bottom"
>
<div
<div
...
@@ -119,7 +129,8 @@
...
@@ -119,7 +129,8 @@
</template>
</template>
<
script
type=
'text/ecmascript-6'
>
<
script
type=
'text/ecmascript-6'
>
const
suffix
=
'港澳学挂'
,
const
suffix
=
'港澳学挂'
,
city
=
'京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼'
city
=
'京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼'
,
platNumberRex
=
/^
([
京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼
][
A-Z
][
A-HJ-NP-Z0-9
]{4,5}[
A-HJ-NP-Z0-9挂学港澳
])
$/
export
default
{
export
default
{
name
:
'LicensePlate'
,
name
:
'LicensePlate'
,
data
()
{
data
()
{
...
@@ -135,9 +146,12 @@ export default {
...
@@ -135,9 +146,12 @@ export default {
suffix
:
[],
suffix
:
[],
keyboardDisabled
:
false
,
keyboardDisabled
:
false
,
hidden
:
false
,
hidden
:
false
,
showPasteButton
:
false
}
}
},
},
mounted
()
{
mounted
()
{
/**navigator.clipboard 只支持https */
if
(
navigator
.
clipboard
)
this
.
showPasteButton
=
true
this
.
cityList
=
[...
city
]
this
.
cityList
=
[...
city
]
this
.
letter
=
[...
'ABCDEFGHJKLMNPQRSTUVWXYZ'
]
this
.
letter
=
[...
'ABCDEFGHJKLMNPQRSTUVWXYZ'
]
this
.
suffix
=
[...
suffix
]
this
.
suffix
=
[...
suffix
]
...
@@ -179,8 +193,7 @@ export default {
...
@@ -179,8 +193,7 @@ export default {
let
{
let
{
plateNo
plateNo
}
=
this
,
}
=
this
,
plateNoErr
=
false
,
plateNoErr
=
false
platNumberRex
=
/^
([
京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼
][
A-Z
][
A-HJ-NP-Z0-9
]{4,5}[
A-HJ-NP-Z0-9挂学港澳
])
$/
/**车牌后缀 */
/**车牌后缀 */
if
(
plateNo
[
6
]
&&
plateNo
[
7
]
&&
suffix
.
includes
(
plateNo
[
6
]))
this
.
plateNo
[
7
]
=
''
if
(
plateNo
[
6
]
&&
plateNo
[
7
]
&&
suffix
.
includes
(
plateNo
[
6
]))
this
.
plateNo
[
7
]
=
''
...
@@ -203,6 +216,24 @@ export default {
...
@@ -203,6 +216,24 @@ export default {
this
.
$emit
(
'done'
,
{
value
})
this
.
$emit
(
'done'
,
{
value
})
this
.
toggle
()
this
.
toggle
()
},
},
async
paste
()
{
if
(
navigator
.
clipboard
)
{
try
{
let
data
=
await
navigator
.
clipboard
.
readText
(),
value
=
data
.
toUpperCase
(),
plateNo
=
[...
value
].
filter
(
e
=>
e
&&
e
!=
''
&&
/
[\u
4e00-
\u
9fa5
\w]
/
.
test
(
e
))
while
(
plateNo
.
length
<
8
)
plateNo
.
push
(
''
)
plateNo
=
plateNo
.
splice
(
0
,
8
)
if
(
platNumberRex
.
test
(
plateNo
.
join
(
''
)))
{
this
.
plateNo
=
plateNo
this
.
check
()
}
}
catch
(
error
)
{
console
.
log
(
error
)
}
}
}
}
}
}
}
</
script
>
</
script
>
...
@@ -293,6 +324,7 @@ export default {
...
@@ -293,6 +324,7 @@ export default {
width
:
calc
(
100%
-
60px
);
width
:
calc
(
100%
-
60px
);
height
:
46px
;
height
:
46px
;
border
:
none
;
border
:
none
;
border-radius
:
5px
;
}
}
}
}
&
-bottom
{
&
-bottom
{
...
...
src/config/env.development.js
View file @
ec0b5cd
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
module
.
exports
=
{
module
.
exports
=
{
title
:
'加载中...'
,
title
:
'加载中...'
,
request
:
{
request
:
{
baseURL
:
'http://scrm.
test
.glsx.com.cn'
,
// 本地测试项目地址,
baseURL
:
'http://scrm.
dev
.glsx.com.cn'
,
// 本地测试项目地址,
// 设置超时时间
// 设置超时时间
timeout
:
180000
,
timeout
:
180000
,
// 携带凭证
// 携带凭证
...
...
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