Merge branch 'secondStage' into thirdStage
# Conflicts: # public/api_address_config.js # src/utils/kkFilePreview.js
This commit is contained in:
+4
-1
@@ -2,7 +2,7 @@
|
||||
<a-config-provider :locale="locale">
|
||||
<div id="app">
|
||||
<router-view v-if="isRouterAlive" />
|
||||
<div class="watermark" v-if="show" v-watermark="{text: watermark, textColor: 'rgba(180, 180, 180, 0.2)'}"></div>
|
||||
<div class="watermark" v-if="show" v-watermark="{text: watermark, textColor: watermarkConfig.color}"></div>
|
||||
</div>
|
||||
</a-config-provider>
|
||||
</template>
|
||||
@@ -37,6 +37,9 @@ export default {
|
||||
return this.$store.getters.userInfo.username + this.$store.getters.userInfo.realname
|
||||
}
|
||||
return null
|
||||
},
|
||||
watermarkConfig () {
|
||||
return window._CONFIG.watermarkConfig
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import Vue from 'vue'
|
||||
import { USER_INFO } from '../store/mutation-types'
|
||||
import { Base64 } from 'js-base64'
|
||||
|
||||
const md5 = require('md5')
|
||||
import md5 from 'md5'
|
||||
|
||||
/**
|
||||
* kkFile预览文件并添加水印
|
||||
@@ -13,7 +12,7 @@ export const kkFilePreview = (fileUrl) => {
|
||||
// 水印内容
|
||||
const watermarkTxt = `${userInfo.username} ${userInfo.realname}`
|
||||
// 客户环境预览需要加的加密参数
|
||||
const watermarkSign = md5(watermarkTxt, 'cnhtc')
|
||||
const watermarkSign = md5(watermarkTxt + 'cnhtc')
|
||||
const url = `${window._CONFIG.onlinePreviewDomainURL}?url=${encodeURIComponent(Base64.encode(fileUrl))}&watermarkTxt=${encodeURIComponent(watermarkTxt)}&watermarkSign=${watermarkSign}`
|
||||
window.open(url)
|
||||
}
|
||||
@@ -16,7 +16,7 @@ Vue.directive('watermark', {
|
||||
can.style.display = 'none'
|
||||
const cans = can.getContext('2d')
|
||||
cans.rotate(-20 * Math.PI / 180)
|
||||
cans.font = font || '13px Microsoft Yahei'
|
||||
cans.font = font || window._CONFIG.watermarkConfig.font
|
||||
cans.fillStyle = textColor || '#DDDDDD'
|
||||
cans.textAlign = 'left'
|
||||
cans.textBaseline = 'Middle'
|
||||
@@ -38,6 +38,7 @@ Vue.directive('watermark', {
|
||||
parentNode.appendChild(div)
|
||||
}
|
||||
}
|
||||
|
||||
if (binding.value.text) {
|
||||
addWaterMarker(binding.value.text, el, binding.value.width, binding.value.height, binding.value.font, binding.value.textColor, binding.value.fillTextX)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user