修改水印细节

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