Commit 9034aaa6 by xue_wengang

水印

parent c1d07de5
......@@ -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)
}
});
}
......
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment