修改水印细节

This commit is contained in:
qq787203167
2022-02-21 16:15:11 +08:00
parent 1ede18bca5
commit 2b3ed371c6
4 changed files with 24 additions and 37 deletions
+7
View File
@@ -75,6 +75,13 @@
},
watch:{
$route:function(val) {
this.$nextTick(() => {
if (document.getElementsByClassName('ant-card-body').length > 0){
this.$watermark.set('fanqiangqiang 范强强')
}
})
}
},
computed:{
},
+3 -19
View File
@@ -1,34 +1,18 @@
let watermark = {}
let setWatermark = (str) => {
let id = '1.23452384164.123412415'
if (document.getElementById(id) !== null) {
document.body.removeChild(document.getElementById(id))
}
let can = document.createElement('canvas')
can.width = 190
can.height = 120
let cans = can.getContext('2d')
cans.rotate(-30 * Math.PI / 180)
cans.font = '15px Vedana'
cans.font = '13px Vedana'
cans.fillStyle = '#f4f4f4'
cans.textAlign = 'left'
cans.textBaseline = 'Middle'
cans.fillText(str, can.width / 20, can.height)
let div = document.createElement('div')
div.id = id
div.style.pointerEvents = 'none'
div.style.top = '-30px'
div.style.left = '0px'
div.style.position = 'absolute'
div.style.zIndex = '1'
div.style.width = '100%'
div.style.height = '100%'
div.style.background = 'url(' + can.toDataURL('image/png') + ') left top repeat'
document.getElementsByClassName('main')[0].appendChild(div)
cans.fillText(str, 10,120)
document.getElementsByClassName('ant-card-body')[0].style.background = 'url(' + can.toDataURL('image/png') + ') left top repeat'
return id
}
+12 -12
View File
@@ -1,18 +1,18 @@
<template>
<div class="main">
<keep-alive :include="includedComponents">
<router-view v-if="keepAlive" />
</keep-alive>
<router-view v-if="!keepAlive" />
<keep-alive :include="includedComponents">
<router-view v-if="keepAlive"/>
</keep-alive>
<router-view v-if="!keepAlive"/>
</div>
</template>
<script>
import Vue from 'vue'
import { CACHE_INCLUDED_ROUTES } from "@/store/mutation-types"
import { CACHE_INCLUDED_ROUTES } from '@/store/mutation-types'
export default {
name: "RouteView",
name: 'RouteView',
computed: {
//update-begin--Author:scott Date:20201015 for:路由缓存问题,关闭了tab页时再打开就不刷新 #842
includedComponents() {
@@ -20,24 +20,24 @@
//如果是缓存路由,则加入到 cache_included_routes
if (this.$route.meta.keepAlive && this.$route.meta.componentName) {
let cacheRouterArray = Vue.ls.get(CACHE_INCLUDED_ROUTES) || []
if(!cacheRouterArray.includes(this.$route.meta.componentName)){
if (!cacheRouterArray.includes(this.$route.meta.componentName)) {
cacheRouterArray.push(this.$route.meta.componentName)
// cacheRouterArray.push("OnlCgformHeadList")
Vue.ls.set(CACHE_INCLUDED_ROUTES, cacheRouterArray)
return cacheRouterArray;
return cacheRouterArray
}
}
return includedRouters;
return includedRouters
},
//update-end--Author:scott Date:20201015 for:路由缓存问题,关闭了tab页时再打开就不刷新 #842
keepAlive () {
keepAlive() {
return this.$route.meta.keepAlive
}
},
}
}
</script>
<style>
.main{
.main {
height: 100%;
overflow: auto;
}
@@ -100,9 +100,7 @@
this.activePage = currentRoute.fullPath
},
mounted() {
this.$nextTick(() => {
this.$watermark.set('测试水印')
})
},
watch: {
'$route': function(newRoute) {
@@ -131,7 +129,6 @@
let oldPositionRoute = this.pageList[oldIndex]
this.pageList.splice(oldIndex, 1, Object.assign({}, newRoute, { meta: oldPositionRoute.meta }))
}
this.$watermark.set('测试水印')
},
'activePage': function(key) {
let index = this.linkList.lastIndexOf(key)
@@ -435,12 +432,11 @@
.main {
position: relative;
background: #fff;
}
.ant-card {
z-index: 999;
background: transparent !important;
background: #fff;
}
.ant-input{
background: transparent !important;