askbot-dragon 1.6.76-beta → 1.6.76

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.
Files changed (308) hide show
  1. package/README.md +27 -27
  2. package/babel.config.js +6 -6
  3. package/dragon.iml +7 -7
  4. package/package.json +58 -55
  5. package/public/index.html +75 -72
  6. package/public/pdfjs/cmaps/78-EUC-H.bcmap +0 -0
  7. package/public/pdfjs/cmaps/78-EUC-V.bcmap +0 -0
  8. package/public/pdfjs/cmaps/78-H.bcmap +0 -0
  9. package/public/pdfjs/cmaps/78-RKSJ-H.bcmap +0 -0
  10. package/public/pdfjs/cmaps/78-RKSJ-V.bcmap +0 -0
  11. package/public/pdfjs/cmaps/78-V.bcmap +0 -0
  12. package/public/pdfjs/cmaps/78ms-RKSJ-H.bcmap +0 -0
  13. package/public/pdfjs/cmaps/78ms-RKSJ-V.bcmap +0 -0
  14. package/public/pdfjs/cmaps/83pv-RKSJ-H.bcmap +0 -0
  15. package/public/pdfjs/cmaps/90ms-RKSJ-H.bcmap +0 -0
  16. package/public/pdfjs/cmaps/90ms-RKSJ-V.bcmap +0 -0
  17. package/public/pdfjs/cmaps/90msp-RKSJ-H.bcmap +0 -0
  18. package/public/pdfjs/cmaps/90msp-RKSJ-V.bcmap +0 -0
  19. package/public/pdfjs/cmaps/90pv-RKSJ-H.bcmap +0 -0
  20. package/public/pdfjs/cmaps/90pv-RKSJ-V.bcmap +0 -0
  21. package/public/pdfjs/cmaps/Add-H.bcmap +0 -0
  22. package/public/pdfjs/cmaps/Add-RKSJ-H.bcmap +0 -0
  23. package/public/pdfjs/cmaps/Add-RKSJ-V.bcmap +0 -0
  24. package/public/pdfjs/cmaps/Add-V.bcmap +0 -0
  25. package/public/pdfjs/cmaps/Adobe-CNS1-0.bcmap +0 -0
  26. package/public/pdfjs/cmaps/Adobe-CNS1-1.bcmap +0 -0
  27. package/public/pdfjs/cmaps/Adobe-CNS1-2.bcmap +0 -0
  28. package/public/pdfjs/cmaps/Adobe-CNS1-3.bcmap +0 -0
  29. package/public/pdfjs/cmaps/Adobe-CNS1-4.bcmap +0 -0
  30. package/public/pdfjs/cmaps/Adobe-CNS1-5.bcmap +0 -0
  31. package/public/pdfjs/cmaps/Adobe-CNS1-6.bcmap +0 -0
  32. package/public/pdfjs/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
  33. package/public/pdfjs/cmaps/Adobe-GB1-0.bcmap +0 -0
  34. package/public/pdfjs/cmaps/Adobe-GB1-1.bcmap +0 -0
  35. package/public/pdfjs/cmaps/Adobe-GB1-2.bcmap +0 -0
  36. package/public/pdfjs/cmaps/Adobe-GB1-3.bcmap +0 -0
  37. package/public/pdfjs/cmaps/Adobe-GB1-4.bcmap +0 -0
  38. package/public/pdfjs/cmaps/Adobe-GB1-5.bcmap +0 -0
  39. package/public/pdfjs/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
  40. package/public/pdfjs/cmaps/Adobe-Japan1-0.bcmap +0 -0
  41. package/public/pdfjs/cmaps/Adobe-Japan1-1.bcmap +0 -0
  42. package/public/pdfjs/cmaps/Adobe-Japan1-2.bcmap +0 -0
  43. package/public/pdfjs/cmaps/Adobe-Japan1-3.bcmap +0 -0
  44. package/public/pdfjs/cmaps/Adobe-Japan1-4.bcmap +0 -0
  45. package/public/pdfjs/cmaps/Adobe-Japan1-5.bcmap +0 -0
  46. package/public/pdfjs/cmaps/Adobe-Japan1-6.bcmap +0 -0
  47. package/public/pdfjs/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
  48. package/public/pdfjs/cmaps/Adobe-Korea1-0.bcmap +0 -0
  49. package/public/pdfjs/cmaps/Adobe-Korea1-1.bcmap +0 -0
  50. package/public/pdfjs/cmaps/Adobe-Korea1-2.bcmap +0 -0
  51. package/public/pdfjs/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
  52. package/public/pdfjs/cmaps/B5-H.bcmap +0 -0
  53. package/public/pdfjs/cmaps/B5-V.bcmap +0 -0
  54. package/public/pdfjs/cmaps/B5pc-H.bcmap +0 -0
  55. package/public/pdfjs/cmaps/B5pc-V.bcmap +0 -0
  56. package/public/pdfjs/cmaps/CNS-EUC-H.bcmap +0 -0
  57. package/public/pdfjs/cmaps/CNS-EUC-V.bcmap +0 -0
  58. package/public/pdfjs/cmaps/CNS1-H.bcmap +0 -0
  59. package/public/pdfjs/cmaps/CNS1-V.bcmap +0 -0
  60. package/public/pdfjs/cmaps/CNS2-H.bcmap +0 -0
  61. package/public/pdfjs/cmaps/CNS2-V.bcmap +3 -0
  62. package/public/pdfjs/cmaps/ETHK-B5-H.bcmap +0 -0
  63. package/public/pdfjs/cmaps/ETHK-B5-V.bcmap +0 -0
  64. package/public/pdfjs/cmaps/ETen-B5-H.bcmap +0 -0
  65. package/public/pdfjs/cmaps/ETen-B5-V.bcmap +0 -0
  66. package/public/pdfjs/cmaps/ETenms-B5-H.bcmap +3 -0
  67. package/public/pdfjs/cmaps/ETenms-B5-V.bcmap +0 -0
  68. package/public/pdfjs/cmaps/EUC-H.bcmap +0 -0
  69. package/public/pdfjs/cmaps/EUC-V.bcmap +0 -0
  70. package/public/pdfjs/cmaps/Ext-H.bcmap +0 -0
  71. package/public/pdfjs/cmaps/Ext-RKSJ-H.bcmap +0 -0
  72. package/public/pdfjs/cmaps/Ext-RKSJ-V.bcmap +0 -0
  73. package/public/pdfjs/cmaps/Ext-V.bcmap +0 -0
  74. package/public/pdfjs/cmaps/GB-EUC-H.bcmap +0 -0
  75. package/public/pdfjs/cmaps/GB-EUC-V.bcmap +0 -0
  76. package/public/pdfjs/cmaps/GB-H.bcmap +4 -0
  77. package/public/pdfjs/cmaps/GB-V.bcmap +0 -0
  78. package/public/pdfjs/cmaps/GBK-EUC-H.bcmap +0 -0
  79. package/public/pdfjs/cmaps/GBK-EUC-V.bcmap +0 -0
  80. package/public/pdfjs/cmaps/GBK2K-H.bcmap +0 -0
  81. package/public/pdfjs/cmaps/GBK2K-V.bcmap +0 -0
  82. package/public/pdfjs/cmaps/GBKp-EUC-H.bcmap +0 -0
  83. package/public/pdfjs/cmaps/GBKp-EUC-V.bcmap +0 -0
  84. package/public/pdfjs/cmaps/GBT-EUC-H.bcmap +0 -0
  85. package/public/pdfjs/cmaps/GBT-EUC-V.bcmap +0 -0
  86. package/public/pdfjs/cmaps/GBT-H.bcmap +0 -0
  87. package/public/pdfjs/cmaps/GBT-V.bcmap +0 -0
  88. package/public/pdfjs/cmaps/GBTpc-EUC-H.bcmap +0 -0
  89. package/public/pdfjs/cmaps/GBTpc-EUC-V.bcmap +0 -0
  90. package/public/pdfjs/cmaps/GBpc-EUC-H.bcmap +0 -0
  91. package/public/pdfjs/cmaps/GBpc-EUC-V.bcmap +0 -0
  92. package/public/pdfjs/cmaps/H.bcmap +0 -0
  93. package/public/pdfjs/cmaps/HKdla-B5-H.bcmap +0 -0
  94. package/public/pdfjs/cmaps/HKdla-B5-V.bcmap +0 -0
  95. package/public/pdfjs/cmaps/HKdlb-B5-H.bcmap +0 -0
  96. package/public/pdfjs/cmaps/HKdlb-B5-V.bcmap +0 -0
  97. package/public/pdfjs/cmaps/HKgccs-B5-H.bcmap +0 -0
  98. package/public/pdfjs/cmaps/HKgccs-B5-V.bcmap +0 -0
  99. package/public/pdfjs/cmaps/HKm314-B5-H.bcmap +0 -0
  100. package/public/pdfjs/cmaps/HKm314-B5-V.bcmap +0 -0
  101. package/public/pdfjs/cmaps/HKm471-B5-H.bcmap +0 -0
  102. package/public/pdfjs/cmaps/HKm471-B5-V.bcmap +0 -0
  103. package/public/pdfjs/cmaps/HKscs-B5-H.bcmap +0 -0
  104. package/public/pdfjs/cmaps/HKscs-B5-V.bcmap +0 -0
  105. package/public/pdfjs/cmaps/Hankaku.bcmap +0 -0
  106. package/public/pdfjs/cmaps/Hiragana.bcmap +0 -0
  107. package/public/pdfjs/cmaps/KSC-EUC-H.bcmap +0 -0
  108. package/public/pdfjs/cmaps/KSC-EUC-V.bcmap +0 -0
  109. package/public/pdfjs/cmaps/KSC-H.bcmap +0 -0
  110. package/public/pdfjs/cmaps/KSC-Johab-H.bcmap +0 -0
  111. package/public/pdfjs/cmaps/KSC-Johab-V.bcmap +0 -0
  112. package/public/pdfjs/cmaps/KSC-V.bcmap +0 -0
  113. package/public/pdfjs/cmaps/KSCms-UHC-H.bcmap +0 -0
  114. package/public/pdfjs/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
  115. package/public/pdfjs/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
  116. package/public/pdfjs/cmaps/KSCms-UHC-V.bcmap +0 -0
  117. package/public/pdfjs/cmaps/KSCpc-EUC-H.bcmap +0 -0
  118. package/public/pdfjs/cmaps/KSCpc-EUC-V.bcmap +0 -0
  119. package/public/pdfjs/cmaps/Katakana.bcmap +0 -0
  120. package/public/pdfjs/cmaps/LICENSE +36 -0
  121. package/public/pdfjs/cmaps/NWP-H.bcmap +0 -0
  122. package/public/pdfjs/cmaps/NWP-V.bcmap +0 -0
  123. package/public/pdfjs/cmaps/RKSJ-H.bcmap +0 -0
  124. package/public/pdfjs/cmaps/RKSJ-V.bcmap +0 -0
  125. package/public/pdfjs/cmaps/Roman.bcmap +0 -0
  126. package/public/pdfjs/cmaps/UniCNS-UCS2-H.bcmap +0 -0
  127. package/public/pdfjs/cmaps/UniCNS-UCS2-V.bcmap +0 -0
  128. package/public/pdfjs/cmaps/UniCNS-UTF16-H.bcmap +0 -0
  129. package/public/pdfjs/cmaps/UniCNS-UTF16-V.bcmap +0 -0
  130. package/public/pdfjs/cmaps/UniCNS-UTF32-H.bcmap +0 -0
  131. package/public/pdfjs/cmaps/UniCNS-UTF32-V.bcmap +0 -0
  132. package/public/pdfjs/cmaps/UniCNS-UTF8-H.bcmap +0 -0
  133. package/public/pdfjs/cmaps/UniCNS-UTF8-V.bcmap +0 -0
  134. package/public/pdfjs/cmaps/UniGB-UCS2-H.bcmap +0 -0
  135. package/public/pdfjs/cmaps/UniGB-UCS2-V.bcmap +0 -0
  136. package/public/pdfjs/cmaps/UniGB-UTF16-H.bcmap +0 -0
  137. package/public/pdfjs/cmaps/UniGB-UTF16-V.bcmap +0 -0
  138. package/public/pdfjs/cmaps/UniGB-UTF32-H.bcmap +0 -0
  139. package/public/pdfjs/cmaps/UniGB-UTF32-V.bcmap +0 -0
  140. package/public/pdfjs/cmaps/UniGB-UTF8-H.bcmap +0 -0
  141. package/public/pdfjs/cmaps/UniGB-UTF8-V.bcmap +0 -0
  142. package/public/pdfjs/cmaps/UniJIS-UCS2-H.bcmap +0 -0
  143. package/public/pdfjs/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
  144. package/public/pdfjs/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
  145. package/public/pdfjs/cmaps/UniJIS-UCS2-V.bcmap +0 -0
  146. package/public/pdfjs/cmaps/UniJIS-UTF16-H.bcmap +0 -0
  147. package/public/pdfjs/cmaps/UniJIS-UTF16-V.bcmap +0 -0
  148. package/public/pdfjs/cmaps/UniJIS-UTF32-H.bcmap +0 -0
  149. package/public/pdfjs/cmaps/UniJIS-UTF32-V.bcmap +0 -0
  150. package/public/pdfjs/cmaps/UniJIS-UTF8-H.bcmap +0 -0
  151. package/public/pdfjs/cmaps/UniJIS-UTF8-V.bcmap +0 -0
  152. package/public/pdfjs/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
  153. package/public/pdfjs/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
  154. package/public/pdfjs/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
  155. package/public/pdfjs/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
  156. package/public/pdfjs/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
  157. package/public/pdfjs/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
  158. package/public/pdfjs/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
  159. package/public/pdfjs/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
  160. package/public/pdfjs/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
  161. package/public/pdfjs/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
  162. package/public/pdfjs/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
  163. package/public/pdfjs/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
  164. package/public/pdfjs/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
  165. package/public/pdfjs/cmaps/UniKS-UCS2-H.bcmap +0 -0
  166. package/public/pdfjs/cmaps/UniKS-UCS2-V.bcmap +0 -0
  167. package/public/pdfjs/cmaps/UniKS-UTF16-H.bcmap +0 -0
  168. package/public/pdfjs/cmaps/UniKS-UTF16-V.bcmap +0 -0
  169. package/public/pdfjs/cmaps/UniKS-UTF32-H.bcmap +0 -0
  170. package/public/pdfjs/cmaps/UniKS-UTF32-V.bcmap +0 -0
  171. package/public/pdfjs/cmaps/UniKS-UTF8-H.bcmap +0 -0
  172. package/public/pdfjs/cmaps/UniKS-UTF8-V.bcmap +0 -0
  173. package/public/pdfjs/cmaps/V.bcmap +0 -0
  174. package/public/pdfjs/cmaps/WP-Symbol.bcmap +0 -0
  175. package/public/pdfjs/standard_fonts/FoxitDingbats.pfb +0 -0
  176. package/public/pdfjs/standard_fonts/FoxitFixed.pfb +0 -0
  177. package/public/pdfjs/standard_fonts/FoxitFixedBold.pfb +0 -0
  178. package/public/pdfjs/standard_fonts/FoxitFixedBoldItalic.pfb +0 -0
  179. package/public/pdfjs/standard_fonts/FoxitFixedItalic.pfb +0 -0
  180. package/public/pdfjs/standard_fonts/FoxitSans.pfb +0 -0
  181. package/public/pdfjs/standard_fonts/FoxitSansBold.pfb +0 -0
  182. package/public/pdfjs/standard_fonts/FoxitSansBoldItalic.pfb +0 -0
  183. package/public/pdfjs/standard_fonts/FoxitSansItalic.pfb +0 -0
  184. package/public/pdfjs/standard_fonts/FoxitSerif.pfb +0 -0
  185. package/public/pdfjs/standard_fonts/FoxitSerifBold.pfb +0 -0
  186. package/public/pdfjs/standard_fonts/FoxitSerifBoldItalic.pfb +0 -0
  187. package/public/pdfjs/standard_fonts/FoxitSerifItalic.pfb +0 -0
  188. package/public/pdfjs/standard_fonts/FoxitSymbol.pfb +0 -0
  189. package/public/pdfjs/standard_fonts/LICENSE_FOXIT +27 -0
  190. package/public/pdfjs/standard_fonts/LICENSE_LIBERATION +102 -0
  191. package/public/pdfjs/standard_fonts/LiberationSans-Bold.ttf +0 -0
  192. package/public/pdfjs/standard_fonts/LiberationSans-BoldItalic.ttf +0 -0
  193. package/public/pdfjs/standard_fonts/LiberationSans-Italic.ttf +0 -0
  194. package/public/pdfjs/standard_fonts/LiberationSans-Regular.ttf +0 -0
  195. package/src/App.vue +31 -31
  196. package/src/api/index.js +1 -1
  197. package/src/api/mock.http +2 -2
  198. package/src/api/requestUrl.js +185 -185
  199. package/src/assets/image/default_avt_ui.png +0 -0
  200. package/src/assets/image/filtType/audio.png +0 -0
  201. package/src/assets/image/filtType/excel1.png +0 -0
  202. package/src/assets/image/filtType/general.png +0 -0
  203. package/src/assets/image/filtType/html.png +0 -0
  204. package/src/assets/image/filtType/image1.png +0 -0
  205. package/src/assets/image/filtType/link.png +0 -0
  206. package/src/assets/image/filtType/md2.png +0 -0
  207. package/src/assets/image/filtType/mode.png +0 -0
  208. package/src/assets/image/filtType/news.png +0 -0
  209. package/src/assets/image/filtType/pdf1.png +0 -0
  210. package/src/assets/image/filtType/ppt1.png +0 -0
  211. package/src/assets/image/filtType/selfadd1.png +0 -0
  212. package/src/assets/image/filtType/txt1.png +0 -0
  213. package/src/assets/image/filtType/video.png +0 -0
  214. package/src/assets/image/filtType/wechat.png +0 -0
  215. package/src/assets/image/filtType/word1.png +0 -0
  216. package/src/assets/image/loading.gif +0 -0
  217. package/src/assets/js/AliyunlssUtil.js +117 -92
  218. package/src/assets/js/Base64Util.js +22 -22
  219. package/src/assets/js/common.js +287 -252
  220. package/src/assets/js/hammer.js +89 -100
  221. package/src/assets/js/script.js +36 -36
  222. package/src/assets/less/common.css +6773 -6773
  223. package/src/assets/less/converSationContainer/common.less +192 -199
  224. package/src/assets/less/converSationContainer/converSatonContainer.less +486 -493
  225. package/src/assets/less/iconfont.css +37 -37
  226. package/src/assets/less/ticketMessage.less +294 -294
  227. package/src/assets/less/variables.less +122 -0
  228. package/src/components/ActionAlertIframe.vue +155 -177
  229. package/src/components/AiGuide.vue +473 -466
  230. package/src/components/AnswerDocknowledge.vue +1207 -1059
  231. package/src/components/AnswerVoice.vue +286 -285
  232. package/src/components/AskIFrame.vue +15 -15
  233. package/src/components/ConversationContainer.vue +10880 -4934
  234. package/src/components/FileType.vue +86 -86
  235. package/src/components/Message.vue +27 -27
  236. package/src/components/MyEditor.vue +343 -351
  237. package/src/components/QwFeedback.vue +304 -0
  238. package/src/components/actionSatisfaction.vue +109 -107
  239. package/src/components/actionSendToBot.vue +64 -62
  240. package/src/components/answerDissatisfaction.vue +64 -62
  241. package/src/components/answerRadio.vue +261 -186
  242. package/src/components/ask-components/DissatisfactionOptions.vue +58 -57
  243. package/src/components/ask-components/Msgloading.vue +38 -37
  244. package/src/components/ask-components/SatisfactionV2.vue +15 -15
  245. package/src/components/askVideo.vue +214 -162
  246. package/src/components/assetDetails.vue +379 -378
  247. package/src/components/assetMessage.vue +231 -228
  248. package/src/components/associationIntention.vue +414 -355
  249. package/src/components/attachmentPreview.vue +92 -90
  250. package/src/components/botActionSatisfactor.vue +70 -68
  251. package/src/components/chatContent.vue +514 -513
  252. package/src/components/feedBack.vue +138 -136
  253. package/src/components/fielListView.vue +352 -351
  254. package/src/components/file/AliyunOssComponents.vue +108 -108
  255. package/src/components/formTemplate.vue +3517 -3572
  256. package/src/components/imgView.vue +32 -0
  257. package/src/components/intelligentSummary.vue +232 -227
  258. package/src/components/interruptComponents/imageSelectionAnswer.vue +203 -0
  259. package/src/components/interruptComponents/multipleChoiceAnswer.vue +134 -0
  260. package/src/components/interruptComponents/singleChoiceAnswer.vue +82 -0
  261. package/src/components/kkview.vue +1130 -1138
  262. package/src/components/loadingProcess.vue +164 -164
  263. package/src/components/markDownText.vue +961 -0
  264. package/src/components/message/ActionAlertIframe.vue +112 -112
  265. package/src/components/message/ShopMessage.vue +164 -164
  266. package/src/components/message/TextMessage.vue +926 -924
  267. package/src/components/message/TicketMessage.vue +201 -201
  268. package/src/components/message/swiper/index.js +4 -4
  269. package/src/components/message/swiper/ticketSwiper.vue +503 -503
  270. package/src/components/message/swiper/ticketSwiperItem.vue +61 -61
  271. package/src/components/msgLoading.vue +231 -231
  272. package/src/components/myPopup.vue +75 -70
  273. package/src/components/outputComponents/outputCom.vue +149 -0
  274. package/src/components/pagination.vue +130 -0
  275. package/src/components/pdfPosition.vue +1337 -1506
  276. package/src/components/popup.vue +230 -227
  277. package/src/components/preview/docView.vue +263 -0
  278. package/src/components/preview/excelView.vue +260 -0
  279. package/src/components/preview/markDownView.vue +70 -0
  280. package/src/components/preview/newPositionPreview.vue +601 -0
  281. package/src/components/preview/pdfView.vue +973 -0
  282. package/src/components/previewDoc.vue +253 -247
  283. package/src/components/previewPdf.vue +1106 -757
  284. package/src/components/previewWisdom.vue +252 -0
  285. package/src/components/receiverMessagePlatform.vue +71 -65
  286. package/src/components/recommend.vue +82 -80
  287. package/src/components/selector/hOption.vue +20 -20
  288. package/src/components/selector/hSelector.vue +199 -199
  289. package/src/components/selector/hWrapper.vue +216 -216
  290. package/src/components/senderMessagePlatform.vue +60 -50
  291. package/src/components/source/BotMessage.vue +24 -24
  292. package/src/components/source/CustomMessage.vue +24 -24
  293. package/src/components/test.vue +260 -260
  294. package/src/components/tree.vue +310 -295
  295. package/src/components/utils/AliyunIssUtil.js +103 -81
  296. package/src/components/utils/ckeditor.js +185 -174
  297. package/src/components/utils/format_date.js +25 -25
  298. package/src/components/utils/index.js +6 -6
  299. package/src/components/utils/math_utils.js +29 -29
  300. package/src/components/voiceComponent.vue +122 -119
  301. package/src/components/welcomeKnowledgeFile.vue +346 -340
  302. package/src/components/welcomeLlmCard.vue +142 -140
  303. package/src/components/welcomeSuggest.vue +99 -97
  304. package/src/locales/cn.json +100 -0
  305. package/src/locales/en.json +99 -0
  306. package/src/main.js +76 -57
  307. package/vue.config.js +54 -54
  308. package/src/components/newPdfPosition.vue +0 -878
@@ -1,1139 +1,1131 @@
1
- <template>
2
- <div class="pdf_view" ref="pdfView" @scroll="pdfScroll" :style="{
3
- marginTop: isPC ? '50px' : '',
4
- marginBottom: tagIds.length > 1 ? '60px' : '0px',
5
- height: setHeight
6
- }">
7
-
8
- <div class="btn_footer" v-if="tagIds.length > 1 && !isPC">
9
- <div class="prev" @click="prev">上一段</div>
10
- <div class="next" @click="next">下一段</div>
11
- </div>
12
- <div id="pagination" v-if="tagIds.length > 1 && isPC">
13
- <el-pagination :current-page="currentPage + 1" @current-change="currentChange" @prev-click="prev"
14
- @next-click="next" layout="slot, prev, pager, next" :page-size="1" :total="tagIds.length">
15
- <span class="total-class">答案由{{ tagIds.length }}段内容生成</span>
16
- </el-pagination>
17
- </div>
18
- </div>
19
- </template>
20
-
21
- <script>
22
- import _ from 'lodash'
23
- // import * as pdfjsLib from 'pdfjs-dist'
24
- // pdfjsLib.GlobalWorkerOptions.workerSrc = 'pdfjs-dist/build/pdf.worker';
25
- // import { TextLayerBuilder } from "pdfjs-dist/web/pdf_viewer";
26
- // EventBus pdf_viewer 支持绑定自定义事件,一版不做
27
- // import 'pdfjs-dist/web/pdf_viewer.css'
28
- /* eslint-disable */
29
- const pdfjsLib = window['pdfjsLib']
30
- if (pdfjsLib) {
31
- pdfjsLib.GlobalWorkerOptions.workerSrc = window['pdfjs-dist/build/pdf.worker']
32
- // 'pdfjs-dist/build/pdf.worker';
33
- }
34
- const { TextLayerBuilder } = window['pdfjs-dist/web/pdf_viewer']
35
- // import { zoomElement } from '../assets/js/hammer'
36
- export default {
37
- name: 'pdfView',
38
- props: ['tagIds', 'isMessageRecord'],
39
- data () {
40
- return {
41
- url: '',
42
- pages: [],
43
- pageLoadStatus: {
44
- WAIT: 0,
45
- LOADED: 1,
46
- },
47
- scale: 1,
48
- rotation: 0,
49
- pageSize: {},
50
- PAGE_INTVERVAL: 15,
51
- SLICE_COUNT: 5,
52
- contentView: null,
53
- fisrtLoad: true,
54
- TextLayerBuilder: null,
55
- totalPageCount: 0,
56
- identifyTextPostion: {
57
- top: 0,
58
- left: 0,
59
- width: 100,
60
- height: 0,
61
- page: 1,
62
- pageHeight: 0,
63
- pageWidth: 0,
64
- extractInfo: {},
65
- currentPageAllLine: []
66
- },
67
- currentPageAllLine: [],
68
- pdfUrl: '',
69
- cachePdf: [],
70
- newViewer: null,
71
- currentPage: 0,
72
- changetoolbar: false,
73
- allTr: [],
74
- preViewType: 'pdf',
75
- displacement: {
76
- pageX: 0,
77
- pageY: 0,
78
- moveable: false,
79
- pageX2: 0,
80
- pageY2: 0,
81
- originScale: 1,
82
- },
83
- isTouchMoved: false,
84
- transformSalce: null,
85
- isPC: false,
86
- handScale: 'auto',
87
- scaleList: [
88
- {
89
- label: '自动缩放',
90
- value: 'auto'
91
- },
92
- {
93
- label: '实际比例',
94
- value: 'reality'
95
- },
96
- {
97
- label: '100%',
98
- value: 1
99
- },
100
- {
101
- label: '120%',
102
- value: 1.2
103
- },
104
- {
105
- label: '150%',
106
- value: 1.5
107
- },
108
- {
109
- label: '170%',
110
- value: 1.7
111
- }
112
- ,
113
- {
114
- label: '200%',
115
- value: 2
116
- }
117
- ],
118
- scrollTop: 0,
119
- scrollLeft: 0
120
- }
121
- },
122
- methods: {
123
- getpdfResloutePage (pdfResloute) {
124
- // 根据当前页面宽度设置缩放比例
125
- // this.scale = Math.round(this.$refs.pdfView.clientWidth / pdfResloute.pageWidth * 100) / 100
126
- // console.log(this.scale,'this.scale');
127
- if (this.isMessageRecord) {
128
- this.scale = Math.round(this.$refs.pdfView.clientWidth / pdfResloute.pageWidth * 100) / 100
129
- } else {
130
- this.scale = 2
131
- }
132
- // 从后端获取到当前分片后所有的pdf页码,初始化数组,数组下{} 对应每页pdf文件
133
- this.pdfUrl = pdfResloute.publicPageFileUrl.substring(0, pdfResloute.publicPageFileUrl.lastIndexOf('/') + 1)
134
- this.initPages(pdfResloute.total)
135
- // 定位功能,加载对应页码位置
136
- this.loadPdfData(pdfResloute.page)
137
- },
138
- async loadPdfData (loadPage) {
139
- if (this.pages[loadPage - 1] && ((this.pages[loadPage - 1].dom && this.pages[loadPage - 1].dom.children.length > 0) || this.pages[loadPage - 1].loading)) {
140
- return
141
- }
142
- this.pages[loadPage - 1].loading = true
143
- // pdfjsLib.GlobalWorkerOptions.workerSrc = require("pdfjs-dist/legacy/build/pdf.worker.entry.js");
144
- // 拿到第一个分片
145
- const { startPage, url } = await this.fetchPdfFragment(loadPage);
146
- let loadingTask = pdfjsLib.getDocument(url)
147
- loadingTask.promise.then((pdfDoc) => {
148
- // 将已经下载的分片保存到 pages 数组中
149
- for (let i = 0; i < pdfDoc.numPages; i += 1) {
150
- const pageIndex = startPage + i;
151
- const page = this.pages[pageIndex - 1];
152
- // 不在缓存列表内,重新获取本页pdf
153
- if (page.loadStatus !== this.pageLoadStatus.LOADED) {
154
- pdfDoc.getPage(i + 1).then((pdfPage) => {
155
- page.pdfPage = pdfPage;
156
- page.loadStatus = this.pageLoadStatus.LOADED;
157
- // 通知可以进行渲染了
158
- this.startRenderPages(pdfPage, page, pageIndex)
159
- });
160
- } else {
161
- if (this.changetoolbar) {
162
- this.$nextTick(() => {
163
- this.renderHighlights()
164
- })
165
- this.changetoolbar = false
166
- }
167
- }
168
- }
169
- });
170
- },
171
- initPages (totalPage) {
172
- // const pages = [];
173
- this.totalPageCount = totalPage
174
- for (let i = 0; i < totalPage; i += 1) {
175
- this.pages.push({
176
- pageNo: i + 1,
177
- loadStatus: this.pageLoadStatus.WAIT,
178
- pdfPage: null,
179
- dom: null
180
- });
181
- }
182
- },
183
- async fetchPdfFragment (pageIndex) {
184
- // 置换加签后的文件地址。
185
- let obj = {}
186
- await this.$http.post(
187
- '/knowledge-api/temporary-certificate/or-origin?expired=30',
188
- 'https://askbot-pdf-all.oss-cn-zhangjiakou.aliyuncs.com/fb348d095c0b4fd7bbd37826563dac7d/2023/05/08/11/55/18/64591b638bb8ab1b91c65eed/3.pdf',
189
- {
190
- headers: {
191
- "Content-Type": "application/json",
192
- },
193
- }).then(async res => {
194
- if (res.bodyText) {
195
- // 最后返回一个 包含这4个参数的对象
196
- obj = await {
197
- "startPage": pageIndex, // 分片的开始页码
198
- "endPage": pageIndex + 5, // 分片结束页码
199
- "totalPage": this.totalPageCount, // pdf 总页数
200
- "url": res.bodyText // 分片内容下载地址
201
- }
202
- }
203
- if (res.data) {
204
- // 最后返回一个 包含这4个参数的对象
205
- obj = await {
206
- "startPage": pageIndex, // 分片的开始页码
207
- "endPage": pageIndex + 5, // 分片结束页码
208
- "totalPage": this.totalPageCount, // pdf 总页数
209
- "url": res.data // 分片内容下载地址
210
- }
211
- }
212
- })
213
- return obj
214
- },
215
- startRenderPages (pdfPage, page, pageIndex) {
216
- if (Object.keys(this.pageSize).length == 0) {
217
- const viewport = pdfPage.getViewport({
218
- scale: this.scale, // 缩放的比例
219
- rotation: this.rotation, // 旋转的角度
220
- });
221
- // 记录pdf页面高度
222
- const pageSize = {
223
- width: viewport.width,
224
- height: viewport.height,
225
- }
226
- this.pageSize = pageSize
227
- // 创建内容绘制区,并设置大小
228
- if (this.$refs.pdfView.clientWidth / this.pageSize.width >= 1 || this.isMessageRecord) {
229
- this.contentView.style.width = `${pageSize.width - 10}px`;
230
- this.contentView.style.height = `${(this.totalPageCount * (pageSize.height + this.PAGE_INTVERVAL)) + this.PAGE_INTVERVAL}px`;
231
- } else {
232
- this.transformSalce = this.$refs.pdfView.clientWidth / this.pageSize.width
233
- this.contentView.style.width = `${pageSize.width * this.transformSalce - 10}px`;
234
- this.contentView.style.height = `${(this.totalPageCount * (pageSize.height * (this.transformSalce) + this.PAGE_INTVERVAL)) + this.PAGE_INTVERVAL}px`;
235
- }
236
- this.contentView.style.margin = '0 auto 0'
237
- this.contentView.style.position = 'relative'
238
- this.contentView.style.paddingBottom = '60px'
239
- // contentView.style.overflowY = 'auto'
240
- this.$refs.pdfView.appendChild(this.contentView);
241
- }
242
- this.renderPages(pageIndex)
243
- },
244
- renderPageContent (page, pageIndex) {
245
- const { pdfPage, pageNo, dom } = page;
246
- // dom 元素已存在,无须重新渲染,直接返回
247
- if (dom && dom.children.length != 0) {
248
- return;
249
- }
250
- const viewport = pdfPage.getViewport({
251
- scale: this.scale,
252
- rotation: this.rotation,
253
- });
254
- // 创建新的canvas
255
- const canvas = document.createElement('canvas');
256
- const context = canvas.getContext('2d');
257
- // canvas.getContext('2d');
258
- canvas.height = this.pageSize.height;
259
- canvas.width = this.pageSize.width;
260
- // 创建渲染的dom
261
- const pageDom = document.createElement('div');
262
- pageDom.style.position = 'absolute';
263
- pageDom.style.top = `${((pageNo - 1) * (this.pageSize.height + this.PAGE_INTVERVAL)) + this.PAGE_INTVERVAL}px`;
264
- pageDom.style.width = `${this.pageSize.width}px`;
265
- pageDom.style.height = `${this.pageSize.height}px`;
266
- pageDom.appendChild(canvas);
267
- // 渲染内容
268
- let renderContext = {
269
- canvasContext: context,
270
- viewport: viewport,
271
- }
272
- pdfPage.render(renderContext).promise.then(() => {
273
- console.log(pdfPage.getTextContent(), 'getTextContent');
274
- return pdfPage.getTextContent()
275
- }).then((textContent) => {
276
- const textLayerDiv = document.createElement('div');
277
- textLayerDiv.setAttribute('class', 'textLayer');
278
- // 将文本图层div添加至每页pdf的div中
279
- // 创建新的TextLayerBuilder实例
280
- let textLayer = new TextLayerBuilder({
281
- textLayerDiv: textLayerDiv,
282
- pageIndex: pdfPage._pageIndex,
283
- viewport: viewport,
284
- });
285
- let findPage = this.currentPageAllLine.find(l => { return l.page == pageIndex })
286
- let rectdomTop = 0
287
- if (findPage) {
288
- let AllLines = findPage.allLines
289
- // setTimeout(() => {
290
- console.log(findPage, 'findPage');
291
- if (AllLines.length > 0) {
292
- for (let j = 0; j < AllLines.length; j++) {
293
- let lines = AllLines[j].lines
294
- let rectdom = document.createElement('div')
295
- rectdom.setAttribute('react-count', AllLines[j].pageCount);
296
- rectdom.style.position = 'absolute';
297
- rectdom.style.top = 0
298
- rectdom.style.left = 0
299
- rectdom.classList.add('rectdom')
300
- for (let index = 0; index < lines.length; index++) {
301
- if (!/^\s+$/g.test(lines[index].content)) {
302
- let postionArr = lines[index].location
303
- let div = document.createElement('div')
304
- div.style.position = 'absolute';
305
- div.style.left = postionArr[0] * this.scale + 'px',
306
- // 后端返回的坐标有基线对齐的问题,top 值是后端算好(基线top - 文字高度),在此加上文字高度的 1/9 (大致比例)为实际展示出文字的top值
307
- div.style.top = (postionArr[1] + postionArr[3] / 9) * this.scale + 'px'
308
- div.style.height = postionArr[3] * this.scale + 'px';
309
- div.style.width = postionArr[2] * this.scale + 'px'
310
- div.style.backgroundColor = 'rgba(54, 106, 255, 0.3)'
311
- div.classList.add('lineHeight')
312
- rectdom.appendChild(div)
313
- if (index == 0 && j == 0) {
314
- if (this.transformSalce !== null) {
315
- rectdomTop = (postionArr[1] + postionArr[3] / 9) * this.scale * this.transformSalce
316
- } else {
317
- rectdomTop = (postionArr[1] + postionArr[3] / 9) * this.scale
318
- }
319
- // if(this.isPC) {
320
- // rectdomTop = rectdomTop - 50 < 0 ? 0 : rectdomTop - 50
321
- // }
322
- // console.log(rectdomTop,div.style.top, (postionArr[1] + postionArr[3] / 9) * this.scale);
323
- }
324
- }
325
- }
326
- if (rectdom.children.length > 0) {
327
- pageDom.appendChild(rectdom)
328
- }
329
- }
330
- }
331
- }
332
- textLayer.setTextContent(textContent);
333
- textLayer.render()
334
- pageDom.appendChild(textLayer.textLayerDiv);
335
- page.dom = pageDom;
336
- page.loading = false
337
- this.contentView.appendChild(pageDom);
338
- if (this.transformSalce !== null) {
339
- this.contentView.style.transform = `scale(${this.transformSalce}, ${this.transformSalce})`
340
- }
341
- if (this.changetoolbar) {
342
- setTimeout(() => {
343
- this.renderHighlights()
344
- this.changetoolbar = false
345
- }, 100)
346
- }
347
- // console.log(this.fisrtLoad,'this.fisrtLoad');
348
- if (this.fisrtLoad) {
349
- setTimeout(() => {
350
- let pageoffsetHeight = 0
351
- if (this.transformSalce !== null) {
352
- pageoffsetHeight = (this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce
353
- } else {
354
- pageoffsetHeight = (this.pageSize.height + this.PAGE_INTVERVAL)
355
- }
356
- if (this.$refs.pdfView.clientHeight - pageoffsetHeight > 0 && pageIndex == 1) {
357
- const height = this.$refs.pdfView.clientHeight;
358
- let startNum = 0
359
- let endNum = 0
360
- if (this.transformSalce !== null) {
361
- startNum = Math.ceil(this.$refs.pdfView.scrollTop / ((this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce))
362
- endNum = startNum + Math.ceil(height / ((this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce))
363
- console.log(Math.ceil(height / ((this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce)), this.pageSize.height, this.PAGE_INTVERVAL, height, this.transformSalce, 'startNum');
364
-
365
- } else {
366
- startNum = Math.ceil(this.$refs.pdfView.scrollTop / (this.pageSize.height + this.PAGE_INTVERVAL))
367
- endNum = startNum + Math.ceil(height / (this.pageSize.height + this.PAGE_INTVERVAL))
368
-
369
- }
370
- for (let pageIndex = startNum; pageIndex <= endNum; pageIndex++) {
371
- if (pageIndex > 0 && pageIndex <= this.pages.length) {
372
- this.loadPdfData(pageIndex)
373
- }
374
- }
375
- }
376
- if (this.$refs.pdfView.scrollTop == Math.floor((pageNo - 1) * pageoffsetHeight)) {
377
- this.$refs.pdfView.scrollTop = rectdomTop
378
- this.fisrtLoad = false
379
- } else {
380
- this.$refs.pdfView.scrollTop = `${((pageNo - 1) * pageoffsetHeight) + rectdomTop - this.PAGE_INTVERVAL}`
381
- this.fisrtLoad = false
382
- }
383
- this.renderHighlights()
384
- // zoomElement(this.contentView)
385
- }, 100)
386
- }
387
- })
388
- },
389
- // 监听容器的滚动事件,触发 scrollPdf 方法
390
- // 这里加了防抖保证不会一次产生过多请求
391
- debounceScrollPdf: _.debounce(function (e, that) {
392
- if (this.fisrtLoad) {
393
- this.fisrtLoad = false
394
- return
395
- }
396
- const scrollTop = e.target.scrollTop;
397
- const height = e.target.clientHeight;
398
- let startNum = 0
399
- let endNum = 0
400
- if (this.transformSalce !== null) {
401
- startNum = Math.ceil(scrollTop / ((that.pageSize.height + that.PAGE_INTVERVAL) * this.transformSalce))
402
- endNum = startNum + Math.ceil(height / ((that.pageSize.height + that.PAGE_INTVERVAL) * this.transformSalce))
403
- } else {
404
- startNum = Math.ceil(scrollTop / (that.pageSize.height + that.PAGE_INTVERVAL))
405
- endNum = startNum + Math.ceil(height / (that.pageSize.height + that.PAGE_INTVERVAL))
406
- }
407
- for (let pageIndex = startNum; pageIndex <= endNum; pageIndex++) {
408
- if (pageIndex > 0 && pageIndex <= that.pages.length) {
409
- that.loadPdfData(pageIndex)
410
- }
411
- }
412
- console.log('=======');
413
- }, 200),
414
- directScrolling (e, that) {
415
- if (this.fisrtLoad) {
416
- this.fisrtLoad = false
417
- return
418
- }
419
- const scrollTop = e.target.scrollTop;
420
- const height = e.target.clientHeight;
421
- // 根据内容可视区域中心点计算页码, 没有滚动时,指向第一页
422
- const pageIndex = scrollTop > 0 ?
423
- Math.ceil((scrollTop + (height / 2)) / (that.pageSize.height + that.PAGE_INTVERVAL)) :
424
- 1;
425
- this.loadPdfData(pageIndex)
426
- },
427
- pdfScroll (e) {
428
- if (this.preViewType !== 'pdf' || this.isTouchMoved) {
429
- return
430
- }
431
- if (this.scrollLeft != e.target.scrollLeft) {
432
- this.scrollLeft = e.target.scrollLeft
433
- }
434
- if (this.scrollTop != e.target.scrollTop) {
435
- this.scrollTop = e.target.scrollTop
436
- this.debounceScrollPdf(e, this)
437
- }
438
- },
439
- // 分片每次只做一次处理,所以不考虑多片情况
440
- loadBefore (pageIndex) {
441
- this.loadPdfData(pageIndex)
442
- },
443
- loadAfter (pageIndex) {
444
- this.loadPdfData(pageIndex)
445
- },
446
- // 首先我们获取到需要渲染的范围
447
- // 根据当前的可视范围内的页码,我们前后只保留 8 页
448
- getRenderScope (pageIndex) {
449
- const pagesToRender = [];
450
- let i = pageIndex - 1;
451
- let j = pageIndex + 1;
452
- // pageIndex - 1 表示当前页码数 对应的下标位置
453
- pagesToRender.push(this.pages[pageIndex - 1]);
454
- while (pagesToRender.length < 8 && pagesToRender.length < this.pages.length) {
455
- if (i > 0) {
456
- pagesToRender.push(this.pages[i - 1]);
457
- i -= 1;
458
- }
459
- if (pagesToRender.length >= 8) {
460
- break;
461
- }
462
- if (j <= this.pages.length) {
463
- pagesToRender.push(this.pages[j - 1]);
464
- j += 1;
465
- }
466
- }
467
- return pagesToRender;
468
- },
469
- // 渲染需要展示的页面,不需展示的页码将其清除
470
- renderPages (pageIndex) {
471
- const pagesToRender = this.getRenderScope(pageIndex);
472
- for (const i of this.pages) {
473
- if (pagesToRender.includes(i)) {
474
- i.loadStatus === this.pageLoadStatus.LOADED ?
475
- this.renderPageContent(i, pageIndex) :
476
- this.renderPageLoading(i);
477
- } else {
478
- this.clearPage(i);
479
- }
480
- }
481
- },
482
- // 清除页面 dom
483
- clearPage (page) {
484
- if (page.dom) {
485
- this.contentView.removeChild(page.dom);
486
- page.loadStatus = 0
487
- page.loading = false
488
- page.dom = undefined;
489
- }
490
- },
491
- // 页面正在下载时渲染loading视图
492
- renderPageLoading (page) {
493
- const { pageNo, dom } = page;
494
- if (dom && dom.children.length != 0) {
495
- return;
496
- }
497
- const pageDom = document.createElement('div');
498
- pageDom.style.width = `${this.pageSize.width}px`;
499
- pageDom.style.height = `${this.pageSize.height}px`;
500
- pageDom.style.position = 'absolute';
501
- pageDom.style.top = `${((pageNo - 1) * (this.pageSize.height + this.PAGE_INTVERVAL)) + this.PAGE_INTVERVAL
502
- }px`;
503
- pageDom.style.backgroundImage = `url('https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif')`
504
- pageDom.style.backgroundPosition = 'center'
505
- pageDom.style.backgroundRepeat = 'no-repeat'
506
- pageDom.style.backgroundColor = '#FFF'
507
- page.dom = pageDom;
508
- this.contentView.appendChild(pageDom);
509
- },
510
- prev () {
511
- this.currentPage--
512
- if (this.currentPage < 0) {
513
- this.currentPage = 0
514
- if (!this.isPC) {
515
- this.$toast({
516
- message: '当前已经是第一段了',
517
- duration: 2000,
518
- })
519
- return
520
- }
521
- }
522
- if (this.preViewType == 'pdf') {
523
- this.scrollToUplaodePage(this.currentPage)
524
- } else {
525
- this.scrollToExcalTop(this.currentPage)
526
- }
527
- // this.getpdfResloutePage(this.cachePdf[this.currentPage - 1])
528
- },
529
- next () {
530
- this.currentPage++
531
- if (this.currentPage >= this.tagIds.length) {
532
- this.currentPage = this.tagIds.length - 1
533
- if (!this.isPC) {
534
- this.$toast({
535
- message: '当前已经是最后一段了',
536
- duration: 2000,
537
- })
538
- return
539
- }
540
- }
541
- if (this.preViewType == 'pdf') {
542
- this.scrollToUplaodePage(this.currentPage)
543
- } else {
544
- this.scrollToExcalTop(this.currentPage)
545
- }
546
- },
547
- currentChange (value) {
548
- this.currentPage = value - 1
549
- if (this.preViewType == 'pdf') {
550
- this.scrollToUplaodePage(this.currentPage)
551
- } else {
552
- this.scrollToExcalTop(this.currentPage)
553
- }
554
- },
555
- scrollToUplaodePage (currentPage) {
556
- this.changetoolbar = true
557
- if (this.preViewType !== 'pdf') {
558
- return
559
- }
560
-
561
- let pdfResloute = this.cachePdf[currentPage]
562
- this.identifyTextPostion.extractInfo = pdfResloute.extractInfo
563
- this.identifyTextPostion.left = pdfResloute.extractInfo.location[0]
564
- this.identifyTextPostion.top = pdfResloute.extractInfo.location[1]
565
- this.identifyTextPostion.width = pdfResloute.extractInfo.location[2]
566
- this.identifyTextPostion.height = pdfResloute.extractInfo.location[3]
567
- this.identifyTextPostion.page = pdfResloute.page
568
- this.identifyTextPostion.pageHeight = pdfResloute.pageHeight
569
- this.identifyTextPostion.pageWidth = pdfResloute.pageWidth
570
- // 在当前段落在最后一页pdf时,根据计算的高度并不能触发滚动,在此执行重新渲染方法,非次情况会执行两次,待优化
571
- this.$nextTick(() => {
572
- this.renderHighlights()
573
- })
574
- if (this.transformSalce !== null) {
575
- this.$refs.pdfView.scrollTop = `${((pdfResloute.page - 1) * (this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce) + this.identifyTextPostion.top}`
576
- } else {
577
- this.$refs.pdfView.scrollTop = `${((pdfResloute.page - 1) * (this.pageSize.height + this.PAGE_INTVERVAL)) + this.identifyTextPostion.top}`
578
- }
579
- },
580
- scrollToExcalTop (currentPage) {
581
- for (let index = 0; index < this.allTr.length; index++) {
582
- if (index == currentPage) {
583
- Array.from(this.allTr[index].children).forEach(item => {
584
- item.style.background = 'rgba(255, 136, 0, 0.6)'
585
- item.classList.add('animation')
586
- setTimeout(() => {
587
- item.classList.remove('animation')
588
- }, 4000)
589
- })
590
- // getBoundingClientRect().top 当前元素距离屏幕顶部的高度 + 弹窗header 高度
591
- if (!this.isPC) {
592
- let top = this.allTr[index].getBoundingClientRect().top - this.$refs.pdfView.getBoundingClientRect().top
593
- this.$refs.pdfView.scrollTop = top
594
- } else {
595
- let top = this.allTr[index].getBoundingClientRect().top
596
- this.$refs.pdfView.scrollTop = top - 50
597
- }
598
- } else {
599
- Array.from(this.allTr[index].children).forEach(item => {
600
- item.style.background = 'rgba(54, 106, 255, 0.6)'
601
- item.classList.remove('animation')
602
- })
603
- }
604
- }
605
- },
606
- // pdf是否需要重新渲染高亮位置
607
- renderHighlights () {
608
- let lineHeightDom = Array.from(document.getElementsByClassName('rectdom'))
609
- console.log(lineHeightDom, this.currentPage, 'this.currentPage');
610
- if (lineHeightDom) {
611
- lineHeightDom.forEach((d) => {
612
- for (let i = 0; i < d.children.length; i++) {
613
- if (d.getAttribute('react-count') == this.currentPage) {
614
- d.children[i].style.backgroundColor = 'rgba(255, 136, 0, 0.3)'
615
- d.children[i].classList.add('animation')
616
- setTimeout(() => {
617
- d.children[i].classList.remove('animation')
618
- }, 4000)
619
- } else {
620
- d.children[i].style.backgroundColor = 'rgba(54, 106, 255, 0.3)'
621
- d.children[i].classList.remove('animation')
622
- }
623
- }
624
- })
625
- }
626
- },
627
- displayHiglight (pageIndex) {
628
- let lineHeightDom = Array.from(document.getElementsByClassName('rectdom'))
629
- if (lineHeightDom) {
630
- lineHeightDom.forEach((d) => {
631
- if (d.getAttribute('page-index') == pageIndex) {
632
- d.style.display = 'none'
633
- }
634
- })
635
- }
636
- },
637
- // 前端暂时缓存多页
638
- autoLoadMore (pageIndex) {
639
- let pdfResloute = this.cachePdf.find(cache => {
640
- return cache.page == pageIndex
641
- })
642
- if (pdfResloute) {
643
- this.getpdfResloutePage(pdfResloute)
644
- } else {
645
- this.loadPdfData(pageIndex)
646
- }
647
- },
648
- setPageAllLine (arr) {
649
- this.currentPageAllLine = []
650
- arr.forEach((item, index) => {
651
- let i = this.currentPageAllLine.findIndex(l => { return l.page && l.page == item.page })
652
- if (i != -1) {
653
- // this.currentPageAllLine[i].allLines.lines.push(item.extractInfo.lines)
654
- this.currentPageAllLine[i].allLines.push({
655
- pageCount: index,
656
- lines: item.extractInfo.lines
657
- })
658
- } else {
659
- this.currentPageAllLine.push({
660
- page: item.page,
661
- allLines: [{
662
- pageCount: index,
663
- lines: item.extractInfo.lines
664
- }],
665
- })
666
- }
667
- })
668
- },
669
- openTouch () {
670
- // this.$nextTick()将回调延迟到下次 DOM 更新循环之后执行
671
- let that = this;
672
- this.$nextTick(() => {
673
- // setInterval(() => {
674
- // this.scale = this.scale + 0.1
675
- // that.pages.forEach((item, index) =>{
676
- // if(item.dom) {
677
- // item.dom.children.forEach( childDom =>{
678
- // if(childDom.getAttribute('react-count')) {
679
- // childDom.style.transform = "scale(" + this.scale + ")";
680
- // childDom.style.transformOrigin = "0px 0px 0px";
681
- // } else {
682
- // item.dom = null
683
- // this.startRenderPages(item.pdfPage, null, index)
684
- // }
685
- // } )
686
- // }
687
- // })
688
- // }, 100);
689
- // 获取放大或缩小的区域DOM
690
- let matrix_box = this.contentView
691
- matrix_box.addEventListener("touchstart", function (event) {
692
- this.isTouchMoved = true
693
- let touches = event.touches;
694
- let events = touches[0];
695
- let events2 = touches[1];
696
-
697
- // event.preventDefault();
698
-
699
- // 第一个触摸点的坐标
700
- that.displacement.pageX = events.pageX;
701
- that.displacement.pageY = events.pageY;
702
-
703
- that.displacement.moveable = true;
704
-
705
- if (events2) {
706
- that.displacement.pageX2 = events2.pageX;
707
- that.displacement.pageY2 = events2.pageY;
708
- }
709
-
710
- that.displacement.originScale = this.scale || 1;
711
- // console.log(that.displacement);
712
- });
713
- document.addEventListener("touchmove", function (event) {
714
- if (!that.displacement.moveable) {
715
- return;
716
- }
717
- // event.preventDefault();
718
- let touches = event.touches;
719
- let events = touches[0];
720
- let events2 = touches[1];
721
- // 双指移动
722
- if (events2) {
723
- // 第2个指头坐标在touchmove时候获取
724
- if (!that.displacement.pageX2) {
725
- that.displacement.pageX2 = events2.pageX;
726
- }
727
- if (!that.displacement.pageY2) {
728
- that.displacement.pageY2 = events2.pageY;
729
- }
730
- // 双指缩放比例计算
731
- let zoom = that.getDistance({
732
- x: events.pageX,
733
- y: events.pageY
734
- },
735
- {
736
- x: events2.pageX,
737
- y: events2.pageY
738
- }
739
- ) / that.getDistance(
740
- {
741
- x: that.displacement.pageX,
742
- y: that.displacement.pageY
743
- },
744
- {
745
- x: that.displacement.pageX2,
746
- y: that.displacement.pageY2
747
- }
748
- );
749
- // 应用在元素上的缩放比例
750
- let newScale = that.displacement.originScale * zoom;
751
- console.log(zoom, newScale, this.scale, 'newScale');
752
- // 最大缩放比例限制
753
- if (newScale > 2) {
754
- newScale = 2;
755
- }
756
- // 最大缩放比例限制
757
- if (newScale < 1) {
758
- newScale = 1;
759
- }
760
- // 记住使用的缩放值
761
- that.displacement.scale = newScale;
762
- // console.log(newScale);
763
- matrix_box.style.transform = "scale(" + newScale + ")";
764
- // 设置旋转元素的基点位置
765
- matrix_box.style.transformOrigin = "0px 0px 0px";
766
- }
767
- }, { passive: false });
768
- document.addEventListener('touchend', function () {
769
- that.isTouchMoved = false
770
- }, { passive: false })
771
- });
772
- },
773
- getDistance (start, stop) {
774
- // Math.hypot()计算参数的平方根
775
- return Math.hypot(stop.x - start.x, stop.y - start.y);
776
- },
777
- setupCanvas (canvas, width, height) {
778
- const dpr = 1;
779
- // const rect = canvas.getBoundingClientRect();
780
- canvas.width = width
781
- canvas.height = height
782
- const ctx = canvas.getContext('2d');
783
- console.log(canvas.width, canvas.height, dpr, this.scale);
784
- ctx?.scale(dpr, dpr);
785
- return ctx;
786
- },
787
- changeScale (value) {
788
- if (value == 'zoom') {
789
- this.handScale = 'auto'
790
- this.transformSalce = (this.transformSalce + 0.2).toFixed(1)
791
- } else if (value == 'reduce') {
792
- if ((this.transformSalce - 0.2).toFixed(1) <= 0) {
793
- return
794
- }
795
- this.handScale = 'auto'
796
- this.transformSalce = (this.transformSalce - 0.2).toFixed(1)
797
- } else if (value == 'auto') {
798
- this.transformSalce = this.$refs.pdfView.clientWidth / this.pageSize.width
799
- } else if (value == 'reality') {
800
- this.transformSalce = 0.5
801
- } else {
802
- this.transformSalce = (value / 2).toFixed(1)
803
- }
804
- this.transformSalce = Number(this.transformSalce)
805
- this.contentView.style.transform = 'scale(' + this.transformSalce + ')';
806
- // this.getpdfResloutePage(this.cachePdf[0])
807
- },
808
- },
809
- computed: {
810
- perviewUrl () {
811
- return '/web/viewer.html?file=' + '/pdflist/pdf4split-1.pdf'
812
- },
813
- setHeight () {
814
- if (this.tagIds.length > 1) {
815
- if (this.isPC) {
816
- return 'calc(100% - 110px)'
817
- } else {
818
- return 'calc(100% - 60px)'
819
- }
820
- } else {
821
- if (this.isPC) {
822
- return 'calc(100% - 50px)'
823
- } else {
824
- return '100%'
825
- }
826
- }
827
- }
828
- },
829
- watch: {
830
- tagIds: {
831
- handler (value) {
832
- if (value && value.length) {
833
- // pdf_view 下创建 所有canvs的容器
834
- this.contentView = document.createElement('div')
835
- this.contentView.style.transformOrigin = '0px 0px 0px'
836
- this.$http.get('/knowledge-api/knowledge/knowledge-part-location-info/list?ids=' + value.join(',')).then(res => {
837
- 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}
838
- // 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}
839
- // 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}
840
- // res.data = {"data":[{"id":"6475eab868110215ab821a80","knowledgeId":"6475e7eac724c54c46cbfa2d","mainId":"5ecf2fcd704541149201ab9c1c31162d","page":0,"total":1,"pageHeight":0.0,"pageWidth":0.0,"publicPageFileUrl":"https://askbot-pdf-all.oss-cn-zhangjiakou.aliyuncs.com/5ecf2fcd704541149201ab9c1c31162d/2023/05/30/08/23/20/6475eab63339db423f26b196/0.html","extractInfo":{"location":null,"content":"产品:系统配置,产品型号:存储,VX30:4G+16G,VX50:16G+256G","lines":null,"tagId":"6475eab868110215ab821a80"}}],"code":"0","msg":null,"traceId":null}
841
- // res.data = {"data":[{"id":"6475e9393339db423f26af01","knowledgeId":"6475e44fc724c54c46cbfa21","mainId":"5ecf2fcd704541149201ab9c1c31162d","page":2,"total":2,"pageHeight":510.25,"pageWidth":1559.05,"publicPageFileUrl":"https://askbot-pdf-all.oss-cn-zhangjiakou.aliyuncs.com/5ecf2fcd704541149201ab9c1c31162d/2023/05/30/08/00/29/6475e55d3339db423f26a9b8/2.pdf","extractInfo":{"location":[327.70532,288.0498,414.9734,12.241608],"content":"三、指示灯状态说明1.白色常亮:开机/开机中2.红色常亮:待机3.白色呼吸:息屏4.红色闪烁:升级1.LAN:通过网线连接到主机的Camera端口2.电源开关:电源切换开关","lines":[{"content":"三、指示灯状态说明","location":[634.3203,288.0498,108.3584,12.0]},{"content":"1.白色常亮:开机/开机中","location":[634.3203,320.08978,108.23407,9.0]},{"content":"2.红色常亮:待机","location":[634.3204,341.3298,78.597046,9.0]},{"content":"3.白色呼吸:息屏","location":[634.32043,362.45282,78.597046,9.0]},{"content":"4.红色闪烁:升级","location":[634.3205,383.6928,78.597046,9.0]},{"content":"1.LAN:通过网线连接到主机的","location":[327.70535,291.2914,144.35995,9.0]},{"content":"Camera端口","location":[327.70532,306.88843,55.322998,9.0]},{"content":"2.电源开关:电源切换开关","location":[482.74832,291.2914,105.36301,9.0]}],"tagId":null}}],"code":"0","msg":null,"traceId":null}
842
- // if(value.length === 1) {
843
- // this.$refs.pdfView.style.height = 'calc(100% - 50px)'
844
- // }
845
- if (res.data.code == 0) {
846
- // tagIds 会按照gpt识别的生成有序的数组,前端直接按照下标的顺序取就可以了
847
- // 缓存拿到的所有数据
848
- this.cachePdf = res.data.data
849
- let publicPageFileUrl = res.data.data[0].publicPageFileUrl
850
- this.currentPage = 0
851
- // console.log(publicPageFileUrl.substring(publicPageFileUrl.lastIndexOf('.')));
852
- if (publicPageFileUrl.substring(publicPageFileUrl.lastIndexOf('.')) === '.pdf') {
853
- this.preViewType = 'pdf'
854
- // this.setPageAllLine(this.cachePdf)
855
- this.getpdfResloutePage(res.data.data[0])
856
- } else {
857
- this.preViewType = 'excal'
858
- this.$http.post(
859
- '/knowledge-api/temporary-certificate/or-origin?expired=30',
860
- publicPageFileUrl,
861
- {
862
- headers: {
863
- "Content-Type": "application/json",
864
- },
865
- }).then(res => {
866
- // 使用原声请求方式 axios会带有不需要的请求头
867
- let xhr = new XMLHttpRequest();
868
- xhr.open('GET', res.data || res.bodyText, true);
869
- // 定义请求完成的处理函数,请求前也可以增加加载框/禁用下载按钮逻辑
870
- xhr.onload = ({ currentTarget }) => {
871
- // 请求完成
872
- if (currentTarget.status === 200) { // 返回200
873
- this.contentView.innerHTML = currentTarget.response
874
- this.contentView.style.padding = '10px'
875
- // this.contentView.style.position = 'relative'
876
- this.$refs.pdfView.style.backgroundColor = '#FFFFFF'
877
- this.$refs.pdfView.appendChild(this.contentView)
878
- let allTr = Array.from(this.$refs.pdfView.getElementsByTagName('tr'))
879
- this.allTr = []
880
- for (let index = 0; index < allTr.length; index++) {
881
- if (value.includes(allTr[index].getAttribute('tag-id'))) {
882
- this.allTr.push(allTr[index])
883
- }
884
- }
885
- this.currentChange(1)
886
-
887
- }
888
- }
889
- xhr.send();
890
- })
891
- }
892
- } else {
893
- let div = document.createElement('div')
894
- div.innerText = '文件加载异常'
895
- this.contentView.appendChild(div)
896
- this.$refs.pdfView.appendChild(this.contentView)
897
- }
898
- })
899
- }
900
- },
901
- deep: true,
902
- immediate: true
903
- }
904
- },
905
- mounted () {
906
- if (/(iPhone|iPad|iPod|iOS|Android)/i.test(navigator.userAgent)) {
907
- this.isPC = false
908
- } else {
909
- this.isPC = true
910
- }
911
- }
912
- }
913
- </script>
914
-
915
- <style lang="less" scoped>
916
- .pdf_view {
917
- width: 100%;
918
- height: calc(100% - 110px);
919
- overflow: auto;
920
- background-color: #f5f7fb;
921
- // margin-bottom: 60px;
922
- box-sizing: border-box;
923
-
924
- // position: relative;
925
- // > div {
926
- // width: 100%;
927
- // height: 100%;
928
- // overflow: hidden;
929
- // overflow-y: auto;
930
- // position: relative;
931
- // }
932
- >iframe {
933
- width: 100%;
934
- height: 100%;
935
- }
936
-
937
- a:link {
938
- color: none;
939
- }
940
-
941
- a:visited {
942
- color: none;
943
- }
944
-
945
- a:hover {
946
- color: none;
947
- }
948
-
949
- a:active {
950
- color: none;
951
- }
952
-
953
- .btn_footer {
954
- width: 100%;
955
- height: 60px;
956
- display: flex;
957
- align-items: center;
958
- justify-content: space-around;
959
- position: absolute;
960
- bottom: 0px;
961
- left: 0;
962
- z-index: 999;
963
- background: #ffffff;
964
-
965
- .prev,
966
- .next {
967
- width: 35%;
968
- height: 40px;
969
- display: flex;
970
- align-items: center;
971
- justify-content: center;
972
- border-radius: 50px;
973
- cursor: pointer;
974
- }
975
-
976
- .prev {
977
- background: #F2F5FA;
978
- color: #000;
979
- }
980
-
981
- .next {
982
- background: #366aff;
983
- color: #ffffff;
984
- }
985
- }
986
-
987
- #pagination {
988
- .total-class {
989
- margin-right: 13px;
990
- font-weight: 400;
991
- }
992
-
993
- position: absolute;
994
- bottom: 0px;
995
- right: 0;
996
- width: 100%;
997
- display: flex;
998
- align-items: center;
999
- justify-content: center;
1000
- height: 50px;
1001
- background-color: white;
1002
- box-shadow: 0px 0px 18px 0px rgba(29, 55, 129, 0.07);
1003
- border-radius: 5px;
1004
- z-index: 1000;
1005
-
1006
- /deep/.el-pagination {
1007
- margin-right: 110px;
1008
- }
1009
-
1010
- /deep/.el-pager {
1011
- background: #EDF0F6;
1012
- border-radius: 15px;
1013
- }
1014
-
1015
- /deep/.el-pagination.is-background .btn-next {
1016
- width: 30px;
1017
- height: 30px;
1018
- background: #EDF0F6;
1019
- border-radius: 50%;
1020
- }
1021
-
1022
- /deep/.el-pagination .btn-next {
1023
- width: 30px;
1024
- height: 30px;
1025
- background: #EDF0F6;
1026
- border-radius: 50%;
1027
- padding-left: 0;
1028
- margin-left: 5px;
1029
- }
1030
-
1031
- /deep/.el-pagination .btn-prev {
1032
- width: 30px;
1033
- height: 30px;
1034
- background: #EDF0F6;
1035
- border-radius: 50%;
1036
- padding-right: 0;
1037
- margin-right: 5px;
1038
- }
1039
-
1040
- /deep/.el-pagination button {
1041
- padding: 0;
1042
- min-width: 30px;
1043
- }
1044
-
1045
- /deep/.el-pager li {
1046
- background: #EDF0F6;
1047
- height: 30px;
1048
- min-width: 30px;
1049
- line-height: 30px;
1050
- font-size: 12px;
1051
- color: #717b90;
1052
- }
1053
-
1054
- /deep/.el-pager li:first-child {
1055
- border-bottom-left-radius: 15px !important;
1056
- border-top-left-radius: 15px !important;
1057
- }
1058
-
1059
- /deep/.el-pager li:last-child {
1060
- border-top-right-radius: 15px !important;
1061
- border-bottom-right-radius: 15px !important;
1062
- }
1063
-
1064
- /deep/.el-pager li.active {
1065
- width: 30px;
1066
- height: 30px;
1067
- min-width: 30px;
1068
- background: #366AFF;
1069
- border: 3px solid #A1B9FF;
1070
- border-radius: 50%;
1071
- line-height: 24px;
1072
- color: white;
1073
- }
1074
-
1075
- /deep/.el-pagination.is-background .el-pager li:not(.disabled).active {
1076
- background: #366AFF;
1077
- }
1078
- }
1079
-
1080
- .change_scale {
1081
- width: 100%;
1082
- height: 50px;
1083
- position: absolute;
1084
- top: 50px;
1085
- left: 0;
1086
- background: #ffffff;
1087
- display: flex;
1088
- align-items: center;
1089
- padding: 0 10px;
1090
- box-sizing: border-box;
1091
-
1092
- section {
1093
- cursor: pointer;
1094
- width: 30px;
1095
- height: 30px;
1096
- margin-right: 5px;
1097
- border-radius: 5px;
1098
- display: flex;
1099
- align-items: center;
1100
- justify-content: center;
1101
-
1102
- i {
1103
- font-weight: 900;
1104
- }
1105
- }
1106
-
1107
- section:hover {
1108
- background: rgba(221, 222, 223, 1);
1109
- }
1110
- }
1111
- }
1112
- </style>
1113
- <style lang="less">
1114
- .animation {
1115
- animation-name: highlight;
1116
- animation-duration: 4s;
1117
- }
1118
-
1119
- @keyframes highlight {
1120
- 0% {
1121
- background: rgba(255, 136, 0, 0.3);
1122
- }
1123
-
1124
- 25% {
1125
- background: rgba(255, 136, 0, 0.6);
1126
- }
1127
-
1128
- 50% {
1129
- background: rgba(255, 136, 0, 0.3);
1130
- }
1131
-
1132
- 75% {
1133
- background: rgba(255, 136, 0, 0.6);
1134
- }
1135
-
1136
- 100% {
1137
- background: rgba(255, 136, 0, 0.3);
1138
- }
1
+ <template>
2
+ <div class="pdf_view" ref="pdfView" @scroll="pdfScroll" :style="{
3
+ marginTop: isPC ? '50px' : '',
4
+ marginBottom: tagIds.length > 1 ? '60px' : '0px',
5
+ height: setHeight
6
+ }">
7
+
8
+ <div class="btn_footer" v-if="tagIds.length > 1 && !isPC">
9
+ <div class="prev" @click="prev">上一段</div>
10
+ <div class="next" @click="next">下一段</div>
11
+ </div>
12
+ <div id="pagination" v-if="tagIds.length > 1 && isPC">
13
+ <el-pagination :current-page="currentPage + 1" @current-change="currentChange" @prev-click="prev"
14
+ @next-click="next" layout="slot, prev, pager, next" :page-size="1" :total="tagIds.length">
15
+ <span class="total-class">答案由{{ tagIds.length }}段内容生成</span>
16
+ </el-pagination>
17
+ </div>
18
+ </div>
19
+ </template>
20
+
21
+ <script>
22
+ import _ from 'lodash'
23
+ // import * as pdfjsLib from 'pdfjs-dist'
24
+ // pdfjsLib.GlobalWorkerOptions.workerSrc = 'pdfjs-dist/build/pdf.worker';
25
+ // import { TextLayerBuilder } from "pdfjs-dist/web/pdf_viewer";
26
+ // EventBus pdf_viewer 支持绑定自定义事件,一版不做
27
+ // import 'pdfjs-dist/web/pdf_viewer.css'
28
+ /* eslint-disable */
29
+ const pdfjsLib = window['pdfjsLib']
30
+ if (pdfjsLib) {
31
+ pdfjsLib.GlobalWorkerOptions.workerSrc = window['pdfjs-dist/build/pdf.worker']
32
+ // 'pdfjs-dist/build/pdf.worker';
33
+ }
34
+ const { TextLayerBuilder } = window['pdfjs-dist/web/pdf_viewer']
35
+ // import { zoomElement } from '../assets/js/hammer'
36
+ export default {
37
+ name: 'pdfView',
38
+ props: ['tagIds', 'isMessageRecord'],
39
+ data () {
40
+ return {
41
+ url: '',
42
+ pages: [],
43
+ pageLoadStatus: {
44
+ WAIT: 0,
45
+ LOADED: 1,
46
+ },
47
+ scale: 1,
48
+ rotation: 0,
49
+ pageSize: {},
50
+ PAGE_INTVERVAL: 15,
51
+ SLICE_COUNT: 5,
52
+ contentView: null,
53
+ fisrtLoad: true,
54
+ TextLayerBuilder: null,
55
+ totalPageCount: 0,
56
+ identifyTextPostion: {
57
+ top: 0,
58
+ left: 0,
59
+ width: 100,
60
+ height: 0,
61
+ page: 1,
62
+ pageHeight: 0,
63
+ pageWidth: 0,
64
+ extractInfo: {},
65
+ currentPageAllLine: []
66
+ },
67
+ currentPageAllLine: [],
68
+ pdfUrl: '',
69
+ cachePdf: [],
70
+ newViewer: null,
71
+ currentPage: 0,
72
+ changetoolbar: false,
73
+ allTr: [],
74
+ preViewType: 'pdf',
75
+ displacement: {
76
+ pageX: 0,
77
+ pageY: 0,
78
+ moveable: false,
79
+ pageX2: 0,
80
+ pageY2: 0,
81
+ originScale: 1,
82
+ },
83
+ isTouchMoved: false,
84
+ transformSalce: null,
85
+ isPC: false,
86
+ handScale: 'auto',
87
+ scaleList: [
88
+ {
89
+ label: '自动缩放',
90
+ value: 'auto'
91
+ },
92
+ {
93
+ label: '实际比例',
94
+ value: 'reality'
95
+ },
96
+ {
97
+ label: '100%',
98
+ value: 1
99
+ },
100
+ {
101
+ label: '120%',
102
+ value: 1.2
103
+ },
104
+ {
105
+ label: '150%',
106
+ value: 1.5
107
+ },
108
+ {
109
+ label: '170%',
110
+ value: 1.7
111
+ }
112
+ ,
113
+ {
114
+ label: '200%',
115
+ value: 2
116
+ }
117
+ ],
118
+ scrollTop: 0,
119
+ scrollLeft: 0
120
+ }
121
+ },
122
+ methods: {
123
+ getpdfResloutePage (pdfResloute) {
124
+ // 根据当前页面宽度设置缩放比例
125
+ // this.scale = Math.round(this.$refs.pdfView.clientWidth / pdfResloute.pageWidth * 100) / 100
126
+ // console.log(this.scale,'this.scale');
127
+ if (this.isMessageRecord) {
128
+ this.scale = Math.round(this.$refs.pdfView.clientWidth / pdfResloute.pageWidth * 100) / 100
129
+ } else {
130
+ this.scale = 2
131
+ }
132
+ // 从后端获取到当前分片后所有的pdf页码,初始化数组,数组下{} 对应每页pdf文件
133
+ this.pdfUrl = pdfResloute.publicPageFileUrl.substring(0, pdfResloute.publicPageFileUrl.lastIndexOf('/') + 1)
134
+ this.initPages(pdfResloute.total)
135
+ // 定位功能,加载对应页码位置
136
+ this.loadPdfData(pdfResloute.page)
137
+ },
138
+ async loadPdfData (loadPage) {
139
+ if (this.pages[loadPage - 1] && ((this.pages[loadPage - 1].dom && this.pages[loadPage - 1].dom.children.length > 0) || this.pages[loadPage - 1].loading)) {
140
+ return
141
+ }
142
+ this.pages[loadPage - 1].loading = true
143
+ // pdfjsLib.GlobalWorkerOptions.workerSrc = require("pdfjs-dist/legacy/build/pdf.worker.entry.js");
144
+ // 拿到第一个分片
145
+ const { startPage, url } = await this.fetchPdfFragment(loadPage);
146
+ let loadingTask = pdfjsLib.getDocument(url)
147
+ loadingTask.promise.then((pdfDoc) => {
148
+ // 将已经下载的分片保存到 pages 数组中
149
+ for (let i = 0; i < pdfDoc.numPages; i += 1) {
150
+ const pageIndex = startPage + i;
151
+ const page = this.pages[pageIndex - 1];
152
+ // 不在缓存列表内,重新获取本页pdf
153
+ if (page.loadStatus !== this.pageLoadStatus.LOADED) {
154
+ pdfDoc.getPage(i + 1).then((pdfPage) => {
155
+ page.pdfPage = pdfPage;
156
+ page.loadStatus = this.pageLoadStatus.LOADED;
157
+ // 通知可以进行渲染了
158
+ this.startRenderPages(pdfPage, page, pageIndex)
159
+ });
160
+ } else {
161
+ if (this.changetoolbar) {
162
+ this.$nextTick(() => {
163
+ this.renderHighlights()
164
+ })
165
+ this.changetoolbar = false
166
+ }
167
+ }
168
+ }
169
+ });
170
+ },
171
+ initPages (totalPage) {
172
+ // const pages = [];
173
+ this.totalPageCount = totalPage
174
+ for (let i = 0; i < totalPage; i += 1) {
175
+ this.pages.push({
176
+ pageNo: i + 1,
177
+ loadStatus: this.pageLoadStatus.WAIT,
178
+ pdfPage: null,
179
+ dom: null
180
+ });
181
+ }
182
+ },
183
+ async fetchPdfFragment (pageIndex) {
184
+ // 置换加签后的文件地址。
185
+ let obj = {}
186
+ await this.$http.post(
187
+ '/knowledge-api/temporary-certificate/or-origin?expired=30',
188
+ 'https://askbot-pdf-all.oss-cn-zhangjiakou.aliyuncs.com/fb348d095c0b4fd7bbd37826563dac7d/2023/05/08/11/55/18/64591b638bb8ab1b91c65eed/3.pdf',
189
+ {
190
+ headers: {
191
+ "Content-Type": "application/json",
192
+ },
193
+ }).then(async res => {
194
+ if (res.bodyText) {
195
+ // 最后返回一个 包含这4个参数的对象
196
+ obj = await {
197
+ "startPage": pageIndex, // 分片的开始页码
198
+ "endPage": pageIndex + 5, // 分片结束页码
199
+ "totalPage": this.totalPageCount, // pdf 总页数
200
+ "url": res.bodyText // 分片内容下载地址
201
+ }
202
+ }
203
+ if (res.data) {
204
+ // 最后返回一个 包含这4个参数的对象
205
+ obj = await {
206
+ "startPage": pageIndex, // 分片的开始页码
207
+ "endPage": pageIndex + 5, // 分片结束页码
208
+ "totalPage": this.totalPageCount, // pdf 总页数
209
+ "url": res.data // 分片内容下载地址
210
+ }
211
+ }
212
+ })
213
+ return obj
214
+ },
215
+ startRenderPages (pdfPage, page, pageIndex) {
216
+ if (Object.keys(this.pageSize).length == 0) {
217
+ const viewport = pdfPage.getViewport({
218
+ scale: this.scale, // 缩放的比例
219
+ rotation: this.rotation, // 旋转的角度
220
+ });
221
+ // 记录pdf页面高度
222
+ const pageSize = {
223
+ width: viewport.width,
224
+ height: viewport.height,
225
+ }
226
+ this.pageSize = pageSize
227
+ // 创建内容绘制区,并设置大小
228
+ if (this.$refs.pdfView.clientWidth / this.pageSize.width >= 1 || this.isMessageRecord) {
229
+ this.contentView.style.width = `${pageSize.width - 10}px`;
230
+ this.contentView.style.height = `${(this.totalPageCount * (pageSize.height + this.PAGE_INTVERVAL)) + this.PAGE_INTVERVAL}px`;
231
+ } else {
232
+ this.transformSalce = this.$refs.pdfView.clientWidth / this.pageSize.width
233
+ this.contentView.style.width = `${pageSize.width * this.transformSalce - 10}px`;
234
+ this.contentView.style.height = `${(this.totalPageCount * (pageSize.height * (this.transformSalce) + this.PAGE_INTVERVAL)) + this.PAGE_INTVERVAL}px`;
235
+ }
236
+ this.contentView.style.margin = '0 auto 0'
237
+ this.contentView.style.position = 'relative'
238
+ this.contentView.style.paddingBottom = '60px'
239
+ // contentView.style.overflowY = 'auto'
240
+ this.$refs.pdfView.appendChild(this.contentView);
241
+ }
242
+ this.renderPages(pageIndex)
243
+ },
244
+ renderPageContent (page, pageIndex) {
245
+ const { pdfPage, pageNo, dom } = page;
246
+ // dom 元素已存在,无须重新渲染,直接返回
247
+ if (dom && dom.children.length != 0) {
248
+ return;
249
+ }
250
+ const viewport = pdfPage.getViewport({
251
+ scale: this.scale,
252
+ rotation: this.rotation,
253
+ });
254
+ // 创建新的canvas
255
+ const canvas = document.createElement('canvas');
256
+ const context = canvas.getContext('2d');
257
+ // canvas.getContext('2d');
258
+ canvas.height = this.pageSize.height;
259
+ canvas.width = this.pageSize.width;
260
+ // 创建渲染的dom
261
+ const pageDom = document.createElement('div');
262
+ pageDom.style.position = 'absolute';
263
+ pageDom.style.top = `${((pageNo - 1) * (this.pageSize.height + this.PAGE_INTVERVAL)) + this.PAGE_INTVERVAL}px`;
264
+ pageDom.style.width = `${this.pageSize.width}px`;
265
+ pageDom.style.height = `${this.pageSize.height}px`;
266
+ pageDom.appendChild(canvas);
267
+ // 渲染内容
268
+ let renderContext = {
269
+ canvasContext: context,
270
+ viewport: viewport,
271
+ }
272
+ pdfPage.render(renderContext).promise.then(() => {
273
+ console.log(pdfPage.getTextContent(), 'getTextContent');
274
+ return pdfPage.getTextContent()
275
+ }).then((textContent) => {
276
+ const textLayerDiv = document.createElement('div');
277
+ textLayerDiv.setAttribute('class', 'textLayer');
278
+ // 将文本图层div添加至每页pdf的div中
279
+ // 创建新的TextLayerBuilder实例
280
+ let textLayer = new TextLayerBuilder({
281
+ textLayerDiv: textLayerDiv,
282
+ pageIndex: pdfPage._pageIndex,
283
+ viewport: viewport,
284
+ });
285
+ let findPage = this.currentPageAllLine.find(l => { return l.page == pageIndex })
286
+ let rectdomTop = 0
287
+ if (findPage) {
288
+ let AllLines = findPage.allLines
289
+ // setTimeout(() => {
290
+ console.log(findPage, 'findPage');
291
+ if (AllLines.length > 0) {
292
+ for (let j = 0; j < AllLines.length; j++) {
293
+ let lines = AllLines[j].lines
294
+ let rectdom = document.createElement('div')
295
+ rectdom.setAttribute('react-count', AllLines[j].pageCount);
296
+ rectdom.style.position = 'absolute';
297
+ rectdom.style.top = 0
298
+ rectdom.style.left = 0
299
+ rectdom.classList.add('rectdom')
300
+ for (let index = 0; index < lines.length; index++) {
301
+ if (!/^\s+$/g.test(lines[index].content)) {
302
+ let postionArr = lines[index].location
303
+ let div = document.createElement('div')
304
+ div.style.position = 'absolute';
305
+ div.style.left = postionArr[0] * this.scale + 'px',
306
+ // 后端返回的坐标有基线对齐的问题,top 值是后端算好(基线top - 文字高度),在此加上文字高度的 1/9 (大致比例)为实际展示出文字的top值
307
+ div.style.top = (postionArr[1] + postionArr[3] / 9) * this.scale + 'px'
308
+ div.style.height = postionArr[3] * this.scale + 'px';
309
+ div.style.width = postionArr[2] * this.scale + 'px'
310
+ div.style.backgroundColor = 'rgba(54, 106, 255, 0.3)'
311
+ div.classList.add('lineHeight')
312
+ rectdom.appendChild(div)
313
+ if (index == 0 && j == 0) {
314
+ if (this.transformSalce !== null) {
315
+ rectdomTop = (postionArr[1] + postionArr[3] / 9) * this.scale * this.transformSalce
316
+ } else {
317
+ rectdomTop = (postionArr[1] + postionArr[3] / 9) * this.scale
318
+ }
319
+ // if(this.isPC) {
320
+ // rectdomTop = rectdomTop - 50 < 0 ? 0 : rectdomTop - 50
321
+ // }
322
+ // console.log(rectdomTop,div.style.top, (postionArr[1] + postionArr[3] / 9) * this.scale);
323
+ }
324
+ }
325
+ }
326
+ if (rectdom.children.length > 0) {
327
+ pageDom.appendChild(rectdom)
328
+ }
329
+ }
330
+ }
331
+ }
332
+ textLayer.setTextContent(textContent);
333
+ textLayer.render()
334
+ pageDom.appendChild(textLayer.textLayerDiv);
335
+ page.dom = pageDom;
336
+ page.loading = false
337
+ this.contentView.appendChild(pageDom);
338
+ if (this.transformSalce !== null) {
339
+ this.contentView.style.transform = `scale(${this.transformSalce}, ${this.transformSalce})`
340
+ }
341
+ if (this.changetoolbar) {
342
+ setTimeout(() => {
343
+ this.renderHighlights()
344
+ this.changetoolbar = false
345
+ }, 100)
346
+ }
347
+ // console.log(this.fisrtLoad,'this.fisrtLoad');
348
+ if (this.fisrtLoad) {
349
+ setTimeout(() => {
350
+ let pageoffsetHeight = 0
351
+ if (this.transformSalce !== null) {
352
+ pageoffsetHeight = (this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce
353
+ } else {
354
+ pageoffsetHeight = (this.pageSize.height + this.PAGE_INTVERVAL)
355
+ }
356
+ if (this.$refs.pdfView.clientHeight - pageoffsetHeight > 0 && pageIndex == 1) {
357
+ const height = this.$refs.pdfView.clientHeight;
358
+ let startNum = 0
359
+ let endNum = 0
360
+ if (this.transformSalce !== null) {
361
+ startNum = Math.ceil(this.$refs.pdfView.scrollTop / ((this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce))
362
+ endNum = startNum + Math.ceil(height / ((this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce))
363
+ console.log(Math.ceil(height / ((this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce)), this.pageSize.height, this.PAGE_INTVERVAL, height, this.transformSalce, 'startNum');
364
+
365
+ } else {
366
+ startNum = Math.ceil(this.$refs.pdfView.scrollTop / (this.pageSize.height + this.PAGE_INTVERVAL))
367
+ endNum = startNum + Math.ceil(height / (this.pageSize.height + this.PAGE_INTVERVAL))
368
+
369
+ }
370
+ for (let pageIndex = startNum; pageIndex <= endNum; pageIndex++) {
371
+ if (pageIndex > 0 && pageIndex <= this.pages.length) {
372
+ this.loadPdfData(pageIndex)
373
+ }
374
+ }
375
+ }
376
+ if (this.$refs.pdfView.scrollTop == Math.floor((pageNo - 1) * pageoffsetHeight)) {
377
+ this.$refs.pdfView.scrollTop = rectdomTop
378
+ this.fisrtLoad = false
379
+ } else {
380
+ this.$refs.pdfView.scrollTop = `${((pageNo - 1) * pageoffsetHeight) + rectdomTop - this.PAGE_INTVERVAL}`
381
+ this.fisrtLoad = false
382
+ }
383
+ this.renderHighlights()
384
+ // zoomElement(this.contentView)
385
+ }, 100)
386
+ }
387
+ })
388
+ },
389
+ // 监听容器的滚动事件,触发 scrollPdf 方法
390
+ // 这里加了防抖保证不会一次产生过多请求
391
+ debounceScrollPdf: _.debounce(function (e, that) {
392
+ if (this.fisrtLoad) {
393
+ this.fisrtLoad = false
394
+ return
395
+ }
396
+ const scrollTop = e.target.scrollTop;
397
+ const height = e.target.clientHeight;
398
+ let startNum = 0
399
+ let endNum = 0
400
+ if (this.transformSalce !== null) {
401
+ startNum = Math.ceil(scrollTop / ((that.pageSize.height + that.PAGE_INTVERVAL) * this.transformSalce))
402
+ endNum = startNum + Math.ceil(height / ((that.pageSize.height + that.PAGE_INTVERVAL) * this.transformSalce))
403
+ } else {
404
+ startNum = Math.ceil(scrollTop / (that.pageSize.height + that.PAGE_INTVERVAL))
405
+ endNum = startNum + Math.ceil(height / (that.pageSize.height + that.PAGE_INTVERVAL))
406
+ }
407
+ for (let pageIndex = startNum; pageIndex <= endNum; pageIndex++) {
408
+ if (pageIndex > 0 && pageIndex <= that.pages.length) {
409
+ that.loadPdfData(pageIndex)
410
+ }
411
+ }
412
+ console.log('=======');
413
+ }, 200),
414
+ directScrolling (e, that) {
415
+ if (this.fisrtLoad) {
416
+ this.fisrtLoad = false
417
+ return
418
+ }
419
+ const scrollTop = e.target.scrollTop;
420
+ const height = e.target.clientHeight;
421
+ // 根据内容可视区域中心点计算页码, 没有滚动时,指向第一页
422
+ const pageIndex = scrollTop > 0 ?
423
+ Math.ceil((scrollTop + (height / 2)) / (that.pageSize.height + that.PAGE_INTVERVAL)) :
424
+ 1;
425
+ this.loadPdfData(pageIndex)
426
+ },
427
+ pdfScroll (e) {
428
+ if (this.preViewType !== 'pdf' || this.isTouchMoved) {
429
+ return
430
+ }
431
+ if (this.scrollLeft != e.target.scrollLeft) {
432
+ this.scrollLeft = e.target.scrollLeft
433
+ }
434
+ if (this.scrollTop != e.target.scrollTop) {
435
+ this.scrollTop = e.target.scrollTop
436
+ this.debounceScrollPdf(e, this)
437
+ }
438
+ },
439
+ // 分片每次只做一次处理,所以不考虑多片情况
440
+ loadBefore (pageIndex) {
441
+ this.loadPdfData(pageIndex)
442
+ },
443
+ loadAfter (pageIndex) {
444
+ this.loadPdfData(pageIndex)
445
+ },
446
+ // 首先我们获取到需要渲染的范围
447
+ // 根据当前的可视范围内的页码,我们前后只保留 8 页
448
+ getRenderScope (pageIndex) {
449
+ const pagesToRender = [];
450
+ let i = pageIndex - 1;
451
+ let j = pageIndex + 1;
452
+ // pageIndex - 1 表示当前页码数 对应的下标位置
453
+ pagesToRender.push(this.pages[pageIndex - 1]);
454
+ while (pagesToRender.length < 8 && pagesToRender.length < this.pages.length) {
455
+ if (i > 0) {
456
+ pagesToRender.push(this.pages[i - 1]);
457
+ i -= 1;
458
+ }
459
+ if (pagesToRender.length >= 8) {
460
+ break;
461
+ }
462
+ if (j <= this.pages.length) {
463
+ pagesToRender.push(this.pages[j - 1]);
464
+ j += 1;
465
+ }
466
+ }
467
+ return pagesToRender;
468
+ },
469
+ // 渲染需要展示的页面,不需展示的页码将其清除
470
+ renderPages (pageIndex) {
471
+ const pagesToRender = this.getRenderScope(pageIndex);
472
+ for (const i of this.pages) {
473
+ if (pagesToRender.includes(i)) {
474
+ i.loadStatus === this.pageLoadStatus.LOADED ?
475
+ this.renderPageContent(i, pageIndex) :
476
+ this.renderPageLoading(i);
477
+ } else {
478
+ this.clearPage(i);
479
+ }
480
+ }
481
+ },
482
+ // 清除页面 dom
483
+ clearPage (page) {
484
+ if (page.dom) {
485
+ this.contentView.removeChild(page.dom);
486
+ page.loadStatus = 0
487
+ page.loading = false
488
+ page.dom = undefined;
489
+ }
490
+ },
491
+ // 页面正在下载时渲染loading视图
492
+ renderPageLoading (page) {
493
+ const { pageNo, dom } = page;
494
+ if (dom && dom.children.length != 0) {
495
+ return;
496
+ }
497
+ const pageDom = document.createElement('div');
498
+ pageDom.style.width = `${this.pageSize.width}px`;
499
+ pageDom.style.height = `${this.pageSize.height}px`;
500
+ pageDom.style.position = 'absolute';
501
+ pageDom.style.top = `${((pageNo - 1) * (this.pageSize.height + this.PAGE_INTVERVAL)) + this.PAGE_INTVERVAL
502
+ }px`;
503
+ pageDom.style.backgroundImage = `url('https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif')`
504
+ pageDom.style.backgroundPosition = 'center'
505
+ pageDom.style.backgroundRepeat = 'no-repeat'
506
+ pageDom.style.backgroundColor = '#FFF'
507
+ page.dom = pageDom;
508
+ this.contentView.appendChild(pageDom);
509
+ },
510
+ prev () {
511
+ this.currentPage--
512
+ if (this.currentPage < 0) {
513
+ this.currentPage = 0
514
+ if (!this.isPC) {
515
+ this.$toast({
516
+ message: '当前已经是第一段了',
517
+ duration: 2000,
518
+ })
519
+ return
520
+ }
521
+ }
522
+ if (this.preViewType == 'pdf') {
523
+ this.scrollToUplaodePage(this.currentPage)
524
+ } else {
525
+ this.scrollToExcalTop(this.currentPage)
526
+ }
527
+ // this.getpdfResloutePage(this.cachePdf[this.currentPage - 1])
528
+ },
529
+ next () {
530
+ this.currentPage++
531
+ if (this.currentPage >= this.tagIds.length) {
532
+ this.currentPage = this.tagIds.length - 1
533
+ if (!this.isPC) {
534
+ this.$toast({
535
+ message: '当前已经是最后一段了',
536
+ duration: 2000,
537
+ })
538
+ return
539
+ }
540
+ }
541
+ if (this.preViewType == 'pdf') {
542
+ this.scrollToUplaodePage(this.currentPage)
543
+ } else {
544
+ this.scrollToExcalTop(this.currentPage)
545
+ }
546
+ },
547
+ currentChange (value) {
548
+ this.currentPage = value - 1
549
+ if (this.preViewType == 'pdf') {
550
+ this.scrollToUplaodePage(this.currentPage)
551
+ } else {
552
+ this.scrollToExcalTop(this.currentPage)
553
+ }
554
+ },
555
+ scrollToUplaodePage (currentPage) {
556
+ this.changetoolbar = true
557
+ if (this.preViewType !== 'pdf') {
558
+ return
559
+ }
560
+
561
+ let pdfResloute = this.cachePdf[currentPage]
562
+ this.identifyTextPostion.extractInfo = pdfResloute.extractInfo
563
+ this.identifyTextPostion.left = pdfResloute.extractInfo.location[0]
564
+ this.identifyTextPostion.top = pdfResloute.extractInfo.location[1]
565
+ this.identifyTextPostion.width = pdfResloute.extractInfo.location[2]
566
+ this.identifyTextPostion.height = pdfResloute.extractInfo.location[3]
567
+ this.identifyTextPostion.page = pdfResloute.page
568
+ this.identifyTextPostion.pageHeight = pdfResloute.pageHeight
569
+ this.identifyTextPostion.pageWidth = pdfResloute.pageWidth
570
+ // 在当前段落在最后一页pdf时,根据计算的高度并不能触发滚动,在此执行重新渲染方法,非次情况会执行两次,待优化
571
+ this.$nextTick(() => {
572
+ this.renderHighlights()
573
+ })
574
+ if (this.transformSalce !== null) {
575
+ this.$refs.pdfView.scrollTop = `${((pdfResloute.page - 1) * (this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce) + this.identifyTextPostion.top}`
576
+ } else {
577
+ this.$refs.pdfView.scrollTop = `${((pdfResloute.page - 1) * (this.pageSize.height + this.PAGE_INTVERVAL)) + this.identifyTextPostion.top}`
578
+ }
579
+ },
580
+ scrollToExcalTop (currentPage) {
581
+ for (let index = 0; index < this.allTr.length; index++) {
582
+ if (index == currentPage) {
583
+ Array.from(this.allTr[index].children).forEach(item => {
584
+ item.style.background = 'rgba(255, 136, 0, 0.6)'
585
+ item.classList.add('animation')
586
+ setTimeout(() => {
587
+ item.classList.remove('animation')
588
+ }, 4000)
589
+ })
590
+ // getBoundingClientRect().top 当前元素距离屏幕顶部的高度 + 弹窗header 高度
591
+ if (!this.isPC) {
592
+ let top = this.allTr[index].getBoundingClientRect().top - this.$refs.pdfView.getBoundingClientRect().top
593
+ this.$refs.pdfView.scrollTop = top
594
+ } else {
595
+ let top = this.allTr[index].getBoundingClientRect().top
596
+ this.$refs.pdfView.scrollTop = top - 50
597
+ }
598
+ } else {
599
+ Array.from(this.allTr[index].children).forEach(item => {
600
+ item.style.background = 'rgba(54, 106, 255, 0.6)'
601
+ item.classList.remove('animation')
602
+ })
603
+ }
604
+ }
605
+ },
606
+ // pdf是否需要重新渲染高亮位置
607
+ renderHighlights () {
608
+ let lineHeightDom = Array.from(document.getElementsByClassName('rectdom'))
609
+ console.log(lineHeightDom, this.currentPage, 'this.currentPage');
610
+ if (lineHeightDom) {
611
+ lineHeightDom.forEach((d) => {
612
+ for (let i = 0; i < d.children.length; i++) {
613
+ if (d.getAttribute('react-count') == this.currentPage) {
614
+ d.children[i].style.backgroundColor = 'rgba(255, 136, 0, 0.3)'
615
+ d.children[i].classList.add('animation')
616
+ setTimeout(() => {
617
+ d.children[i].classList.remove('animation')
618
+ }, 4000)
619
+ } else {
620
+ d.children[i].style.backgroundColor = 'rgba(54, 106, 255, 0.3)'
621
+ d.children[i].classList.remove('animation')
622
+ }
623
+ }
624
+ })
625
+ }
626
+ },
627
+ displayHiglight (pageIndex) {
628
+ let lineHeightDom = Array.from(document.getElementsByClassName('rectdom'))
629
+ if (lineHeightDom) {
630
+ lineHeightDom.forEach((d) => {
631
+ if (d.getAttribute('page-index') == pageIndex) {
632
+ d.style.display = 'none'
633
+ }
634
+ })
635
+ }
636
+ },
637
+ // 前端暂时缓存多页
638
+ autoLoadMore (pageIndex) {
639
+ let pdfResloute = this.cachePdf.find(cache => {
640
+ return cache.page == pageIndex
641
+ })
642
+ if (pdfResloute) {
643
+ this.getpdfResloutePage(pdfResloute)
644
+ } else {
645
+ this.loadPdfData(pageIndex)
646
+ }
647
+ },
648
+ setPageAllLine (arr) {
649
+ this.currentPageAllLine = []
650
+ arr.forEach((item, index) => {
651
+ let i = this.currentPageAllLine.findIndex(l => { return l.page && l.page == item.page })
652
+ if (i != -1) {
653
+ // this.currentPageAllLine[i].allLines.lines.push(item.extractInfo.lines)
654
+ this.currentPageAllLine[i].allLines.push({
655
+ pageCount: index,
656
+ lines: item.extractInfo.lines
657
+ })
658
+ } else {
659
+ this.currentPageAllLine.push({
660
+ page: item.page,
661
+ allLines: [{
662
+ pageCount: index,
663
+ lines: item.extractInfo.lines
664
+ }],
665
+ })
666
+ }
667
+ })
668
+ },
669
+ openTouch () {
670
+ // this.$nextTick()将回调延迟到下次 DOM 更新循环之后执行
671
+ let that = this;
672
+ this.$nextTick(() => {
673
+ // setInterval(() => {
674
+ // this.scale = this.scale + 0.1
675
+ // that.pages.forEach((item, index) =>{
676
+ // if(item.dom) {
677
+ // item.dom.children.forEach( childDom =>{
678
+ // if(childDom.getAttribute('react-count')) {
679
+ // childDom.style.transform = "scale(" + this.scale + ")";
680
+ // childDom.style.transformOrigin = "0px 0px 0px";
681
+ // } else {
682
+ // item.dom = null
683
+ // this.startRenderPages(item.pdfPage, null, index)
684
+ // }
685
+ // } )
686
+ // }
687
+ // })
688
+ // }, 100);
689
+ // 获取放大或缩小的区域DOM
690
+ let matrix_box = this.contentView
691
+ matrix_box.addEventListener("touchstart", function (event) {
692
+ this.isTouchMoved = true
693
+ let touches = event.touches;
694
+ let events = touches[0];
695
+ let events2 = touches[1];
696
+
697
+ // event.preventDefault();
698
+
699
+ // 第一个触摸点的坐标
700
+ that.displacement.pageX = events.pageX;
701
+ that.displacement.pageY = events.pageY;
702
+
703
+ that.displacement.moveable = true;
704
+
705
+ if (events2) {
706
+ that.displacement.pageX2 = events2.pageX;
707
+ that.displacement.pageY2 = events2.pageY;
708
+ }
709
+
710
+ that.displacement.originScale = this.scale || 1;
711
+ // console.log(that.displacement);
712
+ });
713
+ document.addEventListener("touchmove", function (event) {
714
+ if (!that.displacement.moveable) {
715
+ return;
716
+ }
717
+ // event.preventDefault();
718
+ let touches = event.touches;
719
+ let events = touches[0];
720
+ let events2 = touches[1];
721
+ // 双指移动
722
+ if (events2) {
723
+ // 第2个指头坐标在touchmove时候获取
724
+ if (!that.displacement.pageX2) {
725
+ that.displacement.pageX2 = events2.pageX;
726
+ }
727
+ if (!that.displacement.pageY2) {
728
+ that.displacement.pageY2 = events2.pageY;
729
+ }
730
+ // 双指缩放比例计算
731
+ let zoom = that.getDistance({
732
+ x: events.pageX,
733
+ y: events.pageY
734
+ },
735
+ {
736
+ x: events2.pageX,
737
+ y: events2.pageY
738
+ }
739
+ ) / that.getDistance(
740
+ {
741
+ x: that.displacement.pageX,
742
+ y: that.displacement.pageY
743
+ },
744
+ {
745
+ x: that.displacement.pageX2,
746
+ y: that.displacement.pageY2
747
+ }
748
+ );
749
+ // 应用在元素上的缩放比例
750
+ let newScale = that.displacement.originScale * zoom;
751
+ console.log(zoom, newScale, this.scale, 'newScale');
752
+ // 最大缩放比例限制
753
+ if (newScale > 2) {
754
+ newScale = 2;
755
+ }
756
+ // 最大缩放比例限制
757
+ if (newScale < 1) {
758
+ newScale = 1;
759
+ }
760
+ // 记住使用的缩放值
761
+ that.displacement.scale = newScale;
762
+ // console.log(newScale);
763
+ matrix_box.style.transform = "scale(" + newScale + ")";
764
+ // 设置旋转元素的基点位置
765
+ matrix_box.style.transformOrigin = "0px 0px 0px";
766
+ }
767
+ }, { passive: false });
768
+ document.addEventListener('touchend', function () {
769
+ that.isTouchMoved = false
770
+ }, { passive: false })
771
+ });
772
+ },
773
+ getDistance (start, stop) {
774
+ // Math.hypot()计算参数的平方根
775
+ return Math.hypot(stop.x - start.x, stop.y - start.y);
776
+ },
777
+ changeScale (value) {
778
+ if (value == 'zoom') {
779
+ this.handScale = 'auto'
780
+ this.transformSalce = (this.transformSalce + 0.2).toFixed(1)
781
+ } else if (value == 'reduce') {
782
+ if ((this.transformSalce - 0.2).toFixed(1) <= 0) {
783
+ return
784
+ }
785
+ this.handScale = 'auto'
786
+ this.transformSalce = (this.transformSalce - 0.2).toFixed(1)
787
+ } else if (value == 'auto') {
788
+ this.transformSalce = this.$refs.pdfView.clientWidth / this.pageSize.width
789
+ } else if (value == 'reality') {
790
+ this.transformSalce = 0.5
791
+ } else {
792
+ this.transformSalce = (value / 2).toFixed(1)
793
+ }
794
+ this.transformSalce = Number(this.transformSalce)
795
+ this.contentView.style.transform = 'scale(' + this.transformSalce + ')';
796
+ // this.getpdfResloutePage(this.cachePdf[0])
797
+ },
798
+ },
799
+ computed: {
800
+ perviewUrl () {
801
+ return '/web/viewer.html?file=' + '/pdflist/pdf4split-1.pdf'
802
+ },
803
+ setHeight () {
804
+ if (this.tagIds.length > 1) {
805
+ if (this.isPC) {
806
+ return 'calc(100% - 110px)'
807
+ } else {
808
+ return 'calc(100% - 60px)'
809
+ }
810
+ } else {
811
+ if (this.isPC) {
812
+ return 'calc(100% - 50px)'
813
+ } else {
814
+ return '100%'
815
+ }
816
+ }
817
+ }
818
+ },
819
+ watch: {
820
+ tagIds: {
821
+ handler (value) {
822
+ if (value && value.length) {
823
+ // pdf_view 下创建 所有canvs的容器
824
+ this.contentView = document.createElement('div')
825
+ this.contentView.style.transformOrigin = '0px 0px 0px'
826
+ this.$http.get('/knowledge-api/knowledge/knowledge-part-location-info/list?ids=' + value.join(',')).then(res => {
827
+ 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}
828
+ // 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}
829
+ // 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}
830
+ // res.data = {"data":[{"id":"6475eab868110215ab821a80","knowledgeId":"6475e7eac724c54c46cbfa2d","mainId":"5ecf2fcd704541149201ab9c1c31162d","page":0,"total":1,"pageHeight":0.0,"pageWidth":0.0,"publicPageFileUrl":"https://askbot-pdf-all.oss-cn-zhangjiakou.aliyuncs.com/5ecf2fcd704541149201ab9c1c31162d/2023/05/30/08/23/20/6475eab63339db423f26b196/0.html","extractInfo":{"location":null,"content":"产品:系统配置,产品型号:存储,VX30:4G+16G,VX50:16G+256G","lines":null,"tagId":"6475eab868110215ab821a80"}}],"code":"0","msg":null,"traceId":null}
831
+ // res.data = {"data":[{"id":"6475e9393339db423f26af01","knowledgeId":"6475e44fc724c54c46cbfa21","mainId":"5ecf2fcd704541149201ab9c1c31162d","page":2,"total":2,"pageHeight":510.25,"pageWidth":1559.05,"publicPageFileUrl":"https://askbot-pdf-all.oss-cn-zhangjiakou.aliyuncs.com/5ecf2fcd704541149201ab9c1c31162d/2023/05/30/08/00/29/6475e55d3339db423f26a9b8/2.pdf","extractInfo":{"location":[327.70532,288.0498,414.9734,12.241608],"content":"三、指示灯状态说明1.白色常亮:开机/开机中2.红色常亮:待机3.白色呼吸:息屏4.红色闪烁:升级1.LAN:通过网线连接到主机的Camera端口2.电源开关:电源切换开关","lines":[{"content":"三、指示灯状态说明","location":[634.3203,288.0498,108.3584,12.0]},{"content":"1.白色常亮:开机/开机中","location":[634.3203,320.08978,108.23407,9.0]},{"content":"2.红色常亮:待机","location":[634.3204,341.3298,78.597046,9.0]},{"content":"3.白色呼吸:息屏","location":[634.32043,362.45282,78.597046,9.0]},{"content":"4.红色闪烁:升级","location":[634.3205,383.6928,78.597046,9.0]},{"content":"1.LAN:通过网线连接到主机的","location":[327.70535,291.2914,144.35995,9.0]},{"content":"Camera端口","location":[327.70532,306.88843,55.322998,9.0]},{"content":"2.电源开关:电源切换开关","location":[482.74832,291.2914,105.36301,9.0]}],"tagId":null}}],"code":"0","msg":null,"traceId":null}
832
+ // if(value.length === 1) {
833
+ // this.$refs.pdfView.style.height = 'calc(100% - 50px)'
834
+ // }
835
+ if (res.data.code == 0) {
836
+ // tagIds 会按照gpt识别的生成有序的数组,前端直接按照下标的顺序取就可以了
837
+ // 缓存拿到的所有数据
838
+ this.cachePdf = res.data.data
839
+ let publicPageFileUrl = res.data.data[0].publicPageFileUrl
840
+ this.currentPage = 0
841
+ // console.log(publicPageFileUrl.substring(publicPageFileUrl.lastIndexOf('.')));
842
+ if (publicPageFileUrl.substring(publicPageFileUrl.lastIndexOf('.')) === '.pdf') {
843
+ this.preViewType = 'pdf'
844
+ // this.setPageAllLine(this.cachePdf)
845
+ this.getpdfResloutePage(res.data.data[0])
846
+ } else {
847
+ this.preViewType = 'excal'
848
+ this.$http.post(
849
+ '/knowledge-api/temporary-certificate/or-origin?expired=30',
850
+ publicPageFileUrl,
851
+ {
852
+ headers: {
853
+ "Content-Type": "application/json",
854
+ },
855
+ }).then(res => {
856
+ // 使用原声请求方式 axios会带有不需要的请求头
857
+ let xhr = new XMLHttpRequest();
858
+ xhr.open('GET', res.data || res.bodyText, true);
859
+ // 定义请求完成的处理函数,请求前也可以增加加载框/禁用下载按钮逻辑
860
+ xhr.onload = ({ currentTarget }) => {
861
+ // 请求完成
862
+ if (currentTarget.status === 200) { // 返回200
863
+ this.contentView.innerHTML = currentTarget.response
864
+ this.contentView.style.padding = '10px'
865
+ // this.contentView.style.position = 'relative'
866
+ this.$refs.pdfView.style.backgroundColor = '#FFFFFF'
867
+ this.$refs.pdfView.appendChild(this.contentView)
868
+ let allTr = Array.from(this.$refs.pdfView.getElementsByTagName('tr'))
869
+ this.allTr = []
870
+ for (let index = 0; index < allTr.length; index++) {
871
+ if (value.includes(allTr[index].getAttribute('tag-id'))) {
872
+ this.allTr.push(allTr[index])
873
+ }
874
+ }
875
+ this.currentChange(1)
876
+
877
+ }
878
+ }
879
+ xhr.send();
880
+ })
881
+ }
882
+ } else {
883
+ let div = document.createElement('div')
884
+ div.innerText = '文件加载异常'
885
+ this.contentView.appendChild(div)
886
+ this.$refs.pdfView.appendChild(this.contentView)
887
+ }
888
+ })
889
+ }
890
+ },
891
+ deep: true,
892
+ immediate: true
893
+ }
894
+ },
895
+ mounted () {
896
+ if (/(iPhone|iPad|iPod|iOS|Android)/i.test(navigator.userAgent)) {
897
+ this.isPC = false
898
+ } else {
899
+ this.isPC = true
900
+ }
901
+ }
902
+ }
903
+ </script>
904
+
905
+ <style lang="less" scoped>
906
+ @import "../assets/less/variables.less";
907
+
908
+ .pdf_view {
909
+ width: 100%;
910
+ height: calc(100% - 110px);
911
+ overflow: auto;
912
+ background-color: @background-content-color;
913
+ // margin-bottom: 60px;
914
+ box-sizing: border-box;
915
+
916
+ // position: relative;
917
+ // > div {
918
+ // width: 100%;
919
+ // height: 100%;
920
+ // overflow: hidden;
921
+ // overflow-y: auto;
922
+ // position: relative;
923
+ // }
924
+ >iframe {
925
+ width: 100%;
926
+ height: 100%;
927
+ }
928
+
929
+ a:link {
930
+ color: none;
931
+ }
932
+
933
+ a:visited {
934
+ color: none;
935
+ }
936
+
937
+ a:hover {
938
+ color: none;
939
+ }
940
+
941
+ a:active {
942
+ color: none;
943
+ }
944
+
945
+ .btn_footer {
946
+ width: 100%;
947
+ height: 60px;
948
+ display: flex;
949
+ align-items: center;
950
+ justify-content: space-around;
951
+ position: absolute;
952
+ bottom: 0px;
953
+ left: 0;
954
+ z-index: 999;
955
+ background: @background-color-light;
956
+
957
+ .prev,
958
+ .next {
959
+ width: 35%;
960
+ height: 40px;
961
+ display: flex;
962
+ align-items: center;
963
+ justify-content: center;
964
+ border-radius: 50px;
965
+ cursor: pointer;
966
+ }
967
+
968
+ .prev {
969
+ background: @background-color-prev;
970
+ color: @font-primary-color;
971
+ }
972
+
973
+ .next {
974
+ background: @primary-color;
975
+ color: @font-primary-light-color;
976
+ }
977
+ }
978
+
979
+ #pagination {
980
+ .total-class {
981
+ margin-right: 13px;
982
+ font-weight: 400;
983
+ }
984
+
985
+ position: absolute;
986
+ bottom: 0px;
987
+ right: 0;
988
+ width: 100%;
989
+ display: flex;
990
+ align-items: center;
991
+ justify-content: center;
992
+ height: 50px;
993
+ background-color: @background-color-light;
994
+ box-shadow: 0px 0px 18px 0px rgba(29, 55, 129, 0.07);
995
+ border-radius: 5px;
996
+ z-index: 1000;
997
+
998
+ /deep/.el-pagination {
999
+ margin-right: 110px;
1000
+ }
1001
+
1002
+ /deep/.el-pager {
1003
+ background: @background-color-pagination;
1004
+ border-radius: 15px;
1005
+ }
1006
+
1007
+ /deep/.el-pagination.is-background .btn-next {
1008
+ width: 30px;
1009
+ height: 30px;
1010
+ background: @background-color-pagination;
1011
+ border-radius: 50%;
1012
+ }
1013
+
1014
+ /deep/.el-pagination .btn-next {
1015
+ width: 30px;
1016
+ height: 30px;
1017
+ background: @background-color-pagination;
1018
+ border-radius: 50%;
1019
+ padding-left: 0;
1020
+ margin-left: 5px;
1021
+ }
1022
+
1023
+ /deep/.el-pagination .btn-prev {
1024
+ width: 30px;
1025
+ height: 30px;
1026
+ background: @background-color-pagination;
1027
+ border-radius: 50%;
1028
+ padding-right: 0;
1029
+ margin-right: 5px;
1030
+ }
1031
+
1032
+ /deep/.el-pagination button {
1033
+ padding: 0;
1034
+ min-width: 30px;
1035
+ }
1036
+
1037
+ /deep/.el-pager li {
1038
+ background: @background-color-pagination;
1039
+ height: 30px;
1040
+ min-width: 30px;
1041
+ line-height: 30px;
1042
+ font-size: 12px;
1043
+ color: @font-pagination-color;
1044
+ }
1045
+
1046
+ /deep/.el-pager li:first-child {
1047
+ border-bottom-left-radius: 15px !important;
1048
+ border-top-left-radius: 15px !important;
1049
+ }
1050
+
1051
+ /deep/.el-pager li:last-child {
1052
+ border-top-right-radius: 15px !important;
1053
+ border-bottom-right-radius: 15px !important;
1054
+ }
1055
+
1056
+ /deep/.el-pager li.active {
1057
+ width: 30px;
1058
+ height: 30px;
1059
+ min-width: 30px;
1060
+ background: @font-primary-accent-color;
1061
+ border: 3px solid @border-color-copy;
1062
+ border-radius: 50%;
1063
+ line-height: 24px;
1064
+ color: @background-color-light;
1065
+ }
1066
+
1067
+ /deep/.el-pagination.is-background .el-pager li:not(.disabled).active {
1068
+ background: @primary-color;
1069
+ }
1070
+ }
1071
+
1072
+ .change_scale {
1073
+ width: 100%;
1074
+ height: 50px;
1075
+ position: absolute;
1076
+ top: 50px;
1077
+ left: 0;
1078
+ background: @background-color-light;
1079
+ display: flex;
1080
+ align-items: center;
1081
+ padding: 0 10px;
1082
+ box-sizing: border-box;
1083
+
1084
+ section {
1085
+ cursor: pointer;
1086
+ width: 30px;
1087
+ height: 30px;
1088
+ margin-right: 5px;
1089
+ border-radius: 5px;
1090
+ display: flex;
1091
+ align-items: center;
1092
+ justify-content: center;
1093
+
1094
+ i {
1095
+ font-weight: 900;
1096
+ }
1097
+ }
1098
+
1099
+ section:hover {
1100
+ background: rgba(221, 222, 223, 1);
1101
+ }
1102
+ }
1103
+ }
1104
+ </style>
1105
+ <style lang="less">
1106
+ .animation {
1107
+ animation-name: highlight;
1108
+ animation-duration: 4s;
1109
+ }
1110
+
1111
+ @keyframes highlight {
1112
+ 0% {
1113
+ background: rgba(255, 136, 0, 0.3);
1114
+ }
1115
+
1116
+ 25% {
1117
+ background: rgba(255, 136, 0, 0.6);
1118
+ }
1119
+
1120
+ 50% {
1121
+ background: rgba(255, 136, 0, 0.3);
1122
+ }
1123
+
1124
+ 75% {
1125
+ background: rgba(255, 136, 0, 0.6);
1126
+ }
1127
+
1128
+ 100% {
1129
+ background: rgba(255, 136, 0, 0.3);
1130
+ }
1139
1131
  }</style>