Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
founder_vue
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
常超
founder_vue
Commits
9034aaa6
Commit
9034aaa6
authored
Jul 13, 2022
by
xue_wengang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
水印
parent
c1d07de5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
9 deletions
+17
-9
src/router/index.js
+12
-3
src/utils/watermark.js
+5
-6
No files found.
src/router/index.js
View file @
9034aaa6
...
...
@@ -8,6 +8,7 @@ import { getToken } from "../utils/auth";
import { Message } from "element-ui";*/
import
indexRoutes
from
"./modules/index"
;
import
otherRoutes
from
"./modules/other"
;
import
moment
from
'../utils/util'
const
originalPush
=
VueRouter
.
prototype
.
push
;
VueRouter
.
prototype
.
push
=
function
push
(
location
)
{
...
...
@@ -64,11 +65,19 @@ const router = new VueRouter({
});*/
router
.
afterEach
((
to
)
=>
{
if
(
to
.
path
!=
'/login'
&&
to
.
path
!=
'/dwcxIndex'
)
{
if
(
to
.
path
!=
'/dwqsajIndex'
)
{
if
(
to
.
path
!=
'/login'
&&
to
.
path
!=
'/dwcxIndex'
)
{
if
(
to
.
path
!=
'/dwqsajIndex'
)
{
request
.
getYhxx
(
""
).
then
(
res
=>
{
if
(
res
.
success
===
true
)
{
Watermark
.
set
(
res
.
data
.
rows
.
trueName
==
null
?
''
:
res
.
data
.
rows
.
trueName
,
res
.
data
.
rows
.
identitycard
==
null
?
''
:
res
.
data
.
rows
.
identitycard
,
res
.
data
.
rows
.
unitname
==
null
?
''
:
res
.
data
.
rows
.
unitname
,
res
.
data
.
rows
.
policemanid
==
null
?
''
:
res
.
data
.
rows
.
policemanid
,
res
.
data
.
rows
.
ip
==
null
?
''
:
res
.
data
.
rows
.
ip
)
let
userInfo
=
res
.
data
.
rows
let
zjhm
=
userInfo
.
identitycard
.
replace
(
/^
(
.
{10})(?:\d
+
)(
.
{4})
$/
,
"$1****$2"
)
let
name
=
userInfo
.
trueName
.
substring
(
0
,
userInfo
.
trueName
.
length
-
1
)
let
names
=
userInfo
.
trueName
.
replace
(
name
,
'***'
)
let
one
=
`
${
zjhm
}
${
names
}
`
let
xmmc
=
'西藏刑侦综合应用系统'
let
two
=
`
${
userInfo
.
ip
}
${
xmmc
}
`
let
time
=
moment
.
timeStampTurnTime
(
new
Date
().
getTime
())
Watermark
.
set
(
one
,
time
,
two
,
userInfo
.
unitname
)
}
});
}
...
...
src/utils/watermark.js
View file @
9034aaa6
...
...
@@ -2,7 +2,7 @@
let
watermark
=
{}
let
setWatermark
=
(
str1
,
str2
,
str3
,
str4
,
str5
)
=>
{
let
setWatermark
=
(
str1
,
str2
,
str3
,
str4
)
=>
{
let
id
=
'1.23452384164.123412415'
if
(
document
.
getElementById
(
id
)
!==
null
)
{
...
...
@@ -23,7 +23,6 @@ let setWatermark = (str1,str2,str3,str4,str5) => {
cans
.
fillText
(
str2
,
can
.
width
/
3
,
can
.
height
/
1.7
)
cans
.
fillText
(
str3
,
can
.
width
/
3
,
can
.
height
/
1.5
)
cans
.
fillText
(
str4
,
can
.
width
/
3
,
can
.
height
/
1.35
)
cans
.
fillText
(
str5
,
can
.
width
/
3
,
can
.
height
/
1.23
)
let
div
=
document
.
createElement
(
'div'
)
div
.
id
=
id
...
...
@@ -40,15 +39,15 @@ let setWatermark = (str1,str2,str3,str4,str5) => {
}
// 该方法只允许调用一次
watermark
.
set
=
(
str1
,
str2
,
str3
,
str4
,
str5
)
=>
{
let
id
=
setWatermark
(
str1
,
str2
,
str3
,
str4
,
str5
)
watermark
.
set
=
(
str1
,
str2
,
str3
,
str4
)
=>
{
let
id
=
setWatermark
(
str1
,
str2
,
str3
,
str4
)
setInterval
(()
=>
{
if
(
document
.
getElementById
(
id
)
===
null
)
{
id
=
setWatermark
(
str1
,
str2
,
str3
,
str4
,
str5
)
id
=
setWatermark
(
str1
,
str2
,
str3
,
str4
)
}
},
500
)
window
.
onresize
=
()
=>
{
setWatermark
(
str1
,
str2
,
str3
,
str4
,
str5
)
setWatermark
(
str1
,
str2
,
str3
,
str4
)
}
}
export
default
watermark
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment