askbot-dragon 1.5.67-beta → 1.5.68-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -154,7 +154,8 @@ export default {
|
|
|
154
154
|
},
|
|
155
155
|
watermark: {
|
|
156
156
|
textWatermarkValue:'',
|
|
157
|
-
visitorWatermarkValue:''
|
|
157
|
+
visitorWatermarkValue:'',
|
|
158
|
+
source:""
|
|
158
159
|
}
|
|
159
160
|
}
|
|
160
161
|
},
|
|
@@ -239,7 +240,8 @@ export default {
|
|
|
239
240
|
"fileInOssPath":url
|
|
240
241
|
}).then(async res =>{
|
|
241
242
|
if(res.data.code == '0') {
|
|
242
|
-
this.watermark = await this.getknowledgeBaseStructure(item.knowledgeId)
|
|
243
|
+
this.watermark = await this.getknowledgeBaseStructure(item.knowledgeId);
|
|
244
|
+
this.watermark.source = item.source;
|
|
243
245
|
this.previewHref = res.data.data;
|
|
244
246
|
this.sourceFileType = url.substring(url.lastIndexOf('.'))
|
|
245
247
|
let isOhmPc = sessionStorage.getItem('isOhmPc')
|
|
@@ -321,9 +323,9 @@ export default {
|
|
|
321
323
|
visitorWatermarkValue:''
|
|
322
324
|
}
|
|
323
325
|
await this.$http.get("/knowledge-api/internal/knowledgeBaseStructure/" + knowledgeId).then( async res =>{
|
|
324
|
-
if(res.data
|
|
325
|
-
watermark.textWatermarkValue = await res.data.
|
|
326
|
-
if(res.data.
|
|
326
|
+
if(res.data) {
|
|
327
|
+
watermark.textWatermarkValue = await res.data.textWatermarkValue
|
|
328
|
+
if(res.data.visitorWatermark) {
|
|
327
329
|
let userInfo = sessionStorage.getItem('userInfo') || localStorage.getItem('userInfo')
|
|
328
330
|
if(userInfo && userInfo !== 'null') {
|
|
329
331
|
watermark.visitorWatermarkValue = JSON.parse(userInfo).realName
|
|
@@ -49,7 +49,7 @@ const CSS_UNITS = 96.0 / 72.0
|
|
|
49
49
|
// import { zoomElement } from '../assets/js/hammer'
|
|
50
50
|
export default {
|
|
51
51
|
name: 'pdfView',
|
|
52
|
-
props: ['tagIds', 'isMessageRecord','fileName'],
|
|
52
|
+
props: ['tagIds', 'isMessageRecord','fileName', "knowledgeItem"],
|
|
53
53
|
data () {
|
|
54
54
|
return {
|
|
55
55
|
url: '',
|
|
@@ -857,6 +857,160 @@ export default {
|
|
|
857
857
|
this.contentView.style.transform = 'scale(' + this.transformSalce + ')';
|
|
858
858
|
// this.getpdfResloutePage(this.cachePdf[0])
|
|
859
859
|
},
|
|
860
|
+
//添加水印
|
|
861
|
+
watermark() {
|
|
862
|
+
//默认设置
|
|
863
|
+
var defaultSettings = {
|
|
864
|
+
watermark_txt:"",
|
|
865
|
+
watermark_x: 0,//水印起始位置x轴坐标
|
|
866
|
+
watermark_y: 0,//水印起始位置Y轴坐标
|
|
867
|
+
watermark_rows: 0,//水印行数
|
|
868
|
+
watermark_cols: 0,//水印列数
|
|
869
|
+
watermark_x_space: 40,//水印x轴间隔
|
|
870
|
+
watermark_y_space: 60,//水印y轴间隔
|
|
871
|
+
watermark_color: 'black',//水印字体颜色
|
|
872
|
+
watermark_alpha: .3,//水印透明度
|
|
873
|
+
watermark_fontsize: 12,//水印字体大小
|
|
874
|
+
watermark_font: '微软雅黑',//水印字体
|
|
875
|
+
watermark_width: 100,//水印宽度
|
|
876
|
+
watermark_height: 80,//水印长度
|
|
877
|
+
watermark_angle: 20,//水印倾斜度数***
|
|
878
|
+
visitorWatermark_txt:""
|
|
879
|
+
};
|
|
880
|
+
if(this.knowledgeItem.textWatermarkValue){
|
|
881
|
+
defaultSettings.watermark_txt = this.knowledgeItem.textWatermarkValue;
|
|
882
|
+
}
|
|
883
|
+
if (this.knowledgeItem.visitorWatermarkValue){
|
|
884
|
+
defaultSettings.visitorWatermark_txt = this.knowledgeItem.visitorWatermarkValue
|
|
885
|
+
}
|
|
886
|
+
//采用配置项替换默认值,作用类似jquery.extend
|
|
887
|
+
if (arguments.length === 1 && typeof arguments[0] === "object") {
|
|
888
|
+
console.log("arguments = " + JSON.stringify(arguments[0]));
|
|
889
|
+
// 获取参数配置
|
|
890
|
+
var src = arguments[0];
|
|
891
|
+
for (let key in src) {
|
|
892
|
+
if (src[key] && defaultSettings[key] && src[key] === defaultSettings[key])
|
|
893
|
+
continue;
|
|
894
|
+
else if (src[key])
|
|
895
|
+
defaultSettings[key] = src[key];
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
var oTemp = document.createDocumentFragment();
|
|
899
|
+
//获取页面最大宽度
|
|
900
|
+
console.debug('pdf_view',document.getElementById('pdf_view'))
|
|
901
|
+
let scrollWidth = document.getElementById('pdf_view').scrollWidth;
|
|
902
|
+
let clientWidth = document.getElementById('pdf_view').clientWidth;
|
|
903
|
+
var page_width = Math.max(scrollWidth, clientWidth);
|
|
904
|
+
|
|
905
|
+
var cutWidth = page_width * 0.0150;
|
|
906
|
+
|
|
907
|
+
page_width = page_width - cutWidth;
|
|
908
|
+
|
|
909
|
+
//获取页面最大高度
|
|
910
|
+
var page_height = Math.max(document.body.scrollHeight, document.body.clientHeight) + 2860;
|
|
911
|
+
|
|
912
|
+
// var page_height = document.body.scrollHeight+document.body.scrollTop;
|
|
913
|
+
|
|
914
|
+
//如果将水印列数设置为0,或水印列数设置过大,超过页面最大宽度,则重新计算水印列数和水印x轴间隔
|
|
915
|
+
|
|
916
|
+
if (defaultSettings.watermark_cols == 0 || (parseInt(defaultSettings.watermark_x + defaultSettings
|
|
917
|
+
.watermark_width * defaultSettings.watermark_cols + defaultSettings.watermark_x_space *
|
|
918
|
+
(defaultSettings.watermark_cols - 1)) > page_width)) {
|
|
919
|
+
defaultSettings.watermark_cols = parseInt((page_width - defaultSettings.watermark_x + defaultSettings
|
|
920
|
+
.watermark_x_space) / (defaultSettings.watermark_width + defaultSettings
|
|
921
|
+
.watermark_x_space));
|
|
922
|
+
defaultSettings.watermark_x_space = parseInt((page_width - defaultSettings.watermark_x -
|
|
923
|
+
defaultSettings
|
|
924
|
+
.watermark_width * defaultSettings.watermark_cols) / (defaultSettings.watermark_cols - 1));
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
//如果将水印行数设置为0,或水印行数设置过大,超过页面最大长度,则重新计算水印行数和水印y轴间隔
|
|
928
|
+
|
|
929
|
+
if (defaultSettings.watermark_rows == 0 || (parseInt(defaultSettings.watermark_y + defaultSettings
|
|
930
|
+
|
|
931
|
+
.watermark_height * defaultSettings.watermark_rows + defaultSettings.watermark_y_space * (
|
|
932
|
+
|
|
933
|
+
defaultSettings.watermark_rows - 1)) > page_height)) {
|
|
934
|
+
|
|
935
|
+
defaultSettings.watermark_rows = parseInt((defaultSettings.watermark_y_space + page_height -
|
|
936
|
+
|
|
937
|
+
defaultSettings
|
|
938
|
+
|
|
939
|
+
.watermark_y) / (defaultSettings.watermark_height + defaultSettings.watermark_y_space));
|
|
940
|
+
|
|
941
|
+
defaultSettings.watermark_y_space = parseInt(((page_height - defaultSettings.watermark_y) -
|
|
942
|
+
|
|
943
|
+
defaultSettings
|
|
944
|
+
|
|
945
|
+
.watermark_height * defaultSettings.watermark_rows) / (defaultSettings.watermark_rows - 1));
|
|
946
|
+
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
var x;
|
|
950
|
+
|
|
951
|
+
var y;
|
|
952
|
+
|
|
953
|
+
for (var i = 0; i < defaultSettings.watermark_rows; i++) {
|
|
954
|
+
y = defaultSettings.watermark_y + (defaultSettings.watermark_y_space + defaultSettings.watermark_height) * i;
|
|
955
|
+
for (var j = 0; j < defaultSettings.watermark_cols; j++) {
|
|
956
|
+
x = defaultSettings.watermark_x + (defaultSettings.watermark_width + defaultSettings.watermark_x_space) * j;
|
|
957
|
+
|
|
958
|
+
var mask_div = document.createElement('div');
|
|
959
|
+
mask_div.id = 'mask_div' + i + j;
|
|
960
|
+
mask_div.className = 'mask_div';
|
|
961
|
+
|
|
962
|
+
//注意看这里加了图片水印
|
|
963
|
+
mask_div.style.webkitTransform = "rotate(-" + defaultSettings.watermark_angle + "deg)";
|
|
964
|
+
mask_div.style.MozTransform = "rotate(-" + defaultSettings.watermark_angle + "deg)";
|
|
965
|
+
mask_div.style.msTransform = "rotate(-" + defaultSettings.watermark_angle + "deg)";
|
|
966
|
+
mask_div.style.OTransform = "rotate(-" + defaultSettings.watermark_angle + "deg)";
|
|
967
|
+
mask_div.style.transform = "rotate(-" + defaultSettings.watermark_angle + "deg)";
|
|
968
|
+
mask_div.style.visibility = "";
|
|
969
|
+
mask_div.style.position = "absolute";
|
|
970
|
+
//奇偶行错开,这样水印就不对齐,显的不呆板
|
|
971
|
+
console.debug('x',x)
|
|
972
|
+
if (i % 2 != 0) {
|
|
973
|
+
mask_div.style.left = x + 'px';
|
|
974
|
+
if (j % 2 != 0 && this.knowledgeItem.visitorWatermarkValue){
|
|
975
|
+
mask_div.appendChild(document.createTextNode(defaultSettings.visitorWatermark_txt));
|
|
976
|
+
} else {
|
|
977
|
+
if (!this.knowledgeItem.textWatermarkValue){
|
|
978
|
+
mask_div.appendChild(document.createTextNode(defaultSettings.visitorWatermark_txt));
|
|
979
|
+
} else {
|
|
980
|
+
mask_div.appendChild(document.createTextNode(defaultSettings.watermark_txt));
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
} else {
|
|
984
|
+
mask_div.style.left = x + 'px';
|
|
985
|
+
if (j % 2 != 0 && this.knowledgeItem.textWatermarkValue){
|
|
986
|
+
mask_div.appendChild(document.createTextNode(defaultSettings.watermark_txt));
|
|
987
|
+
} else {
|
|
988
|
+
if (!this.knowledgeItem.visitorWatermarkValue){
|
|
989
|
+
mask_div.appendChild(document.createTextNode(defaultSettings.watermark_txt));
|
|
990
|
+
} else {
|
|
991
|
+
mask_div.appendChild(document.createTextNode(defaultSettings.visitorWatermark_txt));
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
mask_div.style.top = y + 'px';
|
|
997
|
+
mask_div.style.overflow = "hidden";
|
|
998
|
+
mask_div.style.zIndex = "9999";
|
|
999
|
+
mask_div.style.pointerEvents = 'none'; //让水印不遮挡页面的点击事件
|
|
1000
|
+
mask_div.style.opacity = defaultSettings.watermark_alpha;
|
|
1001
|
+
mask_div.style.fontSize = defaultSettings.watermark_fontsize;
|
|
1002
|
+
mask_div.style.fontFamily = defaultSettings.watermark_font;
|
|
1003
|
+
mask_div.style.color = defaultSettings.watermark_color;
|
|
1004
|
+
mask_div.style.textAlign = "center";
|
|
1005
|
+
mask_div.style.width = defaultSettings.watermark_width + 'px';
|
|
1006
|
+
mask_div.style.height = defaultSettings.watermark_height + 'px';
|
|
1007
|
+
mask_div.style.display = "block";
|
|
1008
|
+
oTemp.appendChild(mask_div);
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
this.contentView.appendChild(oTemp);
|
|
1012
|
+
|
|
1013
|
+
},
|
|
860
1014
|
},
|
|
861
1015
|
computed: {
|
|
862
1016
|
perviewUrl () {
|
|
@@ -886,7 +1040,13 @@ export default {
|
|
|
886
1040
|
this.contentView = document.createElement('div')
|
|
887
1041
|
this.contentView.setAttribute('id','contentView')
|
|
888
1042
|
this.contentView.style.transformOrigin = '0px 0px 0px'
|
|
889
|
-
this
|
|
1043
|
+
this.contentView.setAttribute('id','contentView');
|
|
1044
|
+
this.$nextTick(() => {
|
|
1045
|
+
if (this.knowledgeItem && (this.knowledgeItem.source === 'CORP_LOCAL_FILE' || this.knowledgeItem.source === 'YUQUE' || this.knowledgeItem.source === 'FEISHU') && (this.knowledgeItem.visitorWatermarkValue || this.knowledgeItem.textWatermarkValue)){
|
|
1046
|
+
this.watermark()
|
|
1047
|
+
}
|
|
1048
|
+
})
|
|
1049
|
+
this.$http.get('/knowledge-api/knowledge/knowledge-part-location-info/list?ids=' + value.join(',')).then(res => {
|
|
890
1050
|
// res.data = {"data":[{"id":"64591b7d8bb8ab1b91c65f24","knowledgeId":"64591a9c8da27649473f3b4b","mainId":"fb348d095c0b4fd7bbd37826563dac7d","page":3,"total":18,"pageHeight":540.0,"pageWidth":960.00946,"publicPageFileUrl":"https://askbot-pdf-all.oss-cn-zhangjiakou.aliyuncs.com/fb348d095c0b4fd7bbd37826563dac7d/2023/05/08/11/55/18/64591b638bb8ab1b91c65eed/3.pdf","extractInfo":{"location":[280.488,161.32,398.71573,61.99298],"content":"黄花城水长城旅游区位于北京市怀柔区九渡河镇境内,距北京市区65公里,是以奇而著称,融山川、碧水、古长城为一体的旅游休闲胜地。而这里的“三绝景”更是引人入","lines":[{"content":"黄花城水长城旅游区位于北京市怀柔区九渡河镇境内,距","location":[280.488,161.32,398.71573,15.9869995]},{"content":"北京市区65公里,是以奇而著称,融山川、碧水、古长","location":[283.691,184.30899,392.3055,15.9869995]},{"content":"城为一体的旅游休闲胜地。而这里的“三绝景”更是引人入","location":[282.699,207.32599,394.3033,15.9869995]}],"tagId":null}}],"code":"0","msg":null,"traceId":null}
|
|
891
1051
|
// res.data = {"data":[{"id":"64590ce1eb1320043401cc90","knowledgeId":"64590cd5017b461d67e282e1","mainId":"fb348d095c0b4fd7bbd37826563dac7d","page":2,"total":5,"pageHeight":841.8898,"pageWidth":595.30396,"publicPageFileUrl":"https://askbot-pdf-all.oss-cn-zhangjiakou.aliyuncs.com/fb348d095c0b4fd7bbd37826563dac7d/2023/05/08/10/53/20/64590ce0eb1320043401cc7b/2.pdf","extractInfo":{"location":[89.32981,638.1907,415.15512,98.63251],"content":":北京地铁 13\r号线 :藤黄\r色 :西直门站—\r东直门站 :17 :41.\r5 :6\r准\rB :2002年\r09月\r28日 ","lines":[{"content":":北京地铁 13\r号线 ","location":[89.32981,638.1907,99.44599,98.63251]},{"content":":藤黄\r色 ","location":[188.7758,638.1907,46.79959,98.63251]},{"content":":西直门站—\r东直门站 ","location":[235.5754,638.1907,86.09996,98.63251]},{"content":":17 ","location":[321.67535,638.1907,36.200012,98.63251]},{"content":":41.\r5 ","location":[357.87537,638.1907,39.400696,98.63251]},{"content":":6\r准\rB ","location":[397.27606,638.1907,41.099,98.63251]},{"content":":2002年\r09月\r28日 ","location":[438.37506,638.1907,66.10986,98.63251]}],"tagId":null}}],"code":"0","msg":null,"traceId":null}
|
|
892
1052
|
// res.data = {"data":[{"id":"64591b7d8bb8ab1b91c65f24","knowledgeId":"64591a9c8da27649473f3b4b","mainId":"fb348d095c0b4fd7bbd37826563dac7d","page":3,"total":18,"pageHeight":540.0,"pageWidth":960.00946,"publicPageFileUrl":"https://askbot-pdf-all.oss-cn-zhangjiakou.aliyuncs.com/fb348d095c0b4fd7bbd37826563dac7d/2023/05/08/11/55/18/64591b638bb8ab1b91c65eed/3.pdf","extractInfo":{"location":[280.488,161.32,398.71573,61.99298],"content":"黄花城水长城旅游区位于北京市怀柔区九渡河镇境内,距北京市区65公里,是以奇而著称,融山川、碧水、古长城为一体的旅游休闲胜地。而这里的“三绝景”更是引人入","lines":[{"content":"黄花城水长城旅游区位于北京市怀柔区九渡河镇境内,距","location":[280.488,161.32,398.71573,15.9869995]},{"content":"北京市区65公里,是以奇而著称,融山川、碧水、古长","location":[283.691,184.30899,392.3055,15.9869995]},{"content":"城为一体的旅游休闲胜地。而这里的“三绝景”更是引人入","location":[282.699,207.32599,394.3033,15.9869995]}],"tagId":null}}],"code":"0","msg":null,"traceId":null}
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
</div>
|
|
55
55
|
<div id="drawer_content_pre">
|
|
56
56
|
<template v-if="tagIds && tagIds.length != 0 && drawer">
|
|
57
|
-
<pdfPosition :tagIds="tagIds" :isMessageRecord="isMessageRecord" :fileName="fileName" ref="pdfPosition"></pdfPosition>
|
|
57
|
+
<pdfPosition :tagIds="tagIds" :isMessageRecord="isMessageRecord" :fileName="fileName" :knowledgeItem="watermark" ref="pdfPosition"></pdfPosition>
|
|
58
58
|
</template>
|
|
59
59
|
<template v-else>
|
|
60
60
|
<div v-if="fileType == 'VIDEO'" style="width: 100%;">
|
|
@@ -160,8 +160,8 @@ export default {
|
|
|
160
160
|
url = url + this.url
|
|
161
161
|
url += '&officePreviewType=pdf'
|
|
162
162
|
if(this.watermark) {
|
|
163
|
-
url = this.watermark.textWatermarkValue ? (url += this.watermark.textWatermarkValue) : url
|
|
164
|
-
url = this.watermark.visitorWatermarkValue ? (url += this.watermark.visitorWatermarkValue) : url
|
|
163
|
+
url = this.watermark.textWatermarkValue ? (url += '&textWatermarkValue=' + this.watermark.textWatermarkValue) : url
|
|
164
|
+
url = this.watermark.visitorWatermarkValue ? (url += '&visitorWatermarkValue=' + this.watermark.visitorWatermarkValue) : url
|
|
165
165
|
}
|
|
166
166
|
return url
|
|
167
167
|
},
|