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,1506 +1,1337 @@
1
- <template>
2
- <div class="pdf_view" id="pdf_view">
3
- <div class="change_scale" v-if="isPC">
4
- <section @click="changeScale('reduce')">
5
- <i class="el-icon-minus"></i>
6
- </section>
7
- <el-divider direction="vertical"></el-divider>
8
- <section @click="changeScale('zoom')">
9
- <i class="el-icon-plus"></i>
10
- </section>
11
- <el-select size="small" v-model="handScale" @change="changeScale" placeholder="请选择">
12
- <el-option v-for="item in scaleList" :key="item.value" :label="item.label" :value="item.value">
13
- </el-option>
14
- </el-select>
15
- </div>
16
- <div class="pdf_container_view" id="pdf_container_view" @scroll="pdfScroll" ref="pdfView"></div>
17
- <div class="btn_footer" v-if="tagIds.length > 1 && !isPC">
18
- <div class="prev" @click="prev">上一段</div>
19
- <div class="next" @click="next">下一段</div>
20
- </div>
21
- <div id="pagination" v-if="tagIds.length > 1 && isPC">
22
- <el-pagination :current-page="currentPage + 1" @current-change="currentChange" @prev-click="prev"
23
- @next-click="next" layout="slot, prev, pager, next" :page-size="1" :total="tagIds.length">
24
- <span class="total-class">答案由{{ tagIds.length }}段内容生成</span>
25
- </el-pagination>
26
- </div>
27
- </div>
28
- </template>
29
- <script>
30
- // :style="{
31
- // marginBottom: tagIds.length > 1 ? '60px' : '0px',
32
- // height: setHeight
33
- // }"
34
- import _ from 'lodash'
35
- import { newInitWaterMark } from "../assets/js/common";
36
- // import * as pdfjsLib from 'pdfjs-dist'
37
- // pdfjsLib.GlobalWorkerOptions.workerSrc = 'pdfjs-dist/build/pdf.worker';
38
- // import { TextLayerBuilder } from "pdfjs-dist/web/pdf_viewer";
39
- // EventBus pdf_viewer 支持绑定自定义事件,一版不做
40
- // import 'pdfjs-dist/web/pdf_viewer.css'
41
- /* eslint-disable */
42
- const pdfjsLib = window['pdfjsLib']
43
- if (pdfjsLib) {
44
- pdfjsLib.GlobalWorkerOptions.workerSrc = window['pdfjs-dist/build/pdf.worker']
45
- // 'pdfjs-dist/build/pdf.worker';
46
- }
47
- const { TextLayerBuilder } = window['pdfjs-dist/web/pdf_viewer']
48
- const CSS_UNITS = 96.0 / 72.0
49
- // import { zoomElement } from '../assets/js/hammer'
50
- export default {
51
- name: 'pdfView',
52
- props: ['tagIds', 'isMessageRecord','fileName', "knowledgeItem",'textWatermarkStr'],
53
- data () {
54
- return {
55
- url: '',
56
- pages: [],
57
- pageLoadStatus: {
58
- WAIT: 0,
59
- LOADED: 1,
60
- },
61
- scale: 1,
62
- rotation: 0,
63
- pageSize: {},
64
- PAGE_INTVERVAL: 15,
65
- SLICE_COUNT: 5,
66
- contentView: null,
67
- fisrtLoad: true,
68
- TextLayerBuilder: null,
69
- totalPageCount: 0,
70
- identifyTextPostion: {
71
- top: 0,
72
- left: 0,
73
- width: 100,
74
- height: 0,
75
- page: 1,
76
- pageHeight: 0,
77
- pageWidth: 0,
78
- extractInfo: {},
79
- currentPageAllLine: []
80
- },
81
- currentPageAllLine: [],
82
- pdfUrl: '',
83
- cachePdf: [],
84
- newViewer: null,
85
- currentPage: 0,
86
- changetoolbar: false,
87
- allTr: [],
88
- preViewType: 'pdf',
89
- displacement: {
90
- pageX: 0,
91
- pageY: 0,
92
- moveable: false,
93
- pageX2: 0,
94
- pageY2: 0,
95
- originScale: 1,
96
- },
97
- isTouchMoved: false,
98
- transformSalce: null,
99
- defaultTransform:0.8,
100
- isPC: false,
101
- handScale: 'auto',
102
- scaleList: [
103
- {
104
- label: '自动缩放',
105
- value: 'auto'
106
- },
107
- {
108
- label: '实际比例',
109
- value: 'reality'
110
- },
111
- {
112
- label: '100%',
113
- value: 1
114
- },
115
- {
116
- label: '120%',
117
- value: 1.2
118
- },
119
- {
120
- label: '150%',
121
- value: 1.5
122
- },
123
- {
124
- label: '170%',
125
- value: 1.7
126
- }
127
- ,
128
- {
129
- label: '200%',
130
- value: 2
131
- }
132
- ],
133
- scrollTop: 0,
134
- scrollLeft: 0
135
- }
136
- },
137
- methods: {
138
- getpdfResloutePage (pdfResloute) {
139
- // 根据当前页面宽度设置缩放比例
140
- // this.scale = Math.round(this.$refs.pdfView.clientWidth / pdfResloute.pageWidth * 100) / 100
141
- if (this.isMessageRecord) {
142
- this.scale = Math.round(this.$refs.pdfView.clientWidth / pdfResloute.pageWidth * 100) / 100
143
- } else {
144
- this.scale = 2
145
- }
146
- // 从后端获取到当前分片后所有的pdf页码,初始化数组,数组下{} 对应每页pdf文件
147
- this.pdfUrl = pdfResloute.publicPageFileUrl.substring(0, pdfResloute.publicPageFileUrl.lastIndexOf('/') + 1)
148
- this.initPages(pdfResloute.total)
149
- // 定位功能,加载对应页码位置
150
- this.loadPdfData(pdfResloute.page)
151
- },
152
- async loadPdfData (loadPage) {
153
- if (this.pages[loadPage - 1] && ((this.pages[loadPage - 1].dom && this.pages[loadPage - 1].dom.children.length > 0) || this.pages[loadPage - 1].loadStatus)) {
154
- return
155
- } else {
156
- if (this.changetoolbar) {
157
- this.$nextTick(() => {
158
- this.renderHighlights()
159
- })
160
- this.changetoolbar = false
161
- }
162
- }
163
- // 记录开始缓存的状态
164
- // pdfjsLib.GlobalWorkerOptions.workerSrc = require("pdfjs-dist/legacy/build/pdf.worker.entry.js");
165
- // 拿到第一个分片
166
- const { startPage, url } = await this.fetchPdfFragment(loadPage);
167
- let loadingTask = pdfjsLib.getDocument(url)
168
- loadingTask.promise.then(async (pdfDoc) => {
169
- // 将已经下载的分片保存到 pages 数组中
170
- // for (let i = 0; i < pdfDoc.numPages; i += 1) {
171
- // const pageIndex = startPage + i;
172
- // const page = this.pages[pageIndex - 1];
173
- // // // 不在缓存列表内,重新获取本页pdf
174
- // // if (page.loadStatus !== this.pageLoadStatus.LOADED) {
175
-
176
- // // } else {
177
- // // if (this.changetoolbar) {
178
- // // this.$nextTick(() => {
179
- // // this.renderHighlights()
180
- // // })
181
- // // this.changetoolbar = false
182
- // // }
183
- // // }
184
- // }
185
- const page = this.pages[loadPage - 1]
186
- await pdfDoc.getPage(1).then(async (pdfPage) => {
187
- this.pages[loadPage - 1].loadStatus = true
188
- this.pages[loadPage - 1].pdfPage = pdfPage;
189
- // 通知可以进行渲染了
190
- await this.startRenderPages(pdfPage, page, loadPage)
191
- });
192
- });
193
- },
194
- initPages (totalPage) {
195
- // const pages = [];
196
- this.totalPageCount = totalPage
197
- for (let i = 0; i < totalPage; i += 1) {
198
- this.pages.push({
199
- pageNo: i + 1,
200
- loadStatus: false,
201
- pdfPage: null,
202
- dom: null
203
- });
204
- }
205
- },
206
- async fetchPdfFragment (pageIndex) {
207
- // 置换加签后的文件地址。
208
- let obj = {}
209
- await this.$http.post(
210
- '/knowledge-api/temporary-certificate/or-origin?expired=30',
211
- this.pdfUrl + pageIndex + '.pdf',
212
- {
213
- headers: {
214
- "Content-Type": "application/json",
215
- },
216
- }).then(async res => {
217
- if (res.bodyText) {
218
- // 最后返回一个 包含这4个参数的对象
219
- obj = await {
220
- "startPage": pageIndex, // 分片的开始页码
221
- "endPage": pageIndex + 5, // 分片结束页码
222
- "totalPage": this.totalPageCount, // pdf 总页数
223
- "url": res.bodyText // 分片内容下载地址
224
- }
225
- }
226
- if (res.data) {
227
- // 最后返回一个 包含这4个参数的对象
228
- obj = await {
229
- "startPage": pageIndex, // 分片的开始页码
230
- "endPage": pageIndex + 5, // 分片结束页码
231
- "totalPage": this.totalPageCount, // pdf 总页数
232
- "url": res.data // 分片内容下载地址
233
- }
234
- }
235
- })
236
- return obj
237
- },
238
- startRenderPages (pdfPage, page, pageIndex) {
239
- if (Object.keys(this.pageSize).length == 0) {
240
- const viewport = pdfPage.getViewport({
241
- scale: this.scale, // 缩放的比例
242
- rotation: this.rotation, // 旋转的角度
243
- });
244
- // 记录pdf页面高度
245
- const pageSize = {
246
- width: viewport.width,
247
- height: viewport.height,
248
- }
249
- this.pageSize = pageSize
250
- // 创建内容绘制区,并设置大小
251
- if (this.$refs.pdfView.clientWidth / this.pageSize.width >= 1 || this.isMessageRecord) {
252
- this.contentView.style.width = `${pageSize.width - 10}px`;
253
- this.contentView.style.height = `${(this.totalPageCount * (pageSize.height + this.PAGE_INTVERVAL)) + this.PAGE_INTVERVAL}px`;
254
- } else {
255
- this.transformSalce = this.$refs.pdfView.clientWidth / this.pageSize.width
256
- this.contentView.style.width = `${pageSize.width * this.transformSalce - 10}px`;
257
- this.contentView.style.height = `${(this.totalPageCount * (pageSize.height * (this.transformSalce) + this.PAGE_INTVERVAL)) + this.PAGE_INTVERVAL}px`;
258
- }
259
- this.contentView.style.margin = '0 auto 0'
260
- this.contentView.style.position = 'relative'
261
- this.contentView.style.paddingBottom = '60px'
262
- // contentView.style.overflowY = 'auto'
263
- this.$refs.pdfView.appendChild(this.contentView);
264
- if (this.textWatermarkStr){
265
- newInitWaterMark('pdf_container_view',this.textWatermarkStr)
266
- }
267
- }
268
- this.renderPages(pageIndex)
269
- },
270
- // 渲染需要展示的页面,不需展示的页码将其清除
271
- renderPages (pageIndex) {
272
- const pagesToRender = this.getRenderScope(pageIndex);
273
- for (const i of this.pages) {
274
- if (pagesToRender.some(p => { return p.pageNo == i.pageNo })) {
275
- if (i.loadStatus === true) {
276
- this.renderPageContent(i, i.pageNo)
277
- } else {
278
- this.renderPageLoading(i, i.pageNo)
279
- }
280
- } else {
281
- this.clearPage(i);
282
- }
283
- }
284
-
285
- },
286
- async renderPageContent (page, pageIndex) {
287
- const { pdfPage, pageNo, dom } = page;
288
- // dom 元素已存在,无须重新渲染,直接返回
289
- if ((dom && dom.children.length != 0) || page.loading) {
290
- return;
291
- }
292
- page.loading = true
293
- const viewport = pdfPage.getViewport({
294
- scale: this.scale,
295
- rotation: this.rotation,
296
- });
297
- // 创建新的canvas
298
- const canvas = document.createElement('canvas');
299
- const context = canvas.getContext('2d');
300
- // canvas.getContext('2d');
301
- canvas.height = this.pageSize.height;
302
- canvas.width = this.pageSize.width;
303
- canvas.style.position = 'relative'
304
- canvas.style.top = -3 + 'px'
305
- // 创建渲染的dom
306
- const pageDom = document.createElement('div');
307
- pageDom.style.position = 'absolute';
308
- pageDom.style.top = `${((pageNo - 1) * (this.pageSize.height + this.PAGE_INTVERVAL)) + this.PAGE_INTVERVAL}px`;
309
- pageDom.style.width = `${this.pageSize.width}px`;
310
- pageDom.style.height = `${this.pageSize.height}px`;
311
- pageDom.setAttribute('data-id', 'page' + pageNo)
312
- pageDom.appendChild(canvas);
313
- // 渲染内容
314
- let renderContext = {
315
- canvasContext: context,
316
- viewport: viewport,
317
- }
318
- await pdfPage.render(renderContext).promise.then(() => {
319
- return pdfPage.getTextContent()
320
- }).then(async (textContent) => {
321
- const textLayerDiv = document.createElement('div');
322
- textLayerDiv.setAttribute('class', 'textLayer');
323
- // 将文本图层div添加至每页pdf的div
324
- // 创建新的TextLayerBuilder实例
325
- let textLayer = new TextLayerBuilder({
326
- textLayerDiv: textLayerDiv,
327
- pageIndex: pdfPage._pageIndex,
328
- viewport: viewport,
329
- });
330
- let findPage = this.currentPageAllLine.find(l => { return l.page == pageIndex })
331
- let rectdomTop = 0
332
- if (findPage) {
333
- let AllLines = findPage.allLines
334
- // setTimeout(() => {
335
- if (AllLines.length > 0) {
336
- for (let j = 0; j < AllLines.length; j++) {
337
- let lines = AllLines[j].lines
338
- let rectdom = document.createElement('div')
339
- rectdom.setAttribute('react-count', AllLines[j].pageCount);
340
- rectdom.style.position = 'absolute';
341
- rectdom.style.top = 0
342
- rectdom.style.left = 0
343
- rectdom.classList.add('rectdom')
344
- for (let index = 0; index < lines.length; index++) {
345
- if (!/^\s+$/g.test(lines[index].content)) {
346
- let postionArr = lines[index].location
347
- let div = document.createElement('div')
348
- div.style.position = 'absolute';
349
- div.style.left = postionArr[0] * this.scale + 'px',
350
- // 后端返回的坐标有基线对齐的问题,top 值是后端算好(基线top - 文字高度),在此加上文字高度的 1/9 (大致比例)为实际展示出文字的top值
351
- div.style.top = postionArr[1] * this.scale + 'px'
352
- div.style.height = postionArr[3] * this.scale + 'px';
353
- div.style.width = postionArr[2] * this.scale + 'px'
354
- div.style.backgroundColor = 'rgba(54, 106, 255, 0.3)'
355
- div.classList.add('lineHeight')
356
- rectdom.appendChild(div)
357
- if (index == 0 && j == 0) {
358
- if (this.transformSalce !== null) {
359
- rectdomTop = postionArr[1] * this.scale * this.transformSalce
360
- } else {
361
- rectdomTop = postionArr[1] * this.scale
362
- }
363
- // if(this.isPC) {
364
- // rectdomTop = rectdomTop - 50 < 0 ? 0 : rectdomTop - 50
365
- // }
366
- }
367
- }
368
- }
369
- if (rectdom.children.length > 0) {
370
- pageDom.appendChild(rectdom)
371
- }
372
- }
373
- }
374
- }
375
- textLayer.setTextContent(textContent);
376
- textLayer.render()
377
- pageDom.appendChild(textLayerDiv);
378
-
379
- let backgroundDom = document.getElementById('backgroundLoad' + pageNo)
380
- if (backgroundDom) {
381
- this.contentView.removeChild(backgroundDom);
382
- }
383
- page.dom = await pageDom;
384
- page.loading = false
385
- this.contentView.appendChild(pageDom);
386
- let pdf_view = document.getElementsByClassName('pdf_view');
387
- if (pdf_view && pdf_view[0]){
388
- pdf_view[0].style.backgroundImage = 'none'
389
- }
390
- if (this.transformSalce !== null) {
391
- this.contentView.style.transform = `scale(${this.transformSalce}, ${this.transformSalce})`
392
- }
393
- if (this.changetoolbar) {
394
- setTimeout(() => {
395
- this.renderHighlights()
396
- this.changetoolbar = false
397
- }, 500)
398
- }
399
- if (this.fisrtLoad) {
400
- setTimeout(() => {
401
- let pageoffsetHeight = 0
402
- if (this.transformSalce !== null) {
403
- pageoffsetHeight = (this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce
404
- } else {
405
- pageoffsetHeight = (this.pageSize.height + this.PAGE_INTVERVAL)
406
- }
407
- if (this.$refs.pdfView.clientHeight - pageoffsetHeight > 0 && pageIndex == 1) {
408
- const height = this.$refs.pdfView.clientHeight;
409
- let startNum = 0
410
- let endNum = 0
411
- if (this.transformSalce !== null) {
412
- startNum = Math.ceil(this.$refs.pdfView.scrollTop / ((this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce))
413
- endNum = startNum + Math.ceil(height / ((this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce))
414
- } else {
415
- startNum = Math.ceil(this.$refs.pdfView.scrollTop / (this.pageSize.height + this.PAGE_INTVERVAL))
416
- endNum = startNum + Math.ceil(height / (this.pageSize.height + this.PAGE_INTVERVAL))
417
-
418
- }
419
- for (let pageIndex = startNum; pageIndex <= endNum; pageIndex++) {
420
- if (pageIndex > 0 && pageIndex <= this.pages.length) {
421
- this.loadPdfData(pageIndex)
422
- }
423
- }
424
- }
425
- if (this.$refs.pdfView.scrollTop == Math.floor((pageNo - 1) * pageoffsetHeight)) {
426
- this.$refs.pdfView.scrollTop = rectdomTop
427
- this.fisrtLoad = false
428
- } else {
429
- this.$refs.pdfView.scrollTop = `${((pageNo - 1) * pageoffsetHeight) + rectdomTop - this.PAGE_INTVERVAL}`
430
- this.fisrtLoad = false
431
- }
432
- this.renderHighlights()
433
- // zoomElement(this.contentView)
434
- }, 100)
435
- }
436
- })
437
- },
438
- // 监听容器的滚动事件,触发 scrollPdf 方法
439
- // 这里加了防抖保证不会一次产生过多请求
440
- debounceScrollPdf: _.debounce(function (e, that) {
441
- if (this.fisrtLoad) {
442
- this.fisrtLoad = false
443
- return
444
- }
445
- const scrollTop = e.target.scrollTop;
446
- const height = e.target.clientHeight;
447
- let startNum = 0
448
- let endNum = 0
449
- if (this.transformSalce !== null) {
450
- startNum = Math.ceil(scrollTop / ((that.pageSize.height + that.PAGE_INTVERVAL) * this.transformSalce))
451
- endNum = startNum + Math.ceil(height / ((that.pageSize.height + that.PAGE_INTVERVAL) * this.transformSalce))
452
- } else {
453
- startNum = Math.ceil(scrollTop / (that.pageSize.height + that.PAGE_INTVERVAL))
454
- endNum = startNum + Math.ceil(height / (that.pageSize.height + that.PAGE_INTVERVAL))
455
- }
456
- for (let pageIndex = startNum; pageIndex <= endNum; pageIndex++) {
457
- if (pageIndex > 0 && pageIndex <= that.pages.length) {
458
- that.loadPdfData(pageIndex)
459
- }
460
- }
461
- }, 200),
462
- directScrolling (e, that) {
463
- if (this.fisrtLoad) {
464
- this.fisrtLoad = false
465
- return
466
- }
467
- const scrollTop = e.target.scrollTop;
468
- const height = e.target.clientHeight;
469
- // 根据内容可视区域中心点计算页码, 没有滚动时,指向第一页
470
- const pageIndex = scrollTop > 0 ?
471
- Math.ceil((scrollTop + (height / 2)) / (that.pageSize.height + that.PAGE_INTVERVAL)) :
472
- 1;
473
- this.loadPdfData(pageIndex)
474
- },
475
- pdfScroll (e) {
476
- if (this.preViewType !== 'pdf' || this.isTouchMoved) {
477
- return
478
- }
479
- if (this.scrollLeft != e.target.scrollLeft) {
480
- this.scrollLeft = e.target.scrollLeft
481
- }
482
- if (this.scrollTop != e.target.scrollTop) {
483
- this.scrollTop = e.target.scrollTop
484
- this.debounceScrollPdf(e, this)
485
- }
486
- },
487
- // 分片每次只做一次处理,所以不考虑多片情况
488
- loadBefore (pageIndex) {
489
- this.loadPdfData(pageIndex)
490
- },
491
- loadAfter (pageIndex) {
492
- this.loadPdfData(pageIndex)
493
- },
494
- // 首先我们获取到需要渲染的范围
495
- // 根据当前的可视范围内的页码,我们前后只保留 8 页
496
- getRenderScope (pageIndex) {
497
- const pagesToRender = [];
498
- let i = pageIndex - 1;
499
- let j = pageIndex + 1;
500
- // pageIndex - 1 表示当前页码数 对应的下标位置
501
- pagesToRender.push(this.pages[pageIndex - 1]);
502
- while (pagesToRender.length < 8 && pagesToRender.length < this.pages.length) {
503
- if (i > 0) {
504
- pagesToRender.push(this.pages[i - 1]);
505
- i -= 1;
506
- }
507
- if (pagesToRender.length >= 8) {
508
- break;
509
- }
510
- if (j <= this.pages.length) {
511
- pagesToRender.push(this.pages[j - 1]);
512
- j += 1;
513
- }
514
- }
515
- // for (let index = 0; index < array.length; index++) {
516
- // const element = array[index];
517
-
518
- // }
519
- return pagesToRender;
520
- },
521
-
522
- // 清除页面 dom
523
- clearPage (page) {
524
- if (this.contentView.contains(page.dom) && page.dom) {
525
- this.contentView.removeChild(page.dom);
526
- page.loadStatus = false
527
- page.loading = false
528
- page.dom = undefined;
529
- }
530
- },
531
- // 页面正在下载时渲染loading视图
532
- renderPageLoading (page) {
533
- const { pageNo, dom } = page;
534
- if (dom && dom.children.length != 0) {
535
- return;
536
- }
537
- let backgroundDom = document.getElementById('backgroundLoad' + pageNo)
538
- if (this.contentView.contains(backgroundDom)) {
539
- return
540
- }
541
- const pageDom = document.createElement('div');
542
- pageDom.style.width = `${this.pageSize.width}px`;
543
- pageDom.style.height = `${this.pageSize.height}px`;
544
- pageDom.style.position = 'absolute';
545
- pageDom.style.top = `${((pageNo - 1) * (this.pageSize.height + this.PAGE_INTVERVAL)) + this.PAGE_INTVERVAL
546
- }px`;
547
- pageDom.style.backgroundImage = `url('https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif')`
548
- pageDom.style.backgroundPosition = 'center'
549
- pageDom.style.backgroundRepeat = 'no-repeat'
550
- pageDom.style.backgroundColor = '#FFF'
551
- pageDom.setAttribute('id', 'backgroundLoad' + pageNo)
552
- page.dom = pageDom;
553
- this.contentView.appendChild(pageDom);
554
- },
555
- prev () {
556
- this.currentPage--
557
- if (this.currentPage < 0) {
558
- this.currentPage = 0
559
- if (!this.isPC) {
560
- this.$toast({
561
- message: '当前已经是第一段了',
562
- duration: 2000,
563
- })
564
- return
565
- }
566
- }
567
- if (this.preViewType == 'pdf') {
568
- this.scrollToUplaodePage(this.currentPage)
569
- } else {
570
- this.scrollToExcalTop(this.currentPage)
571
- }
572
- // this.getpdfResloutePage(this.cachePdf[this.currentPage - 1])
573
- },
574
- next () {
575
- this.currentPage++
576
- if (this.currentPage >= this.tagIds.length) {
577
- this.currentPage = this.tagIds.length - 1
578
- if (!this.isPC) {
579
- this.$toast({
580
- message: '当前已经是最后一段了',
581
- duration: 2000,
582
- })
583
- return
584
- }
585
- }
586
- if (this.preViewType == 'pdf') {
587
- this.scrollToUplaodePage(this.currentPage)
588
- } else {
589
- this.scrollToExcalTop(this.currentPage)
590
- }
591
- },
592
- currentChange (value) {
593
- this.currentPage = value - 1
594
- if (this.preViewType == 'pdf') {
595
- this.scrollToUplaodePage(this.currentPage)
596
- } else {
597
- this.scrollToExcalTop(this.currentPage)
598
- }
599
- },
600
- scrollToUplaodePage (currentPage) {
601
- this.changetoolbar = true
602
- if (this.preViewType !== 'pdf') {
603
- return
604
- }
605
-
606
- let pdfResloute = this.cachePdf[currentPage]
607
- this.identifyTextPostion.extractInfo = pdfResloute.extractInfo
608
- this.identifyTextPostion.left = pdfResloute.extractInfo.location[0]
609
- this.identifyTextPostion.top = pdfResloute.extractInfo.location[1]
610
- this.identifyTextPostion.width = pdfResloute.extractInfo.location[2]
611
- this.identifyTextPostion.height = pdfResloute.extractInfo.location[3]
612
- this.identifyTextPostion.page = pdfResloute.page
613
- this.identifyTextPostion.pageHeight = pdfResloute.pageHeight
614
- this.identifyTextPostion.pageWidth = pdfResloute.pageWidth
615
- // 在当前段落在最后一页pdf时,根据计算的高度并不能触发滚动,在此执行重新渲染方法,非次情况会执行两次,待优化
616
- this.$nextTick(() => {
617
- this.renderHighlights()
618
- })
619
- if (this.transformSalce !== null) {
620
- this.$refs.pdfView.scrollTop = `${((pdfResloute.page - 1) * (this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce) + (this.identifyTextPostion.top * this.scale * this.transformSalce)}`
621
- } else {
622
- this.$refs.pdfView.scrollTop = `${((pdfResloute.page - 1) * (this.pageSize.height + this.PAGE_INTVERVAL)) + (this.identifyTextPostion.top * this.scale * this.transformSalce)}`
623
- }
624
- },
625
- scrollToExcalTop (currentPage) {
626
- for (let index = 0; index < this.allTr.length; index++) {
627
- if (index == currentPage) {
628
- Array.from(this.allTr[index].children).forEach(item => {
629
- item.style.background = 'rgba(255, 136, 0, 0.6)'
630
- item.classList.add('animation')
631
- setTimeout(() => {
632
- item.classList.remove('animation')
633
- }, 4000)
634
- })
635
- // getBoundingClientRect().top 当前元素距离屏幕顶部的高度 + 弹窗header 高度
636
- if (!this.isPC) {
637
- let top = this.allTr[index].getBoundingClientRect().top - this.$refs.pdfView.getBoundingClientRect().top
638
- this.$refs.pdfView.scrollTop = top
639
- } else {
640
- let top = this.allTr[index].getBoundingClientRect().top
641
- this.$refs.pdfView.scrollTop = top - 50
642
- }
643
- } else {
644
- Array.from(this.allTr[index].children).forEach(item => {
645
- item.style.background = 'rgba(54, 106, 255, 0.6)'
646
- item.classList.remove('animation')
647
- })
648
- }
649
- }
650
- },
651
- // pdf是否需要重新渲染高亮位置
652
- renderHighlights () {
653
- let lineHeightDom = Array.from(document.getElementsByClassName('rectdom'))
654
- if (lineHeightDom) {
655
- lineHeightDom.forEach((d) => {
656
- for (let i = 0; i < d.children.length; i++) {
657
- if (d.getAttribute('react-count') == this.currentPage) {
658
- d.children[i].style.backgroundColor = 'rgba(255, 136, 0, 0.3)'
659
- d.children[i].classList.add('animation')
660
- setTimeout(() => {
661
- d.children[i].classList.remove('animation')
662
- }, 4000)
663
- } else {
664
- d.children[i].style.backgroundColor = 'rgba(54, 106, 255, 0.3)'
665
- d.children[i].classList.remove('animation')
666
- }
667
- }
668
- })
669
- }
670
- },
671
- displayHiglight (pageIndex) {
672
- let lineHeightDom = Array.from(document.getElementsByClassName('rectdom'))
673
- if (lineHeightDom) {
674
- lineHeightDom.forEach((d) => {
675
- if (d.getAttribute('page-index') == pageIndex) {
676
- d.style.display = 'none'
677
- }
678
- })
679
- }
680
- },
681
- // 前端暂时缓存多页
682
- autoLoadMore (pageIndex) {
683
- let pdfResloute = this.cachePdf.find(cache => {
684
- return cache.page == pageIndex
685
- })
686
- if (pdfResloute) {
687
- this.getpdfResloutePage(pdfResloute)
688
- } else {
689
- this.loadPdfData(pageIndex)
690
- }
691
- },
692
- setPageAllLine (arr) {
693
- this.currentPageAllLine = []
694
- arr.forEach((item, index) => {
695
- let i = this.currentPageAllLine.findIndex(l => { return l.page && l.page == item.page })
696
- if (i != -1) {
697
- // this.currentPageAllLine[i].allLines.lines.push(item.extractInfo.lines)
698
- this.currentPageAllLine[i].allLines.push({
699
- pageCount: index,
700
- lines: item.extractInfo.lines
701
- })
702
- } else {
703
- this.currentPageAllLine.push({
704
- page: item.page,
705
- allLines: [{
706
- pageCount: index,
707
- lines: item.extractInfo.lines
708
- }],
709
- })
710
- }
711
- })
712
- },
713
- openTouch () {
714
- // this.$nextTick()将回调延迟到下次 DOM 更新循环之后执行
715
- let that = this;
716
- this.$nextTick(() => {
717
- // setInterval(() => {
718
- // this.scale = this.scale + 0.1
719
- // that.pages.forEach((item, index) =>{
720
- // if(item.dom) {
721
- // item.dom.children.forEach( childDom =>{
722
- // if(childDom.getAttribute('react-count')) {
723
- // childDom.style.transform = "scale(" + this.scale + ")";
724
- // childDom.style.transformOrigin = "0px 0px 0px";
725
- // } else {
726
- // item.dom = null
727
- // this.startRenderPages(item.pdfPage, null, index)
728
- // }
729
- // } )
730
- // }
731
- // })
732
- // }, 100);
733
- // 获取放大或缩小的区域DOM
734
- let matrix_box = this.contentView
735
- matrix_box.addEventListener("touchstart", function (event) {
736
- this.isTouchMoved = true
737
- let touches = event.touches;
738
- let events = touches[0];
739
- let events2 = touches[1];
740
-
741
- // event.preventDefault();
742
-
743
- // 第一个触摸点的坐标
744
- that.displacement.pageX = events.pageX;
745
- that.displacement.pageY = events.pageY;
746
-
747
- that.displacement.moveable = true;
748
-
749
- if (events2) {
750
- that.displacement.pageX2 = events2.pageX;
751
- that.displacement.pageY2 = events2.pageY;
752
- }
753
-
754
- that.displacement.originScale = this.scale || 1;
755
- });
756
- document.addEventListener("touchmove", function (event) {
757
- if (!that.displacement.moveable) {
758
- return;
759
- }
760
- // event.preventDefault();
761
- let touches = event.touches;
762
- let events = touches[0];
763
- let events2 = touches[1];
764
- // 双指移动
765
- if (events2) {
766
- // 第2个指头坐标在touchmove时候获取
767
- if (!that.displacement.pageX2) {
768
- that.displacement.pageX2 = events2.pageX;
769
- }
770
- if (!that.displacement.pageY2) {
771
- that.displacement.pageY2 = events2.pageY;
772
- }
773
- // 双指缩放比例计算
774
- let zoom = that.getDistance({
775
- x: events.pageX,
776
- y: events.pageY
777
- },
778
- {
779
- x: events2.pageX,
780
- y: events2.pageY
781
- }
782
- ) / that.getDistance(
783
- {
784
- x: that.displacement.pageX,
785
- y: that.displacement.pageY
786
- },
787
- {
788
- x: that.displacement.pageX2,
789
- y: that.displacement.pageY2
790
- }
791
- );
792
- // 应用在元素上的缩放比例
793
- let newScale = that.displacement.originScale * zoom;
794
- // 最大缩放比例限制
795
- if (newScale > 2) {
796
- newScale = 2;
797
- }
798
- // 最大缩放比例限制
799
- if (newScale < 1) {
800
- newScale = 1;
801
- }
802
- // 记住使用的缩放值
803
- that.displacement.scale = newScale;
804
- // console.log(newScale);
805
- matrix_box.style.transform = "scale(" + newScale + ")";
806
- // 设置旋转元素的基点位置
807
- matrix_box.style.transformOrigin = "0px 0px 0px";
808
- }
809
- }, { passive: false });
810
- document.addEventListener('touchend', function () {
811
- that.isTouchMoved = false
812
- }, { passive: false })
813
- });
814
- },
815
- getDistance (start, stop) {
816
- // Math.hypot()计算参数的平方根
817
- return Math.hypot(stop.x - start.x, stop.y - start.y);
818
- },
819
- setupCanvas (canvas, width, height) {
820
- const dpr = 1;
821
- // const rect = canvas.getBoundingClientRect();
822
- canvas.width = width
823
- canvas.height = height
824
- const ctx = canvas.getContext('2d');
825
- ctx?.scale(dpr, dpr);
826
- return ctx;
827
- },
828
- changeScale (value) {
829
- if (value == 'zoom') {
830
- this.handScale = 'auto'
831
- this.transformSalce = (this.transformSalce + 0.2).toFixed(1)
832
- } else if (value == 'reduce') {
833
- if ((this.transformSalce - 0.2).toFixed(1) <= 0) {
834
- return
835
- }
836
- this.handScale = 'auto'
837
- this.transformSalce = (this.transformSalce - 0.2).toFixed(1)
838
- } else if (value == 'auto') {
839
- this.transformSalce = this.$refs.pdfView.clientWidth / this.pageSize.width
840
- } else if (value == 'reality') {
841
- this.transformSalce = 0.5
842
- } else {
843
- this.transformSalce = (value / 2).toFixed(1)
844
- }
845
- this.transformSalce = Number(this.transformSalce)
846
- this.contentView.style.transform = 'scale(' + this.transformSalce + ')';
847
- // this.getpdfResloutePage(this.cachePdf[0])
848
- },
849
- //添加水印
850
- watermark() {
851
- //默认设置
852
- var defaultSettings = {
853
- watermark_txt:"",
854
- watermark_x: 0,//水印起始位置x轴坐标
855
- watermark_y: 0,//水印起始位置Y轴坐标
856
- watermark_rows: 0,//水印行数
857
- watermark_cols: 0,//水印列数
858
- watermark_x_space: 40,//水印x轴间隔
859
- watermark_y_space: 60,//水印y轴间隔
860
- watermark_color: 'black',//水印字体颜色
861
- watermark_alpha: .3,//水印透明度
862
- watermark_fontsize: 12,//水印字体大小
863
- watermark_font: '微软雅黑',//水印字体
864
- watermark_width: 100,//水印宽度
865
- watermark_height: 80,//水印长度
866
- watermark_angle: 20,//水印倾斜度数***
867
- visitorWatermark_txt:""
868
- };
869
- if(this.knowledgeItem.textWatermarkValue){
870
- defaultSettings.watermark_txt = this.knowledgeItem.textWatermarkValue;
871
- }
872
- if (this.knowledgeItem.visitorWatermarkValue){
873
- defaultSettings.visitorWatermark_txt = this.knowledgeItem.visitorWatermarkValue
874
- }
875
- //采用配置项替换默认值,作用类似jquery.extend
876
- if (arguments.length === 1 && typeof arguments[0] === "object") {
877
- console.log("arguments = " + JSON.stringify(arguments[0]));
878
- // 获取参数配置
879
- var src = arguments[0];
880
- for (let key in src) {
881
- if (src[key] && defaultSettings[key] && src[key] === defaultSettings[key])
882
- continue;
883
- else if (src[key])
884
- defaultSettings[key] = src[key];
885
- }
886
- }
887
- var oTemp = document.createDocumentFragment();
888
- //获取页面最大宽度
889
- console.debug('pdf_view',document.getElementById('pdf_view'))
890
- let scrollWidth = document.getElementById('pdf_view').scrollWidth;
891
- let clientWidth = document.getElementById('pdf_view').clientWidth;
892
- var page_width = Math.max(scrollWidth, clientWidth);
893
-
894
- var cutWidth = page_width * 0.0150;
895
-
896
- page_width = page_width - cutWidth;
897
-
898
- //获取页面最大高度
899
- let height = parseInt(this.totalPageCount * this.pageSize.height)
900
- var page_height = Math.max(document.getElementById('pdf_container_view').scrollHeight,height);
901
-
902
- console.debug('page_height',page_height,this.totalPageCount * this.pageSize.height);
903
-
904
- // var page_height = document.body.scrollHeight+document.body.scrollTop;
905
-
906
- //如果将水印列数设置为0,或水印列数设置过大,超过页面最大宽度,则重新计算水印列数和水印x轴间隔
907
-
908
- if (defaultSettings.watermark_cols == 0 || (parseInt(defaultSettings.watermark_x + defaultSettings
909
- .watermark_width * defaultSettings.watermark_cols + defaultSettings.watermark_x_space *
910
- (defaultSettings.watermark_cols - 1)) > page_width)) {
911
- defaultSettings.watermark_cols = parseInt((page_width - defaultSettings.watermark_x + defaultSettings
912
- .watermark_x_space) / (defaultSettings.watermark_width + defaultSettings
913
- .watermark_x_space));
914
- defaultSettings.watermark_x_space = parseInt((page_width - defaultSettings.watermark_x -
915
- defaultSettings
916
- .watermark_width * defaultSettings.watermark_cols) / (defaultSettings.watermark_cols - 1));
917
- }
918
-
919
- //如果将水印行数设置为0,或水印行数设置过大,超过页面最大长度,则重新计算水印行数和水印y轴间隔
920
-
921
- if (defaultSettings.watermark_rows == 0 || (parseInt(defaultSettings.watermark_y + defaultSettings
922
-
923
- .watermark_height * defaultSettings.watermark_rows + defaultSettings.watermark_y_space * (
924
-
925
- defaultSettings.watermark_rows - 1)) > page_height)) {
926
-
927
- defaultSettings.watermark_rows = parseInt((defaultSettings.watermark_y_space + page_height -
928
-
929
- defaultSettings
930
-
931
- .watermark_y) / (defaultSettings.watermark_height + defaultSettings.watermark_y_space));
932
-
933
- defaultSettings.watermark_y_space = parseInt(((page_height - defaultSettings.watermark_y) -
934
-
935
- defaultSettings
936
-
937
- .watermark_height * defaultSettings.watermark_rows) / (defaultSettings.watermark_rows - 1));
938
-
939
- }
940
-
941
- var x;
942
-
943
- var y;
944
-
945
- for (var i = 0; i < defaultSettings.watermark_rows; i++) {
946
- y = defaultSettings.watermark_y + (defaultSettings.watermark_y_space + defaultSettings.watermark_height) * i;
947
- for (var j = 0; j < defaultSettings.watermark_cols; j++) {
948
- x = defaultSettings.watermark_x + (defaultSettings.watermark_width + defaultSettings.watermark_x_space) * j;
949
-
950
- var mask_div = document.createElement('div');
951
- mask_div.id = 'mask_div' + i + j;
952
- mask_div.className = 'mask_div';
953
-
954
- //注意看这里加了图片水印
955
- mask_div.style.webkitTransform = "rotate(-" + defaultSettings.watermark_angle + "deg)";
956
- mask_div.style.MozTransform = "rotate(-" + defaultSettings.watermark_angle + "deg)";
957
- mask_div.style.msTransform = "rotate(-" + defaultSettings.watermark_angle + "deg)";
958
- mask_div.style.OTransform = "rotate(-" + defaultSettings.watermark_angle + "deg)";
959
- mask_div.style.transform = "rotate(-" + defaultSettings.watermark_angle + "deg)";
960
- mask_div.style.visibility = "";
961
- mask_div.style.position = "absolute";
962
- //奇偶行错开,这样水印就不对齐,显的不呆板
963
- console.debug('x',x)
964
- if (i % 2 != 0) {
965
- mask_div.style.left = x + 'px';
966
- if (j % 2 != 0 && this.knowledgeItem.visitorWatermarkValue){
967
- mask_div.appendChild(document.createTextNode(defaultSettings.visitorWatermark_txt));
968
- } else {
969
- if (!this.knowledgeItem.textWatermarkValue){
970
- mask_div.appendChild(document.createTextNode(defaultSettings.visitorWatermark_txt));
971
- } else {
972
- mask_div.appendChild(document.createTextNode(defaultSettings.watermark_txt));
973
- }
974
- }
975
- } else {
976
- mask_div.style.left = x + 'px';
977
- if (j % 2 != 0 && this.knowledgeItem.textWatermarkValue){
978
- mask_div.appendChild(document.createTextNode(defaultSettings.watermark_txt));
979
- } else {
980
- if (!this.knowledgeItem.visitorWatermarkValue){
981
- mask_div.appendChild(document.createTextNode(defaultSettings.watermark_txt));
982
- } else {
983
- mask_div.appendChild(document.createTextNode(defaultSettings.visitorWatermark_txt));
984
- }
985
- }
986
- }
987
-
988
- mask_div.style.top = y + 'px';
989
- mask_div.style.overflow = "hidden";
990
- mask_div.style.zIndex = "9999";
991
- mask_div.style.pointerEvents = 'none'; //让水印不遮挡页面的点击事件
992
- mask_div.style.opacity = defaultSettings.watermark_alpha;
993
- mask_div.style.fontSize = defaultSettings.watermark_fontsize;
994
- mask_div.style.fontFamily = defaultSettings.watermark_font;
995
- mask_div.style.color = defaultSettings.watermark_color;
996
- mask_div.style.textAlign = "center";
997
- mask_div.style.width = defaultSettings.watermark_width + 'px';
998
- mask_div.style.height = defaultSettings.watermark_height + 'px';
999
- mask_div.style.display = "block";
1000
- oTemp.appendChild(mask_div);
1001
- }
1002
- }
1003
- let pageDom = document.getElementById('pdf_container_view')
1004
- pageDom.appendChild(oTemp);
1005
-
1006
- },
1007
- },
1008
- computed: {
1009
- perviewUrl () {
1010
- return '/web/viewer.html?file=' + '/pdflist/pdf4split-1.pdf'
1011
- },
1012
- setHeight () {
1013
- if (this.tagIds.length > 1) {
1014
- if (this.isPC) {
1015
- return 'calc(100% - 110px)'
1016
- } else {
1017
- return 'calc(100% - 60px)'
1018
- }
1019
- } else {
1020
- if (this.isPC) {
1021
- return 'calc(100% - 50px)'
1022
- } else {
1023
- return '100%'
1024
- }
1025
- }
1026
- }
1027
- },
1028
- watch: {
1029
- tagIds: {
1030
- handler (value) {
1031
- if (value && value.length) {
1032
- // pdf_view 下创建 所有canvs的容器
1033
- this.contentView = document.createElement('div')
1034
- this.contentView.setAttribute('id','contentView')
1035
- this.contentView.style.transformOrigin = '0px 0px 0px'
1036
- this.contentView.setAttribute('id','contentView');
1037
-
1038
- this.$http.get('/knowledge-api/knowledge/knowledge-part-location-info/list?ids=' + value.join(',')).then(res => {
1039
- // 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}
1040
- // 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}
1041
- // 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}
1042
- // 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}
1043
- // 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}
1044
- // if(value.length === 1) {
1045
- // this.$refs.pdfView.style.height = 'calc(100% - 50px)'
1046
- // }
1047
- // res.data = {
1048
- // "data": [
1049
- // {
1050
- // "id": "64e746120372d778849d2e8e",
1051
- // "knowledgeId": "64e30035edffac0ec96a2d39",
1052
- // "mainId": "e0f6898c6b0d47fa98e8f71ceab1bde8",
1053
- // "page": 14,
1054
- // "total": 60,
1055
- // "pageHeight": 728.504,
1056
- // "pageWidth": 515.906,
1057
- // "publicPageFileUrl": "https://askbot-pdf-all.oss-cn-zhangjiakou.aliyuncs.com/e0f6898c6b0d47fa98e8f71ceab1bde8/2023/08/21/02/12/07/64e300378c3dfb3bc434f51a/15.pdf",
1058
- // "extractInfo": {
1059
- // "location": [
1060
- // 52.665375,
1061
- // 312.01306,
1062
- // 404.98618,
1063
- // 142.5199
1064
- // ],
1065
- // "content": null,
1066
- // "lines": [
1067
- // {
1068
- // "content": null,
1069
- // "location": [
1070
- // 52.665375,
1071
- // 312.01306,
1072
- // 404.98618,
1073
- // 142.5199
1074
- // ]
1075
- // }
1076
- // ],
1077
- // "tagId": null
1078
- // },
1079
- // "block": {
1080
- // "type": "TEXT",
1081
- // "location": [
1082
- // 52.665375,
1083
- // 312.01306,
1084
- // 404.98618,
1085
- // 142.5199
1086
- // ],
1087
- // "color": "#366AFF",
1088
- // "flowChart": {
1089
- // "content": ""
1090
- // },
1091
- // "image": {
1092
- // "url": null,
1093
- // "desc": ""
1094
- // },
1095
- // "table": {
1096
- // "title": null,
1097
- // "table": null
1098
- // },
1099
- // "text": {
1100
- // "originText": "① 头部防护:安全帽\n佩戴要求:\n①存在坠物或对头部产生碰撞风险的作业场所需要佩戴安全帽 ;\n②安全帽必须戴正、戴牢、不能晃动,要系紧下颏带,调节好后箍以\n防安全帽脱落 ;\n③受强力撞击及超过有效期的安全帽必须更换。",
1101
- // "indexText": "① 头部防护:安全帽\n佩戴要求:\n①存在坠物或对头部产生碰撞风险的作业场所需要佩戴安全帽 ;\n②安全帽必须戴正、戴牢、不能晃动,要系紧下颏带,调节好后箍以\n防安全帽脱落 ;\n③受强力撞击及超过有效期的安全帽必须更换。",
1102
- // "lines": [
1103
- // {
1104
- // "location": [
1105
- // 69.08148,
1106
- // 368.92072,
1107
- // 65.90851,
1108
- // 10.5
1109
- // ]
1110
- // },
1111
- // {
1112
- // "location": [
1113
- // 86.290985,
1114
- // 384.67072,
1115
- // 31.5,
1116
- // 10.5
1117
- // ]
1118
- // },
1119
- // {
1120
- // "location": [
1121
- // 286.2992,
1122
- // 315.73584,
1123
- // 37.656006,
1124
- // 12.0
1125
- // ]
1126
- // },
1127
- // {
1128
- // "location": [
1129
- // 324.6939,
1130
- // 316.79932,
1131
- // 122.74487,
1132
- // 10.5
1133
- // ]
1134
- // },
1135
- // {
1136
- // "location": [
1137
- // 286.2954,
1138
- // 336.0458,
1139
- // 149.625,
1140
- // 10.5
1141
- // ]
1142
- // },
1143
- // {
1144
- // "location": [
1145
- // 286.2954,
1146
- // 356.0483,
1147
- // 161.15405,
1148
- // 10.5
1149
- // ]
1150
- // },
1151
- // {
1152
- // "location": [
1153
- // 286.2954,
1154
- // 376.0508,
1155
- // 161.15405,
1156
- // 10.5
1157
- // ]
1158
- // },
1159
- // {
1160
- // "location": [
1161
- // 286.2954,
1162
- // 396.0533,
1163
- // 76.125,
1164
- // 10.5
1165
- // ]
1166
- // },
1167
- // {
1168
- // "location": [
1169
- // 286.2954,
1170
- // 416.05582,
1171
- // 161.17517,
1172
- // 10.5
1173
- // ]
1174
- // },
1175
- // {
1176
- // "location": [
1177
- // 286.2954,
1178
- // 436.8038,
1179
- // 52.5,
1180
- // 10.5
1181
- // ]
1182
- // },
1183
- // {
1184
- // "location": [
1185
- // 338.7992,
1186
- // 435.73584,
1187
- // 12.0,
1188
- // 12.0
1189
- // ]
1190
- // }
1191
- // ]
1192
- // }
1193
- // }
1194
- // }
1195
- // ],
1196
- // "code": "0",
1197
- // "msg": null,
1198
- // "traceId": null
1199
- // }
1200
- if (res.data.code == 0) {
1201
- // tagIds 会按照gpt识别的生成有序的数组,前端直接按照下标的顺序取就可以了
1202
- // 缓存拿到的所有数据
1203
- this.cachePdf = res.data.data
1204
- let publicPageFileUrl = res.data.data && res.data.data[0] ? res.data.data[0].publicPageFileUrl : ''
1205
- this.currentPage = 0
1206
- if (publicPageFileUrl && publicPageFileUrl.substring(publicPageFileUrl.lastIndexOf('.')) === '.pdf') {
1207
- this.preViewType = 'pdf'
1208
- this.setPageAllLine(this.cachePdf)
1209
- this.getpdfResloutePage(res.data.data[0])
1210
- } else {
1211
- this.preViewType = 'excal'
1212
- this.$http.post(
1213
- '/knowledge-api/temporary-certificate/or-origin?expired=30',
1214
- publicPageFileUrl,
1215
- {
1216
- headers: {
1217
- "Content-Type": "application/json",
1218
- },
1219
- }).then(res => {
1220
- // 使用原声请求方式 axios会带有不需要的请求头
1221
- let xhr = new XMLHttpRequest();
1222
- xhr.open('GET', res.data || res.bodyText, true);
1223
- // 定义请求完成的处理函数,请求前也可以增加加载框/禁用下载按钮逻辑
1224
- xhr.onload = ({ currentTarget }) => {
1225
- // 请求完成
1226
- if (currentTarget.status === 200) { // 返回200
1227
- let pdf_view = document.getElementsByClassName('pdf_view');
1228
- if (pdf_view && pdf_view[0]){
1229
- pdf_view[0].style.backgroundImage = 'none'
1230
- }
1231
- this.contentView.innerHTML = currentTarget.response
1232
- this.contentView.style.padding = '10px'
1233
- // this.contentView.style.position = 'relative'
1234
- this.$refs.pdfView.style.backgroundColor = '#FFFFFF'
1235
- this.$refs.pdfView.appendChild(this.contentView)
1236
-
1237
- let allTr = Array.from(this.$refs.pdfView.getElementsByTagName('tr'))
1238
- this.allTr = []
1239
- for (let index = 0; index < allTr.length; index++) {
1240
- if (value.includes(allTr[index].getAttribute('tag-id'))) {
1241
- this.allTr.push(allTr[index])
1242
- }
1243
- }
1244
- this.currentChange(1)
1245
-
1246
- }
1247
- }
1248
- xhr.send();
1249
- })
1250
- }
1251
- } else {
1252
- let div = document.createElement('div')
1253
- div.innerText = '文件加载异常'
1254
- this.contentView.appendChild(div)
1255
- this.$refs.pdfView.appendChild(this.contentView)
1256
- }
1257
- })
1258
- }
1259
- },
1260
- deep: true,
1261
- immediate: true
1262
- }
1263
- },
1264
- mounted () {
1265
- if (/(iPhone|iPad|iPod|iOS|Android)/i.test(navigator.userAgent)) {
1266
- this.isPC = false
1267
- } else {
1268
- this.isPC = true
1269
- }
1270
- }
1271
- }
1272
- </script>
1273
-
1274
- <style lang="less" scoped>
1275
- .pdf_view {
1276
- width: 100%;
1277
- // height: calc(100% - 110px);
1278
- height: 100%;
1279
- overflow: auto;
1280
- //overflow-y: scroll;
1281
- background-color: #f5f7fb;
1282
- // margin-bottom: 60px;
1283
- box-sizing: border-box;
1284
- // position: relative;
1285
- // > div {
1286
- // width: 100%;
1287
- // height: 100%;
1288
- // overflow: hidden;
1289
- // overflow-y: auto;
1290
- // position: relative;
1291
- // }
1292
- >iframe {
1293
- width: 100%;
1294
- height: 100%;
1295
- }
1296
-
1297
- a:link {
1298
- color: none;
1299
- }
1300
-
1301
- a:visited {
1302
- color: none;
1303
- }
1304
-
1305
- a:hover {
1306
- color: none;
1307
- }
1308
-
1309
- a:active {
1310
- color: none;
1311
- }
1312
- .btn_footer {
1313
- width: 100%;
1314
- height: 60px;
1315
- display: flex;
1316
- align-items: center;
1317
- justify-content: space-around;
1318
- position: absolute;
1319
- bottom: 0px;
1320
- left: 0;
1321
- z-index: 999;
1322
- background: #ffffff;
1323
-
1324
- .prev,
1325
- .next {
1326
- width: 35%;
1327
- height: 40px;
1328
- display: flex;
1329
- align-items: center;
1330
- justify-content: center;
1331
- border-radius: 50px;
1332
- cursor: pointer;
1333
- }
1334
-
1335
- .prev {
1336
- background: #F2F5FA;
1337
- color: #000;
1338
- }
1339
-
1340
- .next {
1341
- background: #366aff;
1342
- color: #ffffff;
1343
- }
1344
- }
1345
-
1346
- #pagination {
1347
- .total-class {
1348
- margin-right: 13px;
1349
- font-weight: 400;
1350
- }
1351
-
1352
- position: absolute;
1353
- bottom: 0px;
1354
- right: 0;
1355
- width: 100%;
1356
- display: flex;
1357
- align-items: center;
1358
- justify-content: center;
1359
- height: 50px;
1360
- background-color: white;
1361
- box-shadow: 0px 0px 18px 0px rgba(29, 55, 129, 0.07);
1362
- border-radius: 5px;
1363
- z-index: 1000;
1364
-
1365
-
1366
-
1367
- /deep/.el-pagination {
1368
- margin-right: 110px;
1369
- }
1370
-
1371
- /deep/.el-pager {
1372
- background: #EDF0F6;
1373
- border-radius: 15px;
1374
- }
1375
-
1376
- /deep/.el-pagination.is-background .btn-next {
1377
- width: 30px;
1378
- height: 30px;
1379
- background: #EDF0F6;
1380
- border-radius: 50%;
1381
- }
1382
-
1383
- /deep/.el-pagination .btn-next {
1384
- width: 30px;
1385
- height: 30px;
1386
- background: #EDF0F6;
1387
- border-radius: 50%;
1388
- padding-left: 0;
1389
- margin-left: 5px;
1390
- }
1391
-
1392
- /deep/.el-pagination .btn-prev {
1393
- width: 30px;
1394
- height: 30px;
1395
- background: #EDF0F6;
1396
- border-radius: 50%;
1397
- padding-right: 0;
1398
- margin-right: 5px;
1399
- }
1400
-
1401
- /deep/.el-pagination button {
1402
- padding: 0;
1403
- min-width: 30px;
1404
- }
1405
-
1406
- /deep/.el-pager li {
1407
- background: #EDF0F6;
1408
- height: 30px;
1409
- min-width: 30px;
1410
- line-height: 30px;
1411
- font-size: 12px;
1412
- color: #717b90;
1413
- }
1414
-
1415
- /deep/.el-pager li:first-child {
1416
- border-bottom-left-radius: 15px !important;
1417
- border-top-left-radius: 15px !important;
1418
- }
1419
-
1420
- /deep/.el-pager li:last-child {
1421
- border-top-right-radius: 15px !important;
1422
- border-bottom-right-radius: 15px !important;
1423
- }
1424
-
1425
- /deep/.el-pager li.active {
1426
- width: 30px;
1427
- height: 30px;
1428
- min-width: 30px;
1429
- background: #366AFF;
1430
- border: 3px solid #A1B9FF;
1431
- border-radius: 50%;
1432
- line-height: 24px;
1433
- color: white;
1434
- }
1435
-
1436
- /deep/.el-pagination.is-background .el-pager li:not(.disabled).active {
1437
- background: #366AFF;
1438
- }
1439
- }
1440
-
1441
- .change_scale {
1442
- width: 100%;
1443
- height: 50px;
1444
- position: absolute;
1445
- top: 50px;
1446
- left: 0;
1447
- background: #ffffff;
1448
- display: flex;
1449
- align-items: center;
1450
- padding: 0 10px;
1451
- box-sizing: border-box;
1452
-
1453
- section {
1454
- cursor: pointer;
1455
- width: 30px;
1456
- height: 30px;
1457
- margin-right: 5px;
1458
- border-radius: 5px;
1459
- display: flex;
1460
- align-items: center;
1461
- justify-content: center;
1462
-
1463
- i {
1464
- font-weight: 900;
1465
- }
1466
- }
1467
-
1468
- section:hover {
1469
- background: rgba(221, 222, 223, 1);
1470
- }
1471
- }
1472
- .pdf_container_view{
1473
- height: 100%;
1474
- width: 100%;
1475
- position: relative;
1476
- overflow: auto;
1477
- }
1478
- }
1479
- </style>
1480
- <style lang="less">
1481
- .animation {
1482
- animation-name: highlight;
1483
- animation-duration: 4s;
1484
- }
1485
-
1486
- @keyframes highlight {
1487
- 0% {
1488
- background: rgba(255, 136, 0, 0.3);
1489
- }
1490
-
1491
- 25% {
1492
- background: rgba(255, 136, 0, 0.6);
1493
- }
1494
-
1495
- 50% {
1496
- background: rgba(255, 136, 0, 0.3);
1497
- }
1498
-
1499
- 75% {
1500
- background: rgba(255, 136, 0, 0.6);
1501
- }
1502
-
1503
- 100% {
1504
- background: rgba(255, 136, 0, 0.3);
1505
- }
1506
- }</style>
1
+ <template>
2
+ <div class="pdf_view" id="pdf_view">
3
+ <div class="change_scale" v-if="isPC">
4
+ <section @click="changeScale('reduce')">
5
+ <i class="el-icon-minus"></i>
6
+ </section>
7
+ <el-divider direction="vertical"></el-divider>
8
+ <section @click="changeScale('zoom')">
9
+ <i class="el-icon-plus"></i>
10
+ </section>
11
+ <el-select size="small" v-model="handScale" @change="changeScale" :placeholder="$t('dragonCommon.selectScale')">
12
+ <el-option v-for="item in scaleList" :key="item.value" :label="item.label" :value="item.value">
13
+ </el-option>
14
+ </el-select>
15
+ </div>
16
+ <div class="pdf_container_view" id="pdf_container_view" @scroll="pdfScroll" ref="pdfView"></div>
17
+ <div class="btn_footer" v-if="tagIds.length > 1 && !isPC">
18
+ <div class="prev" @click="prev">{{ $t('dragonCommon.previous') }}</div>
19
+ <div class="next" @click="next">{{ $t('dragonCommon.next') }}</div>
20
+ </div>
21
+ <div id="pagination" v-if="tagIds.length > 1 && isPC">
22
+ <el-pagination
23
+ :current-page="currentPage + 1"
24
+ @current-change="currentChange"
25
+ @prev-click="prev"
26
+ @next-click="next"
27
+ layout="slot, prev, pager, next"
28
+ :page-size="1"
29
+ :total="tagIds.length"
30
+ >
31
+ <span class="total-class">{{ $t('dragonCommon.answersGeneratedByPre') }}{{tagIds.length}}{{ $t('dragonCommon.answersGeneratedByAfter') }}</span>
32
+ </el-pagination>
33
+ </div>
34
+ </div>
35
+ </template>
36
+ <script>
37
+ // :style="{
38
+ // marginBottom: tagIds.length > 1 ? '60px' : '0px',
39
+ // height: setHeight
40
+ // }"
41
+ import _ from 'lodash'
42
+ import { newInitWaterMark } from "../assets/js/common";
43
+ // import * as pdfjsLib from 'pdfjs-dist'
44
+ // pdfjsLib.GlobalWorkerOptions.workerSrc = 'pdfjs-dist/build/pdf.worker';
45
+ // import { TextLayerBuilder } from "pdfjs-dist/web/pdf_viewer";
46
+ // EventBus pdf_viewer 支持绑定自定义事件,一版不做
47
+ // import 'pdfjs-dist/web/pdf_viewer.css'
48
+ /* eslint-disable */
49
+ const pdfjsLib = window['pdfjsLib']
50
+ if (pdfjsLib) {
51
+ pdfjsLib.GlobalWorkerOptions.workerSrc = window['pdfjs-dist/build/pdf.worker']
52
+ // 'pdfjs-dist/build/pdf.worker';
53
+ }
54
+ const { TextLayerBuilder } = window['pdfjs-dist/web/pdf_viewer']
55
+ // import { zoomElement } from '../assets/js/hammer'
56
+ export default {
57
+ name: 'pdfView',
58
+ props: ['tagIds', 'isMessageRecord','textWatermarkStr'],
59
+ data () {
60
+ return {
61
+ url: '',
62
+ pages: [],
63
+ pageLoadStatus: {
64
+ WAIT: 0,
65
+ LOADED: 1,
66
+ },
67
+ scale: 1,
68
+ rotation: 0,
69
+ pageSize: {},
70
+ PAGE_INTVERVAL: 15,
71
+ SLICE_COUNT: 5,
72
+ contentView: null,
73
+ fisrtLoad: true,
74
+ TextLayerBuilder: null,
75
+ totalPageCount: 0,
76
+ identifyTextPostion: {
77
+ top: 0,
78
+ left: 0,
79
+ width: 100,
80
+ height: 0,
81
+ page: 1,
82
+ pageHeight: 0,
83
+ pageWidth: 0,
84
+ extractInfo: {},
85
+ currentPageAllLine: []
86
+ },
87
+ currentPageAllLine: [],
88
+ pdfUrl: '',
89
+ cachePdf: [],
90
+ newViewer: null,
91
+ currentPage: 0,
92
+ changetoolbar: false,
93
+ allTr: [],
94
+ preViewType: 'pdf',
95
+ displacement: {
96
+ pageX: 0,
97
+ pageY: 0,
98
+ moveable: false,
99
+ pageX2: 0,
100
+ pageY2: 0,
101
+ originScale: 1,
102
+ },
103
+ isTouchMoved: false,
104
+ transformSalce: null,
105
+ isPC: false,
106
+ handScale: 'auto',
107
+ scaleList: [],
108
+ scrollTop: 0,
109
+ scrollLeft: 0
110
+ }
111
+ },
112
+ methods: {
113
+ getpdfResloutePage (pdfResloute) {
114
+ // 根据当前页面宽度设置缩放比例
115
+ // this.scale = Math.round(this.$refs.pdfView.clientWidth / pdfResloute.pageWidth * 100) / 100
116
+ if (this.isMessageRecord) {
117
+ this.scale = Math.round(this.$refs.pdfView.clientWidth / pdfResloute.pageWidth * 100) / 100
118
+ } else {
119
+ this.scale = 2
120
+ }
121
+ // 从后端获取到当前分片后所有的pdf页码,初始化数组,数组下{} 对应每页pdf文件
122
+ this.pdfUrl = pdfResloute.publicPageFileUrl.substring(0, pdfResloute.publicPageFileUrl.lastIndexOf('/') + 1)
123
+ this.initPages(pdfResloute.total)
124
+ // 定位功能,加载对应页码位置
125
+ this.loadPdfData(pdfResloute.page)
126
+ },
127
+ async loadPdfData (loadPage) {
128
+ if (this.pages[loadPage - 1] && ((this.pages[loadPage - 1].dom && this.pages[loadPage - 1].dom.children.length > 0) || this.pages[loadPage - 1].loadStatus)) {
129
+ return
130
+ } else {
131
+ if (this.changetoolbar) {
132
+ this.$nextTick(() => {
133
+ this.renderHighlights()
134
+ })
135
+ this.changetoolbar = false
136
+ }
137
+ }
138
+ // 记录开始缓存的状态
139
+ // pdfjsLib.GlobalWorkerOptions.workerSrc = require("pdfjs-dist/legacy/build/pdf.worker.entry.js");
140
+ // 拿到第一个分片
141
+ const { startPage, url } = await this.fetchPdfFragment(loadPage);
142
+ let loadingTask = pdfjsLib.getDocument(url)
143
+ loadingTask.promise.then(async (pdfDoc) => {
144
+ // 将已经下载的分片保存到 pages 数组中
145
+ // for (let i = 0; i < pdfDoc.numPages; i += 1) {
146
+ // const pageIndex = startPage + i;
147
+ // const page = this.pages[pageIndex - 1];
148
+ // // // 不在缓存列表内,重新获取本页pdf
149
+ // // if (page.loadStatus !== this.pageLoadStatus.LOADED) {
150
+
151
+ // // } else {
152
+ // // if (this.changetoolbar) {
153
+ // // this.$nextTick(() => {
154
+ // // this.renderHighlights()
155
+ // // })
156
+ // // this.changetoolbar = false
157
+ // // }
158
+ // // }
159
+ // }
160
+ const page = this.pages[loadPage - 1]
161
+ await pdfDoc.getPage(1).then(async (pdfPage) => {
162
+ this.pages[loadPage - 1].loadStatus = true
163
+ this.pages[loadPage - 1].pdfPage = pdfPage;
164
+ // 通知可以进行渲染了
165
+ await this.startRenderPages(pdfPage, page, loadPage)
166
+ });
167
+ });
168
+ },
169
+ initPages (totalPage) {
170
+ // const pages = [];
171
+ this.totalPageCount = totalPage
172
+ for (let i = 0; i < totalPage; i += 1) {
173
+ this.pages.push({
174
+ pageNo: i + 1,
175
+ loadStatus: false,
176
+ pdfPage: null,
177
+ dom: null
178
+ });
179
+ }
180
+ },
181
+ async fetchPdfFragment (pageIndex) {
182
+ // 置换加签后的文件地址。
183
+ let obj = {}
184
+ await this.$http.post(
185
+ '/knowledge-api/temporary-certificate/or-origin?expired=30',
186
+ this.pdfUrl + pageIndex + '.pdf',
187
+ {
188
+ headers: {
189
+ "Content-Type": "application/json",
190
+ },
191
+ }).then(async res => {
192
+ if (res.bodyText) {
193
+ // 最后返回一个 包含这4个参数的对象
194
+ obj = await {
195
+ "startPage": pageIndex, // 分片的开始页码
196
+ "endPage": pageIndex + 5, // 分片结束页码
197
+ "totalPage": this.totalPageCount, // pdf 总页数
198
+ "url": res.bodyText // 分片内容下载地址
199
+ }
200
+ }
201
+ if (res.data) {
202
+ // 最后返回一个 包含这4个参数的对象
203
+ obj = await {
204
+ "startPage": pageIndex, // 分片的开始页码
205
+ "endPage": pageIndex + 5, // 分片结束页码
206
+ "totalPage": this.totalPageCount, // pdf 总页数
207
+ "url": res.data // 分片内容下载地址
208
+ }
209
+ }
210
+ })
211
+ return obj
212
+ },
213
+ startRenderPages (pdfPage, page, pageIndex) {
214
+ if (Object.keys(this.pageSize).length == 0) {
215
+ const viewport = pdfPage.getViewport({
216
+ scale: this.scale, // 缩放的比例
217
+ rotation: this.rotation, // 旋转的角度
218
+ });
219
+ // 记录pdf页面高度
220
+ const pageSize = {
221
+ width: viewport.width,
222
+ height: viewport.height,
223
+ }
224
+ this.pageSize = pageSize
225
+ // 创建内容绘制区,并设置大小
226
+ if (this.$refs.pdfView.clientWidth / this.pageSize.width >= 1 || this.isMessageRecord) {
227
+ this.contentView.style.width = `${pageSize.width - 10}px`;
228
+ this.contentView.style.height = `${(this.totalPageCount * (pageSize.height + this.PAGE_INTVERVAL)) + this.PAGE_INTVERVAL}px`;
229
+ } else {
230
+ this.transformSalce = this.$refs.pdfView.clientWidth / this.pageSize.width
231
+ this.contentView.style.width = `${pageSize.width * this.transformSalce - 10}px`;
232
+ this.contentView.style.height = `${(this.totalPageCount * (pageSize.height * (this.transformSalce) + this.PAGE_INTVERVAL)) + this.PAGE_INTVERVAL}px`;
233
+ }
234
+ this.contentView.style.margin = '0 auto 0'
235
+ this.contentView.style.position = 'relative'
236
+ this.contentView.style.paddingBottom = '60px'
237
+ // contentView.style.overflowY = 'auto'
238
+ this.$refs.pdfView.appendChild(this.contentView);
239
+ if (this.textWatermarkStr){
240
+ newInitWaterMark('pdf_container_view',this.textWatermarkStr)
241
+ }
242
+ }
243
+ this.renderPages(pageIndex)
244
+ },
245
+ // 渲染需要展示的页面,不需展示的页码将其清除
246
+ renderPages (pageIndex) {
247
+ const pagesToRender = this.getRenderScope(pageIndex);
248
+ for (const i of this.pages) {
249
+ if (pagesToRender.some(p => { return p.pageNo == i.pageNo })) {
250
+ if (i.loadStatus === true) {
251
+ this.renderPageContent(i, i.pageNo)
252
+ } else {
253
+ this.renderPageLoading(i, i.pageNo)
254
+ }
255
+ } else {
256
+ this.clearPage(i);
257
+ }
258
+ }
259
+
260
+ },
261
+ async renderPageContent (page, pageIndex) {
262
+ const { pdfPage, pageNo, dom } = page;
263
+ // dom 元素已存在,无须重新渲染,直接返回
264
+ if ((dom && dom.children.length != 0) || page.loading) {
265
+ return;
266
+ }
267
+ page.loading = true
268
+ const viewport = pdfPage.getViewport({
269
+ scale: this.scale,
270
+ rotation: this.rotation,
271
+ });
272
+ // 创建新的canvas
273
+ const canvas = document.createElement('canvas');
274
+ const context = canvas.getContext('2d');
275
+ // canvas.getContext('2d');
276
+ canvas.height = this.pageSize.height;
277
+ canvas.width = this.pageSize.width;
278
+ canvas.style.position = 'relative'
279
+ canvas.style.top = -3 + 'px'
280
+ // 创建渲染的dom
281
+ const pageDom = document.createElement('div');
282
+ pageDom.style.position = 'absolute';
283
+ pageDom.style.top = `${((pageNo - 1) * (this.pageSize.height + this.PAGE_INTVERVAL)) + this.PAGE_INTVERVAL}px`;
284
+ pageDom.style.width = `${this.pageSize.width}px`;
285
+ pageDom.style.height = `${this.pageSize.height}px`;
286
+ pageDom.setAttribute('data-id', 'page' + pageNo)
287
+ pageDom.appendChild(canvas);
288
+ // 渲染内容
289
+ let renderContext = {
290
+ canvasContext: context,
291
+ viewport: viewport,
292
+ }
293
+ await pdfPage.render(renderContext).promise.then(() => {
294
+ return pdfPage.getTextContent()
295
+ }).then(async (textContent) => {
296
+ const textLayerDiv = document.createElement('div');
297
+ textLayerDiv.setAttribute('class', 'textLayer');
298
+ // 将文本图层div添加至每页pdf的div中
299
+ // 创建新的TextLayerBuilder实例
300
+ let textLayer = new TextLayerBuilder({
301
+ textLayerDiv: textLayerDiv,
302
+ pageIndex: pdfPage._pageIndex,
303
+ viewport: viewport,
304
+ });
305
+ let findPage = this.currentPageAllLine.find(l => { return l.page == pageIndex })
306
+ let rectdomTop = 0
307
+ if (findPage) {
308
+ let AllLines = findPage.allLines
309
+ // setTimeout(() => {
310
+ if (AllLines.length > 0) {
311
+ for (let j = 0; j < AllLines.length; j++) {
312
+ let lines = AllLines[j].lines
313
+ let rectdom = document.createElement('div')
314
+ rectdom.setAttribute('react-count', AllLines[j].pageCount);
315
+ rectdom.style.position = 'absolute';
316
+ rectdom.style.top = 0
317
+ rectdom.style.left = 0
318
+ rectdom.classList.add('rectdom')
319
+ if (lines){
320
+ for (let index = 0; index < lines.length; index++) {
321
+ if (!/^\s+$/g.test(lines[index].content)) {
322
+ let postionArr = lines[index].location
323
+ let div = document.createElement('div')
324
+ div.style.position = 'absolute';
325
+ div.style.left = postionArr[0] * this.scale + 'px',
326
+ // 后端返回的坐标有基线对齐的问题,top 值是后端算好(基线top - 文字高度),在此加上文字高度的 1/9 (大致比例)为实际展示出文字的top值
327
+ div.style.top = postionArr[1] * this.scale + 'px'
328
+ div.style.height = postionArr[3] * this.scale + 'px';
329
+ div.style.width = postionArr[2] * this.scale + 'px'
330
+ div.style.backgroundColor = 'rgba(54, 106, 255, 0.3)'
331
+ div.classList.add('lineHeight')
332
+ rectdom.appendChild(div)
333
+ if (index == 0 && j == 0) {
334
+ if (this.transformSalce !== null) {
335
+ rectdomTop = postionArr[1] * this.scale * this.transformSalce
336
+ } else {
337
+ rectdomTop = postionArr[1] * this.scale
338
+ }
339
+ // if(this.isPC) {
340
+ // rectdomTop = rectdomTop - 50 < 0 ? 0 : rectdomTop - 50
341
+ // }
342
+ }
343
+ }
344
+ }
345
+ }
346
+ if (rectdom.children.length > 0) {
347
+ pageDom.appendChild(rectdom)
348
+ }
349
+ }
350
+ }
351
+ }
352
+ textLayer.setTextContent(textContent);
353
+ textLayer.render()
354
+ pageDom.appendChild(textLayerDiv);
355
+
356
+ let backgroundDom = document.getElementById('backgroundLoad' + pageNo)
357
+ if (backgroundDom) {
358
+ this.contentView.removeChild(backgroundDom);
359
+ }
360
+ page.dom = await pageDom;
361
+ page.loading = false
362
+ this.contentView.appendChild(pageDom);
363
+ if (this.transformSalce !== null) {
364
+ this.contentView.style.transform = `scale(${this.transformSalce}, ${this.transformSalce})`
365
+ }
366
+ if (this.changetoolbar) {
367
+ setTimeout(() => {
368
+ this.renderHighlights()
369
+ this.changetoolbar = false
370
+ }, 500)
371
+ }
372
+ if (this.fisrtLoad) {
373
+ setTimeout(() => {
374
+ let pageoffsetHeight = 0
375
+ if (this.transformSalce !== null) {
376
+ pageoffsetHeight = (this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce
377
+ } else {
378
+ pageoffsetHeight = (this.pageSize.height + this.PAGE_INTVERVAL)
379
+ }
380
+ if (this.$refs.pdfView.clientHeight - pageoffsetHeight > 0 && pageIndex == 1) {
381
+ const height = this.$refs.pdfView.clientHeight;
382
+ let startNum = 0
383
+ let endNum = 0
384
+ if (this.transformSalce !== null) {
385
+ startNum = Math.ceil(this.$refs.pdfView.scrollTop / ((this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce))
386
+ endNum = startNum + Math.ceil(height / ((this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce))
387
+ } else {
388
+ startNum = Math.ceil(this.$refs.pdfView.scrollTop / (this.pageSize.height + this.PAGE_INTVERVAL))
389
+ endNum = startNum + Math.ceil(height / (this.pageSize.height + this.PAGE_INTVERVAL))
390
+
391
+ }
392
+ for (let pageIndex = startNum; pageIndex <= endNum; pageIndex++) {
393
+ if (pageIndex > 0 && pageIndex <= this.pages.length) {
394
+ this.loadPdfData(pageIndex)
395
+ }
396
+ }
397
+ }
398
+ if (this.$refs.pdfView.scrollTop == Math.floor((pageNo - 1) * pageoffsetHeight)) {
399
+ this.$refs.pdfView.scrollTop = rectdomTop
400
+ this.fisrtLoad = false
401
+ } else {
402
+ this.$refs.pdfView.scrollTop = `${((pageNo - 1) * pageoffsetHeight) + rectdomTop - this.PAGE_INTVERVAL}`
403
+ this.fisrtLoad = false
404
+ }
405
+ this.renderHighlights()
406
+ // zoomElement(this.contentView)
407
+ }, 100)
408
+ }
409
+ })
410
+ },
411
+ // 监听容器的滚动事件,触发 scrollPdf 方法
412
+ // 这里加了防抖保证不会一次产生过多请求
413
+ debounceScrollPdf: _.debounce(function (e, that) {
414
+ if (this.fisrtLoad) {
415
+ this.fisrtLoad = false
416
+ return
417
+ }
418
+ const scrollTop = e.target.scrollTop;
419
+ const height = e.target.clientHeight;
420
+ let startNum = 0
421
+ let endNum = 0
422
+ if (this.transformSalce !== null) {
423
+ startNum = Math.ceil(scrollTop / ((that.pageSize.height + that.PAGE_INTVERVAL) * this.transformSalce))
424
+ endNum = startNum + Math.ceil(height / ((that.pageSize.height + that.PAGE_INTVERVAL) * this.transformSalce))
425
+ } else {
426
+ startNum = Math.ceil(scrollTop / (that.pageSize.height + that.PAGE_INTVERVAL))
427
+ endNum = startNum + Math.ceil(height / (that.pageSize.height + that.PAGE_INTVERVAL))
428
+ }
429
+ for (let pageIndex = startNum; pageIndex < endNum; pageIndex++) {
430
+ if (pageIndex > 0 && pageIndex <= that.pages.length) {
431
+ that.loadPdfData(pageIndex)
432
+ }
433
+ }
434
+ }, 200),
435
+ directScrolling (e, that) {
436
+ if (this.fisrtLoad) {
437
+ this.fisrtLoad = false
438
+ return
439
+ }
440
+ const scrollTop = e.target.scrollTop;
441
+ const height = e.target.clientHeight;
442
+ // 根据内容可视区域中心点计算页码, 没有滚动时,指向第一页
443
+ const pageIndex = scrollTop > 0 ?
444
+ Math.ceil((scrollTop + (height / 2)) / (that.pageSize.height + that.PAGE_INTVERVAL)) :
445
+ 1;
446
+ this.loadPdfData(pageIndex)
447
+ },
448
+ pdfScroll (e) {
449
+ if (this.preViewType !== 'pdf' || this.isTouchMoved) {
450
+ return
451
+ }
452
+ if (this.scrollLeft != e.target.scrollLeft) {
453
+ this.scrollLeft = e.target.scrollLeft
454
+ }
455
+ if (this.scrollTop != e.target.scrollTop) {
456
+ this.scrollTop = e.target.scrollTop
457
+ this.debounceScrollPdf(e, this)
458
+ }
459
+ },
460
+ // 分片每次只做一次处理,所以不考虑多片情况
461
+ loadBefore (pageIndex) {
462
+ this.loadPdfData(pageIndex)
463
+ },
464
+ loadAfter (pageIndex) {
465
+ this.loadPdfData(pageIndex)
466
+ },
467
+ // 首先我们获取到需要渲染的范围
468
+ // 根据当前的可视范围内的页码,我们前后只保留 8
469
+ getRenderScope (pageIndex) {
470
+ const pagesToRender = [];
471
+ let i = pageIndex - 1;
472
+ let j = pageIndex + 1;
473
+ // pageIndex - 1 表示当前页码数 对应的下标位置
474
+ pagesToRender.push(this.pages[pageIndex - 1]);
475
+ while (pagesToRender.length < 8 && pagesToRender.length < this.pages.length) {
476
+ if (i > 0) {
477
+ pagesToRender.push(this.pages[i - 1]);
478
+ i -= 1;
479
+ }
480
+ if (pagesToRender.length >= 8) {
481
+ break;
482
+ }
483
+ if (j <= this.pages.length) {
484
+ pagesToRender.push(this.pages[j - 1]);
485
+ j += 1;
486
+ }
487
+ }
488
+ // for (let index = 0; index < array.length; index++) {
489
+ // const element = array[index];
490
+
491
+ // }
492
+ return pagesToRender;
493
+ },
494
+
495
+ // 清除页面 dom
496
+ clearPage (page) {
497
+ if (this.contentView.contains(page.dom) && page.dom) {
498
+ this.contentView.removeChild(page.dom);
499
+ page.loadStatus = false
500
+ page.loading = false
501
+ page.dom = undefined;
502
+ }
503
+ },
504
+ // 页面正在下载时渲染loading视图
505
+ renderPageLoading (page) {
506
+ const { pageNo, dom } = page;
507
+ if (dom && dom.children.length != 0) {
508
+ return;
509
+ }
510
+ let backgroundDom = document.getElementById('backgroundLoad' + pageNo)
511
+ if (this.contentView.contains(backgroundDom)) {
512
+ return
513
+ }
514
+ const pageDom = document.createElement('div');
515
+ pageDom.style.width = `${this.pageSize.width}px`;
516
+ pageDom.style.height = `${this.pageSize.height}px`;
517
+ pageDom.style.position = 'absolute';
518
+ pageDom.style.top = `${((pageNo - 1) * (this.pageSize.height + this.PAGE_INTVERVAL)) + this.PAGE_INTVERVAL
519
+ }px`;
520
+ pageDom.style.backgroundImage = `url('https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif')`
521
+ pageDom.style.backgroundPosition = 'center'
522
+ pageDom.style.backgroundRepeat = 'no-repeat'
523
+ pageDom.style.backgroundColor = '#FFF'
524
+ pageDom.setAttribute('id', 'backgroundLoad' + pageNo)
525
+ page.dom = pageDom;
526
+ this.contentView.appendChild(pageDom);
527
+ },
528
+ prev () {
529
+ this.currentPage--
530
+ if (this.currentPage < 0) {
531
+ this.currentPage = 0
532
+ if (!this.isPC) {
533
+ this.$toast({
534
+ message: this.$t('dragonCommon.firstParagraph'),
535
+ duration: 2000,
536
+ })
537
+ return
538
+ }
539
+ }
540
+ if (this.preViewType == 'pdf') {
541
+ this.scrollToUplaodePage(this.currentPage)
542
+ } else {
543
+ this.scrollToExcalTop(this.currentPage)
544
+ }
545
+ // this.getpdfResloutePage(this.cachePdf[this.currentPage - 1])
546
+ },
547
+ next () {
548
+ this.currentPage++
549
+ if (this.currentPage >= this.tagIds.length) {
550
+ this.currentPage = this.tagIds.length - 1
551
+ if (!this.isPC) {
552
+ this.$toast({
553
+ message: this.$t('dragonCommon.lastParagraph'),
554
+ duration: 2000,
555
+ })
556
+ return
557
+ }
558
+ }
559
+ if (this.preViewType == 'pdf') {
560
+ this.scrollToUplaodePage(this.currentPage)
561
+ } else {
562
+ this.scrollToExcalTop(this.currentPage)
563
+ }
564
+ },
565
+ currentChange (value) {
566
+ this.currentPage = value - 1
567
+ if (this.preViewType == 'pdf') {
568
+ this.scrollToUplaodePage(this.currentPage)
569
+ } else {
570
+ this.scrollToExcalTop(this.currentPage)
571
+ }
572
+ },
573
+ scrollToUplaodePage (currentPage) {
574
+ this.changetoolbar = true
575
+ if (this.preViewType !== 'pdf') {
576
+ return
577
+ }
578
+
579
+ let pdfResloute = this.cachePdf[currentPage]
580
+ this.identifyTextPostion.extractInfo = pdfResloute.extractInfo
581
+ this.identifyTextPostion.left = pdfResloute.extractInfo.location[0]
582
+ this.identifyTextPostion.top = pdfResloute.extractInfo.location[1]
583
+ this.identifyTextPostion.width = pdfResloute.extractInfo.location[2]
584
+ this.identifyTextPostion.height = pdfResloute.extractInfo.location[3]
585
+ this.identifyTextPostion.page = pdfResloute.page
586
+ this.identifyTextPostion.pageHeight = pdfResloute.pageHeight
587
+ this.identifyTextPostion.pageWidth = pdfResloute.pageWidth
588
+ // 在当前段落在最后一页pdf时,根据计算的高度并不能触发滚动,在此执行重新渲染方法,非次情况会执行两次,待优化
589
+ this.$nextTick(() => {
590
+ this.renderHighlights()
591
+ })
592
+ if (this.transformSalce !== null) {
593
+ this.$refs.pdfView.scrollTop = `${((pdfResloute.page - 1) * (this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce) + (this.identifyTextPostion.top * this.scale * this.transformSalce)}`
594
+ } else {
595
+ this.$refs.pdfView.scrollTop = `${((pdfResloute.page - 1) * (this.pageSize.height + this.PAGE_INTVERVAL)) + (this.identifyTextPostion.top * this.scale * this.transformSalce)}`
596
+ }
597
+ },
598
+ scrollToExcalTop (currentPage) {
599
+ for (let index = 0; index < this.allTr.length; index++) {
600
+ if (index == currentPage) {
601
+ Array.from(this.allTr[index].children).forEach(item => {
602
+ item.style.background = 'rgba(255, 136, 0, 0.6)'
603
+ item.classList.add('animation')
604
+ setTimeout(() => {
605
+ item.classList.remove('animation')
606
+ }, 4000)
607
+ })
608
+ // getBoundingClientRect().top 当前元素距离屏幕顶部的高度 + 弹窗header 高度
609
+ if (!this.isPC) {
610
+ let top = this.allTr[index].getBoundingClientRect().top - this.$refs.pdfView.getBoundingClientRect().top
611
+ this.$refs.pdfView.scrollTop = top
612
+ } else {
613
+ let top = this.allTr[index].getBoundingClientRect().top
614
+ this.$refs.pdfView.scrollTop = top - 50
615
+ }
616
+ } else {
617
+ Array.from(this.allTr[index].children).forEach(item => {
618
+ item.style.background = 'rgba(54, 106, 255, 0.6)'
619
+ item.classList.remove('animation')
620
+ })
621
+ }
622
+ }
623
+ },
624
+ // pdf是否需要重新渲染高亮位置
625
+ renderHighlights () {
626
+ let lineHeightDom = Array.from(document.getElementsByClassName('rectdom'))
627
+ if (lineHeightDom) {
628
+ lineHeightDom.forEach((d) => {
629
+ for (let i = 0; i < d.children.length; i++) {
630
+ if (d.getAttribute('react-count') == this.currentPage) {
631
+ d.children[i].style.backgroundColor = 'rgba(255, 136, 0, 0.3)'
632
+ d.children[i].classList.add('animation')
633
+ setTimeout(() => {
634
+ d.children[i].classList.remove('animation')
635
+ }, 4000)
636
+ } else {
637
+ d.children[i].style.backgroundColor = 'rgba(54, 106, 255, 0.3)'
638
+ d.children[i].classList.remove('animation')
639
+ }
640
+ }
641
+ })
642
+ }
643
+ },
644
+ displayHiglight (pageIndex) {
645
+ let lineHeightDom = Array.from(document.getElementsByClassName('rectdom'))
646
+ if (lineHeightDom) {
647
+ lineHeightDom.forEach((d) => {
648
+ if (d.getAttribute('page-index') == pageIndex) {
649
+ d.style.display = 'none'
650
+ }
651
+ })
652
+ }
653
+ },
654
+ // 前端暂时缓存多页
655
+ autoLoadMore (pageIndex) {
656
+ let pdfResloute = this.cachePdf.find(cache => {
657
+ return cache.page == pageIndex
658
+ })
659
+ if (pdfResloute) {
660
+ this.getpdfResloutePage(pdfResloute)
661
+ } else {
662
+ this.loadPdfData(pageIndex)
663
+ }
664
+ },
665
+ setPageAllLine (arr) {
666
+ this.currentPageAllLine = []
667
+ arr.forEach((item, index) => {
668
+ let i = this.currentPageAllLine.findIndex(l => { return l.page && l.page == item.page })
669
+ if (i != -1) {
670
+ // this.currentPageAllLine[i].allLines.lines.push(item.extractInfo.lines)
671
+ this.currentPageAllLine[i].allLines.push({
672
+ pageCount: index,
673
+ lines: item.extractInfo.lines
674
+ })
675
+ } else {
676
+ this.currentPageAllLine.push({
677
+ page: item.page,
678
+ allLines: [{
679
+ pageCount: index,
680
+ lines: item.extractInfo.lines
681
+ }],
682
+ })
683
+ }
684
+ })
685
+ },
686
+ openTouch () {
687
+ // this.$nextTick()将回调延迟到下次 DOM 更新循环之后执行
688
+ let that = this;
689
+ this.$nextTick(() => {
690
+ // setInterval(() => {
691
+ // this.scale = this.scale + 0.1
692
+ // that.pages.forEach((item, index) =>{
693
+ // if(item.dom) {
694
+ // item.dom.children.forEach( childDom =>{
695
+ // if(childDom.getAttribute('react-count')) {
696
+ // childDom.style.transform = "scale(" + this.scale + ")";
697
+ // childDom.style.transformOrigin = "0px 0px 0px";
698
+ // } else {
699
+ // item.dom = null
700
+ // this.startRenderPages(item.pdfPage, null, index)
701
+ // }
702
+ // } )
703
+ // }
704
+ // })
705
+ // }, 100);
706
+ // 获取放大或缩小的区域DOM
707
+ let matrix_box = this.contentView
708
+ matrix_box.addEventListener("touchstart", function (event) {
709
+ this.isTouchMoved = true
710
+ let touches = event.touches;
711
+ let events = touches[0];
712
+ let events2 = touches[1];
713
+
714
+ // event.preventDefault();
715
+
716
+ // 第一个触摸点的坐标
717
+ that.displacement.pageX = events.pageX;
718
+ that.displacement.pageY = events.pageY;
719
+
720
+ that.displacement.moveable = true;
721
+
722
+ if (events2) {
723
+ that.displacement.pageX2 = events2.pageX;
724
+ that.displacement.pageY2 = events2.pageY;
725
+ }
726
+
727
+ that.displacement.originScale = this.scale || 1;
728
+ });
729
+ document.addEventListener("touchmove", function (event) {
730
+ if (!that.displacement.moveable) {
731
+ return;
732
+ }
733
+ // event.preventDefault();
734
+ let touches = event.touches;
735
+ let events = touches[0];
736
+ let events2 = touches[1];
737
+ // 双指移动
738
+ if (events2) {
739
+ // 第2个指头坐标在touchmove时候获取
740
+ if (!that.displacement.pageX2) {
741
+ that.displacement.pageX2 = events2.pageX;
742
+ }
743
+ if (!that.displacement.pageY2) {
744
+ that.displacement.pageY2 = events2.pageY;
745
+ }
746
+ // 双指缩放比例计算
747
+ let zoom = that.getDistance({
748
+ x: events.pageX,
749
+ y: events.pageY
750
+ },
751
+ {
752
+ x: events2.pageX,
753
+ y: events2.pageY
754
+ }
755
+ ) / that.getDistance(
756
+ {
757
+ x: that.displacement.pageX,
758
+ y: that.displacement.pageY
759
+ },
760
+ {
761
+ x: that.displacement.pageX2,
762
+ y: that.displacement.pageY2
763
+ }
764
+ );
765
+ // 应用在元素上的缩放比例
766
+ let newScale = that.displacement.originScale * zoom;
767
+ // 最大缩放比例限制
768
+ if (newScale > 2) {
769
+ newScale = 2;
770
+ }
771
+ // 最大缩放比例限制
772
+ if (newScale < 1) {
773
+ newScale = 1;
774
+ }
775
+ // 记住使用的缩放值
776
+ that.displacement.scale = newScale;
777
+ // console.log(newScale);
778
+ matrix_box.style.transform = "scale(" + newScale + ")";
779
+ // 设置旋转元素的基点位置
780
+ matrix_box.style.transformOrigin = "0px 0px 0px";
781
+ }
782
+ }, { passive: false });
783
+ document.addEventListener('touchend', function () {
784
+ that.isTouchMoved = false
785
+ }, { passive: false })
786
+ });
787
+ },
788
+ getDistance (start, stop) {
789
+ // Math.hypot()计算参数的平方根
790
+ return Math.hypot(stop.x - start.x, stop.y - start.y);
791
+ },
792
+ changeScale (value) {
793
+ if (value == 'zoom') {
794
+ this.handScale = 'auto'
795
+ this.transformSalce = (this.transformSalce + 0.2).toFixed(1)
796
+ } else if (value == 'reduce') {
797
+ if ((this.transformSalce - 0.2).toFixed(1) <= 0) {
798
+ return
799
+ }
800
+ this.handScale = 'auto'
801
+ this.transformSalce = (this.transformSalce - 0.2).toFixed(1)
802
+ } else if (value == 'auto') {
803
+ this.transformSalce = this.$refs.pdfView.clientWidth / this.pageSize.width
804
+ } else if (value == 'reality') {
805
+ this.transformSalce = 0.5
806
+ } else {
807
+ this.transformSalce = (value / 2).toFixed(1)
808
+ }
809
+ this.transformSalce = Number(this.transformSalce)
810
+ this.contentView.style.transform = 'scale(' + this.transformSalce + ')';
811
+ // this.getpdfResloutePage(this.cachePdf[0])
812
+ },
813
+ },
814
+ computed: {
815
+ perviewUrl () {
816
+ return '/web/viewer.html?file=' + '/pdflist/pdf4split-1.pdf'
817
+ },
818
+ setHeight () {
819
+ if (this.tagIds.length > 1) {
820
+ if (this.isPC) {
821
+ return 'calc(100% - 110px)'
822
+ } else {
823
+ return 'calc(100% - 60px)'
824
+ }
825
+ } else {
826
+ if (this.isPC) {
827
+ return 'calc(100% - 50px)'
828
+ } else {
829
+ return '100%'
830
+ }
831
+ }
832
+ }
833
+ },
834
+ watch: {
835
+ tagIds: {
836
+ handler (value) {
837
+ if (value && value.length) {
838
+ // pdf_view 下创建 所有canvs的容器
839
+ this.contentView = document.createElement('div')
840
+ this.contentView.style.transformOrigin = '0px 0px 0px'
841
+ this.contentView.setAttribute('id','contentView');
842
+ this.$http.get('/knowledge-api/knowledge/knowledge-part-location-info/list?ids=' + value.join(',')).then(res => {
843
+ // 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}
844
+ // 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}
845
+ // 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}
846
+ // 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}
847
+ // 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}
848
+ // if(value.length === 1) {
849
+ // this.$refs.pdfView.style.height = 'calc(100% - 50px)'
850
+ // }
851
+ // res.data = {
852
+ // "data": [
853
+ // {
854
+ // "id": "64e746120372d778849d2e8e",
855
+ // "knowledgeId": "64e30035edffac0ec96a2d39",
856
+ // "mainId": "e0f6898c6b0d47fa98e8f71ceab1bde8",
857
+ // "page": 14,
858
+ // "total": 60,
859
+ // "pageHeight": 728.504,
860
+ // "pageWidth": 515.906,
861
+ // "publicPageFileUrl": "https://askbot-pdf-all.oss-cn-zhangjiakou.aliyuncs.com/e0f6898c6b0d47fa98e8f71ceab1bde8/2023/08/21/02/12/07/64e300378c3dfb3bc434f51a/15.pdf",
862
+ // "extractInfo": {
863
+ // "location": [
864
+ // 52.665375,
865
+ // 312.01306,
866
+ // 404.98618,
867
+ // 142.5199
868
+ // ],
869
+ // "content": null,
870
+ // "lines": [
871
+ // {
872
+ // "content": null,
873
+ // "location": [
874
+ // 52.665375,
875
+ // 312.01306,
876
+ // 404.98618,
877
+ // 142.5199
878
+ // ]
879
+ // }
880
+ // ],
881
+ // "tagId": null
882
+ // },
883
+ // "block": {
884
+ // "type": "TEXT",
885
+ // "location": [
886
+ // 52.665375,
887
+ // 312.01306,
888
+ // 404.98618,
889
+ // 142.5199
890
+ // ],
891
+ // "color": "#366AFF",
892
+ // "flowChart": {
893
+ // "content": ""
894
+ // },
895
+ // "image": {
896
+ // "url": null,
897
+ // "desc": ""
898
+ // },
899
+ // "table": {
900
+ // "title": null,
901
+ // "table": null
902
+ // },
903
+ // "text": {
904
+ // "originText": "① 头部防护:安全帽\n佩戴要求:\n①存在坠物或对头部产生碰撞风险的作业场所需要佩戴安全帽 ;\n②安全帽必须戴正、戴牢、不能晃动,要系紧下颏带,调节好后箍以\n防安全帽脱落 ;\n③受强力撞击及超过有效期的安全帽必须更换。",
905
+ // "indexText": "① 头部防护:安全帽\n佩戴要求:\n①存在坠物或对头部产生碰撞风险的作业场所需要佩戴安全帽 ;\n②安全帽必须戴正、戴牢、不能晃动,要系紧下颏带,调节好后箍以\n防安全帽脱落 ;\n③受强力撞击及超过有效期的安全帽必须更换。",
906
+ // "lines": [
907
+ // {
908
+ // "location": [
909
+ // 69.08148,
910
+ // 368.92072,
911
+ // 65.90851,
912
+ // 10.5
913
+ // ]
914
+ // },
915
+ // {
916
+ // "location": [
917
+ // 86.290985,
918
+ // 384.67072,
919
+ // 31.5,
920
+ // 10.5
921
+ // ]
922
+ // },
923
+ // {
924
+ // "location": [
925
+ // 286.2992,
926
+ // 315.73584,
927
+ // 37.656006,
928
+ // 12.0
929
+ // ]
930
+ // },
931
+ // {
932
+ // "location": [
933
+ // 324.6939,
934
+ // 316.79932,
935
+ // 122.74487,
936
+ // 10.5
937
+ // ]
938
+ // },
939
+ // {
940
+ // "location": [
941
+ // 286.2954,
942
+ // 336.0458,
943
+ // 149.625,
944
+ // 10.5
945
+ // ]
946
+ // },
947
+ // {
948
+ // "location": [
949
+ // 286.2954,
950
+ // 356.0483,
951
+ // 161.15405,
952
+ // 10.5
953
+ // ]
954
+ // },
955
+ // {
956
+ // "location": [
957
+ // 286.2954,
958
+ // 376.0508,
959
+ // 161.15405,
960
+ // 10.5
961
+ // ]
962
+ // },
963
+ // {
964
+ // "location": [
965
+ // 286.2954,
966
+ // 396.0533,
967
+ // 76.125,
968
+ // 10.5
969
+ // ]
970
+ // },
971
+ // {
972
+ // "location": [
973
+ // 286.2954,
974
+ // 416.05582,
975
+ // 161.17517,
976
+ // 10.5
977
+ // ]
978
+ // },
979
+ // {
980
+ // "location": [
981
+ // 286.2954,
982
+ // 436.8038,
983
+ // 52.5,
984
+ // 10.5
985
+ // ]
986
+ // },
987
+ // {
988
+ // "location": [
989
+ // 338.7992,
990
+ // 435.73584,
991
+ // 12.0,
992
+ // 12.0
993
+ // ]
994
+ // }
995
+ // ]
996
+ // }
997
+ // }
998
+ // }
999
+ // ],
1000
+ // "code": "0",
1001
+ // "msg": null,
1002
+ // "traceId": null
1003
+ // }
1004
+ if (res.data.code == 0) {
1005
+ // tagIds 会按照gpt识别的生成有序的数组,前端直接按照下标的顺序取就可以了
1006
+ // 缓存拿到的所有数据
1007
+ this.cachePdf = res.data.data
1008
+ let publicPageFileUrl = res.data.data && res.data.data[0] ? res.data.data[0].publicPageFileUrl : ''
1009
+ this.currentPage = 0
1010
+ if (publicPageFileUrl && publicPageFileUrl.substring(publicPageFileUrl.lastIndexOf('.')) === '.pdf') {
1011
+ this.preViewType = 'pdf'
1012
+ this.setPageAllLine(this.cachePdf)
1013
+ this.getpdfResloutePage(res.data.data[0])
1014
+ } else {
1015
+ this.preViewType = 'excal'
1016
+ this.$http.post(
1017
+ '/knowledge-api/temporary-certificate/or-origin?expired=30',
1018
+ publicPageFileUrl,
1019
+ {
1020
+ headers: {
1021
+ "Content-Type": "application/json",
1022
+ },
1023
+ }).then(res => {
1024
+ // 使用原声请求方式 axios会带有不需要的请求头
1025
+ let xhr = new XMLHttpRequest();
1026
+ xhr.open('GET', res.data || res.bodyText, true);
1027
+ // 定义请求完成的处理函数,请求前也可以增加加载框/禁用下载按钮逻辑
1028
+ xhr.onload = ({ currentTarget }) => {
1029
+ // 请求完成
1030
+ if (currentTarget.status === 200) { // 返回200
1031
+ this.contentView.innerHTML = currentTarget.response
1032
+ this.contentView.style.padding = '10px'
1033
+ // this.contentView.style.position = 'relative'
1034
+ this.$refs.pdfView.style.backgroundColor = '#FFFFFF'
1035
+ this.$refs.pdfView.appendChild(this.contentView)
1036
+ let allTr = Array.from(this.$refs.pdfView.getElementsByTagName('tr'))
1037
+ this.allTr = []
1038
+ for (let index = 0; index < allTr.length; index++) {
1039
+ if (value.includes(allTr[index].getAttribute('tag-id'))) {
1040
+ this.allTr.push(allTr[index])
1041
+ }
1042
+ }
1043
+ this.currentChange(1)
1044
+
1045
+ }
1046
+ }
1047
+ xhr.send();
1048
+ })
1049
+ }
1050
+ } else {
1051
+ let div = document.createElement('div')
1052
+ div.innerText = this.$t('dragonCommon.fileloadException')
1053
+ this.contentView.appendChild(div)
1054
+ this.$refs.pdfView.appendChild(this.contentView)
1055
+ }
1056
+ })
1057
+ }
1058
+ },
1059
+ deep: true,
1060
+ immediate: true
1061
+ }
1062
+ },
1063
+ mounted () {
1064
+ this.$i18n.locale = sessionStorage.getItem("systemLanguage") || 'cn';
1065
+ this.scaleList = [
1066
+ {
1067
+ label: this.$t('dragonCommon.scaleAuto'),
1068
+ value: 'auto'
1069
+ },
1070
+ {
1071
+ label: this.$t('dragonCommon.scaleReality'),
1072
+ value: 'reality'
1073
+ },
1074
+ {
1075
+ label: '100%',
1076
+ value: 1
1077
+ },
1078
+ {
1079
+ label: '120%',
1080
+ value: 1.2
1081
+ },
1082
+ {
1083
+ label: '150%',
1084
+ value: 1.5
1085
+ },
1086
+ {
1087
+ label: '170%',
1088
+ value: 1.7
1089
+ }
1090
+ ,
1091
+ {
1092
+ label: '200%',
1093
+ value: 2
1094
+ }
1095
+ ]
1096
+ if (/(iPhone|iPad|iPod|iOS|Android)/i.test(navigator.userAgent)) {
1097
+ this.isPC = false
1098
+ } else {
1099
+ this.isPC = true
1100
+ }
1101
+ }
1102
+ }
1103
+ </script>
1104
+
1105
+ <style lang="less" scoped>
1106
+ @import "../assets/less/variables.less";
1107
+ .pdf_view {
1108
+ width: 100%;
1109
+ // height: calc(100% - 110px);
1110
+ height: 100%;
1111
+ overflow: auto;
1112
+ background-color: @background-content-color;
1113
+ // margin-bottom: 60px;
1114
+ box-sizing: border-box;
1115
+ // position: relative;
1116
+ // > div {
1117
+ // width: 100%;
1118
+ // height: 100%;
1119
+ // overflow: hidden;
1120
+ // overflow-y: auto;
1121
+ // position: relative;
1122
+ // }
1123
+ >iframe {
1124
+ width: 100%;
1125
+ height: 100%;
1126
+ }
1127
+
1128
+ a:link {
1129
+ color: none;
1130
+ }
1131
+
1132
+ a:visited {
1133
+ color: none;
1134
+ }
1135
+
1136
+ a:hover {
1137
+ color: none;
1138
+ }
1139
+
1140
+ a:active {
1141
+ color: none;
1142
+ }
1143
+ .btn_footer {
1144
+ width: 100%;
1145
+ height: 60px;
1146
+ display: flex;
1147
+ align-items: center;
1148
+ justify-content: space-around;
1149
+ position: absolute;
1150
+ bottom: 0px;
1151
+ left: 0;
1152
+ z-index: 999;
1153
+ background: @background-color-light;
1154
+
1155
+ .prev,
1156
+ .next {
1157
+ width: 35%;
1158
+ height: 40px;
1159
+ display: flex;
1160
+ align-items: center;
1161
+ justify-content: center;
1162
+ border-radius: 50px;
1163
+ cursor: pointer;
1164
+ }
1165
+
1166
+ .prev {
1167
+ background: @background-content-color;
1168
+ color: @font-primary-color;
1169
+ }
1170
+
1171
+ .next {
1172
+ background: @primary-color;
1173
+ color: @font-primary-light-color;
1174
+ }
1175
+ }
1176
+
1177
+ #pagination {
1178
+ .total-class {
1179
+ margin-right: 13px;
1180
+ font-weight: 400;
1181
+ }
1182
+
1183
+ position: absolute;
1184
+ bottom: 0px;
1185
+ right: 0;
1186
+ width: 100%;
1187
+ display: flex;
1188
+ align-items: center;
1189
+ justify-content: center;
1190
+ height: 50px;
1191
+ background-color: @background-color-light;
1192
+ box-shadow: 0px 0px 18px 0px rgba(29, 55, 129, 0.07);
1193
+ border-radius: 5px;
1194
+ z-index: 1000;
1195
+
1196
+
1197
+
1198
+ /deep/.el-pagination {
1199
+ margin-right: 110px;
1200
+ }
1201
+
1202
+ /deep/.el-pager {
1203
+ background: @background-color-pagination;
1204
+ border-radius: 15px;
1205
+ }
1206
+
1207
+ /deep/.el-pagination.is-background .btn-next {
1208
+ width: 30px;
1209
+ height: 30px;
1210
+ background: @background-color-pagination;
1211
+ border-radius: 50%;
1212
+ }
1213
+
1214
+ /deep/.el-pagination .btn-next {
1215
+ width: 30px;
1216
+ height: 30px;
1217
+ background: @background-color-pagination;
1218
+ border-radius: 50%;
1219
+ padding-left: 0;
1220
+ margin-left: 5px;
1221
+ }
1222
+
1223
+ /deep/.el-pagination .btn-prev {
1224
+ width: 30px;
1225
+ height: 30px;
1226
+ background: @background-color-pagination;
1227
+ border-radius: 50%;
1228
+ padding-right: 0;
1229
+ margin-right: 5px;
1230
+ }
1231
+
1232
+ /deep/.el-pagination button {
1233
+ padding: 0;
1234
+ min-width: 30px;
1235
+ }
1236
+
1237
+ /deep/.el-pager li {
1238
+ background: @background-color-pagination;
1239
+ height: 30px;
1240
+ min-width: 30px;
1241
+ line-height: 30px;
1242
+ font-size: 12px;
1243
+ color: @font-pagination-color;
1244
+ }
1245
+
1246
+ /deep/.el-pager li:first-child {
1247
+ border-bottom-left-radius: 15px !important;
1248
+ border-top-left-radius: 15px !important;
1249
+ }
1250
+
1251
+ /deep/.el-pager li:last-child {
1252
+ border-top-right-radius: 15px !important;
1253
+ border-bottom-right-radius: 15px !important;
1254
+ }
1255
+
1256
+ /deep/.el-pager li.active {
1257
+ width: 30px;
1258
+ height: 30px;
1259
+ min-width: 30px;
1260
+ background: @primary-color;
1261
+ border: 3px solid @border-color-copy;
1262
+ border-radius: 50%;
1263
+ line-height: 24px;
1264
+ color: @font-primary-light-color;
1265
+ }
1266
+
1267
+ /deep/.el-pagination.is-background .el-pager li:not(.disabled).active {
1268
+ background: @primary-color;
1269
+ }
1270
+ }
1271
+
1272
+ .change_scale {
1273
+ width: 100%;
1274
+ height: 50px;
1275
+ position: absolute;
1276
+ top: 50px;
1277
+ left: 0;
1278
+ background: @background-color-light;
1279
+ display: flex;
1280
+ align-items: center;
1281
+ padding: 0 10px;
1282
+ box-sizing: border-box;
1283
+
1284
+ section {
1285
+ cursor: pointer;
1286
+ width: 30px;
1287
+ height: 30px;
1288
+ margin-right: 5px;
1289
+ border-radius: 5px;
1290
+ display: flex;
1291
+ align-items: center;
1292
+ justify-content: center;
1293
+
1294
+ i {
1295
+ font-weight: 900;
1296
+ }
1297
+ }
1298
+
1299
+ section:hover {
1300
+ background: rgba(221, 222, 223, 1);
1301
+ }
1302
+ }
1303
+ .pdf_container_view{
1304
+ height: 100%;
1305
+ width: 100%;
1306
+ position: relative;
1307
+ overflow: auto;
1308
+ }
1309
+ }
1310
+ </style>
1311
+ <style lang="less">
1312
+ .animation {
1313
+ animation-name: highlight;
1314
+ animation-duration: 4s;
1315
+ }
1316
+
1317
+ @keyframes highlight {
1318
+ 0% {
1319
+ background: rgba(255, 136, 0, 0.3);
1320
+ }
1321
+
1322
+ 25% {
1323
+ background: rgba(255, 136, 0, 0.6);
1324
+ }
1325
+
1326
+ 50% {
1327
+ background: rgba(255, 136, 0, 0.3);
1328
+ }
1329
+
1330
+ 75% {
1331
+ background: rgba(255, 136, 0, 0.6);
1332
+ }
1333
+
1334
+ 100% {
1335
+ background: rgba(255, 136, 0, 0.3);
1336
+ }
1337
+ }</style>