askbot-dragon 1.5.46-beta → 1.5.48-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.46-beta",
3
+ "version": "1.5.48-beta",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve",
6
6
  "build": "vue-cli-service build",
@@ -13,6 +13,7 @@
13
13
  "audio-loader": "^1.0.3",
14
14
  "ckeditor": "^4.12.1",
15
15
  "core-js": "^3.6.5",
16
+ "esdk-obs-browserjs": "^3.23.5",
16
17
  "install": "^0.13.0",
17
18
  "jquery": "^3.5.1",
18
19
  "lodash": "^4.17.21",
@@ -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 () {
@@ -0,0 +1,32 @@
1
+ // 创建ObsClient实例
2
+ import ObsClient from 'esdk-obs-browserjs';
3
+ const obsClient = new ObsClient({
4
+ access_key_id: "EE4MAFWH4YLQSQF7NNIP",
5
+ secret_access_key: "Dq9giqqwZoX77dqSIzhA1Yhhe9tarA3LRBGBF4eO",
6
+ server : 'https://obs.cn-east-3.myhuaweicloud.com',
7
+ timeout : 1000
8
+ });
9
+ async function putObject(file,callback){
10
+ let fileUrl = ''
11
+ let objName = (process.env.VUE_APP_ENV === 'development' ? 'dev_' : 'pro_') + file.name
12
+ await obsClient.putObject({
13
+ Bucket: 'askbot-uat',
14
+ Key : objName,
15
+ SourceFile : file,
16
+ ACL : obsClient.enums.AclPublicRead,
17
+ ProgressCallback: callback
18
+ }).then(function(result) {
19
+ if(result.CommonMsg.Status < 300){
20
+ console.log('Create object:' + JSON.stringify(result) + ' successfully!\n');
21
+ fileUrl = {
22
+ url:'https://askbot-uat.obs.cn-east-3.myhuaweicloud.com/' + objName,
23
+ name:file.name
24
+ }
25
+ }
26
+ });
27
+ return fileUrl
28
+ }
29
+
30
+ export {
31
+ putObject
32
+ }
@@ -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{
@@ -234,8 +234,7 @@ export default {
234
234
  if(res.data.code == '0') {
235
235
  this.previewHref = res.data.data;
236
236
  this.sourceFileType = url.substring(url.lastIndexOf('.'))
237
- let isOhmPc = sessionStorage.getItem('isOhmPc')
238
- if (isMobile() || isOhmPc == 'true'){
237
+ if (isMobile()){
239
238
  this.$refs.previewPdf.drawer = true;
240
239
  this.$refs.previewPdf.previewShowPopup = true;
241
240
  } else {
@@ -244,18 +243,7 @@ export default {
244
243
  }
245
244
  this.$refs.previewPdf.fileType = type
246
245
  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'){
255
- this.$refs.previewPdf.fileName = fileName;
256
- } else {
257
- this.$refs.previewPdf.fileName = '';
258
- }
246
+ this.$refs.previewPdf.isMessageRecord = this.isMessageRecord ? true : false
259
247
  if(item.tagIds && item.tagIds.length != 0) {
260
248
  this.$refs.previewPdf.loading = false
261
249
  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
  松开发送
@@ -105,7 +105,7 @@ import AnswerVoice from "@/components/AnswerVoice";
105
105
  // import ChatContent from "./chatContent";
106
106
  // import FeedBack from '@/components/feedBack'
107
107
  // 知识类型
108
- import AnswerDocknowledge from "./AnswerDocknowledge.vue";
108
+ // import AnswerDocknowledge from "./AnswerDocknowledge.vue";
109
109
  export default {
110
110
  name: 'ConversationContainer',
111
111
  components: {
@@ -131,7 +131,7 @@ export default {
131
131
  // FormTemplate,
132
132
  // FileType,
133
133
  // ChatContent,
134
- AnswerDocknowledge,
134
+ // AnswerDocknowledge,
135
135
  },
136
136
  props: {
137
137
  messages: Array
@@ -188,48 +188,17 @@ export default {
188
188
  answerDocknowledge:
189
189
  // {"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},
190
190
 
191
- {
192
- "conditionList": null,
193
- "apiKey": null,
194
- "effectiveTime": null,
195
- "intentId": null,
196
- "msgId": null,
197
- "actionCategory": null,
198
- "id": null,
199
- "type": "answer_doc_knowledge",
200
- "nodeId": null,
201
- "content": {
202
- "knowledgeId": null,
203
- "actionType": "answer_doc_knowledge",
204
- "images": null,
205
- "knowledgePartId": null,
206
- "srcContentId": null,
207
- "text": "新能源车是指采用新型能源的轿车、客车、货车等机动车辆,包括纯电动汽车、插电式混合动力汽车和燃料电池汽车。根据数据显示,2020年我国新能源汽车销售量达到139万辆,同比增长10.9%。预计2021年新能源车市场将继续保持高速增长,销售量有望超过200万辆。政府对新能源汽车实行补贴政策,同时逐步放松对新能源车的限购和限行政策。此外,中国汽车企业在新能源车领域的技术研发能力也不断提升,各大品牌纷纷推出新能源车型,采用更优秀的动力电池和电控系统,提高了车辆的续航里程。因此,新能源车市场发展前景广阔。",
208
- "list": [
209
- {
210
- "owner": null,
211
- "tagId": "6525183560177f6223d52a14",
212
- "enterprise": null,
213
- "tagIds": [
214
- "6525183560177f6223d52a14"
215
- ],
216
- "format": "docx",
217
- "srcContentId": "99cada54a02161f979acc28c5b8b913e",
218
- "updateTime": "2023-10-10 17:24:05",
219
- "source": "CORP_LOCAL_FILE",
220
- "srcContent": "新能源车指的是采用新型能源的轿车、客车、货车等机动车辆。目前主要的新能源车包括纯电动汽车、插电式混合动力汽车、燃料电池汽车等。以下是对新能源车的分析报告:市场发展趋势:随着环保和能源安全意识的增强,新能源车市场呈现快速发展态势。数据显示,2020年我国新能源汽车销售量达到139万辆,同比增长10.9%。预计2021年新能源车市场仍将保持高速增长,销售量有望达到200万辆以上。政策扶持力度加大:我国政府对新能源汽车实行补贴政策,以鼓励消费者选择绿色出行方式。此外,对新能源车限购、限行等政策也逐步放松。政策扶持的加大将进一步促进新能",
221
- "url": "http://guoranwisdom.oss-cn-zhangjiakou.aliyuncs.com/43aadcaac45f4be19b63fd18ca68f2e6/2023/10/10/17/23/a27c5c1dd534d180c5512c907d5c9888/新能源车分析报告 (1).docx?uploadId=0921CB01AB5847E8BEF44730EE5DACF7",
222
- "knowledgeId": "6525182f002ff5198983a90c",
223
- "knowledgePartId": "YfHmGIsBvcIPGxbfkvwK",
224
- "from": "新能源车分析报告 (1)",
225
- "introduction": "新能源车指的是采用新型能源的轿车、客车、货车等机动车辆。目前主要的新能源车包括纯电动汽车、插电式混合动力汽车、燃料电池汽车等。以下是对新能源车的分析报告:市场发展趋势:随着环保和能源安全意识的增强,新能源车市场呈现快速发展态势。数据显示,2020年我国新能源汽车销售量达到139万辆,同比增长10.9%。预计2021年新能源车市场仍将保持高速增长,销售量有望达到200万辆以上。政策扶持力度加大:我国政府对新能源汽车实行补贴政策,以鼓励消费者选择绿色出行方式。此外,对新能源车限购、限行等政策也逐步放松。政策扶持的加大将进一步促进新能"
226
- }
227
- ],
228
- "renderType": 0,
229
- "type": 0,
230
- "srcContent": null
231
- }
232
- },
191
+ {
192
+ "content": {
193
+ "images": [{ url: 'https://static.guoranbot.com/images/knowledge/e0f6898c6b0d47fa98e8f71ceab1bde8/安全标志--禁止标志.png' }],
194
+ "actionType": "answer_doc_knowledge",
195
+ "text": "中国的省份名称有湖北省、广西壮族自治区等。",
196
+ "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麦克风" },],
197
+ "renderType": 0,
198
+ "type": 0
199
+ },
200
+ "type": "answer_doc_knowledge"
201
+ },
233
202
  ActionAiGuideObj: {
234
203
  // 智能引导
235
204
  type: "answer_intellect_guide",
@@ -25,7 +25,7 @@
25
25
  </div>
26
26
  </template>
27
27
  <script>
28
- import {ossConfig,uploadImageByBase64} from "../assets/js/AliyunlssUtil";
28
+ import { putObject } from "../assets/js/obsBrowser";
29
29
 
30
30
  export default {
31
31
  name: "ask_video",
@@ -85,7 +85,10 @@
85
85
  console.debug('img.src',output)
86
86
  let base64 = canvas.toDataURL("image/png")
87
87
  let blob = that.dataURLtoFile(base64,'name')
88
- let promise = uploadImageByBase64(ossConfig,blob);
88
+ // let promise = uploadImageByBase64(ossConfig,blob);
89
+ const file = new File([blob], 'name', { type: 'text/plain', lastModified: Date.now() });
90
+ console.debug('file',file)
91
+ let promise = putObject(file);
89
92
  promise.then((res)=>{
90
93
  console.debug("upload base64 reslut",res);
91
94
  if (res&&res.url){
@@ -233,7 +233,7 @@
233
233
  this.$emit("onRadioClick", id, name, apikey);
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)
@@ -833,6 +833,7 @@ import Tree from '../components/tree'
833
833
  import selectPopup from '../components/popup'
834
834
  import fileListView from './fielListView.vue'
835
835
  import { uniqueData } from './utils/math_utils'
836
+ import { putObject } from "../assets/js/obsBrowser";
836
837
  export default {
837
838
  name: "formTemplate",
838
839
  data() {
@@ -1598,21 +1599,24 @@ export default {
1598
1599
  status:'',
1599
1600
  url:''
1600
1601
  }
1601
- let res = multipartUpload(
1602
- this.ossConfig,
1603
- file,
1604
- null,
1605
- imageInfo
1606
- );
1607
- res.then((res) => {
1602
+ // let res = multipartUpload(
1603
+ // this.ossConfig,
1604
+ // file,
1605
+ // null,
1606
+ // imageInfo
1607
+ // );
1608
+ let resp = putObject(file);
1609
+ resp.then((res) => {
1608
1610
  console.log("upload result:", res);
1609
1611
  // let filePath = res.name;
1610
- imageData.urls.push({
1612
+ let obj = {
1611
1613
  name:file.name,
1612
- url:ossFileUrl(this.ossConfig, res.name),
1614
+ url:res.url,
1613
1615
  status:'success'
1614
- })
1615
- imageInfo.url = ossFileUrl(this.ossConfig, res.name)
1616
+ }
1617
+ imageData.urls.push(obj)
1618
+ // imageInfo.url = ossFileUrl(this.ossConfig, res.name)
1619
+ imageInfo.url = res.url;
1616
1620
  imageInfo.status='success'
1617
1621
  imageInfo.name=file.name
1618
1622
  for (let j=0;j<this.extInfoFieldValue[this.filedId].length;j++){
@@ -2498,13 +2502,14 @@ export default {
2498
2502
  progress: 0,
2499
2503
  },
2500
2504
  };*/
2501
- let res = multipartUpload(
2502
- this.ossConfig,
2503
- file,
2504
- null,
2505
- imgInfo
2506
- );
2507
- res.then((res) => {
2505
+ // let res = multipartUpload(
2506
+ // this.ossConfig,
2507
+ // file,
2508
+ // null,
2509
+ // imgInfo
2510
+ // );
2511
+ let ress = putObject(file)
2512
+ ress.then((res) => {
2508
2513
  console.debug("upload result:", res);
2509
2514
  // let filePath = res.name;
2510
2515
  /* imageData.content.progress = 1;
@@ -2512,7 +2517,7 @@ export default {
2512
2517
  ossFileUrl(this.ossConfig, res.name)
2513
2518
  );
2514
2519
  console.log('imageData',imageData)*/
2515
- imgInfo.url = ossFileUrl(this.ossConfig, res.name)
2520
+ imgInfo.url = res.url
2516
2521
  imgInfo.status='success'
2517
2522
  if (data.file){
2518
2523
  imgInfo.name = data.file.name
@@ -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: [
@@ -284,41 +281,36 @@ export default {
284
281
  const { pdfPage, pageNo, dom } = page;
285
282
  // dom 元素已存在,无须重新渲染,直接返回
286
283
  if ((dom && dom.children.length != 0) || page.loading) {
287
- return;
284
+ return;
288
285
  }
289
286
  page.loading = true
290
287
  const viewport = pdfPage.getViewport({
291
- scale: this.scale,
292
- rotation: this.rotation,
288
+ scale: this.scale,
289
+ rotation: this.rotation,
293
290
  });
294
291
  // 创建新的canvas
295
292
  const canvas = document.createElement('canvas');
296
293
  const context = canvas.getContext('2d');
297
294
  // canvas.getContext('2d');
298
- canvas.height = this.pageSize.height * (this.fileName ? CSS_UNITS : 1);
299
- canvas.width = this.pageSize.width * (this.fileName ? CSS_UNITS : 1);
295
+ canvas.height = this.pageSize.height;
296
+ canvas.width = this.pageSize.width;
300
297
  canvas.style.position = 'relative'
301
298
  canvas.style.top = -3 + 'px'
302
299
  // 创建渲染的dom
303
300
  const pageDom = document.createElement('div');
304
301
  pageDom.style.position = 'absolute';
305
- pageDom.style.top = `${((pageNo - 1) * (this.pageSize.height + this.PAGE_INTVERVAL) * (this.fileName ? CSS_UNITS : 1)) + this.PAGE_INTVERVAL}px`;
306
- pageDom.style.width = `${this.pageSize.width * (this.fileName ? CSS_UNITS : 1)}px`;
307
- 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`;
308
305
  pageDom.setAttribute('data-id', 'page' + pageNo)
309
- // pageDom.appendChild(canvas);
306
+ pageDom.appendChild(canvas);
310
307
  // 渲染内容
311
308
  let renderContext = {
312
309
  canvasContext: context,
313
310
  viewport: viewport,
314
- transform: this.fileName ? [CSS_UNITS, 0, 0, CSS_UNITS, 0, 0] : '',
315
311
  }
316
312
  await pdfPage.render(renderContext).promise.then(() => {
317
- const html = canvas.toDataURL();
318
- let image = document.createElement('img');
319
- image.setAttribute('src',html)
320
- pageDom.appendChild(image);
321
- return pdfPage.getTextContent()
313
+ return pdfPage.getTextContent()
322
314
  }).then(async (textContent) => {
323
315
  const textLayerDiv = document.createElement('div');
324
316
  textLayerDiv.setAttribute('class', 'textLayer');
@@ -348,35 +340,36 @@ export default {
348
340
  let postionArr = lines[index].location
349
341
  let div = document.createElement('div')
350
342
  div.style.position = 'absolute';
351
- div.style.left = postionArr[0] * this.scale * (this.fileName ? CSS_UNITS : 1) + 'px',
343
+ div.style.left = postionArr[0] * this.scale + 'px',
352
344
  // 后端返回的坐标有基线对齐的问题,top 值是后端算好(基线top - 文字高度),在此加上文字高度的 1/9 (大致比例)为实际展示出文字的top值
353
- div.style.top = postionArr[1] * this.scale * (this.fileName ? CSS_UNITS : 1) + 'px'
354
- div.style.height = postionArr[3] * this.scale * (this.fileName ? CSS_UNITS : 1) + 'px';
355
- 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'
356
348
  div.style.backgroundColor = 'rgba(54, 106, 255, 0.3)'
357
349
  div.classList.add('lineHeight')
358
350
  rectdom.appendChild(div)
359
351
  if (index == 0 && j == 0) {
360
352
  if (this.transformSalce !== null) {
361
- rectdomTop = postionArr[1]* this.scale * (this.fileName ? CSS_UNITS : 1) * this.transformSalce
362
- } else {
363
- rectdomTop = postionArr[1] * this.scale * (this.fileName ? CSS_UNITS : 1) * this.defaultTransform
364
- }
365
- // if(this.isPC) {
366
- // rectdomTop = rectdomTop - 50 < 0 ? 0 : rectdomTop - 50
367
- // }
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
+ }
368
366
  }
369
- }
370
- }
371
- if (rectdom.children.length > 0) {
372
- pageDom.appendChild(rectdom)
373
367
  }
374
- }
375
368
  }
376
- }
377
- textLayer.setTextContent(textContent);
378
- textLayer.render()
379
- pageDom.appendChild(textLayerDiv);
369
+ textLayer.setTextContent(textContent);
370
+ textLayer.render()
371
+ pageDom.appendChild(textLayerDiv);
372
+
380
373
  let backgroundDom = document.getElementById('backgroundLoad' + pageNo)
381
374
  if (backgroundDom) {
382
375
  this.contentView.removeChild(backgroundDom);
@@ -384,27 +377,8 @@ export default {
384
377
  page.dom = await pageDom;
385
378
  page.loading = false
386
379
  this.contentView.appendChild(pageDom);
387
- let pdf_view = document.getElementsByClassName('pdf_view');
388
- if (pdf_view && pdf_view[0]){
389
- pdf_view[0].style.backgroundImage = 'none'
390
- }
391
- let postionArr = []
392
- if (findPage){
393
- let AllLines = findPage.allLines
394
- if (AllLines.length){
395
- postionArr = AllLines[0].lines[0].location
396
- }
397
- }
398
- if(this.transformSalce !== null && this.fileName) {
399
- this.contentView.style.transform = `scale(${this.transformSalce}, ${this.transformSalce})`
400
- if (postionArr.length){
401
- this.contentView.style.left = (postionArr[0] * this.scale * CSS_UNITS * (this.transformSalce) * -1) + 10 + 'px';
402
- }
403
- } else {
404
- this.contentView.style.transform = `scale(${this.defaultTransform})`;
405
- if (postionArr.length){
406
- this.contentView.style.left = (postionArr[0] * this.scale * CSS_UNITS * (this.defaultTransform) * -1) / 2 + 'px';
407
- }
380
+ if (this.transformSalce !== null) {
381
+ this.contentView.style.transform = `scale(${this.transformSalce}, ${this.transformSalce})`
408
382
  }
409
383
  if (this.changetoolbar) {
410
384
  setTimeout(() => {
@@ -416,21 +390,22 @@ export default {
416
390
  setTimeout(() => {
417
391
  let pageoffsetHeight = 0
418
392
  if (this.transformSalce !== null) {
419
- pageoffsetHeight = (this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce * (this.fileName ? CSS_UNITS : 1)
393
+ pageoffsetHeight = (this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce
420
394
  } else {
421
- pageoffsetHeight = (this.pageSize.height + this.PAGE_INTVERVAL) * this.defaultTransform *(this.fileName ? CSS_UNITS : 1)
395
+ pageoffsetHeight = (this.pageSize.height + this.PAGE_INTVERVAL)
422
396
  }
423
397
  if (this.$refs.pdfView.clientHeight - pageoffsetHeight > 0 && pageIndex == 1) {
424
398
  const height = this.$refs.pdfView.clientHeight;
425
399
  let startNum = 0
426
400
  let endNum = 0
427
401
  if (this.transformSalce !== null) {
428
- startNum = Math.ceil(this.$refs.pdfView.scrollTop / ((this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce* (this.fileName ? CSS_UNITS : 1)))
429
- endNum = startNum + Math.ceil(height / ((this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce* (this.fileName ? CSS_UNITS : 1)))
430
- } else {
431
- startNum = Math.ceil(this.$refs.pdfView.scrollTop / ((this.pageSize.height + this.PAGE_INTVERVAL) * (this.fileName ? CSS_UNITS : 1) * this.defaultTransform))
432
- endNum = startNum + Math.ceil(height / ((this.pageSize.height + this.PAGE_INTVERVAL) * (this.fileName ? CSS_UNITS : 1) * this.defaultTransform))}
433
- 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
+ }
434
409
  for (let pageIndex = startNum; pageIndex <= endNum; pageIndex++) {
435
410
  if (pageIndex > 0 && pageIndex <= this.pages.length) {
436
411
  this.loadPdfData(pageIndex)
@@ -462,14 +437,14 @@ export default {
462
437
  let startNum = 0
463
438
  let endNum = 0
464
439
  if (this.transformSalce !== null) {
465
- startNum = Math.ceil(scrollTop / ((that.pageSize.height + that.PAGE_INTVERVAL) * this.transformSalce * (this.fileName ? CSS_UNITS : 1)))
466
- 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))
467
442
  } else {
468
- startNum = Math.ceil(scrollTop / ((that.pageSize.height + that.PAGE_INTVERVAL) * (this.fileName ? CSS_UNITS : 1) * this.defaultTransform))
469
- 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))
470
445
  }
471
446
  for (let pageIndex = startNum; pageIndex < endNum; pageIndex++) {
472
- if (pageIndex > 0 && pageIndex <= that.pages.length) {
447
+ if (pageIndex > 0 && pageIndex < that.pages.length) {
473
448
  that.loadPdfData(pageIndex)
474
449
  }
475
450
  }
@@ -554,10 +529,10 @@ export default {
554
529
  return
555
530
  }
556
531
  const pageDom = document.createElement('div');
557
- pageDom.style.width = `${this.pageSize.width * (this.fileName ? CSS_UNITS : 1)}px`;
558
- 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`;
559
534
  pageDom.style.position = 'absolute';
560
- 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
561
536
  }px`;
562
537
  pageDom.style.backgroundImage = `url('https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif')`
563
538
  pageDom.style.backgroundPosition = 'center'
@@ -634,7 +609,7 @@ export default {
634
609
  if (this.transformSalce !== null) {
635
610
  this.$refs.pdfView.scrollTop = `${((pdfResloute.page - 1) * (this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce) + (this.identifyTextPostion.top * this.scale * this.transformSalce)}`
636
611
  } else {
637
- this.$refs.pdfView.scrollTop = `${((pdfResloute.page - 1) * (this.pageSize.height + this.PAGE_INTVERVAL)) + (this.identifyTextPostion.top * this.scale * this.defaultTransform)}`
612
+ this.$refs.pdfView.scrollTop = `${((pdfResloute.page - 1) * (this.pageSize.height + this.PAGE_INTVERVAL)) + (this.identifyTextPostion.top * this.scale * this.transformSalce)}`
638
613
  }
639
614
  },
640
615
  scrollToExcalTop (currentPage) {
@@ -888,7 +863,6 @@ export default {
888
863
  if (value && value.length) {
889
864
  // 在 pdf_view 下创建 所有canvs的容器
890
865
  this.contentView = document.createElement('div')
891
- this.contentView.setAttribute('id','contentView')
892
866
  this.contentView.style.transformOrigin = '0px 0px 0px'
893
867
  this.$http.get('/knowledge-api/knowledge/knowledge-part-location-info/list?ids=' + value.join(',')).then(res => {
894
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}
@@ -1079,16 +1053,11 @@ export default {
1079
1053
  xhr.onload = ({ currentTarget }) => {
1080
1054
  // 请求完成
1081
1055
  if (currentTarget.status === 200) { // 返回200
1082
- let pdf_view = document.getElementsByClassName('pdf_view');
1083
- if (pdf_view && pdf_view[0]){
1084
- pdf_view[0].style.backgroundImage = 'none'
1085
- }
1086
1056
  this.contentView.innerHTML = currentTarget.response
1087
1057
  this.contentView.style.padding = '10px'
1088
1058
  // this.contentView.style.position = 'relative'
1089
1059
  this.$refs.pdfView.style.backgroundColor = '#FFFFFF'
1090
1060
  this.$refs.pdfView.appendChild(this.contentView)
1091
-
1092
1061
  let allTr = Array.from(this.$refs.pdfView.getElementsByTagName('tr'))
1093
1062
  this.allTr = []
1094
1063
  for (let index = 0; index < allTr.length; index++) {
@@ -1131,14 +1100,10 @@ export default {
1131
1100
  width: 100%;
1132
1101
  height: calc(100% - 110px);
1133
1102
  overflow: auto;
1134
- //overflow-y: scroll;
1135
1103
  background-color: #f5f7fb;
1136
1104
  // margin-bottom: 60px;
1137
1105
  box-sizing: border-box;
1138
- background-image: url('https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif');
1139
- background-position: center;
1140
- background-size: 50px;
1141
- background-repeat: no-repeat;
1106
+
1142
1107
  // position: relative;
1143
1108
  // > div {
1144
1109
  // width: 100%;
@@ -1327,12 +1292,6 @@ export default {
1327
1292
  background: rgba(221, 222, 223, 1);
1328
1293
  }
1329
1294
  }
1330
- .pdf_container_view{
1331
- height: 100%;
1332
- width: 100%;
1333
- position: relative;
1334
- overflow: auto;
1335
- }
1336
1295
  }
1337
1296
  </style>
1338
1297
  <style lang="less">
@@ -1345,6 +1304,7 @@ export default {
1345
1304
  0% {
1346
1305
  background: rgba(255, 136, 0, 0.3);
1347
1306
  }
1307
+
1348
1308
  25% {
1349
1309
  background: rgba(255, 136, 0, 0.6);
1350
1310
  }