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
69368f13
Commit
69368f13
authored
Jul 13, 2022
by
xue_wengang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
水印
parent
ec753e31
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
61 deletions
+66
-61
src/main.js
+0
-9
src/router/index.js
+21
-9
src/utils/watermark.js
+45
-43
No files found.
src/main.js
View file @
69368f13
...
...
@@ -14,7 +14,6 @@ import store from "./store";
import
"./plugins/element.js"
;
import
Util
from
"./utils/util"
;
import
VueWechatTitle
from
"vue-wechat-title"
;
import
Watermark
from
"./utils/watermark.js"
import
Driver
from
'driver.js'
import
'driver.js/dist/driver.min.css'
import
'./assets/iconfont/iconfont.css'
...
...
@@ -54,14 +53,6 @@ Vue.prototype.$bus = new Vue()
window
.
util
=
Util
;
Vue
.
use
(
VueWechatTitle
);
let
userInfo
=
window
.
sessionStorage
.
getItem
(
"userInfo"
)
||
""
;
if
(
userInfo
)
{
userInfo
=
JSON
.
parse
(
window
.
sessionStorage
.
getItem
(
"userInfo"
))
let
info
=
`
${
userInfo
.
realname
}
${
userInfo
.
identitycard
}
`
let
zjhm
=
userInfo
.
identitycard
.
replace
(
/^
(
.
{10})(?:\d
+
)(
.
{4})
$/
,
"$1****$2"
)
Watermark
.
set
(
userInfo
.
realname
,
zjhm
,
userInfo
.
ip
)
}
Vue
.
directive
(
"nsLoading"
,
{
bind
(
el
,
binding
)
{
const
instance
=
new
LoadingCons
({
...
...
src/router/index.js
View file @
69368f13
...
...
@@ -54,7 +54,8 @@ import xsspPtRoutes from "./modules/xsspPt";
import
pgypbgglRoutes
from
"./modules/pgypbggl"
;
import
commonServerRoutes
from
"./modules/commonServer"
;
import
aiModuleRoutes
from
"./modules/aiModule"
;
import
Watermark
from
"../utils/watermark.js"
import
moment
from
'../utils/util'
import
rwddRoutes
from
"./modules/rwddzx"
;
import
zcxwRoutes
from
"./modules/zcxw"
;
...
...
@@ -153,15 +154,26 @@ const router = createRouter()
// });
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
if
(
to
.
meta
.
isAdd
)
{
if
(
!
to
.
meta
.
langTile
)
{
to
.
meta
.
langTile
=
to
.
meta
.
title
;
}
let
str
=
`新增
${
to
.
meta
.
langTile
}
`
;
if
(
to
.
query
.
xxzjbh
)
{
str
=
`修改
${
to
.
meta
.
langTile
}
`
;
if
(
to
.
path
!=
'/login'
&&
to
.
path
!=
'/jump'
)
{
if
(
to
.
meta
.
isAdd
)
{
if
(
!
to
.
meta
.
langTile
)
{
to
.
meta
.
langTile
=
to
.
meta
.
title
;
}
let
str
=
`新增
${
to
.
meta
.
langTile
}
`
;
if
(
to
.
query
.
xxzjbh
)
{
str
=
`修改
${
to
.
meta
.
langTile
}
`
;
}
to
.
meta
.
title
=
str
;
}
to
.
meta
.
title
=
str
;
let
userInfo
=
JSON
.
parse
(
window
.
sessionStorage
.
getItem
(
"userInfo"
))
let
name
=
userInfo
.
realname
.
substring
(
0
,
userInfo
.
realname
.
length
-
1
)
let
names
=
userInfo
.
realname
.
replace
(
name
,
'***'
)
let
zjhm
=
userInfo
.
identitycard
.
replace
(
/^
(
.
{10})(?:\d
+
)(
.
{4})
$/
,
"$1****$2"
)
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
)
}
next
()
})
...
...
src/utils/watermark.js
View file @
69368f13
let
watermark
=
{}
let
setWatermark
=
(
str
,
str3
,
str4
,
str5
)
=>
{
let
id
=
'1.23452384164.123412415'
if
(
document
.
getElementById
(
id
)
!==
null
)
{
document
.
body
.
removeChild
(
document
.
getElementById
(
id
))
}
let
can
=
document
.
createElement
(
'canvas'
)
can
.
width
=
3
00
can
.
height
=
23
0
let
cans
=
can
.
getContext
(
'2d'
)
cans
.
rotate
(
-
20
*
Math
.
PI
/
180
)
cans
.
font
=
'13
px Vedana'
cans
.
fillStyle
=
'rgba(0, 0, 0, 0.1
)'
cans
.
textAlign
=
'left'
cans
.
textBaseline
=
'Middle'
cans
.
fillText
(
str
,
can
.
width
/
3
,
can
.
height
/
2
)
cans
.
fillText
(
str3
,
can
.
width
/
3
,
can
.
height
/
1.73
)
cans
.
fillText
(
str4
,
can
.
width
/
3
,
can
.
height
/
1.5
5
)
// cans.fillText(str5, can.width / 3, can.height / 1.38
)
let
div
=
document
.
createElement
(
'div'
)
div
.
id
=
id
div
.
style
.
pointerEvents
=
'none'
div
.
style
.
top
=
'7
0px'
div
.
style
.
left
=
'5
0px'
div
.
style
.
position
=
'fixed'
div
.
style
.
zIndex
=
'100000'
div
.
style
.
width
=
document
.
documentElement
.
clientWidth
-
125
+
'px'
div
.
style
.
height
=
document
.
documentElement
.
clientHeight
-
125
+
'px'
div
.
style
.
background
=
'url('
+
can
.
toDataURL
(
'image/png'
)
+
') left top repeat'
document
.
body
.
appendChild
(
div
)
return
id
let
setWatermark
=
(
str
1
,
str2
,
str3
,
str4
)
=>
{
let
id
=
'1.23452384164.123412415'
if
(
document
.
getElementById
(
id
)
!==
null
)
{
document
.
body
.
removeChild
(
document
.
getElementById
(
id
))
}
let
can
=
document
.
createElement
(
'canvas'
)
can
.
width
=
6
00
can
.
height
=
40
0
let
cans
=
can
.
getContext
(
'2d'
)
cans
.
rotate
(
-
20
*
Math
.
PI
/
180
)
cans
.
font
=
'16
px Vedana'
cans
.
fillStyle
=
'rgba(0, 0, 0, 0.35
)'
cans
.
textAlign
=
'left'
cans
.
textBaseline
=
'Middle'
cans
.
fillText
(
str1
,
can
.
width
/
3
,
can
.
height
/
2
)
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
)
let
div
=
document
.
createElement
(
'div'
)
div
.
id
=
id
div
.
style
.
pointerEvents
=
'none'
div
.
style
.
top
=
'1
0px'
div
.
style
.
left
=
'
0px'
div
.
style
.
position
=
'fixed'
div
.
style
.
zIndex
=
'100000'
div
.
style
.
width
=
document
.
documentElement
.
clientWidth
-
10
+
'px'
div
.
style
.
height
=
document
.
documentElement
.
clientHeight
-
10
+
'px'
div
.
style
.
background
=
'url('
+
can
.
toDataURL
(
'image/png'
)
+
') left top repeat'
document
.
body
.
appendChild
(
div
)
return
id
}
// 该方法只允许调用一次
watermark
.
set
=
(
str
,
str3
,
str4
)
=>
{
let
id
=
setWatermark
(
str
,
str3
,
str4
)
setInterval
(()
=>
{
if
(
document
.
getElementById
(
id
)
===
null
)
{
id
=
setWatermark
(
str
,
str3
,
str4
)
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
)
}
},
500
)
window
.
onresize
=
()
=>
{
setWatermark
(
str1
,
str2
,
str3
,
str4
)
}
},
500
)
window
.
onresize
=
()
=>
{
setWatermark
(
str
,
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