askbot-dragon 1.5.64-beta → 1.5.66-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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "askbot-dragon",
3
- "version": "1.5.64-beta",
3
+ "version": "1.5.66-beta",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve",
6
6
  "build": "vue-cli-service build",
@@ -3,15 +3,6 @@ export function zoomElement (el) {
3
3
  let store = {
4
4
  scale: 1
5
5
  };
6
- if (!el){
7
- return
8
- }
9
- let scale = 1;
10
- if (el.style.transform){
11
- let transForm = el.style.transform;
12
- var values = transForm.split('(')[1].split(')')[0].split(',');
13
- scale = values[0] ? values[0] : 1
14
- }
15
6
  // 缩放事件的处理
16
7
  el.addEventListener('touchstart', function (event) {
17
8
  let touches = event.touches;
@@ -76,15 +67,13 @@ export function zoomElement (el) {
76
67
  newScale = 3;
77
68
  }
78
69
  // 最小缩放比例限制
79
- if(newScale < scale) {
80
- newScale = scale;
70
+ if(newScale < 1) {
71
+ newScale = 1;
81
72
  }
82
73
  // 记住使用的缩放值
83
74
  store.scale = newScale;
84
75
  // 图像应用缩放效果
85
76
  el.style.transform = 'scale(' + newScale + ')';
86
- el.style.transformOrigin = 'top left'
87
-
88
77
  }
89
78
  });
90
79
  document.addEventListener('touchend', function () {
@@ -35,13 +35,6 @@
35
35
  border-radius: 6px;
36
36
  background-color: #bfceec !important;
37
37
  }
38
- @media screen and (max-width: 767px){
39
- ::-webkit-scrollbar {
40
- width: 0;
41
- height: 0;
42
- background-color:@system_bordercolor_4;
43
- }
44
- }
45
38
 
46
39
  // 弹窗body
47
40
  .el-dialog__body{
@@ -244,18 +244,7 @@ export default {
244
244
  }
245
245
  this.$refs.previewPdf.fileType = type
246
246
  this.$refs.previewPdf.tagIds = item.tagIds
247
- this.$refs.previewPdf.isMessageRecord = this.isMessageRecord ? true : false ;
248
- let index = url.indexOf("?");
249
- let newFileInOssPath = url;
250
- if (index !== -1){
251
- newFileInOssPath = url.substring(0, url.indexOf("?"))
252
- }
253
- let fileName = newFileInOssPath.substring(newFileInOssPath.lastIndexOf('.'))
254
- if (fileName === '.doc' || fileName === '.docx' || fileName === '.txt'|| fileName === '.html'){
255
- this.$refs.previewPdf.fileName = fileName;
256
- } else {
257
- this.$refs.previewPdf.fileName = '';
258
- }
247
+ this.$refs.previewPdf.isMessageRecord = this.isMessageRecord ? true : false
259
248
  if(item.tagIds && item.tagIds.length != 0) {
260
249
  this.$refs.previewPdf.loading = false
261
250
  return
@@ -34,7 +34,7 @@
34
34
  </div> -->
35
35
 
36
36
  <text-message :text="text" @submitClick="submitClick"></text-message>
37
- <answer-docknowledge :isAskLightning="2" :msg="answerDocknowledge"></answer-docknowledge>
37
+ <!-- <answer-docknowledge :isAskLightning="2" :msg="answerDocknowledge"></answer-docknowledge> -->
38
38
  <!-- <voice-component @closeVoice="closeVoice">
39
39
  <div slot="voiceTip">
40
40
  松开发送
@@ -63,7 +63,7 @@
63
63
  <answer-voice :msg="answerVoiceObj"></answer-voice>
64
64
  <answer-voice :msg="answerVoiceObj"></answer-voice>
65
65
  <div v-for="(item,index) in processAction" :key="index">
66
- <association-intention :msg="item" :msgType="item.type" :isOpen="isOpen"></association-intention>
66
+ <association-intention :msg="item" :nodownload="true" :msgType="item.type" :isOpen="isOpen"></association-intention>
67
67
  </div>
68
68
  <!-- <answer-voice @stopOtherAudio="stopOtherAudio" ref="audioTagCell" :msg="answerVoiceObj1"></answer-voice> -->
69
69
 
@@ -108,7 +108,7 @@ import AnswerVoice from "@/components/AnswerVoice";
108
108
  // import ChatContent from "./chatContent";
109
109
  // import FeedBack from '@/components/feedBack'
110
110
  // 知识类型
111
- import AnswerDocknowledge from "./AnswerDocknowledge.vue";
111
+ // import AnswerDocknowledge from "./AnswerDocknowledge.vue";
112
112
  export default {
113
113
  name: 'ConversationContainer',
114
114
  components: {
@@ -134,7 +134,7 @@ export default {
134
134
  // FormTemplate,
135
135
  // FileType,
136
136
  // ChatContent,
137
- AnswerDocknowledge,
137
+ // AnswerDocknowledge,
138
138
  },
139
139
  props: {
140
140
  messages: Array
@@ -191,48 +191,17 @@ export default {
191
191
  answerDocknowledge:
192
192
  // {"content":{"knowledgeId":"64915d6e098ec248701da267","actionType":"answer_doc_knowledge","text":"跳舞不仅要有实力,还要有好的穿搭,本文针对街舞爱好者提供了穿搭指南,给你带来灵感和帮助!","list":[{"tagIds":[],"format":"html","updateTime":"2023-06-20 16:03:58","source":"WECHAT","url":"https://guoranwisdom.oss-cn-zhangjiakou.aliyuncs.com/137993c6d830416696bbd771fc61d423/1937/2023/06/20/16/03/微信同步/52720/501775e41a724d7da06e66b3b4686407.html","knowledgeId":"64915d6e098ec248701da267","from":"跳舞要有范儿,穿搭占一半!快来get你的街舞穿搭指南~"}],"renderType":0,"type":0,"isKnowledgeSummary":true},"type":"answer_doc_knowledge","sessionId":1687251699065,"keyId":"1a079f48-ace3-4064-89b4-8a292c6a8a93_________","isKnowledgeSummary":true},
193
193
 
194
- {
195
- "conditionList": null,
196
- "apiKey": null,
197
- "effectiveTime": null,
198
- "intentId": null,
199
- "msgId": null,
200
- "actionCategory": null,
201
- "id": null,
202
- "type": "answer_doc_knowledge",
203
- "nodeId": null,
204
- "content": {
205
- "knowledgeId": null,
206
- "actionType": "answer_doc_knowledge",
207
- "images": null,
208
- "knowledgePartId": null,
209
- "srcContentId": null,
210
- "text": "新能源车是指采用新型能源的轿车、客车、货车等机动车辆,包括纯电动汽车、插电式混合动力汽车和燃料电池汽车。根据数据显示,2020年我国新能源汽车销售量达到139万辆,同比增长10.9%。预计2021年新能源车市场将继续保持高速增长,销售量有望超过200万辆。政府对新能源汽车实行补贴政策,同时逐步放松对新能源车的限购和限行政策。此外,中国汽车企业在新能源车领域的技术研发能力也不断提升,各大品牌纷纷推出新能源车型,采用更优秀的动力电池和电控系统,提高了车辆的续航里程。因此,新能源车市场发展前景广阔。",
211
- "list": [
212
- {
213
- "owner": null,
214
- "tagId": "6525183560177f6223d52a14",
215
- "enterprise": null,
216
- "tagIds": [
217
- "6525183560177f6223d52a14"
218
- ],
219
- "format": "docx",
220
- "srcContentId": "99cada54a02161f979acc28c5b8b913e",
221
- "updateTime": "2023-10-10 17:24:05",
222
- "source": "CORP_LOCAL_FILE",
223
- "srcContent": "新能源车指的是采用新型能源的轿车、客车、货车等机动车辆。目前主要的新能源车包括纯电动汽车、插电式混合动力汽车、燃料电池汽车等。以下是对新能源车的分析报告:市场发展趋势:随着环保和能源安全意识的增强,新能源车市场呈现快速发展态势。数据显示,2020年我国新能源汽车销售量达到139万辆,同比增长10.9%。预计2021年新能源车市场仍将保持高速增长,销售量有望达到200万辆以上。政策扶持力度加大:我国政府对新能源汽车实行补贴政策,以鼓励消费者选择绿色出行方式。此外,对新能源车限购、限行等政策也逐步放松。政策扶持的加大将进一步促进新能",
224
- "url": "http://guoranwisdom.oss-cn-zhangjiakou.aliyuncs.com/43aadcaac45f4be19b63fd18ca68f2e6/2023/10/10/17/23/a27c5c1dd534d180c5512c907d5c9888/新能源车分析报告 (1).docx?uploadId=0921CB01AB5847E8BEF44730EE5DACF7",
225
- "knowledgeId": "6525182f002ff5198983a90c",
226
- "knowledgePartId": "YfHmGIsBvcIPGxbfkvwK",
227
- "from": "新能源车分析报告 (1)",
228
- "introduction": "新能源车指的是采用新型能源的轿车、客车、货车等机动车辆。目前主要的新能源车包括纯电动汽车、插电式混合动力汽车、燃料电池汽车等。以下是对新能源车的分析报告:市场发展趋势:随着环保和能源安全意识的增强,新能源车市场呈现快速发展态势。数据显示,2020年我国新能源汽车销售量达到139万辆,同比增长10.9%。预计2021年新能源车市场仍将保持高速增长,销售量有望达到200万辆以上。政策扶持力度加大:我国政府对新能源汽车实行补贴政策,以鼓励消费者选择绿色出行方式。此外,对新能源车限购、限行等政策也逐步放松。政策扶持的加大将进一步促进新能"
229
- }
230
- ],
231
- "renderType": 0,
232
- "type": 0,
233
- "srcContent": null
234
- }
235
- },
194
+ {
195
+ "content": {
196
+ "images": [{ url: 'https://static.guoranbot.com/images/knowledge/e0f6898c6b0d47fa98e8f71ceab1bde8/安全标志--禁止标志.png' }],
197
+ "actionType": "answer_doc_knowledge",
198
+ "text": "中国的省份名称有湖北省、广西壮族自治区等。",
199
+ "list": [{ "tagIds": [], "format": "yqhtml", "srcContentId": "8ee0fa9bb5a89ea01f588843589bf931", "updateTime": "2023-04-14 20:15:50", "source": "YUQUE", "srcContent": "功能概述分院科室的建立。分院科室医生关联。分院科室建立时,科室编码需要与集团提供的科室编码保持一致。科室维护进入扁鹊基础配置模块,如图进入科室维护界面进行科室新增输入科室信息进行科室增加。", "url": "https://guoranwisdom.oss-cn-zhangjiakou.aliyuncs.com/yuque/7faaefde11374c7992c377731ea4dddc/dinga77cc098b0b5e113ee0f45d8e4f7c288/2023/4/14/19/54/31/acc2421dcfd04db39eba0c37e7d3b580.html", "knowledgeId": "643940bb6cbe816b83ebbaaf", "knowledgePartId": "lPexf4cBYkmDoUE2eSUt", "from": "2.3 科室", "introduction": "功能概述分院科室的建立。分院科室医生关联。分院科室建立时,科室编码需要与集团提供的科室编码保持一致。科室维护进入扁鹊基础配置模块,如图进入科室维护界面进行科室新增输入科室信息进行科室增加。" }, { "tagIds": [], "format": "feishuhtml", "srcContentId": "8ee0fa9bb5a89ea01f588843589bf931", "updateTime": "2023-04-13 23:19:48", "source": "YUQUE", "srcContent": "功能概述分院科室的建立。分院科室医生关联。分院科室建立时,科室编码需要与集团提供的科室编码保持一致。科室维护进入扁鹊基础配置模块,如图进入科室维护界面进行科室新增输入科室信息进行科室增加。", "url": "https://guoranwisdom.oss-cn-zhangjiakou.aliyuncs.com/yuque/7faaefde11374c7992c377731ea4dddc/dinga77cc098b0b5e113ee0f45d8e4f7c288/2023/4/13/22/20/40/0e48cc7b15b34d2f84fe49fd1a89d606.html", "knowledgeId": "643817509ab4545bef50db64", "knowledgePartId": "NeYze4cBh77-s6lwjWOl", "from": "2.12 重要异常科室对照", "introduction": "功能概述分院科室的建立。分院科室医生关联。分院科室建立时,科室编码需要与集团提供的科室编码保持一致。科室维护进入扁鹊基础配置模块,如图进入科室维护界面进行科室新增输入科室信息进行科室增加。" }, { "tagIds": ['12312313123'], "format": "yqhtml", "srcContentId": "8ee0fa9bb5a89ea01f588843589bf931", "updateTime": "2023-04-13 23:19:02", "source": "YUQUE", "srcContent": "功能概述分院科室的建立。分院科室医生关联。分院科室建立时,科室编码需要与集团提供的科室编码保持一致。科室维护进入扁鹊基础配置模块,如图进入科室维护界面进行科室新增输入科室信息进行科室增加。", "url": "https://guoranwisdom.oss-cn-zhangjiakou.aliyuncs.com/yuque/7faaefde11374c7992c377731ea4dddc/dinga77cc098b0b5e113ee0f45d8e4f7c288/2023/4/13/22/20/18/5cdf1295ec1649f6ab73948aa82ea810.html", "knowledgeId": "643817509ab4545bef50db58", "knowledgePartId": "Hvcye4cBYkmDoUE21h6V", "from": "2.3 科室", "introduction": "功能概述分院科室的建立。分院科室医生关联。分院科室建立时,科室编码需要与集团提供的科室编码保持一致。科室维护进入扁鹊基础配置模块,如图进入科室维护界面进行科室新增输入科室信息进行科室增加。" }, { "tagId": "6475eab868110215ab821a7c", "tagIds": ["6475eab868110215ab821a7c"], "format": "xlsx", "srcContentId": "0bf639060655ff3ec217484a2fc7827d", "updateTime": "2023-05-30 20:28:21", "source": "CORP_LOCAL_FILE", "srcContent": "产品:外观,解释:VX50有两种套餐可下单: 套餐一:只购买VX50终端设备,不包含摄像头、麦克风 套餐二:除购买VX50终端设备外,可选购SC701云台摄像头及MC30/MC31麦克风", "url": "https://guoranwisdom.oss-cn-zhangjiakou.aliyuncs.com/5ecf2fcd704541149201ab9c1c31162d/2023/05/30/20/11/85b7b2a5f61e2b060387656e88c02d50/VX30与VX50对比表.xlsx", "knowledgeId": "6475e7eac724c54c46cbfa2d", "knowledgePartId": "T_uhbIgB3v-0X8BLeDAh", "from": "VX30与VX50对比表", "introduction": "产品:外观,解释:VX50有两种套餐可下单: 套餐一:只购买VX50终端设备,不包含摄像头、麦克风 套餐二:除购买VX50终端设备外,可选购SC701云台摄像头及MC30/MC31麦克风" },],
200
+ "renderType": 0,
201
+ "type": 0
202
+ },
203
+ "type": "answer_doc_knowledge"
204
+ },
236
205
  ActionAiGuideObj: {
237
206
  // 智能引导
238
207
  type: "answer_intellect_guide",
@@ -4955,7 +4924,6 @@ export default {
4955
4924
  url:
4956
4925
  'https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/2021/08/24/07/35/41221223-c180-4f3f-bdc8-94875b693965/WeChat_20210719215122.mp4',
4957
4926
  videoFlag: false,
4958
- nodownload: false,
4959
4927
  videoUploadPercent: 0,
4960
4928
  isShowUploadVideo: true,
4961
4929
  recommend: {
@@ -12,19 +12,16 @@
12
12
  /> -->
13
13
  <video
14
14
  controls="controls"
15
- controlslist="nodownload"
15
+ :controlslist="nodownload&&'nodownload'"
16
16
  :raw-controls="true"
17
17
  x5-video-player-type="h5-page"
18
- style="object-fit: contain;width: calc(100vw - 169px);height: 160px;background-color: black;border-radius: 25px;max-width: 200px;padding-left: 10px"
18
+ style="object-fit: contain;width: calc(100vw - 139px);height: 160px;background-color: black;border-radius: 25px;max-width: 230px;padding-left: 10px"
19
19
  preload
20
20
  :poster="videoSrc+'?spm=qipa250&x-oss-process=video/snapshot,t_1000,f_jpg,w_0,h_0,m_fast'"
21
21
  class="video-player vjs-custom-skin"
22
22
  :id="msg.id+'key'">
23
23
  <source :src="videoSrc"/>
24
24
  </video>
25
- <div v-show="!nodownload" class="dragon-video-download">
26
- <a :href="msg.content.url" download><span class="el-icon-download"></span></a>
27
- </div>
28
25
  <div id="output"></div>
29
26
  </div>
30
27
  </template>
@@ -126,8 +123,6 @@
126
123
  video::-webkit-media-controls-mute-button { display: none !important;}
127
124
  #dragon-video{
128
125
  position: relative;
129
- width: calc(100vw - 109px);
130
- max-width: 260px;
131
126
  #outputVideo{
132
127
  position: absolute;
133
128
  top: 0px;
@@ -139,24 +134,6 @@ video::-webkit-media-controls-mute-button { display: none !important;}
139
134
  }
140
135
 
141
136
  }
142
- .dragon-video-download{
143
- position: absolute;
144
- width: 40px;
145
- height: 26px;
146
- background-color: rgba(54, 106, 255, 0.5);
147
- border-radius: 13px;
148
- text-align: center;
149
- bottom: 2px;
150
- right: 6px;
151
- a {
152
- span {
153
- height: 26px;
154
- line-height: 26px;
155
- display: block;
156
- color: white;
157
- }
158
- }
159
- }
160
137
  }
161
138
 
162
139
  </style>
@@ -58,8 +58,8 @@
58
58
  </div>
59
59
  <div v-else-if="msgType === 'answer_video' || msgType === 'user_video' || msgType === 'VIDEO'">
60
60
  <div class="association-img" v-if="msg.content.url">
61
- <ask-video :msg="msg" :url="msg.content.url" :local-url="msg.content.localUrl" :nodownload="msg.content.nodownload"
62
- :progress="msg.content.progress"></ask-video>
61
+ <ask-video :msg="msg" :url="msg.content.url" :local-url="msg.content.localUrl"
62
+ :progress="msg.content.progress" :nodownload="nodownload"></ask-video>
63
63
  </div>
64
64
  <Recommend v-if="msg.recommend && msg.recommend.list && msg.recommend.list.length > 0" :msg="msg" @onRadioClickReco="onRadioClickReco"></Recommend>
65
65
  </div>
@@ -88,7 +88,7 @@
88
88
  export default {
89
89
  name: "associationIntention",
90
90
  components: {Recommend, askVideo, previewDoc},
91
- props: ["msg",'msgType','isOpen','sourceOhm','isOhmPc'],
91
+ props: ["msg",'msgType','isOpen','sourceOhm','isOhmPc', 'nodownload'],
92
92
  filters: {
93
93
  imageStyle: function (html) {
94
94
  //富文本内图片自适应高度宽度
@@ -233,7 +233,7 @@
233
233
  this.$emit("onRadioClick", id, name, apikey,optionApiKey);
234
234
  },
235
235
  onImageClick(url){
236
- this.$emit('onImageClick', encodeURI(url))
236
+ this.$emit('onImageClick',url)
237
237
  },
238
238
  msgContent(content){
239
239
  console.debug('215',content)
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div id="pdf_view" class="pdf_view" :style="{
2
+ <div class="pdf_view" ref="pdfView" @scroll="pdfScroll" :style="{
3
3
  marginTop: isPC ? '50px' : '',
4
4
  marginBottom: tagIds.length > 1 ? '60px' : '0px',
5
5
  height: setHeight
@@ -17,7 +17,6 @@
17
17
  </el-option>
18
18
  </el-select>
19
19
  </div>
20
- <div class="pdf_container_view" id="pdf_container_view" @scroll="pdfScroll" ref="pdfView"></div>
21
20
  <div class="btn_footer" v-if="tagIds.length > 1 && !isPC">
22
21
  <div class="prev" @click="prev">上一段</div>
23
22
  <div class="next" @click="next">下一段</div>
@@ -45,11 +44,10 @@ if (pdfjsLib) {
45
44
  // 'pdfjs-dist/build/pdf.worker';
46
45
  }
47
46
  const { TextLayerBuilder } = window['pdfjs-dist/web/pdf_viewer']
48
- const CSS_UNITS = 96.0 / 72.0
49
47
  // import { zoomElement } from '../assets/js/hammer'
50
48
  export default {
51
49
  name: 'pdfView',
52
- props: ['tagIds', 'isMessageRecord','fileName'],
50
+ props: ['tagIds', 'isMessageRecord'],
53
51
  data () {
54
52
  return {
55
53
  url: '',
@@ -96,7 +94,6 @@ export default {
96
94
  },
97
95
  isTouchMoved: false,
98
96
  transformSalce: null,
99
- defaultTransform:0.8,
100
97
  isPC: false,
101
98
  handScale: 'auto',
102
99
  scaleList: [
@@ -251,13 +248,12 @@ export default {
251
248
  if (this.$refs.pdfView.clientWidth / this.pageSize.width >= 1 || this.isMessageRecord) {
252
249
  this.contentView.style.width = `${pageSize.width - 10}px`;
253
250
  this.contentView.style.height = `${(this.totalPageCount * (pageSize.height + this.PAGE_INTVERVAL)) + this.PAGE_INTVERVAL}px`;
254
- this.contentView.style.margin = '0 auto 0'
255
251
  } else {
256
- this.transformSalce = this.$refs.pdfView.clientWidth / this.pageSize.width / CSS_UNITS
252
+ this.transformSalce = this.$refs.pdfView.clientWidth / this.pageSize.width
257
253
  this.contentView.style.width = `${pageSize.width * this.transformSalce - 10}px`;
258
254
  this.contentView.style.height = `${(this.totalPageCount * (pageSize.height * (this.transformSalce) + this.PAGE_INTVERVAL)) + this.PAGE_INTVERVAL}px`;
259
255
  }
260
- // this.contentView.style.margin = '0 auto 0'
256
+ this.contentView.style.margin = '0 auto 0'
261
257
  this.contentView.style.position = 'relative'
262
258
  this.contentView.style.paddingBottom = '60px'
263
259
  // contentView.style.overflowY = 'auto'
@@ -285,41 +281,36 @@ export default {
285
281
  const { pdfPage, pageNo, dom } = page;
286
282
  // dom 元素已存在,无须重新渲染,直接返回
287
283
  if ((dom && dom.children.length != 0) || page.loading) {
288
- return;
284
+ return;
289
285
  }
290
286
  page.loading = true
291
287
  const viewport = pdfPage.getViewport({
292
- scale: this.scale,
293
- rotation: this.rotation,
288
+ scale: this.scale,
289
+ rotation: this.rotation,
294
290
  });
295
291
  // 创建新的canvas
296
292
  const canvas = document.createElement('canvas');
297
293
  const context = canvas.getContext('2d');
298
294
  // canvas.getContext('2d');
299
- canvas.height = this.pageSize.height * (this.fileName ? CSS_UNITS : 1);
300
- canvas.width = this.pageSize.width * (this.fileName ? CSS_UNITS : 1);
295
+ canvas.height = this.pageSize.height;
296
+ canvas.width = this.pageSize.width;
301
297
  canvas.style.position = 'relative'
302
298
  canvas.style.top = -3 + 'px'
303
299
  // 创建渲染的dom
304
300
  const pageDom = document.createElement('div');
305
301
  pageDom.style.position = 'absolute';
306
- pageDom.style.top = `${((pageNo - 1) * (this.pageSize.height + this.PAGE_INTVERVAL) * (this.fileName ? CSS_UNITS : 1)) + this.PAGE_INTVERVAL}px`;
307
- pageDom.style.width = `${this.pageSize.width * (this.fileName ? CSS_UNITS : 1)}px`;
308
- pageDom.style.height = `${this.pageSize.height * (this.fileName ? CSS_UNITS : 1)}px`;
302
+ pageDom.style.top = `${((pageNo - 1) * (this.pageSize.height + this.PAGE_INTVERVAL)) + this.PAGE_INTVERVAL}px`;
303
+ pageDom.style.width = `${this.pageSize.width}px`;
304
+ pageDom.style.height = `${this.pageSize.height}px`;
309
305
  pageDom.setAttribute('data-id', 'page' + pageNo)
310
- // pageDom.appendChild(canvas);
306
+ pageDom.appendChild(canvas);
311
307
  // 渲染内容
312
308
  let renderContext = {
313
309
  canvasContext: context,
314
310
  viewport: viewport,
315
- transform: this.fileName ? [CSS_UNITS, 0, 0, CSS_UNITS, 0, 0] : '',
316
311
  }
317
312
  await pdfPage.render(renderContext).promise.then(() => {
318
- const html = canvas.toDataURL();
319
- let image = document.createElement('img');
320
- image.setAttribute('src',html)
321
- pageDom.appendChild(image);
322
- return pdfPage.getTextContent()
313
+ return pdfPage.getTextContent()
323
314
  }).then(async (textContent) => {
324
315
  const textLayerDiv = document.createElement('div');
325
316
  textLayerDiv.setAttribute('class', 'textLayer');
@@ -349,35 +340,36 @@ export default {
349
340
  let postionArr = lines[index].location
350
341
  let div = document.createElement('div')
351
342
  div.style.position = 'absolute';
352
- div.style.left = postionArr[0] * this.scale * (this.fileName ? CSS_UNITS : 1) + 'px',
343
+ div.style.left = postionArr[0] * this.scale + 'px',
353
344
  // 后端返回的坐标有基线对齐的问题,top 值是后端算好(基线top - 文字高度),在此加上文字高度的 1/9 (大致比例)为实际展示出文字的top值
354
- div.style.top = postionArr[1] * this.scale * (this.fileName ? CSS_UNITS : 1) + 'px'
355
- div.style.height = postionArr[3] * this.scale * (this.fileName ? CSS_UNITS : 1) + 'px';
356
- div.style.width = postionArr[2] * this.scale * (this.fileName ? CSS_UNITS : 1) + 'px'
345
+ div.style.top = postionArr[1] * this.scale + 'px'
346
+ div.style.height = postionArr[3] * this.scale + 'px';
347
+ div.style.width = postionArr[2] * this.scale + 'px'
357
348
  div.style.backgroundColor = 'rgba(54, 106, 255, 0.3)'
358
349
  div.classList.add('lineHeight')
359
350
  rectdom.appendChild(div)
360
351
  if (index == 0 && j == 0) {
361
352
  if (this.transformSalce !== null) {
362
- rectdomTop = postionArr[1]* this.scale * (this.fileName ? CSS_UNITS : 1) * this.transformSalce
363
- } else {
364
- rectdomTop = postionArr[1] * this.scale * (this.fileName ? CSS_UNITS : 1) * this.defaultTransform
365
- }
366
- // if(this.isPC) {
367
- // rectdomTop = rectdomTop - 50 < 0 ? 0 : rectdomTop - 50
368
- // }
353
+ rectdomTop = postionArr[1] * this.scale * this.transformSalce
354
+ } else {
355
+ rectdomTop = postionArr[1] * this.scale
356
+ }
357
+ // if(this.isPC) {
358
+ // rectdomTop = rectdomTop - 50 < 0 ? 0 : rectdomTop - 50
359
+ // }
360
+ }
361
+ }
362
+ }
363
+ if (rectdom.children.length > 0) {
364
+ pageDom.appendChild(rectdom)
365
+ }
369
366
  }
370
- }
371
367
  }
372
- if (rectdom.children.length > 0) {
373
- pageDom.appendChild(rectdom)
374
- }
375
- }
376
368
  }
377
- }
378
- textLayer.setTextContent(textContent);
379
- textLayer.render()
380
- pageDom.appendChild(textLayerDiv);
369
+ textLayer.setTextContent(textContent);
370
+ textLayer.render()
371
+ pageDom.appendChild(textLayerDiv);
372
+
381
373
  let backgroundDom = document.getElementById('backgroundLoad' + pageNo)
382
374
  if (backgroundDom) {
383
375
  this.contentView.removeChild(backgroundDom);
@@ -385,22 +377,8 @@ export default {
385
377
  page.dom = await pageDom;
386
378
  page.loading = false
387
379
  this.contentView.appendChild(pageDom);
388
- let pdf_view = document.getElementsByClassName('pdf_view');
389
- if (pdf_view && pdf_view[0]){
390
- pdf_view[0].style.backgroundImage = 'none'
391
- }
392
- let postionArr = []
393
- if (findPage){
394
- let AllLines = findPage.allLines
395
- if (AllLines.length){
396
- postionArr = AllLines[0].lines[0].location
397
- }
398
- }
399
- if(this.transformSalce !== null && this.fileName) {
400
- this.contentView.style.transform = `scale(${this.transformSalce}, ${this.transformSalce})`
401
- } else {
402
- this.contentView.style.transform = `scale(${this.defaultTransform})`;
403
-
380
+ if (this.transformSalce !== null) {
381
+ this.contentView.style.transform = `scale(${this.transformSalce}, ${this.transformSalce})`
404
382
  }
405
383
  if (this.changetoolbar) {
406
384
  setTimeout(() => {
@@ -412,21 +390,22 @@ export default {
412
390
  setTimeout(() => {
413
391
  let pageoffsetHeight = 0
414
392
  if (this.transformSalce !== null) {
415
- pageoffsetHeight = (this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce * (this.fileName ? CSS_UNITS : 1)
393
+ pageoffsetHeight = (this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce
416
394
  } else {
417
- pageoffsetHeight = (this.pageSize.height + this.PAGE_INTVERVAL) * this.defaultTransform *(this.fileName ? CSS_UNITS : 1)
395
+ pageoffsetHeight = (this.pageSize.height + this.PAGE_INTVERVAL)
418
396
  }
419
397
  if (this.$refs.pdfView.clientHeight - pageoffsetHeight > 0 && pageIndex == 1) {
420
398
  const height = this.$refs.pdfView.clientHeight;
421
399
  let startNum = 0
422
400
  let endNum = 0
423
401
  if (this.transformSalce !== null) {
424
- startNum = Math.ceil(this.$refs.pdfView.scrollTop / ((this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce* (this.fileName ? CSS_UNITS : 1)))
425
- endNum = startNum + Math.ceil(height / ((this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce* (this.fileName ? CSS_UNITS : 1)))
426
- } else {
427
- startNum = Math.ceil(this.$refs.pdfView.scrollTop / ((this.pageSize.height + this.PAGE_INTVERVAL) * (this.fileName ? CSS_UNITS : 1) * this.defaultTransform))
428
- endNum = startNum + Math.ceil(height / ((this.pageSize.height + this.PAGE_INTVERVAL) * (this.fileName ? CSS_UNITS : 1) * this.defaultTransform))}
429
- console.log(this.$refs.pdfView.scrollTop, startNum, endNum, 'endNumendNum');
402
+ startNum = Math.ceil(this.$refs.pdfView.scrollTop / ((this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce))
403
+ endNum = startNum + Math.ceil(height / ((this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce))
404
+ } else {
405
+ startNum = Math.ceil(this.$refs.pdfView.scrollTop / (this.pageSize.height + this.PAGE_INTVERVAL))
406
+ endNum = startNum + Math.ceil(height / (this.pageSize.height + this.PAGE_INTVERVAL))
407
+
408
+ }
430
409
  for (let pageIndex = startNum; pageIndex <= endNum; pageIndex++) {
431
410
  if (pageIndex > 0 && pageIndex <= this.pages.length) {
432
411
  this.loadPdfData(pageIndex)
@@ -458,14 +437,14 @@ export default {
458
437
  let startNum = 0
459
438
  let endNum = 0
460
439
  if (this.transformSalce !== null) {
461
- startNum = Math.ceil(scrollTop / ((that.pageSize.height + that.PAGE_INTVERVAL) * this.transformSalce * (this.fileName ? CSS_UNITS : 1)))
462
- endNum = startNum + Math.ceil(height / ((that.pageSize.height + that.PAGE_INTVERVAL) * this.transformSalce * (this.fileName ? CSS_UNITS : 1)))
440
+ startNum = Math.ceil(scrollTop / ((that.pageSize.height + that.PAGE_INTVERVAL) * this.transformSalce))
441
+ endNum = startNum + Math.ceil(height / ((that.pageSize.height + that.PAGE_INTVERVAL) * this.transformSalce))
463
442
  } else {
464
- startNum = Math.ceil(scrollTop / ((that.pageSize.height + that.PAGE_INTVERVAL) * (this.fileName ? CSS_UNITS : 1) * this.defaultTransform))
465
- endNum = startNum + Math.ceil(height / ((that.pageSize.height + that.PAGE_INTVERVAL) * (this.fileName ? CSS_UNITS : 1) * this.defaultTransform))
443
+ startNum = Math.ceil(scrollTop / (that.pageSize.height + that.PAGE_INTVERVAL))
444
+ endNum = startNum + Math.ceil(height / (that.pageSize.height + that.PAGE_INTVERVAL))
466
445
  }
467
- for (let pageIndex = startNum; pageIndex <= endNum; pageIndex++) {
468
- if (pageIndex > 0 && pageIndex <= that.pages.length) {
446
+ for (let pageIndex = startNum; pageIndex < endNum; pageIndex++) {
447
+ if (pageIndex > 0 && pageIndex < that.pages.length) {
469
448
  that.loadPdfData(pageIndex)
470
449
  }
471
450
  }
@@ -550,10 +529,10 @@ export default {
550
529
  return
551
530
  }
552
531
  const pageDom = document.createElement('div');
553
- pageDom.style.width = `${this.pageSize.width * (this.fileName ? CSS_UNITS : 1)}px`;
554
- pageDom.style.height = `${this.pageSize.height * (this.fileName ? CSS_UNITS : 1)}px`;
532
+ pageDom.style.width = `${this.pageSize.width}px`;
533
+ pageDom.style.height = `${this.pageSize.height}px`;
555
534
  pageDom.style.position = 'absolute';
556
- pageDom.style.top = `${((pageNo - 1) * (this.pageSize.height + this.PAGE_INTVERVAL) * (this.fileName ? CSS_UNITS : 1)) + this.PAGE_INTVERVAL
535
+ pageDom.style.top = `${((pageNo - 1) * (this.pageSize.height + this.PAGE_INTVERVAL)) + this.PAGE_INTVERVAL
557
536
  }px`;
558
537
  pageDom.style.backgroundImage = `url('https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif')`
559
538
  pageDom.style.backgroundPosition = 'center'
@@ -628,9 +607,9 @@ export default {
628
607
  this.renderHighlights()
629
608
  })
630
609
  if (this.transformSalce !== null) {
631
- this.$refs.pdfView.scrollTop = `${((pdfResloute.page - 1) * (this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce * (this.fileName ? CSS_UNITS : 1)) + (this.identifyTextPostion.top * this.scale * this.transformSalce * (this.fileName ? CSS_UNITS : 1))}`
610
+ this.$refs.pdfView.scrollTop = `${((pdfResloute.page - 1) * (this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce) + (this.identifyTextPostion.top * this.scale * this.transformSalce)}`
632
611
  } else {
633
- this.$refs.pdfView.scrollTop = `${((pdfResloute.page - 1) * (this.pageSize.height + this.PAGE_INTVERVAL) * this.defaultTransform * (this.fileName ? CSS_UNITS : 1)) + (this.identifyTextPostion.top * this.scale * this.defaultTransform * (this.fileName ? CSS_UNITS : 1))}`
612
+ this.$refs.pdfView.scrollTop = `${((pdfResloute.page - 1) * (this.pageSize.height + this.PAGE_INTVERVAL)) + (this.identifyTextPostion.top * this.scale * this.transformSalce)}`
634
613
  }
635
614
  },
636
615
  scrollToExcalTop (currentPage) {
@@ -884,7 +863,6 @@ export default {
884
863
  if (value && value.length) {
885
864
  // 在 pdf_view 下创建 所有canvs的容器
886
865
  this.contentView = document.createElement('div')
887
- this.contentView.setAttribute('id','contentView')
888
866
  this.contentView.style.transformOrigin = '0px 0px 0px'
889
867
  this.$http.get('/knowledge-api/knowledge/knowledge-part-location-info/list?ids=' + value.join(',')).then(res => {
890
868
  // 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}
@@ -1075,16 +1053,11 @@ export default {
1075
1053
  xhr.onload = ({ currentTarget }) => {
1076
1054
  // 请求完成
1077
1055
  if (currentTarget.status === 200) { // 返回200
1078
- let pdf_view = document.getElementsByClassName('pdf_view');
1079
- if (pdf_view && pdf_view[0]){
1080
- pdf_view[0].style.backgroundImage = 'none'
1081
- }
1082
1056
  this.contentView.innerHTML = currentTarget.response
1083
1057
  this.contentView.style.padding = '10px'
1084
1058
  // this.contentView.style.position = 'relative'
1085
1059
  this.$refs.pdfView.style.backgroundColor = '#FFFFFF'
1086
1060
  this.$refs.pdfView.appendChild(this.contentView)
1087
-
1088
1061
  let allTr = Array.from(this.$refs.pdfView.getElementsByTagName('tr'))
1089
1062
  this.allTr = []
1090
1063
  for (let index = 0; index < allTr.length; index++) {
@@ -1127,14 +1100,10 @@ export default {
1127
1100
  width: 100%;
1128
1101
  height: calc(100% - 110px);
1129
1102
  overflow: auto;
1130
- //overflow-y: scroll;
1131
1103
  background-color: #f5f7fb;
1132
1104
  // margin-bottom: 60px;
1133
1105
  box-sizing: border-box;
1134
- background-image: url('https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif');
1135
- background-position: center;
1136
- background-size: 50px;
1137
- background-repeat: no-repeat;
1106
+
1138
1107
  // position: relative;
1139
1108
  // > div {
1140
1109
  // width: 100%;
@@ -1323,12 +1292,6 @@ export default {
1323
1292
  background: rgba(221, 222, 223, 1);
1324
1293
  }
1325
1294
  }
1326
- .pdf_container_view{
1327
- height: 100%;
1328
- width: 100%;
1329
- position: relative;
1330
- overflow: auto;
1331
- }
1332
1295
  }
1333
1296
  </style>
1334
1297
  <style lang="less">
@@ -1341,6 +1304,7 @@ export default {
1341
1304
  0% {
1342
1305
  background: rgba(255, 136, 0, 0.3);
1343
1306
  }
1307
+
1344
1308
  25% {
1345
1309
  background: rgba(255, 136, 0, 0.6);
1346
1310
  }