askbot-dragon 1.6.75-beta → 1.6.75

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 +965 -0
  282. package/src/components/previewDoc.vue +253 -247
  283. package/src/components/previewPdf.vue +1106 -833
  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,833 +1,1106 @@
1
-
2
- <!-- preview-pdf
3
- 组件主要负责 知识项目中 文件的预览,携带定位信息参数 tagIds tagId 的会解析文件增加定位功能
4
- 不携带定位信息的 也是走 kkview项目预览
5
- 另外增加了在知识项目中预览当前文件的一些功能
6
- -->
7
- <template>
8
- <!-- <van-popup v-model="previewShowPopup" position="bottom" :style="{ height: '90%', background:'#FFFFFF'}" v-if="previewShowPopup">
9
- <div class="footer">
10
- <span>查看详情</span>
11
- <section @click="close">
12
- <i class="iconfont guoran-shanchu"></i>
13
- </section>
14
- </div>
15
- <template v-if="tagIds && tagIds.length != 0 && previewShowPopup">
16
- <pdfPosition :tagIds="tagIds" ></pdfPosition>
17
- </template>
18
- <template v-else>
19
- <div v-if="fileType == 'VIDEO'" style="width: 100%;height: calc(100% - 60px)">
20
- <video :src="url" controls width="100%;" height="98%"></video>
21
- </div>
22
- <div v-else-if="fileType == 'HTML'" style="width: 100%;height: calc(100% - 60px)">
23
- <div class="preview_iframe_html" style="text-algin:left" v-html="fileText"></div>
24
- </div>
25
- <template v-else-if="url.includes('https://www') || url.includes('http://www')">
26
- <iframe class="preview_iframe"
27
- :src="url"
28
- width="100%"
29
- height="100%"
30
- scrolling="100%"
31
- frameborder="no"
32
- border="0"></iframe>
33
- </template>
34
- <template v-else>
35
- <iframe class="preview_iframe" :src="previewUrl" style="border:none;"></iframe>
36
- </template>
37
- </template>
38
- <div class="loading_img" v-show="loading">
39
- <img src="https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif" alt="">
40
- </div>
41
- </van-popup> -->
42
- <el-drawer title="我是标题" :visible.sync="drawer" :with-header="false" :append-to-body="true" :destroy-on-close="true"
43
- :modal="false" :direction="previewShowPopup ? 'btt' : 'rtl'" :size="previewShowPopup ? '90%' : '65%'"
44
- custom-class="pdf-preview-drawer" v-if="drawer">
45
- <!-- v-else-if="drawer" -->
46
- <div class="drawer-header" :class="isLiBang ? 'libang_head' : ''" v-if="!isPc">
47
- <div class="header-btn btn_position">
48
- <div class="onload_btn" v-if="isDownload || true" @click="downLoad">
49
- 下载
50
- </div>
51
- <div class="summaryBtn" :class="showSummary ? 'summaryActiveBtn' : ''" @click="summaryFun"
52
- v-if="isHasChat || true">
53
- <i class="iconfont guoran-tongyichicun-write-29-jiqiren"></i>
54
- <span>智能摘要</span>
55
- </div>
56
- <template v-if="isHasChat || true">
57
- <div class="chat" @click="previewToDialog(true)" v-if="!previewKnowledgeId">
58
- <i class="iconfont guoran-wendapingjia"></i>
59
- 聊一聊
60
- </div>
61
- <div class="chat chat_active" @click="previewToDialog(false)" v-else>
62
- <i class="iconfont guoran-wendapingjia"></i>
63
- 聊一聊
64
- </div>
65
- </template>
66
- </div>
67
- <div class="header_title">
68
- <div class="header_close">
69
- <span>
70
- {{ title ? title : "查看详情" }}
71
- </span>
72
- <section @click="close">
73
- <i class="iconfont guoran-shanchu"></i>
74
- </section>
75
- </div>
76
- <p v-if="folderName && isLiBang" class="header_floder" @click="clickFloder">
77
- <i class="iconfont guoran-tongyichicun-wenjianjia-zhankaizhuangtai--folderOpen"></i>
78
- {{ folderName }}
79
- <i v-if="folderUrl" class="iconfont guoran-tongyichicun-dianjichakantuli"></i>
80
- </p>
81
- </div>
82
- </div>
83
- <div class="drawer-header" :class="isLiBang && folderName ? 'libang_head' : ''" v-else>
84
- <div class="header_title">
85
- <div :class="isLiBang && folderName ? 'header_close' : 'header_top'">
86
- <span>
87
- {{ title ? title : "查看详情" }}
88
- </span>
89
- <div class="header-btn">
90
- <div class="onload_btn" v-if="isDownload || true" @click="downLoad">
91
- 下载
92
- </div>
93
- <div class="summaryBtn" :class="showSummary ? 'summaryActiveBtn' : ''" @click="summaryFun"
94
- v-if="isHasChat || true">
95
- <i class="iconfont guoran-tongyichicun-write-29-jiqiren"></i>
96
- <span>智能摘要</span>
97
- </div>
98
- <template v-if="isHasChat || true">
99
- <div class="chat" @click="previewToDialog(true)" v-if="!previewKnowledgeId">
100
- <i class="iconfont guoran-wendapingjia"></i>
101
- 聊一聊
102
- </div>
103
- <div class="chat chat_active" @click="previewToDialog(false)" v-else>
104
- <i class="iconfont guoran-wendapingjia"></i>
105
- 聊一聊
106
- </div>
107
- </template>
108
- <section @click="close">
109
- <i class="iconfont guoran-shanchu"></i>
110
- </section>
111
- </div>
112
- </div>
113
- <p v-if="folderName && isLiBang" class="header_floder" @click="clickFloder">
114
- <i class="iconfont guoran-tongyichicun-wenjianjia-zhankaizhuangtai--folderOpen"></i>
115
- {{ folderName }}
116
- <i v-if="folderUrl" class="iconfont guoran-tongyichicun-dianjichakantuli"></i>
117
- </p>
118
- </div>
119
- </div>
120
- <div id="drawer_content_pre" :class="isLiBang && folderName ? 'libang_content_pre' : ''">
121
- <!-- :style="{marginTop:tagIds && tagIds.length != 0 && isPc ? '50px' : ''}" -->
122
- <intelligent-summary v-show="showSummary && isHasChat" :tagIds="tagIds" :knowledgeId="knowledgeId"
123
- @closeSummary="closeSummary" @recommendQues="recommendQues"
124
- @getSummarySuccess="getSummarySuccess"></intelligent-summary>
125
- <div class="pdf_positon" :style="pdfStyle" v-if="tagIds && tagIds.length != 0 && drawer">
126
- <pdfPosition :tagIds="tagIds" :isMessageRecord="isMessageRecord" :textWatermarkStr="textWatermarkStr">
127
- </pdfPosition>
128
- </div>
129
- <template v-else>
130
- <div v-if="fileType == 'VIDEO'" style="width: 100%;">
131
- <video :src="url" controls width="100%;" height="98%"></video>
132
- </div>
133
- <div v-else-if="fileType == 'HTML'" style="width: 100%;">
134
- <div class="preview_iframe_html" style="text-algin:left" v-html="fileText"></div>
135
- </div>
136
- <template v-else-if="url.includes('https://www') || url.includes('http://www')">
137
- <iframe class="preview_iframe" :src="url" width="100%" height="100%" scrolling="100%" frameborder="no"
138
- border="0"></iframe>
139
- </template>
140
- <template v-else>
141
- <iframe class="preview_iframe_kk" :src="previewUrl" style="border:none;"
142
- :style="{ height: iframeHeight }"></iframe>
143
- </template>
144
- </template>
145
- <!-- <div class="mobile_onload_btn" v-if="isDownload && !isPc" @click="downLoad">
146
- 下载
147
- </div> -->
148
- </div>
149
- <div class="loading_img" v-show="loading">
150
- <img src="https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif" alt="">
151
- </div>
152
- </el-drawer>
153
- </template>
154
-
155
- <script>
156
- import pdfPosition from './pdfPosition.vue'
157
- import { zoomElement } from '../assets/js/hammer'
158
- import IntelligentSummary from "./intelligentSummary";
159
- import { isMobile } from "../assets/js/common";
160
- // import { Toast } from 'vant';
161
- export default {
162
- data () {
163
- return {
164
- previewShowPopup: false,
165
- fileText: '',
166
- fileType: "",
167
- isPc: false,
168
- drawer: false,
169
- tagIds: [],
170
- // '6454aa1a70573a6ead6f0f7d', '6454aa1a70573a6ead6f0f81',
171
- loading: true,
172
- fileName:'',
173
- previewKnowledgeId:"",
174
- showSummary:true,
175
- iframeHeight:"100%",
176
- isDownload: false,
177
- textWatermarkStr:""
178
- }
179
- },
180
- mounted() {
181
- window.addEventListener('message',this.handleIframeMessage,false);
182
- this.isPcFun();
183
- },
184
- props:{
185
- url:{
186
- type: String,
187
- required: true,
188
- },
189
- officePreviewType:{
190
- type: String,
191
- default: ''
192
- },
193
- isMessageRecord:{
194
- type: Boolean,
195
- default:false,
196
- },
197
- sourceFileType:{
198
- type: String,
199
- default: '',
200
- },
201
- title: {
202
- type: String,
203
- default: ''
204
- },
205
- isHasChat:{
206
- type:Boolean,
207
- default:false
208
- },
209
- knowledgeId:{
210
- type: String,
211
- default: '',
212
- },
213
- previewOssPath:{
214
- type: String,
215
- default: '',
216
- },
217
- folderName: {
218
- type: String,
219
- default: '',
220
- },
221
- folderUrl: {
222
- type: String,
223
- default: '',
224
- },
225
- isLiBang: {
226
- type: Boolean,
227
- default: false
228
- }
229
- },
230
- components: {
231
- IntelligentSummary,
232
- pdfPosition
233
- },
234
- watch: {
235
- drawer (value) {
236
- if (value) {
237
- this.$emit('open')
238
- this.$nextTick(() => {
239
- if (this.tagIds && this.tagIds.length != 0){
240
- zoomElement(document.getElementById('pdf_container_view'))
241
- }
242
- })
243
- } else {
244
- this.$emit('close')
245
- }
246
- setTimeout(() => {
247
- let previewIframe = document.getElementsByClassName('preview_iframe')
248
- Array.from(previewIframe).forEach(item =>{
249
- item.onload = () =>{
250
- console.debug('previewIframe 106',previewIframe,this.drawer)
251
- item.style.backgroundImage = 'none'
252
- }
253
- })
254
- })
255
- },
256
- showSummary:{
257
- handler(val){
258
- // if (!val){
259
- // this.$nextTick(() => {
260
- // let preCon = document.querySelector('.pdf_view');
261
- // if (preCon){
262
- // preCon.style.height = 'calc(100% - ' + 50 + 'px)'
263
- // }
264
- // })
265
- // } else {
266
- // this.getSummarySuccess();
267
- // }
268
- if(val) {
269
- this.getSummarySuccess();
270
- }
271
- }
272
- },
273
- knowledgeId:{
274
- handler(val){
275
- if (val){
276
- this.getTextWatermark();
277
- }
278
- }
279
- }
280
- },
281
- computed:{
282
- pdfStyle() {
283
- return {
284
- paddingTop: this.isPc ? '30px' : '0', // 30px 是 加上外层的 20 流出 50的上边距展示 放大缩小操作栏
285
- paddingBottom: this.tagIds > 1 ? '60px' : '0',
286
- height: '100%'
287
- }
288
- },
289
- previewUrl() {
290
- console.debug('VUE_APP_ENV',process.env.VUE_APP_ENV)
291
- let url = process.env.VUE_APP_ENV === 'production' ? 'https://kkfileview.askbot.cn/onlinePreview?url=' : 'https://test.open.askbot.cn/kkfileview/onlinePreview?url='
292
- // if(this.url != '') {
293
- // if(/[\u4E00-\u9FA5]+/g.test(this.url)) {
294
- // url += btoa(encodeURIComponent(this.url))
295
- // } else {
296
- // url += btoa(this.url)
297
- // }
298
- // }
299
- url = url + this.url
300
- url += '&officePreviewType=pdf'
301
- if(this.watermark) {
302
- url = this.watermark.textWatermarkValue ? (url += '&textWatermarkValue=' + this.watermark.textWatermarkValue) : url
303
- url = this.watermark.visitorWatermarkValue ? (url += '&visitorWatermarkValue=' + this.watermark.visitorWatermarkValue) : url
304
- }
305
- console.log('textWatermarkStr 216', this.textWatermarkStr)
306
- if (this.textWatermarkStr) {
307
- url += '&textWatermarkValue=' + this.textWatermarkStr
308
- }
309
- return url
310
- },
311
- // fileType() {
312
- // const fileType = this.url.substring(this.url.lastIndexOf('.'));
313
- // if (fileType === '.mp4' || fileType === '.MP4' || fileType === '.MOV' || fileType === '.mov') {
314
- // return 'VIDEO'
315
- // } else {
316
- // return 'OTHER'
317
- // }
318
-
319
- // }
320
- },
321
- methods: {
322
- close () {
323
- setTimeout(() => {
324
- this.previewShowPopup = false;
325
- this.fileType = ''
326
- }, 300)
327
- this.drawer = false;
328
- this.showSummary = false;
329
- },
330
- loadIframe () {
331
-
332
- if (this.fileType == 'VIDEO' || this.fileType == 'WECHAT' || (this.tagIds && this.tagIds.length != 0)) {
333
- this.loading = false
334
- } else {
335
- let iframe = document.getElementsByClassName('preview_iframe')[0] || document.getElementsByClassName('preview_iframe_kk')[0];
336
- if (iframe) {
337
- iframe.onload = () => {
338
- this.loading = false;
339
- document.getElementById('drawer_content_pre').style.backgroundImage = 'none'
340
- }
341
- }
342
- // let time = setInterval(() =>{
343
- //
344
- // if(iframe) {
345
- // this.loading = false
346
- // clearInterval(time)
347
- // }
348
- // }, 500)
349
- }
350
- },
351
- getBolb () {
352
- this.$http.post('/knowledge-api/knowledge/htmlTextDeal?onlyText=false', {
353
- fileInOssPath: this.url,
354
- templateId: ''
355
- }).then(res => {
356
- if (res.data.code == 0) {
357
- this.fileText = res.data.data
358
- this.loading = false
359
- }
360
- })
361
- },
362
- previewToDialog (flag) {
363
- this.$emit('previewToDialog', flag)
364
- },
365
- closeSummary () {
366
- this.showSummary = false;
367
- },
368
- recommendQues (item, knowledgeId) {
369
- console.log('recommendQues', item, knowledgeId);
370
- this.$emit('recommendQues', item, knowledgeId)
371
- },
372
- handleIframeMessage (res) {
373
- console.log('handleIframeMessage', res)
374
- if (res.data.type == 'getViewerHeight') {
375
- let iframeHeight = this.iframeHeight.replace('px', '')
376
- if (res.data.data && iframeHeight != (res.data.data + 50)) {
377
- this.iframeHeight = res.data.data + 50 + 'px'
378
- }
379
- }
380
- },
381
- summaryFun () {
382
- this.showSummary = !this.showSummary;
383
- if (this.showSummary) {
384
- document.getElementById('drawer_content_pre').scrollTop = 0;
385
- }
386
- },
387
- getSummarySuccess () {
388
- this.$nextTick(() => {
389
- // if (this.tagIds.length > 0){
390
- // let intelligentSummary = document.getElementById('intelligentSummary');
391
- // let preCon = document.querySelector('.pdf_view')
392
- // if (intelligentSummary){
393
- // let height = intelligentSummary.offsetHeight + (this.isPc ? 100 : 50 );
394
- // if (preCon){
395
- // preCon.style.height = 'calc(100% - ' + height + 'px)'
396
- // }
397
- // console.log('height',height,preCon)
398
- // }
399
- // }
400
- // let intelligentSummary = document.getElementById('intelligentSummary');
401
- // let height = intelligentSummary.offsetHeight
402
- // this.pdfStyle.height = 'calc(100% - ' + height + 'px)'
403
- })
404
- },
405
- getTextWatermark () {
406
- let url = '/knowledge-api/open/knowledge/getPermissionInfo';
407
- let obj = {
408
- "knowledgeId": this.knowledgeId,
409
- "userId": sessionStorage.getItem('_currentUserId'),
410
- "mainId": sessionStorage.getItem('_mainId'),
411
- "corpId": sessionStorage.getItem('_corpid')
412
- }
413
- this.$http.post(url, obj).then(res => {
414
- console.log('getTextWatermark', res.data.data)
415
- if (res.data.data) {
416
- this.textWatermarkStr = res.data.data.textWatermarkStr;
417
- this.isDownload = res.data.data.showDownloadBtn;
418
- }
419
- })
420
- },
421
- downLoad () {
422
- let url = this.previewOssPath
423
- if (decodeURIComponent(url) != url) {
424
- url = decodeURIComponent(url)
425
- }
426
- const fileType = url.substring(url.lastIndexOf('.'));
427
- this.$http.post('/knowledge-api/temporary-certificate/or-origin?expired=10', url, {
428
- headers: {
429
- "Content-Type": "application/json",
430
- }
431
- }).then(res => {
432
- console.log('downLoad 341', res)
433
- if (res.data|| res.bodyText) {
434
- if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
435
- if (isMobile()) {
436
-
437
- // const textArea = document.createElement("textarea");
438
- // // 在 textarea 中插入需要复制的文本
439
- // textArea.value = res.data;
440
- // // textarea 添加到文档中
441
- //document.body.appendChild(textArea);
442
- //// 选中 textarea 的内容
443
- // textArea.select();
444
- //var successful =document.execCommand('copy');
445
- // console.log(successful, 'successful');
446
- //if(successful) {
447
- //Toast('下载地址已复制,请前往Safari浏览器访问下载')// } else {
448
- // Toast('请允许复制内容到剪贴板')
449
- // }
450
- // // 移除 textarea 元素
451
- // document.body.removeChild(textArea);
452
- const iframe = document.createElement("iframe");
453
- iframe.setAttribute("hidden", "hidden");
454
- iframe.onload = () => {
455
- if (iframe) {
456
- console.log("iframe onload....")
457
- iframe.setAttribute('src', 'about:blank');
458
- }
459
- };
460
- document.body.insertBefore(iframe, null);
461
- iframe.setAttribute("src", res.data || res.bodyText);
462
- // Toast('下载地址已复制,请前往Safari浏览器访问下载')
463
- this.close()
464
-
465
- } else {
466
- navigator.clipboard.writeText(res.data)
467
- this.$message.success({
468
- message: '下载地址已复制,请前往Safari浏览器访问下载',
469
- })
470
- }
471
- return
472
- } else {
473
- // setTimeout(() =>{
474
- // window.open(res.data,'下载', 'noopener')
475
- // }, 2000)
476
- // window.open(res.data,'下载', 'noopener')
477
- if (isMobile()) {
478
- const iframe = document.createElement("iframe");
479
- iframe.setAttribute("hidden", "hidden");
480
- iframe.onload = () => {
481
- if (iframe) {
482
- console.log("iframe onload....")
483
- iframe.setAttribute('src', 'about:blank');
484
- }
485
- };
486
- document.body.insertBefore(iframe, null);
487
- iframe.setAttribute("src", res.data);
488
- } else {
489
- let a = document.createElement('a')
490
- a.href = res.data
491
- a.download = (this.title) + fileType
492
- a.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }))
493
- }
494
- this.close()
495
- }
496
- }
497
- })
498
- },
499
- isPcFun () {
500
- if (/(iPhone|iPad|iPod|iOS|Android)/i.test(navigator.userAgent)) {
501
- this.isPc = false
502
- } else {
503
- this.isPc = true
504
- }
505
- },
506
- clickFloder() {
507
- this.$emit('previewClickFloder')
508
- }
509
- },
510
- beforeDestroy () {
511
- window.removeEventListener('message', this.handleIframeMessage);
512
- }
513
- }
514
- </script>
515
-
516
- <style lang="less" scoped>
517
- #drawer_content_pre {
518
- padding: 20px;
519
- scroll-behavior: smooth;
520
-
521
- .mobile_onload_btn {
522
- position: absolute;
523
- right: 0;
524
- bottom: 10%;
525
- width: 20px;
526
- height: 60px;
527
- display: flex;
528
- align-items: center;
529
- justify-content: center;
530
- cursor: pointer;
531
- border-top-left-radius: 10px;
532
- border-bottom-left-radius: 10px;
533
- color: #366aff;
534
- background: #ffffff;
535
- border: 1px solid #a1b9ff;
536
- font-size: 12px;
537
- border-right: none;
538
- text-align: center;
539
- }
540
-
541
- .pdf_positon {
542
- width: 100%;
543
- box-sizing: border-box;
544
- }
545
- }
546
-
547
- .onload_btn {
548
- width: 76px;
549
- height: 26px;
550
- display: flex;
551
- align-items: center;
552
- justify-content: center;
553
- cursor: pointer;
554
- margin-right: 10px;
555
- border-radius: 15px;
556
- color: #366aff;
557
- background: #ffffff;
558
- border: 1px solid #a1b9ff;
559
- box-sizing: border-box;
560
- }
561
-
562
- .preview_iframe {
563
- width: 100%;
564
- height: 100%;
565
- box-sizing: border-box;
566
- background-image: url('https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif');
567
- background-position: center;
568
- background-size: 50px;
569
- background-repeat: no-repeat;
570
- }
571
-
572
- .preview_iframe_kk {
573
- width: 100%;
574
- height: 100%;
575
- }
576
-
577
-
578
- .preview_iframe_html {
579
- width: 100%;
580
- height: 100%;
581
- overflow-y: scroll;
582
- text-align: left;
583
- box-sizing: border-box;
584
- padding: 16px;
585
-
586
- /deep/.lake-content {
587
- margin-left: 10px;
588
- }
589
-
590
- /deep/a:link {
591
- color: #0000ee !important;
592
- }
593
-
594
- /deep/a:visited {
595
- color: #0000ee !important;
596
- }
597
-
598
- /deep/a:hover {
599
- color: #0000ee !important;
600
- }
601
-
602
- /deep/a:active {
603
- color: #0000ee !important;
604
- }
605
-
606
- /deep/li:not(.rich-text-li),
607
- ol:not(.list-paddingleft-2),
608
- ul:not(.list-paddingleft-2) {
609
- list-style-type: auto !important;
610
- }
611
-
612
- /deep/img {
613
- width: 100%;
614
- }
615
-
616
- /deep/.ne-table {
617
- width: 100% !important;
618
- }
619
- }
620
-
621
- .footer {
622
- width: calc(100% - 40px);
623
- height: 50px;
624
- display: flex;
625
- align-items: center;
626
- justify-content: space-between;
627
- cursor: pointer;
628
- padding: 0 20px;
629
- border-bottom: 1px solid #cccccc;
630
- }
631
-
632
- .loading_img {
633
- display: flex;
634
- align-items: center;
635
- justify-content: center;
636
- width: 100%;
637
- height: 100%;
638
- position: absolute;
639
- top: 0;
640
- left: 0;
641
- background: #FFF;
642
-
643
- img {
644
- width: 50px;
645
- height: 50px;
646
- }
647
- }
648
-
649
- .libang_head {
650
- height: 64px !important;
651
- }
652
-
653
- .drawer-header {
654
- width: 100%;
655
- height: 50px;
656
- cursor: pointer;
657
- padding: 6px 20px;
658
- border-bottom: 1px solid #cccccc;
659
- .btn_position {
660
- position: absolute;
661
- top: -34px;
662
- left: 12px;
663
- }
664
- .header-btn {
665
- display: flex;
666
- align-items: center;
667
- justify-content: space-between;
668
-
669
- .header-right {
670
- display: flex;
671
- }
672
-
673
- .summaryBtn {
674
- flex: none;
675
- //width: 95px;
676
- height: 26px;
677
- padding: 0 8px;
678
- background: #ffffff;
679
- display: flex;
680
- align-items: center;
681
- justify-content: center;
682
- box-sizing: border-box;
683
- border: 1px solid #a1b9ff;
684
- border-radius: 15px;
685
- cursor: pointer;
686
- color: #366aff;
687
- margin-right: 10px;
688
- font-size: 14px;
689
-
690
- i {
691
- font-size: 14px;
692
- margin-right: 5px;
693
- }
694
- }
695
-
696
- .summaryActiveBtn {
697
- background: #366aff !important;
698
- color: #ffffff !important;
699
- }
700
-
701
- .chat {
702
- flex: none;
703
- height: 26px;
704
- padding: 0 8px;
705
- background: #ffffff;
706
- display: flex;
707
- align-items: center;
708
- justify-content: center;
709
- box-sizing: border-box;
710
- border: 1px solid #a1b9ff;
711
- border-radius: 15px 0px 15px 15px;
712
- cursor: pointer;
713
- color: #366aff;
714
- margin-right: 10px;
715
- font-size: 14px;
716
-
717
- i {
718
- font-size: 14px;
719
- margin-right: 5px;
720
- margin-top: 2px;
721
- }
722
- }
723
-
724
- .chat_active {
725
- background: #366aff !important;
726
- color: #FFFFFF !important;
727
- }
728
- }
729
-
730
- .header_title {
731
- font-size: 14px;
732
- height: 100%;
733
- .header_close {
734
- display: flex;
735
- align-items: center;
736
- justify-content: space-between;
737
- line-height: 26px;
738
- }
739
- .header_floder {
740
- display: flex;
741
- align-items: center;
742
- line-height: 26px;
743
- i {
744
- margin: 0 5px;
745
- color: #366aff;
746
- }
747
- }
748
- .header_top {
749
- height: 100%;
750
- display: flex;
751
- align-items: center;
752
- justify-content: space-between;
753
- }
754
- }
755
- }
756
-
757
- @media screen and (max-width: 767px) {
758
-
759
- /* 这里是针对移动设备的css样式设置 */
760
- /deep/.el-drawer__body {
761
- height: 100%;
762
- }
763
-
764
- #drawer_content_pre {
765
- overflow: auto;
766
- height: calc(100% - 50px);
767
- background: #FFF;
768
- }
769
-
770
- .libang_content_pre {
771
- height: calc(100% - 64px) !important;
772
- }
773
- }
774
-
775
- @media screen and (min-width: 768px) {
776
-
777
- /* 这里是针对pc设备的css样式设置 */
778
- /deep/.el-drawer__body {
779
- height: 100%;
780
- }
781
-
782
- #drawer_content_pre {
783
- overflow: auto;
784
- height: calc(100% - 50px);
785
- background: #FFF;
786
- }
787
-
788
- .libang_content_pre {
789
- height: calc(100% - 64px) !important;
790
- }
791
- }
792
-
793
- @media screen and (min-width: 1200px) {
794
-
795
- /* 这里是针对pc设备的css样式设置 */
796
- .el-drawer__wrapper {
797
- width: 55%;
798
- left: calc(100vw - 55%);
799
- right: 0;
800
-
801
- /deep/.pdf-preview-drawer {
802
- width: 100% !important;
803
- }
804
- }
805
-
806
- /deep/.el-drawer__body {
807
- height: 100%;
808
- }
809
-
810
- #drawer_content_pre {
811
- overflow: auto;
812
- height: calc(100% - 50px);
813
- background: #FFF;
814
- }
815
-
816
- .libang_content_pre {
817
- height: calc(100% - 64px) !important;
818
- }
819
- }
820
- </style>
821
- <style lang="less">
822
- .pdf-preview-drawer {
823
- overflow: visible !important;
824
- }
825
- .libang_content_pre {
826
- .change_scale {
827
- top: 64px !important;
828
- }
829
- .float_intelligentSummary {
830
- top: 74px !important;
831
- }
832
- }
833
- </style>
1
+
2
+ <!-- preview-pdf
3
+ 组件主要负责 知识项目中 文件的预览,携带定位信息参数 tagIds tagId 的会解析文件增加定位功能
4
+ 不携带定位信息的 也是走 kkview项目预览
5
+ 另外增加了在知识项目中预览当前文件的一些功能
6
+ -->
7
+ <template>
8
+ <el-drawer title="" :visible.sync="drawer" :with-header="false" :append-to-body="true" :destroy-on-close="true"
9
+ :modal="false" :direction="!isPc ? 'btt' : 'rtl'" :size="!isPc ? '90%' : '65%'"
10
+ custom-class="pdf-preview-drawer" v-if="drawer">
11
+ <div class="drawer-header" :class="(isDownload || (isHasChat && fileType != 'IMAGE')) && isLiBang ? 'has_btn_libang_head' : (isLiBang ? 'libang_head' : (isDownload || (isHasChat && fileType != 'IMAGE') ? 'has_btn_head' : ''))" v-if="!isPc">
12
+ <div class="header_title">
13
+ <template v-if="isDownload || (isHasChat && fileType != 'IMAGE')">
14
+ <div class="top-header">
15
+ <div class="header-btn">
16
+ <div class="onload_btn" v-if="isDownload" @click="downLoad">
17
+ {{ $t('dragonCommon.download') }}
18
+ </div>
19
+ <div class="summaryBtn" :class="showSummary ? 'summaryActiveBtn' : ''" @click="summaryFun" v-if="isHasChat && fileType != 'IMAGE'">
20
+ <i class="iconfont guoran-tongyichicun-write-29-jiqiren"></i>
21
+ <span>{{ $t('dragonCommon.smartSummary') }}</span>
22
+ </div>
23
+ <template v-if="isHasChat && fileType != 'IMAGE'">
24
+ <div class="chat" @click="previewToDialog(true)" v-if="!previewKnowledgeId">
25
+ <i class="iconfont guoran-wendapingjia"></i>
26
+ {{ $t('dragonCommon.chat') }}
27
+ </div>
28
+ <div class="chat chat_active" @click="previewToDialog(false)" v-else>
29
+ <i class="iconfont guoran-wendapingjia"></i>
30
+ {{ $t('dragonCommon.chat') }}
31
+ </div>
32
+ </template>
33
+ </div>
34
+ <section @click="close">
35
+ <i class="iconfont guoran-shanchu"></i>
36
+ </section>
37
+ </div>
38
+ <span class="title_left">
39
+ {{ title ? title : $t('dragonCommon.viewDetails') }}
40
+ </span>
41
+ </template>
42
+ <div class="header_close" v-else>
43
+ <span class="title_left">
44
+ {{ title ? title : $t('dragonCommon.viewDetails') }}
45
+ </span>
46
+ <section @click="close">
47
+ <i class="iconfont guoran-shanchu"></i>
48
+ </section>
49
+ </div>
50
+ <p v-if="folderName && isLiBang" class="header_floder" @click="clickFloder">
51
+ <i class="iconfont guoran-tongyichicun-wenjianjia-zhankaizhuangtai--folderOpen"></i>
52
+ {{ folderName }}
53
+ <i v-if="folderUrl" class="iconfont guoran-tongyichicun-dianjichakantuli"></i>
54
+ </p>
55
+ </div>
56
+ </div>
57
+ <div class="drawer-header" :class="isLiBang && folderName ? 'libang_head' : ''" v-else>
58
+ <div class="header_title">
59
+ <div :class="isLiBang && folderName ? 'header_close' : 'header_top'">
60
+ <span class="title_left">
61
+ {{ title ? title : $t('dragonCommon.viewDetails') }}
62
+ </span>
63
+ <div class="header-btn">
64
+ <div class="onload_btn" v-if="isDownload" @click="downLoad">
65
+ {{ $t('dragonCommon.download') }}
66
+ </div>
67
+ <div class="summaryBtn" :class="showSummary ? 'summaryActiveBtn' : ''" @click="summaryFun"
68
+ v-if="isHasChat && fileType != 'IMAGE'">
69
+ <i class="iconfont guoran-tongyichicun-write-29-jiqiren"></i>
70
+ <span>{{ $t('dragonCommon.smartSummary') }}</span>
71
+ </div>
72
+ <template v-if="isHasChat && fileType != 'IMAGE'">
73
+ <div class="chat" @click="previewToDialog(true)" v-if="!previewKnowledgeId">
74
+ <i class="iconfont guoran-wendapingjia"></i>
75
+ {{ $t('dragonCommon.chat') }}
76
+ </div>
77
+ <div class="chat chat_active" @click="previewToDialog(false)" v-else>
78
+ <i class="iconfont guoran-wendapingjia"></i>
79
+ {{ $t('dragonCommon.chat') }}
80
+ </div>
81
+ </template>
82
+ <section @click="close">
83
+ <i class="iconfont guoran-shanchu"></i>
84
+ </section>
85
+ </div>
86
+ </div>
87
+ <p v-if="folderName && isLiBang" class="header_floder" @click="clickFloder">
88
+ <i class="iconfont guoran-tongyichicun-wenjianjia-zhankaizhuangtai--folderOpen"></i>
89
+ {{ folderName }}
90
+ <i v-if="folderUrl" class="iconfont guoran-tongyichicun-dianjichakantuli"></i>
91
+ </p>
92
+ </div>
93
+ </div>
94
+ <div id="drawer_content_pre" :class="(isDownload || (isHasChat && fileType != 'IMAGE')) && !isPc && isLiBang && folderName ? 'has_btn_libang_content_pre' : (isLiBang && folderName ? 'libang_content_pre' : '')">
95
+ <intelligent-summary v-show="showSummary && (isHasChat && fileType != 'IMAGE')" :tagIds="tagIds" :knowledgeId="knowledgeId"
96
+ @closeSummary="closeSummary" @recommendQues="recommendQues"
97
+ @getSummarySuccess="getSummarySuccess"></intelligent-summary>
98
+ <div class="pdf_positon" :style="pdfStyle" v-if="tagIds && tagIds.length != 0 && drawer && newVersion === false && newFileType !== 'PPT' && newFileType !== 'PPTX' && newFileType !== 'IMAGE'">
99
+ <pdfPosition :tagIds="tagIds" :isMessageRecord="isMessageRecord" :textWatermarkStr="textWatermarkStr">
100
+ </pdfPosition>
101
+ </div>
102
+ <new-position-preview
103
+ ref="newPositionPreview"
104
+ v-else-if="tagIds && tagIds.length!= 0 && newVersion && newFileType !== 'PPT' && newFileType !== 'PPTX' && newFileType !== 'IMAGE'"
105
+ :knowledgeId="knowledgeId"
106
+ :tagIds="tagIds"
107
+ :url="previewHref"
108
+ :textWatermarkStr="textWatermarkStr"
109
+ :previewOssPath="previewOssPath"
110
+ :isLining="isLining"
111
+ ></new-position-preview>
112
+ <template v-else>
113
+ <div v-if="fileType == 'VIDEO'" style="width: 100%;">
114
+ <video :src="url" controls width="100%;" height="98%"></video>
115
+ </div>
116
+ <div v-else-if="fileType == 'HTML'" style="width: 100%;">
117
+ <div class="preview_iframe_html" style="text-align:left" v-html="fileText"></div>
118
+ </div>
119
+ <template v-else-if="url.includes('https://www') || url.includes('http://www')">
120
+ <iframe class="preview_iframe" :src="url" width="100%" height="100%" scrolling="100%" frameborder="no"
121
+ border="0"></iframe>
122
+ </template>
123
+ <template v-else>
124
+ <iframe class="preview_iframe_kk" :src="previewUrl" style="border:none;"
125
+ :style="{ height: iframeHeight }"></iframe>
126
+ <template v-if="!loading && ((newFileType === 'PPT' || newFileType === 'PPTX') && pageChunkData.length > 1)">
127
+ <div class="btn_footer" v-if="!isPc">
128
+ <div class="prev" @click="prev">{{$t('dragonCommon.previous')}}</div>
129
+ <div class="next" @click="next">{{$t('dragonCommon.next')}}</div>
130
+ </div>
131
+ <div id="pagination" v-if="isPc">
132
+ <el-pagination :current-page="currentPage + 1" @current-change="currentChange" @prev-click="prev"
133
+ @next-click="next" layout="slot, prev, pager, next" :page-size="1" :total="pageChunkData.length">
134
+ <span class="total-class">{{$t('dragonCommon.answersGeneratedByPre')}} {{ pageChunkData.length }} {{$t('dragonCommon.answersGeneratedByAfter')}}</span>
135
+ </el-pagination>
136
+ </div>
137
+ </template>
138
+ </template>
139
+ </template>
140
+ </div>
141
+ <div class="loading_img" v-show="loading">
142
+ <img src="https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif" alt="">
143
+ </div>
144
+ <div id="text">
145
+ {{ copy }}
146
+ </div>
147
+ </el-drawer>
148
+ </template>
149
+
150
+ <script>
151
+ import pdfPosition from './pdfPosition.vue'
152
+ import { zoomElement } from '../assets/js/hammer'
153
+ import IntelligentSummary from "./intelligentSummary";
154
+ import { isMobile } from "../assets/js/common";
155
+ import { Toast } from 'vant';
156
+ import NewPositionPreview from "./preview/newPositionPreview";
157
+ export default {
158
+ data () {
159
+ return {
160
+ previewShowPopup: false,
161
+ fileText: '',
162
+ fileType: "",
163
+ isPc: false,
164
+ drawer: false,
165
+ tagIds: [],
166
+ // '6454aa1a70573a6ead6f0f7d', '6454aa1a70573a6ead6f0f81',
167
+ loading: true,
168
+ previewKnowledgeId: "",
169
+ showSummary: false,
170
+ iframeHeight: "100%",
171
+ isDownload: false,
172
+ textWatermarkStr: "",
173
+ copy:'',
174
+ newVersion:'',
175
+ previewHref:"",
176
+ newFileType:"",
177
+ numberPage:0,
178
+ pageChunkData:[],
179
+ currentPage:0
180
+ }
181
+ },
182
+ mounted () {
183
+ this.$i18n.locale = sessionStorage.getItem("systemLanguage") || 'cn';
184
+ window.addEventListener('message', this.handleIframeMessage, false);
185
+ this.isPcFun();
186
+ },
187
+ props: {
188
+ url: {
189
+ type: String,
190
+ required: true,
191
+ },
192
+ officePreviewType: {
193
+ type: String,
194
+ default: ''
195
+ },
196
+ isMessageRecord: {
197
+ type: Boolean,
198
+ default: false,
199
+ },
200
+ sourceFileType: {
201
+ type: String,
202
+ default: '',
203
+ },
204
+ title: {
205
+ type: String,
206
+ default: ''
207
+ },
208
+ isHasChat: {
209
+ type: Boolean,
210
+ default: false
211
+ },
212
+ knowledgeId: {
213
+ type: String,
214
+ default: '',
215
+ },
216
+ previewOssPath: {
217
+ type: String,
218
+ default: '',
219
+ },
220
+ folderName: {
221
+ type: String,
222
+ default: '',
223
+ },
224
+ folderUrl: {
225
+ type: String,
226
+ default: '',
227
+ },
228
+ isLiBang: {
229
+ type: Boolean,
230
+ default: false
231
+ },
232
+ isLining:{
233
+ type: Boolean,
234
+ default: false
235
+ },
236
+ processEnvUrl:{
237
+ type: String,
238
+ default: ''
239
+ },
240
+ isProduction:{
241
+ type: Boolean,
242
+ default: false
243
+ }
244
+ },
245
+ components: {
246
+ NewPositionPreview,
247
+ IntelligentSummary,
248
+ pdfPosition
249
+ },
250
+ watch: {
251
+ drawer (value) {
252
+ if (value) {
253
+ this.$emit('open')
254
+ this.$nextTick(() => {
255
+ zoomElement(document.getElementById('drawer_content_pre'))
256
+ })
257
+ } else {
258
+ this.$emit('close')
259
+ }
260
+ },
261
+ showSummary: {
262
+ handler (val) {
263
+ // if (!val){
264
+ // this.$nextTick(() => {
265
+ // let preCon = document.querySelector('.pdf_view');
266
+ // if (preCon){
267
+ // preCon.style.height = 'calc(100% - ' + 50 + 'px)'
268
+ // }
269
+ // })
270
+ // } else {
271
+ // this.getSummarySuccess();
272
+ // }
273
+ if (val) {
274
+ this.getSummarySuccess();
275
+ }
276
+ }
277
+ },
278
+ knowledgeId: {
279
+ handler (val) {
280
+ if (val) {
281
+ this.getTextWatermark();
282
+ }
283
+ }
284
+ }
285
+ },
286
+ computed: {
287
+ pdfStyle () {
288
+ return {
289
+ paddingTop: this.isPc ? '30px' : '0', // 30px 是 加上外层的 20 流出 50的上边距展示 放大缩小操作栏
290
+ paddingBottom: this.tagIds > 1 ? '60px' : '0',
291
+ height: '100%'
292
+ }
293
+ },
294
+ previewUrl () {
295
+ let url = ""
296
+ if (process.env.VUE_APP_ENV == 'production'){
297
+ url = "https://kkfileview.askbot.cn/onlinePreview?url="
298
+ } else {
299
+ url = "https://test.open.askbot.cn/kkfileview/onlinePreview?url="
300
+ }
301
+ if (this.processEnvUrl){
302
+ url = this.processEnvUrl
303
+ }
304
+ if(process.env.VUE_APP_SOURCE == 'lining_test') {
305
+ url = 'https://wxgw.lining.com/askbot/kkfileview/onlinePreview?url='
306
+ }
307
+ console.debug('VUE_APP_ENV', process.env.VUE_APP_ENV,process.env.VUE_APP_SOURCE,url)
308
+ // if(this.url != '') {
309
+ // if(/[\u4E00-\u9FA5]+/g.test(this.url)) {
310
+ // url += btoa(encodeURIComponent(this.url))
311
+ // } else {
312
+ // url += btoa(this.url)
313
+ // }
314
+ // }
315
+ url = url + this.url
316
+ if (this.sourceFileType == '.ppt' || this.sourceFileType == '.pptx' || this.sourceFileType == '.pdf') {
317
+ url += '&officePreviewType=pdf'
318
+ }
319
+ console.log('textWatermarkStr 216', this.textWatermarkStr)
320
+ if (this.textWatermarkStr) {
321
+ url += '&textWatermarkValue=' + this.textWatermarkStr
322
+ }
323
+ if (this.isLining){
324
+ url += '&isLining=true'
325
+ }
326
+ return url
327
+ },
328
+ // fileType() {
329
+ // const fileType = this.url.substring(this.url.lastIndexOf('.'));
330
+ // if (fileType === '.mp4' || fileType === '.MP4' || fileType === '.MOV' || fileType === '.mov') {
331
+ // return 'VIDEO'
332
+ // } else {
333
+ // return 'OTHER'
334
+ // }
335
+
336
+ // }
337
+ },
338
+ methods: {
339
+ close () {
340
+ setTimeout(() => {
341
+ this.previewShowPopup = false;
342
+ this.fileType = ''
343
+ }, 300)
344
+ this.drawer = false;
345
+ this.showSummary = false;
346
+ },
347
+ loadIframe () {
348
+
349
+ if (this.fileType == 'VIDEO' || this.fileType == 'WECHAT' || (this.tagIds && this.tagIds.length != 0 && this.newFileType !== 'PPT' && this.newFileType !== 'PPTX' && this.newFileType !== 'IMAGE')) {
350
+ this.loading = false
351
+ } else {
352
+ let iframe = document.getElementsByClassName('preview_iframe')[0] || document.getElementsByClassName('preview_iframe_kk')[0];
353
+ if (iframe) {
354
+ iframe.onload = () => {
355
+ this.loading = false;
356
+ document.getElementById('drawer_content_pre').style.backgroundImage = 'none'
357
+ }
358
+ }
359
+ // let time = setInterval(() =>{
360
+ //
361
+ // if(iframe) {
362
+ // this.loading = false
363
+ // clearInterval(time)
364
+ // }
365
+ // }, 500)
366
+ }
367
+ },
368
+ getBolb () {
369
+ this.$http.post('/knowledge-api/knowledge/htmlTextDeal?onlyText=false', {
370
+ fileInOssPath: this.url,
371
+ templateId: ''
372
+ }).then(res => {
373
+ if (res.data.code == 0) {
374
+ this.fileText = res.data.data
375
+ this.loading = false
376
+ }
377
+ })
378
+ },
379
+ previewToDialog (flag) {
380
+ this.$emit('previewToDialog', flag)
381
+ },
382
+ closeSummary () {
383
+ this.showSummary = false;
384
+ },
385
+ recommendQues (item, knowledgeId) {
386
+ console.log('recommendQues', item, knowledgeId);
387
+ this.$emit('recommendQues', item, knowledgeId)
388
+ },
389
+ handleIframeMessage (res) {
390
+ if (res.data.type == 'getViewerHeight') {
391
+ let iframeHeight = this.iframeHeight.replace('px', '')
392
+ if (res.data.data && iframeHeight != (res.data.data + 50)) {
393
+ this.iframeHeight = res.data.data + 50 + 'px'
394
+ }
395
+ }
396
+ if (res.data.type == 'getViewPage' && res.data.data){
397
+ this.numberPage = Number(res.data.data);
398
+ if (this.pageChunkData.length > 0){
399
+ this.scrollPPTPage(this.pageChunkData[0])
400
+ }
401
+ }
402
+ if (res.data.type == 'getViewerHeight' || res.data.type == 'getViewPage'){
403
+ if (this.pageChunkData.length > 0){
404
+ this.scrollPPTPage(this.pageChunkData[0])
405
+ }
406
+ }
407
+ },
408
+ summaryFun () {
409
+ this.showSummary = !this.showSummary;
410
+ if (this.showSummary) {
411
+ document.getElementById('drawer_content_pre').scrollTop = 0;
412
+ }
413
+ },
414
+ getSummarySuccess () {
415
+ this.$nextTick(() => {
416
+ // if (this.tagIds.length > 0){
417
+ // let intelligentSummary = document.getElementById('intelligentSummary');
418
+ // let preCon = document.querySelector('.pdf_view')
419
+ // if (intelligentSummary){
420
+ // let height = intelligentSummary.offsetHeight + (this.isPc ? 100 : 50 );
421
+ // if (preCon){
422
+ // preCon.style.height = 'calc(100% - ' + height + 'px)'
423
+ // }
424
+ // console.log('height',height,preCon)
425
+ // }
426
+ // }
427
+ // let intelligentSummary = document.getElementById('intelligentSummary');
428
+ // let height = intelligentSummary.offsetHeight
429
+ // this.pdfStyle.height = 'calc(100% - ' + height + 'px)'
430
+ })
431
+ },
432
+ getTextWatermark () {
433
+ let url = '/knowledge-api/open/knowledge/getPermissionInfo';
434
+ let obj = {
435
+ "knowledgeId": this.knowledgeId,
436
+ "userId": sessionStorage.getItem('_currentUserId'),
437
+ "mainId": sessionStorage.getItem('_mainId'),
438
+ "corpId": sessionStorage.getItem('_corpid')
439
+ }
440
+ this.$http.post(url, obj).then(res => {
441
+ console.log('getTextWatermark', res.data.data)
442
+ if (res.data.data) {
443
+ this.textWatermarkStr = res.data.data.textWatermarkStr;
444
+ this.isDownload = res.data.data.showDownloadBtn;
445
+ }
446
+ })
447
+ },
448
+ downLoad () {
449
+ let url = this.previewOssPath
450
+ if (decodeURIComponent(url) != url) {
451
+ url = decodeURIComponent(url)
452
+ }
453
+ const fileType = url.substring(url.lastIndexOf('.'));
454
+ this.$http.post('/knowledge-api/temporary-certificate/or-origin?expired=10', url, {
455
+ headers: {
456
+ "Content-Type": "application/json",
457
+ }
458
+ }).then(res => {
459
+ console.log('downLoad 341', res)
460
+ if (res.data || res.bodyText) {
461
+ if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
462
+ this.copy = res.data
463
+ if (isMobile()) {
464
+ setTimeout(() =>{
465
+ const range = document.createRange();
466
+ range.selectNode(document.getElementById('text'));
467
+ const selection = window.getSelection();
468
+ //移除之前选中内容
469
+ if (selection.rangeCount > 0) selection.removeAllRanges();
470
+ selection.addRange(range);
471
+ document.execCommand('copy');
472
+ selection.removeAllRanges()
473
+ Toast(this.$t('dragonCommon.Safaridownload'));
474
+ this.close()
475
+ },100)
476
+ } else {
477
+ let a = document.createElement('a')
478
+ a.href = res.data
479
+ a.download = (this.title) + fileType
480
+ a.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }))
481
+ }
482
+ return
483
+ } else {
484
+ // setTimeout(() =>{
485
+ // window.open(res.data,'下载', 'noopener')
486
+ // }, 2000)
487
+ // window.open(res.data,'下载', 'noopener')
488
+ if (isMobile()) {
489
+ const iframe = document.createElement("iframe");
490
+ iframe.setAttribute("hidden", "hidden");
491
+ iframe.onload = () => {
492
+ if (iframe) {
493
+ console.log("iframe onload....")
494
+ iframe.setAttribute('src', 'about:blank');
495
+ }
496
+ };
497
+ document.body.insertBefore(iframe, null);
498
+ iframe.setAttribute("src", res.data);
499
+ } else {
500
+ let a = document.createElement('a')
501
+ a.href = res.data
502
+ a.download = (this.title) + fileType
503
+ a.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }))
504
+ }
505
+ this.close()
506
+ }
507
+ }
508
+ })
509
+ },
510
+ isPcFun () {
511
+ if (/(iPhone|iPad|iPod|iOS|Android)/i.test(navigator.userAgent)) {
512
+ this.isPc = false
513
+ } else {
514
+ let documentWidth = document.documentElement.clientWidth;
515
+ if(documentWidth < 750) {
516
+ this.isPc = false
517
+ } else {
518
+ this.isPc = true
519
+ }
520
+ }
521
+ },
522
+ clickFloder() {
523
+ this.$emit('previewClickFloder')
524
+ },
525
+ getOssPath(url){
526
+ let httpUrl = '/knowledge-api/knowledge/getTemporaryCertificate';
527
+ let type = this.getFileType(url)
528
+ this.newFileType = type;
529
+ console.log('type',type)
530
+ if (type === 'VIDEO' || type === 'PDF' || type === 'EXCEL' || type === 'TXT' || type === 'DOC' || type === 'MD') {
531
+ httpUrl += '?needEncrypt=false'
532
+ } else {
533
+ httpUrl += '?needEncrypt=true'
534
+ }
535
+ this.$http.post(httpUrl, {
536
+ "fileInOssPath": url
537
+ }).then(res => {
538
+ console.log('getOssPath',res)
539
+ if (res.data.code == '0'){
540
+ this.previewHref = res.data.data;
541
+ }
542
+ })
543
+ },
544
+ getFileType(url){
545
+ let index = url.lastIndexOf('?')
546
+ let newFileInOssPath = url.substring(0, url.indexOf("?"))
547
+ if (index == -1){
548
+ newFileInOssPath = url
549
+ }
550
+ const fileType = newFileInOssPath.substring(newFileInOssPath.lastIndexOf('.'));
551
+ if (fileType === '.mp4' || fileType === '.MP4' || fileType === '.MOV' || fileType === '.MOVC' || fileType === '.mov' || fileType === '.movc') {
552
+ return 'VIDEO'
553
+ } else if (fileType === '.html') {
554
+ return 'HTML'
555
+ } else if (fileType === '.png' || fileType === '.jpg' || fileType === '.jpeg' || fileType === '.PNG' || fileType === '.JPG' || fileType === '.JPEG') {
556
+ return 'IMAGE'
557
+ } else if (fileType === '.docx' || fileType === '.doc'){
558
+ return 'DOC'
559
+ } else if (fileType === '.ppt' || fileType === '.pptx'){
560
+ return 'PPT'
561
+ } else if (fileType === '.pdf'){
562
+ return 'PDF'
563
+ } else if (fileType === '.txt'){
564
+ return 'TXT'
565
+ } else if (fileType === '.md'){
566
+ return 'MD'
567
+ } else {
568
+ return 'OTHER'
569
+ }
570
+ },
571
+ //判断是否使用新定位组件
572
+ getLocationInfo(){
573
+ this.newVersion = "";
574
+ this.$http.get('/knowledge-api/knowledge/knowledge-part-location-info/list?ids=' + this.tagIds.join(',')).then(res => {
575
+ console.log('getLocationInfo',res)
576
+ this.pageChunkData = [];
577
+ if (res.data.code == 0){
578
+ if (res.data.data && res.data.data.length > 0 && res.data.data[0].extractVersion == 'v3'){
579
+ this.newVersion = true;
580
+ if (this.newFileType !== 'PPT' && this.newFileType !== 'PPTX' && this.newFileType !== 'IMAGE'){
581
+ this.loading = false;
582
+ }
583
+ for (let i=0;i<res.data.data.length;i++){
584
+ if (res.data.data[i].paragraphChunkInfo && res.data.data[i].paragraphChunkInfo.pageChunkData){
585
+ this.pageChunkData.push(res.data.data[i].paragraphChunkInfo.pageChunkData.page_number)
586
+ }
587
+ }
588
+ if (this.pageChunkData.length > 1){
589
+ let iframe = document.getElementsByClassName('preview_iframe_kk')
590
+ if (iframe && iframe.length > 0){
591
+ iframe[0].style.paddingBottom = '50px'
592
+ }
593
+ }
594
+ } else {
595
+ this.newVersion = false;
596
+ }
597
+ }
598
+ })
599
+ },
600
+ currentChange (value) {
601
+ this.currentPage = value - 1;
602
+ this.scrollPPTPage()
603
+ },
604
+ prev(){
605
+ if (this.currentPage == 0){
606
+ return
607
+ }
608
+ this.currentPage--;
609
+ this.scrollPPTPage()
610
+ },
611
+ next(){
612
+ if (this.currentPage === (this.pageChunkData.length - 1)){
613
+ return;
614
+ }
615
+ this.currentPage++;
616
+ this.scrollPPTPage()
617
+ },
618
+ scrollPPTPage(){
619
+ if (this.numberPage > 0){
620
+ let pageNumber = this.pageChunkData[this.currentPage];
621
+ let height = Math.floor(Number(this.iframeHeight.replace('px',"")));
622
+ let pageHeight = Math.floor(height / this.numberPage);
623
+ let scrollHeight = (pageNumber - 1) * pageHeight;
624
+ let dom = document.getElementById('drawer_content_pre');
625
+ if (dom){
626
+ dom.scrollTo(0,scrollHeight)
627
+ }
628
+ }
629
+ }
630
+ },
631
+ beforeDestroy () {
632
+ window.removeEventListener('message', this.handleIframeMessage);
633
+ }
634
+ }
635
+ </script>
636
+
637
+ <style lang="less" scoped>
638
+ @import "../assets/less/variables.less";
639
+
640
+ #drawer_content_pre {
641
+ padding: 20px;
642
+ scroll-behavior: smooth;
643
+
644
+ .mobile_onload_btn {
645
+ position: absolute;
646
+ right: 0;
647
+ bottom: 10%;
648
+ width: 20px;
649
+ height: 60px;
650
+ display: flex;
651
+ align-items: center;
652
+ justify-content: center;
653
+ cursor: pointer;
654
+ border-top-left-radius: 10px;
655
+ border-bottom-left-radius: 10px;
656
+ color: @font-primary-accent-color;
657
+ background: @background-color-light;
658
+ border: 1px solid @border-color-copy;
659
+ font-size: 12px;
660
+ border-right: none;
661
+ text-align: center;
662
+ }
663
+
664
+ .pdf_positon {
665
+ width: 100%;
666
+ box-sizing: border-box;
667
+ }
668
+ }
669
+
670
+ .onload_btn {
671
+ width: 76px;
672
+ height: 26px;
673
+ display: flex;
674
+ align-items: center;
675
+ justify-content: center;
676
+ cursor: pointer;
677
+ margin-right: 10px;
678
+ border-radius: 15px;
679
+ color: @font-primary-accent-color;
680
+ background: @background-color-light;
681
+ border: 1px solid @border-color-copy;
682
+ box-sizing: border-box;
683
+ }
684
+
685
+ .preview_iframe {
686
+ width: 100%;
687
+ height: 100%;
688
+ box-sizing: border-box;
689
+ background-image: url('https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif');
690
+ background-position: center;
691
+ background-size: 50px;
692
+ background-repeat: no-repeat;
693
+ }
694
+
695
+ .preview_iframe_kk {
696
+ width: 100%;
697
+ height: 100%;
698
+ }
699
+ .btn_footer {
700
+ width: 100%;
701
+ height: 60px;
702
+ display: flex;
703
+ align-items: center;
704
+ justify-content: space-around;
705
+ position: absolute;
706
+ bottom: 0px;
707
+ left: 0;
708
+ z-index: 999;
709
+ background: @background-color-light;
710
+
711
+ .prev,
712
+ .next {
713
+ width: 35%;
714
+ height: 40px;
715
+ display: flex;
716
+ align-items: center;
717
+ justify-content: center;
718
+ border-radius: 50px;
719
+ cursor: pointer;
720
+ }
721
+
722
+ .prev {
723
+ background: @background-color-prev;
724
+ color: @font-primary-color;
725
+ }
726
+
727
+ .next {
728
+ background: @primary-color;
729
+ color: @font-primary-light-color;
730
+ }
731
+ }
732
+ #pagination {
733
+ .total-class {
734
+ margin-right: 13px;
735
+ font-weight: 400;
736
+ }
737
+
738
+ position: absolute;
739
+ bottom: 0px;
740
+ right: 0;
741
+ width: 100%;
742
+ display: flex;
743
+ align-items: center;
744
+ justify-content: center;
745
+ height: 50px;
746
+ background-color: @background-color-light;
747
+ box-shadow: 0px 0px 18px 0px rgba(29, 55, 129, 0.07);
748
+ border-radius: 5px;
749
+ z-index: 1000;
750
+
751
+
752
+
753
+ /deep/.el-pagination {
754
+ margin-right: 110px;
755
+ }
756
+
757
+ /deep/.el-pager {
758
+ background: @background-color-pagination;
759
+ border-radius: 15px;
760
+ }
761
+
762
+ /deep/.el-pagination.is-background .btn-next {
763
+ width: 30px;
764
+ height: 30px;
765
+ background: @background-color-pagination;
766
+ border-radius: 50%;
767
+ }
768
+
769
+ /deep/.el-pagination .btn-next {
770
+ width: 30px;
771
+ height: 30px;
772
+ background: @background-color-pagination;
773
+ border-radius: 50%;
774
+ padding-left: 0;
775
+ margin-left: 5px;
776
+ }
777
+
778
+ /deep/.el-pagination .btn-prev {
779
+ width: 30px;
780
+ height: 30px;
781
+ background: @background-color-pagination;
782
+ border-radius: 50%;
783
+ padding-right: 0;
784
+ margin-right: 5px;
785
+ }
786
+
787
+ /deep/.el-pagination button {
788
+ padding: 0;
789
+ min-width: 30px;
790
+ }
791
+
792
+ /deep/.el-pager li {
793
+ background: @background-color-pagination;
794
+ height: 30px;
795
+ min-width: 30px;
796
+ line-height: 30px;
797
+ font-size: 12px;
798
+ color: @font-pagination-color;
799
+ }
800
+
801
+ /deep/.el-pager li:first-child {
802
+ border-bottom-left-radius: 15px !important;
803
+ border-top-left-radius: 15px !important;
804
+ }
805
+
806
+ /deep/.el-pager li:last-child {
807
+ border-top-right-radius: 15px !important;
808
+ border-bottom-right-radius: 15px !important;
809
+ }
810
+
811
+ /deep/.el-pager li.active {
812
+ width: 30px;
813
+ height: 30px;
814
+ min-width: 30px;
815
+ background: @primary-color;
816
+ border: 3px solid @border-color-copy;
817
+ border-radius: 50%;
818
+ line-height: 24px;
819
+ color: @font-primary-light-color;
820
+ }
821
+
822
+ /deep/.el-pagination.is-background .el-pager li:not(.disabled).active {
823
+ background: @primary-color;
824
+ }
825
+ }
826
+ .preview_iframe_html {
827
+ width: 100%;
828
+ height: 100%;
829
+ overflow-y: scroll;
830
+ text-align: left;
831
+ box-sizing: border-box;
832
+ padding: 16px;
833
+
834
+ /deep/.lake-content {
835
+ margin-left: 10px;
836
+ }
837
+
838
+ /deep/a:link {
839
+ color: #0000ee !important;
840
+ }
841
+
842
+ /deep/a:visited {
843
+ color: #0000ee !important;
844
+ }
845
+
846
+ /deep/a:hover {
847
+ color: #0000ee !important;
848
+ }
849
+
850
+ /deep/a:active {
851
+ color: #0000ee !important;
852
+ }
853
+
854
+ /deep/li:not(.rich-text-li),
855
+ ol:not(.list-paddingleft-2),
856
+ ul:not(.list-paddingleft-2) {
857
+ list-style-type: auto !important;
858
+ }
859
+
860
+ /deep/img {
861
+ width: 100%;
862
+ }
863
+
864
+ /deep/.ne-table {
865
+ width: 100% !important;
866
+ }
867
+ }
868
+
869
+ .footer {
870
+ width: calc(100% - 40px);
871
+ height: 50px;
872
+ display: flex;
873
+ align-items: center;
874
+ justify-content: space-between;
875
+ cursor: pointer;
876
+ padding: 0 20px;
877
+ border-bottom: 1px solid @border-color-r5;
878
+ }
879
+
880
+ .loading_img {
881
+ display: flex;
882
+ align-items: center;
883
+ justify-content: center;
884
+ width: 100%;
885
+ height: 100%;
886
+ position: absolute;
887
+ top: 0;
888
+ left: 0;
889
+ background: @background-color-light;
890
+
891
+ img {
892
+ width: 50px;
893
+ height: 50px;
894
+ }
895
+ }
896
+
897
+ .libang_head {
898
+ height: 64px !important;
899
+ }
900
+ .has_btn_libang_head{
901
+ height: 85px!important;
902
+ }
903
+ .has_btn_head{
904
+ height: 60px!important;
905
+ }
906
+ .drawer-header {
907
+ width: 100%;
908
+ height: 50px;
909
+ cursor: pointer;
910
+ padding: 6px 20px;
911
+ border-bottom: 1px solid @border-color-r5;
912
+ .btn_position {
913
+ position: absolute;
914
+ top: -34px;
915
+ left: 12px;
916
+ }
917
+
918
+ .header-btn {
919
+ display: flex;
920
+ align-items: center;
921
+ justify-content: space-between;
922
+ flex: none;
923
+ .header-right {
924
+ display: flex;
925
+ }
926
+ .summaryBtn {
927
+ flex: none;
928
+ //width: 95px;
929
+ height: 26px;
930
+ padding: 0 8px;
931
+ background: @background-color-light;
932
+ display: flex;
933
+ align-items: center;
934
+ justify-content: center;
935
+ box-sizing: border-box;
936
+ border: 1px solid @border-color-copy;
937
+ border-radius: 15px;
938
+ cursor: pointer;
939
+ color: @font-primary-accent-color;
940
+ margin-right: 10px;
941
+ font-size: 14px;
942
+
943
+ i {
944
+ font-size: 14px;
945
+ margin-right: 5px;
946
+ }
947
+ }
948
+
949
+ .summaryActiveBtn {
950
+ background: @primary-color !important;
951
+ color: @font-primary-light-color !important;
952
+ }
953
+
954
+ .chat {
955
+ flex: none;
956
+ height: 26px;
957
+ padding: 0 8px;
958
+ background: @background-color-light;
959
+ display: flex;
960
+ align-items: center;
961
+ justify-content: center;
962
+ box-sizing: border-box;
963
+ border: 1px solid @border-color-copy;
964
+ border-radius: 15px 0px 15px 15px;
965
+ cursor: pointer;
966
+ color: @font-primary-accent-color;
967
+ margin-right: 10px;
968
+ font-size: 14px;
969
+
970
+ i {
971
+ font-size: 14px;
972
+ margin-right: 5px;
973
+ margin-top: 2px;
974
+ }
975
+ }
976
+
977
+ .chat_active {
978
+ background: @primary-color !important;
979
+ color: @font-primary-light-color !important;
980
+ }
981
+ }
982
+
983
+ .header_title {
984
+ font-size: 14px;
985
+ height: 100%;
986
+ .header_close {
987
+ display: flex;
988
+ align-items: center;
989
+ justify-content: space-between;
990
+ line-height: 26px;
991
+ }
992
+ .title_left {
993
+ white-space: nowrap; /* 确保文本不会换行 */
994
+ overflow: hidden; /* 隐藏超出容器的文本 */
995
+ text-overflow: ellipsis; /* 当文本超出容器时显示省略号 */
996
+ margin-right: 8px;
997
+ text-align: left;
998
+ }
999
+ .top-header{
1000
+ display: flex;
1001
+ align-items: center;
1002
+ justify-content: flex-end;
1003
+ margin-bottom: 6px;
1004
+ }
1005
+ .header_floder {
1006
+ display: flex;
1007
+ align-items: center;
1008
+ line-height: 26px;
1009
+ text-align: left;
1010
+ i {
1011
+ margin: 0 5px;
1012
+ color: @font-primary-accent-color;
1013
+ }
1014
+ }
1015
+ .header_top {
1016
+ height: 100%;
1017
+ display: flex;
1018
+ align-items: center;
1019
+ justify-content: space-between;
1020
+ }
1021
+ }
1022
+ }
1023
+ .has_btn_libang_content_pre{
1024
+ height: calc(100% - 85px) !important;
1025
+ }
1026
+ @media screen and (max-width: 767px) {
1027
+
1028
+ /* 这里是针对移动设备的css样式设置 */
1029
+ /deep/.el-drawer__body {
1030
+ height: 100%;
1031
+ }
1032
+
1033
+ #drawer_content_pre {
1034
+ overflow: auto;
1035
+ height: calc(100% - 50px);
1036
+ background: @background-color-light;
1037
+ background-image: url('https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif');
1038
+ background-position: center;
1039
+ background-size: 50px;
1040
+ background-repeat: no-repeat;
1041
+ }
1042
+
1043
+ .libang_content_pre {
1044
+ height: calc(100% - 64px) !important;
1045
+ }
1046
+ }
1047
+
1048
+ @media screen and (min-width: 768px) {
1049
+
1050
+ /* 这里是针对pc设备的css样式设置 */
1051
+ /deep/.el-drawer__body {
1052
+ height: 100%;
1053
+ }
1054
+
1055
+ #drawer_content_pre {
1056
+ overflow: auto;
1057
+ height: calc(100% - 50px);
1058
+ background: @background-color-light;
1059
+ }
1060
+
1061
+ .libang_content_pre {
1062
+ height: calc(100% - 64px) !important;
1063
+ }
1064
+ }
1065
+
1066
+ @media screen and (min-width: 1200px) {
1067
+
1068
+ /* 这里是针对pc设备的css样式设置 */
1069
+ .el-drawer__wrapper {
1070
+ width: 55%;
1071
+ left: calc(100vw - 55%);
1072
+ right: 0;
1073
+
1074
+ /deep/.pdf-preview-drawer {
1075
+ width: 100% !important;
1076
+ }
1077
+ }
1078
+
1079
+ /deep/.el-drawer__body {
1080
+ height: 100%;
1081
+ }
1082
+
1083
+ #drawer_content_pre {
1084
+ overflow: auto;
1085
+ height: calc(100% - 50px);
1086
+ background: @background-color-light;
1087
+ }
1088
+
1089
+ .libang_content_pre {
1090
+ height: calc(100% - 64px) !important;
1091
+ }
1092
+ }
1093
+ </style>
1094
+ <style lang="less">
1095
+ .pdf-preview-drawer {
1096
+ overflow: visible !important;
1097
+ }
1098
+ .libang_content_pre {
1099
+ .change_scale {
1100
+ top: 64px !important;
1101
+ }
1102
+ .float_intelligentSummary {
1103
+ top: 74px !important;
1104
+ }
1105
+ }
1106
+ </style>