@tencentcloud/ai-desk-customer-vue 0.1.0

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 (351) hide show
  1. package/.code.yml +17 -0
  2. package/.eslintignore +6 -0
  3. package/.stylelintrc.json +40 -0
  4. package/CHANGELOG.md +5 -0
  5. package/README.md +12 -0
  6. package/adapter-vue-web.ts +73 -0
  7. package/adapter-vue.ts +10 -0
  8. package/assets/audio-before-delete.svg +4 -0
  9. package/assets/audio-blue.png +0 -0
  10. package/assets/audio-bubble-blue.svg +3 -0
  11. package/assets/audio-bubble-red.svg +3 -0
  12. package/assets/audio-delete.svg +10 -0
  13. package/assets/audio.svg +6 -0
  14. package/assets/back.svg +16 -0
  15. package/assets/background_mobile.png +0 -0
  16. package/assets/camera-uni.png +0 -0
  17. package/assets/close-quote-icon.svg +3 -0
  18. package/assets/customer_avatar.png +0 -0
  19. package/assets/customer_avatar_mobile.png +0 -0
  20. package/assets/dialog-close.png +0 -0
  21. package/assets/double-arrow.svg +1 -0
  22. package/assets/download.svg +6 -0
  23. package/assets/emoji.png +0 -0
  24. package/assets/face-uni.png +0 -0
  25. package/assets/face.png +0 -0
  26. package/assets/file-h5.png +0 -0
  27. package/assets/files.png +0 -0
  28. package/assets/form-dialog-bg.png +0 -0
  29. package/assets/icon-arrow-left.svg +7 -0
  30. package/assets/icon-close.svg +6 -0
  31. package/assets/iconRight.svg +3 -0
  32. package/assets/icon_form.png +0 -0
  33. package/assets/icon_form_filled.png +0 -0
  34. package/assets/icon_question.png +0 -0
  35. package/assets/icon_refresh.png +0 -0
  36. package/assets/icon_success.png +0 -0
  37. package/assets/imRobotGuess.svg +4 -0
  38. package/assets/image-uni.png +0 -0
  39. package/assets/image.png +0 -0
  40. package/assets/keyboard_icon.png +0 -0
  41. package/assets/loading.png +0 -0
  42. package/assets/more-uni.png +0 -0
  43. package/assets/more_tools.png +0 -0
  44. package/assets/msg-audio.svg +1 -0
  45. package/assets/msg-copy.svg +30 -0
  46. package/assets/msg-del.svg +33 -0
  47. package/assets/msg-quote.svg +8 -0
  48. package/assets/msg-revoke.svg +29 -0
  49. package/assets/radio-check.png +0 -0
  50. package/assets/radio-uncheck.png +0 -0
  51. package/assets/radio.svg +6 -0
  52. package/assets/refresh.svg +4 -0
  53. package/assets/rotate-left.svg +7 -0
  54. package/assets/rotate-right.svg +7 -0
  55. package/assets/star.png +0 -0
  56. package/assets/starLine.png +0 -0
  57. package/assets/translate.svg +12 -0
  58. package/assets/video-play.png +0 -0
  59. package/assets/video-uni.png +0 -0
  60. package/assets/video.png +0 -0
  61. package/assets/zoom-in.svg +9 -0
  62. package/assets/zoom-out.svg +9 -0
  63. package/components/CustomerServiceChat/chat-header/index-web.vue +141 -0
  64. package/components/CustomerServiceChat/emoji-config/custom-emoji.ts +15 -0
  65. package/components/CustomerServiceChat/emoji-config/default-emoji.ts +114 -0
  66. package/components/CustomerServiceChat/emoji-config/index.ts +140 -0
  67. package/components/CustomerServiceChat/emoji-config/locales/en.ts +66 -0
  68. package/components/CustomerServiceChat/emoji-config/locales/zh_cn.ts +66 -0
  69. package/components/CustomerServiceChat/index-web.vue +250 -0
  70. package/components/CustomerServiceChat/message-input/index-web.vue +214 -0
  71. package/components/CustomerServiceChat/message-input/index.ts +2 -0
  72. package/components/CustomerServiceChat/message-input/message-input-button.vue +95 -0
  73. package/components/CustomerServiceChat/message-input/message-input-editor-web.vue +884 -0
  74. package/components/CustomerServiceChat/message-input/message-input-file-web.ts +38 -0
  75. package/components/CustomerServiceChat/message-input/message-input-quote/index.vue +204 -0
  76. package/components/CustomerServiceChat/message-input-toolbar/emoji-dialog-mobile/emoji-dialog-mobile.vue +145 -0
  77. package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/emoji-picker-dialog.vue +180 -0
  78. package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/index.ts +2 -0
  79. package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/index.vue +90 -0
  80. package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/style/h5.scss +26 -0
  81. package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/style/index.scss +4 -0
  82. package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/style/web.scss +55 -0
  83. package/components/CustomerServiceChat/message-input-toolbar/file-upload/index.ts +2 -0
  84. package/components/CustomerServiceChat/message-input-toolbar/file-upload/index.vue +77 -0
  85. package/components/CustomerServiceChat/message-input-toolbar/image-upload/index.ts +2 -0
  86. package/components/CustomerServiceChat/message-input-toolbar/image-upload/index.vue +185 -0
  87. package/components/CustomerServiceChat/message-input-toolbar/index-web.vue +191 -0
  88. package/components/CustomerServiceChat/message-input-toolbar/index.ts +2 -0
  89. package/components/CustomerServiceChat/message-input-toolbar/style/uni.scss +111 -0
  90. package/components/CustomerServiceChat/message-input-toolbar/toolbar-item-container/index.vue +149 -0
  91. package/components/CustomerServiceChat/message-input-toolbar/toolbar-item-container/style/color.scss +6 -0
  92. package/components/CustomerServiceChat/message-input-toolbar/toolbar-item-container/style/h5.scss +20 -0
  93. package/components/CustomerServiceChat/message-input-toolbar/toolbar-item-container/style/index.scss +5 -0
  94. package/components/CustomerServiceChat/message-input-toolbar/toolbar-item-container/style/uni.scss +36 -0
  95. package/components/CustomerServiceChat/message-input-toolbar/toolbar-item-container/style/web.scss +19 -0
  96. package/components/CustomerServiceChat/message-input-toolbar/video-upload/index.ts +2 -0
  97. package/components/CustomerServiceChat/message-input-toolbar/video-upload/index.vue +146 -0
  98. package/components/CustomerServiceChat/message-list/index-web.vue +712 -0
  99. package/components/CustomerServiceChat/message-list/link/index.ts +23 -0
  100. package/components/CustomerServiceChat/message-list/message-elements/message-audio-web.vue +223 -0
  101. package/components/CustomerServiceChat/message-list/message-elements/message-bubble-web.vue +504 -0
  102. package/components/CustomerServiceChat/message-list/message-elements/message-custom.vue +5 -0
  103. package/components/CustomerServiceChat/message-list/message-elements/message-face.vue +45 -0
  104. package/components/CustomerServiceChat/message-list/message-elements/message-file.vue +151 -0
  105. package/components/CustomerServiceChat/message-list/message-elements/message-image-web.vue +97 -0
  106. package/components/CustomerServiceChat/message-list/message-elements/message-location.vue +34 -0
  107. package/components/CustomerServiceChat/message-list/message-elements/message-quote/index-web.vue +286 -0
  108. package/components/CustomerServiceChat/message-list/message-elements/message-quote/interface.ts +60 -0
  109. package/components/CustomerServiceChat/message-list/message-elements/message-record/index.vue +139 -0
  110. package/components/CustomerServiceChat/message-list/message-elements/message-text.vue +94 -0
  111. package/components/CustomerServiceChat/message-list/message-elements/message-timestamp.vue +76 -0
  112. package/components/CustomerServiceChat/message-list/message-elements/message-video-web.vue +319 -0
  113. package/components/CustomerServiceChat/message-list/message-elements/plugins/plugin-components/index.ts +9 -0
  114. package/components/CustomerServiceChat/message-list/message-elements/plugins/plugin-components/message-customer/index.ts +5 -0
  115. package/components/CustomerServiceChat/message-list/message-elements/plugins/plugin-components/message-customer/message-customer-service.vue +22 -0
  116. package/components/CustomerServiceChat/message-list/message-elements/plugins/plugin-components/message-plugin-layout-web.vue +133 -0
  117. package/components/CustomerServiceChat/message-list/message-elements/plugins/plugin-components/message-plugin-web.vue +83 -0
  118. package/components/CustomerServiceChat/message-list/message-elements/read-status/index.vue +193 -0
  119. package/components/CustomerServiceChat/message-list/message-elements/simple-message-list/index.vue +462 -0
  120. package/components/CustomerServiceChat/message-list/message-elements/simple-message-list/message-container.vue +105 -0
  121. package/components/CustomerServiceChat/message-list/message-elements/video-play.vue +59 -0
  122. package/components/CustomerServiceChat/message-list/message-tool/index-web.vue +312 -0
  123. package/components/CustomerServiceChat/message-list/message-tool/message-revoked.vue +63 -0
  124. package/components/CustomerServiceChat/message-list/scroll-button/index.vue +201 -0
  125. package/components/CustomerServiceChat/message-list/style/color.scss +32 -0
  126. package/components/CustomerServiceChat/message-list/style/h5.scss +16 -0
  127. package/components/CustomerServiceChat/message-list/style/index.scss +11 -0
  128. package/components/CustomerServiceChat/message-list/style/web.scss +180 -0
  129. package/components/CustomerServiceChat/style/common.scss +59 -0
  130. package/components/CustomerServiceChat/style/h5.scss +51 -0
  131. package/components/CustomerServiceChat/style/index.scss +12 -0
  132. package/components/CustomerServiceChat/style/uni.scss +13 -0
  133. package/components/CustomerServiceChat/style/web.scss +46 -0
  134. package/components/CustomerServiceChat/style/wx.scss +5 -0
  135. package/components/CustomerServiceChat/utils/conversationDraft.ts +86 -0
  136. package/components/CustomerServiceChat/utils/sendMessage.ts +140 -0
  137. package/components/common/Avatar/index.vue +148 -0
  138. package/components/common/BottomPopup/index.ts +3 -0
  139. package/components/common/BottomPopup/index.vue +160 -0
  140. package/components/common/BottomPopup/style/h5.scss +62 -0
  141. package/components/common/BottomPopup/style/index.scss +3 -0
  142. package/components/common/BottomPopup/style/modal.scss +5 -0
  143. package/components/common/Dialog/index.ts +3 -0
  144. package/components/common/Dialog/index.vue +120 -0
  145. package/components/common/Dialog/style/color.scss +43 -0
  146. package/components/common/Dialog/style/dialog.scss +4 -0
  147. package/components/common/Dialog/style/h5.scss +56 -0
  148. package/components/common/Dialog/style/web.scss +61 -0
  149. package/components/common/Drawer/index.vue +164 -0
  150. package/components/common/Icon.vue +83 -0
  151. package/components/common/ImagePreviewer/image-item-web.vue +42 -0
  152. package/components/common/ImagePreviewer/index-web.vue +682 -0
  153. package/components/common/ImagePreviewer/index.ts +3 -0
  154. package/components/common/Overlay/index.vue +126 -0
  155. package/components/common/ProgressMessage/index.vue +95 -0
  156. package/components/common/RadioSelect/index.vue +59 -0
  157. package/components/common/RichText/LICENSE +21 -0
  158. package/components/common/RichText/README.md +244 -0
  159. package/components/common/RichText/dist/mp-alipay/index.acss +1 -0
  160. package/components/common/RichText/dist/mp-alipay/index.axml +1 -0
  161. package/components/common/RichText/dist/mp-alipay/index.js +8 -0
  162. package/components/common/RichText/dist/mp-alipay/index.json +1 -0
  163. package/components/common/RichText/dist/mp-alipay/node/node.acss +1 -0
  164. package/components/common/RichText/dist/mp-alipay/node/node.axml +1 -0
  165. package/components/common/RichText/dist/mp-alipay/node/node.js +1 -0
  166. package/components/common/RichText/dist/mp-alipay/node/node.json +1 -0
  167. package/components/common/RichText/dist/mp-alipay/parser.js +1 -0
  168. package/components/common/RichText/dist/mp-baidu/index.css +1 -0
  169. package/components/common/RichText/dist/mp-baidu/index.js +8 -0
  170. package/components/common/RichText/dist/mp-baidu/index.json +1 -0
  171. package/components/common/RichText/dist/mp-baidu/index.swan +1 -0
  172. package/components/common/RichText/dist/mp-baidu/node/node.css +1 -0
  173. package/components/common/RichText/dist/mp-baidu/node/node.js +1 -0
  174. package/components/common/RichText/dist/mp-baidu/node/node.json +1 -0
  175. package/components/common/RichText/dist/mp-baidu/node/node.swan +1 -0
  176. package/components/common/RichText/dist/mp-baidu/parser.js +1 -0
  177. package/components/common/RichText/dist/mp-qq/index.js +8 -0
  178. package/components/common/RichText/dist/mp-qq/index.json +1 -0
  179. package/components/common/RichText/dist/mp-qq/index.qml +1 -0
  180. package/components/common/RichText/dist/mp-qq/index.qss +1 -0
  181. package/components/common/RichText/dist/mp-qq/node/node.js +1 -0
  182. package/components/common/RichText/dist/mp-qq/node/node.json +1 -0
  183. package/components/common/RichText/dist/mp-qq/node/node.qml +1 -0
  184. package/components/common/RichText/dist/mp-qq/node/node.qss +1 -0
  185. package/components/common/RichText/dist/mp-qq/parser.js +1 -0
  186. package/components/common/RichText/dist/mp-toutiao/index.js +8 -0
  187. package/components/common/RichText/dist/mp-toutiao/index.json +1 -0
  188. package/components/common/RichText/dist/mp-toutiao/index.ttml +1 -0
  189. package/components/common/RichText/dist/mp-toutiao/index.ttss +1 -0
  190. package/components/common/RichText/dist/mp-toutiao/node/node.js +1 -0
  191. package/components/common/RichText/dist/mp-toutiao/node/node.json +1 -0
  192. package/components/common/RichText/dist/mp-toutiao/node/node.ttml +1 -0
  193. package/components/common/RichText/dist/mp-toutiao/node/node.ttss +1 -0
  194. package/components/common/RichText/dist/mp-toutiao/parser.js +1 -0
  195. package/components/common/RichText/dist/mp-weixin/index.js +8 -0
  196. package/components/common/RichText/dist/mp-weixin/index.json +1 -0
  197. package/components/common/RichText/dist/mp-weixin/index.wxml +1 -0
  198. package/components/common/RichText/dist/mp-weixin/index.wxss +1 -0
  199. package/components/common/RichText/dist/mp-weixin/node/node.js +1 -0
  200. package/components/common/RichText/dist/mp-weixin/node/node.json +1 -0
  201. package/components/common/RichText/dist/mp-weixin/node/node.wxml +1 -0
  202. package/components/common/RichText/dist/mp-weixin/node/node.wxss +1 -0
  203. package/components/common/RichText/dist/mp-weixin/parser.js +1 -0
  204. package/components/common/RichText/dist/uni-app/components/mp-html/mp-html.vue +498 -0
  205. package/components/common/RichText/dist/uni-app/components/mp-html/node/node.vue +587 -0
  206. package/components/common/RichText/dist/uni-app/components/mp-html/parser.js +1393 -0
  207. package/components/common/RichText/dist/uni-app/static/app-plus/mp-html/js/handler.js +1 -0
  208. package/components/common/RichText/dist/uni-app/static/app-plus/mp-html/js/uni.webview.min.js +1 -0
  209. package/components/common/RichText/dist/uni-app/static/app-plus/mp-html/local.html +1 -0
  210. package/components/common/RichText/docs/.nojekyll +0 -0
  211. package/components/common/RichText/docs/index.html +50 -0
  212. package/components/common/RichText/docs/lib/docsify.min.js +1 -0
  213. package/components/common/RichText/docs/lib/prism-bash.min.js +1 -0
  214. package/components/common/RichText/docs/lib/search.min.js +1 -0
  215. package/components/common/RichText/docs/lib/vue.css +858 -0
  216. package/components/common/RichText/gulpfile.js +113 -0
  217. package/components/common/RichText/lint.js +63 -0
  218. package/components/common/RichText/package.json +74 -0
  219. package/components/common/RichText/plugins/README.md +2 -0
  220. package/components/common/RichText/plugins/audio/README.md +25 -0
  221. package/components/common/RichText/plugins/audio/build.js +11 -0
  222. package/components/common/RichText/plugins/audio/context.js +7 -0
  223. package/components/common/RichText/plugins/audio/index.js +34 -0
  224. package/components/common/RichText/plugins/audio/miniprogram/audio.js +189 -0
  225. package/components/common/RichText/plugins/audio/miniprogram/audio.json +3 -0
  226. package/components/common/RichText/plugins/audio/miniprogram/audio.wxml +17 -0
  227. package/components/common/RichText/plugins/audio/miniprogram/audio.wxss +127 -0
  228. package/components/common/RichText/plugins/audio/miniprogram/build.js +3 -0
  229. package/components/common/RichText/plugins/audio/uni-app/audio.vue +269 -0
  230. package/components/common/RichText/plugins/audio/uni-app/build.js +3 -0
  231. package/components/common/RichText/plugins/card/README.md +30 -0
  232. package/components/common/RichText/plugins/card/build.js +14 -0
  233. package/components/common/RichText/plugins/card/index.js +7 -0
  234. package/components/common/RichText/plugins/card/miniprogram/build.js +3 -0
  235. package/components/common/RichText/plugins/card/miniprogram/card.js +26 -0
  236. package/components/common/RichText/plugins/card/miniprogram/card.json +3 -0
  237. package/components/common/RichText/plugins/card/miniprogram/card.wxml +9 -0
  238. package/components/common/RichText/plugins/card/miniprogram/card.wxss +55 -0
  239. package/components/common/RichText/plugins/card/uni-app/build.js +3 -0
  240. package/components/common/RichText/plugins/card/uni-app/card.vue +122 -0
  241. package/components/common/RichText/plugins/editable/README.md +137 -0
  242. package/components/common/RichText/plugins/editable/config.js +15 -0
  243. package/components/common/RichText/plugins/editable/miniprogram/build.js +813 -0
  244. package/components/common/RichText/plugins/editable/miniprogram/index.js +551 -0
  245. package/components/common/RichText/plugins/editable/uni-app/build.js +744 -0
  246. package/components/common/RichText/plugins/editable/uni-app/index.js +553 -0
  247. package/components/common/RichText/plugins/emoji/README.md +15 -0
  248. package/components/common/RichText/plugins/emoji/index.js +203 -0
  249. package/components/common/RichText/plugins/highlight/README.md +26 -0
  250. package/components/common/RichText/plugins/highlight/config.js +5 -0
  251. package/components/common/RichText/plugins/highlight/index.js +96 -0
  252. package/components/common/RichText/plugins/highlight/miniprogram/build.js +88 -0
  253. package/components/common/RichText/plugins/highlight/prism.css +125 -0
  254. package/components/common/RichText/plugins/highlight/prism.min.js +7 -0
  255. package/components/common/RichText/plugins/highlight/uni-app/build.js +88 -0
  256. package/components/common/RichText/plugins/img-cache/README.md +24 -0
  257. package/components/common/RichText/plugins/img-cache/build.js +16 -0
  258. package/components/common/RichText/plugins/img-cache/index.js +138 -0
  259. package/components/common/RichText/plugins/latex/README.md +16 -0
  260. package/components/common/RichText/plugins/latex/build.js +14 -0
  261. package/components/common/RichText/plugins/latex/index.js +77 -0
  262. package/components/common/RichText/plugins/latex/katex.css +1070 -0
  263. package/components/common/RichText/plugins/latex/katex.min.js +1 -0
  264. package/components/common/RichText/plugins/markdown/README.md +17 -0
  265. package/components/common/RichText/plugins/markdown/index.js +34 -0
  266. package/components/common/RichText/plugins/markdown/marked.min.js +6 -0
  267. package/components/common/RichText/plugins/markdown/miniprogram/build.js +70 -0
  268. package/components/common/RichText/plugins/markdown/uni-app/build.js +68 -0
  269. package/components/common/RichText/plugins/search/README.md +46 -0
  270. package/components/common/RichText/plugins/search/miniprogram/index.js +137 -0
  271. package/components/common/RichText/plugins/search/uni-app/index.js +132 -0
  272. package/components/common/RichText/plugins/style/README.md +30 -0
  273. package/components/common/RichText/plugins/style/index.js +129 -0
  274. package/components/common/RichText/plugins/style/parser.js +175 -0
  275. package/components/common/RichText/plugins/template/README.md +2 -0
  276. package/components/common/RichText/plugins/template/build.js +65 -0
  277. package/components/common/RichText/plugins/template/index.js +67 -0
  278. package/components/common/RichText/plugins/txv-video/README.md +18 -0
  279. package/components/common/RichText/plugins/txv-video/build.js +3 -0
  280. package/components/common/RichText/plugins/txv-video/index.js +46 -0
  281. package/components/common/RichText/plugins/txv-video/miniprogram/build.js +6 -0
  282. package/components/common/RichText/plugins/txv-video/uni-app/build.js +3 -0
  283. package/components/common/RichText/src/miniprogram/index.js +396 -0
  284. package/components/common/RichText/src/miniprogram/index.json +6 -0
  285. package/components/common/RichText/src/miniprogram/index.wxml +7 -0
  286. package/components/common/RichText/src/miniprogram/index.wxss +13 -0
  287. package/components/common/RichText/src/miniprogram/node/node.js +247 -0
  288. package/components/common/RichText/src/miniprogram/node/node.json +6 -0
  289. package/components/common/RichText/src/miniprogram/node/node.wxml +112 -0
  290. package/components/common/RichText/src/miniprogram/node/node.wxss +164 -0
  291. package/components/common/RichText/src/miniprogram/parser.js +1269 -0
  292. package/components/common/RichText/src/uni-app/components/mp-html/mp-html.vue +498 -0
  293. package/components/common/RichText/src/uni-app/components/mp-html/node/node.vue +585 -0
  294. package/components/common/RichText/src/uni-app/components/mp-html/parser.js +1393 -0
  295. package/components/common/RichText/src/uni-app/static/app-plus/mp-html/js/handler.js +254 -0
  296. package/components/common/RichText/src/uni-app/static/app-plus/mp-html/js/uni.webview.min.js +1 -0
  297. package/components/common/RichText/src/uni-app/static/app-plus/mp-html/local.html +33 -0
  298. package/components/common/RichText/tools/config.js +82 -0
  299. package/components/common/RichText/tools/converter.js +205 -0
  300. package/components/common/RichText/tools/ifdef.js +115 -0
  301. package/components/common/RichText/tools/minifier.js +40 -0
  302. package/components/common/RichText/tools/plugin.js +248 -0
  303. package/components/common/Toast/index-web.ts +122 -0
  304. package/components/common/Toast/index-web.vue +178 -0
  305. package/components/common/Toast/type.ts +8 -0
  306. package/components/common/common.scss +59 -0
  307. package/components/customer-icon.vue +56 -0
  308. package/components/message-branch.vue +120 -0
  309. package/components/message-customer-service.vue +114 -0
  310. package/components/message-form/form-branch.vue +68 -0
  311. package/components/message-form/form-input.vue +242 -0
  312. package/components/message-form/index.vue +80 -0
  313. package/components/message-multi-branch/branch-pc.vue +79 -0
  314. package/components/message-multi-branch/index.vue +60 -0
  315. package/components/message-multi-form/component-mobile/form-popup.vue +37 -0
  316. package/components/message-multi-form/component-mobile/input-mobile.vue +102 -0
  317. package/components/message-multi-form/component-mobile/label-mobile.vue +32 -0
  318. package/components/message-multi-form/component-mobile/radios-mobile.vue +161 -0
  319. package/components/message-multi-form/component-pc/input-pc.vue +93 -0
  320. package/components/message-multi-form/component-pc/label-pc.vue +33 -0
  321. package/components/message-multi-form/component-pc/radio-pc.vue +98 -0
  322. package/components/message-multi-form/form-mobile.vue +385 -0
  323. package/components/message-multi-form/form-pc.vue +184 -0
  324. package/components/message-multi-form/index.vue +61 -0
  325. package/components/message-product-card.vue +129 -0
  326. package/components/message-rating/index.vue +56 -0
  327. package/components/message-rating/message-rating-number.vue +247 -0
  328. package/components/message-rating/message-rating-star.vue +237 -0
  329. package/components/message-rich-text.vue +155 -0
  330. package/components/message-robot-welcome.vue +181 -0
  331. package/components/message-stream.vue +109 -0
  332. package/constant.ts +122 -0
  333. package/excluded-list.txt +6 -0
  334. package/index.ts +30 -0
  335. package/index.vue +60 -0
  336. package/interface.ts +176 -0
  337. package/logger/index.ts +12 -0
  338. package/logger/main.ts +120 -0
  339. package/package.json +62 -0
  340. package/script/fileCopy.js +60 -0
  341. package/script/syncVersion.js +35 -0
  342. package/server.ts +128 -0
  343. package/styles/common.scss +116 -0
  344. package/tsconfig.json +34 -0
  345. package/typings.d.ts +20 -0
  346. package/utils/chatStorage.ts +70 -0
  347. package/utils/copy-web.ts +141 -0
  348. package/utils/enableSampleTaskStatus.ts +8 -0
  349. package/utils/env.ts +15 -0
  350. package/utils/index.ts +59 -0
  351. package/utils/utils.ts +162 -0
@@ -0,0 +1,585 @@
1
+ <template>
2
+ <view :id="attrs.id" :class="'_block _'+name+' '+attrs.class" :style="attrs.style">
3
+ <block v-for="(n, i) in childs" v-bind:key="i">
4
+ <!-- 图片 -->
5
+ <!-- 占位图 -->
6
+ <image v-if="n.name==='img'&&!n.t&&((opts[1]&&!ctrl[i])||ctrl[i]<0)" class="_img" :style="n.attrs.style" :src="ctrl[i]<0?opts[2]:opts[1]" mode="widthFix" />
7
+ <!-- 显示图片 -->
8
+ <!-- #ifdef H5 || (APP-PLUS && VUE2) -->
9
+ <img v-if="n.name==='img'" :id="n.attrs.id" :class="'_img '+n.attrs.class" :style="(ctrl[i]===-1?'display:none;':'')+n.attrs.style" :src="n.attrs.src||(ctrl.load?n.attrs['data-src']:'')" :data-i="i" @load="imgLoad" @error="mediaError" @tap.stop="imgTap" @longpress="imgLongTap" />
10
+ <!-- #endif -->
11
+ <!-- #ifndef H5 || (APP-PLUS && VUE2) -->
12
+ <!-- 表格中的图片,使用 rich-text 防止大小不正确 -->
13
+ <rich-text v-if="n.name==='img'&&n.t" :style="'display:'+n.t" :nodes="[{attrs:{style:n.attrs.style||'',src:n.attrs.src},name:'img'}]" :data-i="i" @tap.stop="imgTap" />
14
+ <!-- #endif -->
15
+ <!-- #ifndef H5 || APP-PLUS || MP-KUAISHOU -->
16
+ <image v-else-if="n.name==='img'" :id="n.attrs.id" :class="'_img '+n.attrs.class" :style="(ctrl[i]===-1?'display:none;':'')+'width:'+(ctrl[i]||1)+'px;height:1px;'+n.attrs.style" :src="n.attrs.src" :mode="!n.h?'widthFix':(!n.w?'heightFix':(n.m||'scaleToFill'))" :lazy-load="opts[0]" :webp="n.webp" :show-menu-by-longpress="opts[3]&&!n.attrs.ignore" :image-menu-prevent="!opts[3]||n.attrs.ignore" :data-i="i" @load="imgLoad" @error="mediaError" @tap.stop="imgTap" @longpress="imgLongTap" />
17
+ <!-- #endif -->
18
+ <!-- #ifdef MP-KUAISHOU -->
19
+ <image v-else-if="n.name==='img'" :id="n.attrs.id" :class="'_img '+n.attrs.class" :style="(ctrl[i]===-1?'display:none;':'')+n.attrs.style" :src="n.attrs.src" :lazy-load="opts[0]" :data-i="i" @load="imgLoad" @error="mediaError" @tap.stop="imgTap"></image>
20
+ <!-- #endif -->
21
+ <!-- #ifdef APP-PLUS && VUE3 -->
22
+ <image v-else-if="n.name==='img'" :id="n.attrs.id" :class="'_img '+n.attrs.class" :style="(ctrl[i]===-1?'display:none;':'')+'width:'+(ctrl[i]||1)+'px;'+n.attrs.style" :src="n.attrs.src||(ctrl.load?n.attrs['data-src']:'')" :mode="!n.h?'widthFix':(!n.w?'heightFix':(n.m||''))" :data-i="i" @load="imgLoad" @error="mediaError" @tap.stop="imgTap" @longpress="imgLongTap" />
23
+ <!-- #endif -->
24
+ <!-- 文本 -->
25
+ <!-- #ifdef MP-WEIXIN -->
26
+ <text v-else-if="n.text" :user-select="opts[4]=='force'&&isiOS" decode>{{n.text}}</text>
27
+ <!-- #endif -->
28
+ <!-- #ifndef MP-WEIXIN || MP-BAIDU || MP-ALIPAY || MP-TOUTIAO -->
29
+ <text v-else-if="n.text" decode>{{n.text}}</text>
30
+ <!-- #endif -->
31
+ <text v-else-if="n.name==='br'">\n</text>
32
+ <!-- 链接 -->
33
+ <view v-else-if="n.name==='a'" :id="n.attrs.id" :class="(n.attrs.href?'_a ':'')+n.attrs.class" hover-class="_hover" :style="'display:inline;'+n.attrs.style" :data-i="i" @tap.stop="linkTap">
34
+ <node name="span" :childs="n.children" :opts="opts" style="display:inherit" />
35
+ </view>
36
+ <!-- 视频 -->
37
+ <!-- #ifdef APP-PLUS -->
38
+ <view v-else-if="n.html" :id="n.attrs.id" :class="'_video '+n.attrs.class" :style="n.attrs.style" v-html="n.html" @vplay.stop="play" />
39
+ <!-- #endif -->
40
+ <!-- #ifndef APP-PLUS -->
41
+ <video v-else-if="n.name==='video'" :id="n.attrs.id" :class="n.attrs.class" :style="n.attrs.style" :autoplay="n.attrs.autoplay" :controls="n.attrs.controls" :loop="n.attrs.loop" :muted="n.attrs.muted" :object-fit="n.attrs['object-fit']" :poster="n.attrs.poster" :src="n.src[ctrl[i]||0]" :data-i="i" @play="play" @error="mediaError" />
42
+ <!-- #endif -->
43
+ <!-- #ifdef H5 || APP-PLUS -->
44
+ <iframe v-else-if="n.name==='iframe'" :style="n.attrs.style" :allowfullscreen="n.attrs.allowfullscreen" :frameborder="n.attrs.frameborder" :src="n.attrs.src" />
45
+ <embed v-else-if="n.name==='embed'" :style="n.attrs.style" :src="n.attrs.src" />
46
+ <!-- #endif -->
47
+ <!-- #ifndef MP-TOUTIAO || ((H5 || APP-PLUS) && VUE3) -->
48
+ <!-- 音频 -->
49
+ <audio v-else-if="n.name==='audio'" :id="n.attrs.id" :class="n.attrs.class" :style="n.attrs.style" :author="n.attrs.author" :controls="n.attrs.controls" :loop="n.attrs.loop" :name="n.attrs.name" :poster="n.attrs.poster" :src="n.src[ctrl[i]||0]" :data-i="i" @play="play" @error="mediaError" />
50
+ <!-- #endif -->
51
+ <view v-else-if="(n.name==='table'&&n.c)||n.name==='li'" :id="n.attrs.id" :class="'_'+n.name+' '+n.attrs.class" :style="n.attrs.style">
52
+ <node v-if="n.name==='li'" :childs="n.children" :opts="opts" />
53
+ <view v-else v-for="(tbody, x) in n.children" v-bind:key="x" :class="'_'+tbody.name+' '+tbody.attrs.class" :style="tbody.attrs.style">
54
+ <node v-if="tbody.name==='td'||tbody.name==='th'" :childs="tbody.children" :opts="opts" />
55
+ <block v-else v-for="(tr, y) in tbody.children" v-bind:key="y">
56
+ <view v-if="tr.name==='td'||tr.name==='th'" :class="'_'+tr.name+' '+tr.attrs.class" :style="tr.attrs.style">
57
+ <node :childs="tr.children" :opts="opts" />
58
+ </view>
59
+ <view v-else :class="'_'+tr.name+' '+tr.attrs.class" :style="tr.attrs.style">
60
+ <view v-for="(td, z) in tr.children" v-bind:key="z" :class="'_'+td.name+' '+td.attrs.class" :style="td.attrs.style">
61
+ <node :childs="td.children" :opts="opts" />
62
+ </view>
63
+ </view>
64
+ </block>
65
+ </view>
66
+ </view>
67
+ <!-- insert -->
68
+ <!-- 富文本 -->
69
+ <!-- #ifdef H5 || ((MP-WEIXIN || MP-QQ || APP-PLUS || MP-360) && VUE2) -->
70
+ <rich-text v-else-if="!n.c&&!handler.isInline(n.name, n.attrs.style)" :id="n.attrs.id" :style="n.f" :user-select="opts[4]" :nodes="[n]" />
71
+ <!-- #endif -->
72
+ <!-- #ifndef H5 || ((MP-WEIXIN || MP-QQ || APP-PLUS || MP-360) && VUE2) -->
73
+ <rich-text v-else-if="!n.c" :id="n.attrs.id" :style="'display:inline;'+n.f" :preview="false" :selectable="opts[4]" :user-select="opts[4]" :nodes="[n]" />
74
+ <!-- #endif -->
75
+ <!-- 继续递归 -->
76
+ <view v-else-if="n.c===2" :id="n.attrs.id" :class="'_block _'+n.name+' '+n.attrs.class" :style="n.f+';'+n.attrs.style">
77
+ <node v-for="(n2, j) in n.children" v-bind:key="j" :style="n2.f" :name="n2.name" :attrs="n2.attrs" :childs="n2.children" :opts="opts" />
78
+ </view>
79
+ <node v-else :style="n.f" :name="n.name" :attrs="n.attrs" :childs="n.children" :opts="opts" />
80
+ </block>
81
+ </view>
82
+ </template>
83
+ <script module="handler" lang="wxs">
84
+ // 行内标签列表
85
+ var inlineTags = {
86
+ abbr: true,
87
+ b: true,
88
+ big: true,
89
+ code: true,
90
+ del: true,
91
+ em: true,
92
+ i: true,
93
+ ins: true,
94
+ label: true,
95
+ q: true,
96
+ small: true,
97
+ span: true,
98
+ strong: true,
99
+ sub: true,
100
+ sup: true
101
+ }
102
+ /**
103
+ * @description 判断是否为行内标签
104
+ */
105
+ module.exports = {
106
+ isInline: function (tagName, style) {
107
+ return inlineTags[tagName] || (style || '').indexOf('display:inline') !== -1
108
+ }
109
+ }
110
+ </script>
111
+ <script>
112
+ import node from './node'
113
+ export default {
114
+ name: 'node',
115
+ options: {
116
+ // #ifdef MP-WEIXIN
117
+ virtualHost: true,
118
+ // #endif
119
+ // #ifdef MP-TOUTIAO
120
+ addGlobalClass: false
121
+ // #endif
122
+ },
123
+ data () {
124
+ return {
125
+ ctrl: {},
126
+ // #ifdef MP-WEIXIN
127
+ isiOS: uni.getSystemInfoSync().system.includes('iOS')
128
+ // #endif
129
+ }
130
+ },
131
+ props: {
132
+ name: String,
133
+ attrs: {
134
+ type: Object,
135
+ default () {
136
+ return {}
137
+ }
138
+ },
139
+ childs: Array,
140
+ opts: Array
141
+ },
142
+ components: {
143
+ // #ifndef (H5 || APP-PLUS) && VUE3
144
+ node
145
+ // #endif
146
+ },
147
+ mounted () {
148
+ this.$nextTick(() => {
149
+ for (this.root = this.$parent; this.root.$options.name !== 'mp-html'; this.root = this.root.$parent);
150
+ })
151
+ // #ifdef H5 || APP-PLUS
152
+ if (this.opts[0]) {
153
+ let i
154
+ for (i = this.childs.length; i--;) {
155
+ if (this.childs[i].name === 'img') break
156
+ }
157
+ if (i !== -1) {
158
+ this.observer = uni.createIntersectionObserver(this).relativeToViewport({
159
+ top: 500,
160
+ bottom: 500
161
+ })
162
+ this.observer.observe('._img', res => {
163
+ if (res.intersectionRatio) {
164
+ this.$set(this.ctrl, 'load', 1)
165
+ this.observer.disconnect()
166
+ }
167
+ })
168
+ }
169
+ }
170
+ // #endif
171
+ },
172
+ beforeDestroy () {
173
+ // #ifdef H5 || APP-PLUS
174
+ if (this.observer) {
175
+ this.observer.disconnect()
176
+ }
177
+ // #endif
178
+ },
179
+ methods: {
180
+ // #ifdef MP-WEIXIN
181
+ toJSON () { return this },
182
+ // #endif
183
+ /**
184
+ * @description 播放视频事件
185
+ * @param {Event} e
186
+ */
187
+ play (e) {
188
+ const i = e.currentTarget.dataset.i
189
+ const node = this.childs[i]
190
+ this.root.$emit('play', {
191
+ source: node.name,
192
+ attrs: {
193
+ ...node.attrs,
194
+ src: node.src[this.ctrl[i] || 0]
195
+ }
196
+ })
197
+ // #ifndef APP-PLUS
198
+ if (this.root.pauseVideo) {
199
+ let flag = false
200
+ const id = e.target.id
201
+ for (let i = this.root._videos.length; i--;) {
202
+ if (this.root._videos[i].id === id) {
203
+ flag = true
204
+ } else {
205
+ this.root._videos[i].pause() // 自动暂停其他视频
206
+ }
207
+ }
208
+ // 将自己加入列表
209
+ if (!flag) {
210
+ const ctx = uni.createVideoContext(id
211
+ // #ifndef MP-BAIDU
212
+ , this
213
+ // #endif
214
+ )
215
+ ctx.id = id
216
+ if (this.root.playbackRate) {
217
+ ctx.playbackRate(this.root.playbackRate)
218
+ }
219
+ this.root._videos.push(ctx)
220
+ }
221
+ }
222
+ // #endif
223
+ },
224
+
225
+ /**
226
+ * @description 图片点击事件
227
+ * @param {Event} e
228
+ */
229
+ imgTap (e) {
230
+ const node = this.childs[e.currentTarget.dataset.i]
231
+ if (node.a) {
232
+ this.linkTap(node.a)
233
+ return
234
+ }
235
+ if (node.attrs.ignore) return
236
+ // #ifdef H5 || APP-PLUS
237
+ node.attrs.src = node.attrs.src || node.attrs['data-src']
238
+ // #endif
239
+ this.root.$emit('imgtap', node.attrs)
240
+ // 自动预览图片
241
+ if (this.root.previewImg) {
242
+ uni.previewImage({
243
+ // #ifdef MP-WEIXIN
244
+ showmenu: this.root.showImgMenu,
245
+ // #endif
246
+ // #ifdef MP-ALIPAY
247
+ enablesavephoto: this.root.showImgMenu,
248
+ enableShowPhotoDownload: this.root.showImgMenu,
249
+ // #endif
250
+ current: parseInt(node.attrs.i),
251
+ urls: this.root.imgList
252
+ })
253
+ }
254
+ },
255
+
256
+ /**
257
+ * @description 图片长按
258
+ */
259
+ imgLongTap (e) {
260
+ // #ifdef APP-PLUS
261
+ const attrs = this.childs[e.currentTarget.dataset.i].attrs
262
+ if (this.opts[3] && !attrs.ignore) {
263
+ uni.showActionSheet({
264
+ itemList: ['保存图片'],
265
+ success: () => {
266
+ const save = path => {
267
+ uni.saveImageToPhotosAlbum({
268
+ filePath: path,
269
+ success () {
270
+ uni.showToast({
271
+ title: '保存成功'
272
+ })
273
+ }
274
+ })
275
+ }
276
+ if (this.root.imgList[attrs.i].startsWith('http')) {
277
+ uni.downloadFile({
278
+ url: this.root.imgList[attrs.i],
279
+ success: res => save(res.tempFilePath)
280
+ })
281
+ } else {
282
+ save(this.root.imgList[attrs.i])
283
+ }
284
+ }
285
+ })
286
+ }
287
+ // #endif
288
+ },
289
+
290
+ /**
291
+ * @description 图片加载完成事件
292
+ * @param {Event} e
293
+ */
294
+ imgLoad (e) {
295
+ const i = e.currentTarget.dataset.i
296
+ /* #ifndef H5 || (APP-PLUS && VUE2) */
297
+ if (!this.childs[i].w) {
298
+ // 设置原宽度
299
+ this.$set(this.ctrl, i, e.detail.width)
300
+ } else /* #endif */ if ((this.opts[1] && !this.ctrl[i]) || this.ctrl[i] === -1) {
301
+ // 加载完毕,取消加载中占位图
302
+ this.$set(this.ctrl, i, 1)
303
+ }
304
+ this.checkReady()
305
+ },
306
+
307
+ /**
308
+ * @description 检查是否所有图片加载完毕
309
+ */
310
+ checkReady () {
311
+ if (this.root && !this.root.lazyLoad) {
312
+ this.root._unloadimgs -= 1
313
+ if (!this.root._unloadimgs) {
314
+ setTimeout(() => {
315
+ this.root.getRect().then(rect => {
316
+ this.root.$emit('ready', rect)
317
+ }).catch(() => {
318
+ this.root.$emit('ready', {})
319
+ })
320
+ }, 350)
321
+ }
322
+ }
323
+ },
324
+
325
+ /**
326
+ * @description 链接点击事件
327
+ * @param {Event} e
328
+ */
329
+ linkTap (e) {
330
+ const node = e.currentTarget ? this.childs[e.currentTarget.dataset.i] : {}
331
+ const attrs = node.attrs || e
332
+ const href = attrs.href
333
+ this.root.$emit('linktap', Object.assign({
334
+ innerText: this.root.getText(node.children || []) // 链接内的文本内容
335
+ }, attrs))
336
+ if (href) {
337
+ if (href[0] === '#') {
338
+ // 跳转锚点
339
+ this.root.navigateTo(href.substring(1)).catch(() => { })
340
+ } else if (href.split('?')[0].includes('://')) {
341
+ // 复制外部链接
342
+ if (this.root.copyLink) {
343
+ // #ifdef H5
344
+ window.open(href)
345
+ // #endif
346
+ // #ifdef MP
347
+ uni.setClipboardData({
348
+ data: href,
349
+ success: () =>
350
+ uni.showToast({
351
+ title: '链接已复制'
352
+ })
353
+ })
354
+ // #endif
355
+ // #ifdef APP-PLUS
356
+ plus.runtime.openWeb(href)
357
+ // #endif
358
+ }
359
+ } else {
360
+ // 跳转页面
361
+ uni.navigateTo({
362
+ url: href,
363
+ fail () {
364
+ uni.switchTab({
365
+ url: href,
366
+ fail () { }
367
+ })
368
+ }
369
+ })
370
+ }
371
+ }
372
+ },
373
+
374
+ /**
375
+ * @description 错误事件
376
+ * @param {Event} e
377
+ */
378
+ mediaError (e) {
379
+ const i = e.currentTarget.dataset.i
380
+ const node = this.childs[i]
381
+ // 加载其他源
382
+ if (node.name === 'video' || node.name === 'audio') {
383
+ let index = (this.ctrl[i] || 0) + 1
384
+ if (index > node.src.length) {
385
+ index = 0
386
+ }
387
+ if (index < node.src.length) {
388
+ this.$set(this.ctrl, i, index)
389
+ return
390
+ }
391
+ } else if (node.name === 'img') {
392
+ // #ifdef H5 && VUE3
393
+ if (this.opts[0] && !this.ctrl.load) return
394
+ // #endif
395
+ // 显示错误占位图
396
+ if (this.opts[2]) {
397
+ this.$set(this.ctrl, i, -1)
398
+ }
399
+ this.checkReady()
400
+ }
401
+ if (this.root) {
402
+ this.root.$emit('error', {
403
+ source: node.name,
404
+ attrs: node.attrs,
405
+ // #ifndef H5 && VUE3
406
+ errMsg: e.detail.errMsg
407
+ // #endif
408
+ })
409
+ }
410
+ }
411
+ }
412
+ }
413
+ </script>
414
+ <style>
415
+ /* a 标签默认效果 */
416
+ ._a {
417
+ padding: 1.5px 0 1.5px 0;
418
+ color: #366092;
419
+ word-break: break-all;
420
+ }
421
+
422
+ /* a 标签点击态效果 */
423
+ ._hover {
424
+ text-decoration: underline;
425
+ opacity: 0.7;
426
+ }
427
+
428
+ /* 图片默认效果 */
429
+ ._img {
430
+ max-width: 100%;
431
+ -webkit-touch-callout: none;
432
+ }
433
+
434
+ /* 内部样式 */
435
+
436
+ ._block {
437
+ display: block;
438
+ }
439
+
440
+ ._b,
441
+ ._strong {
442
+ font-weight: bold;
443
+ }
444
+
445
+ ._code {
446
+ font-family: monospace;
447
+ }
448
+
449
+ ._del {
450
+ text-decoration: line-through;
451
+ }
452
+
453
+ ._em,
454
+ ._i {
455
+ font-style: italic;
456
+ }
457
+
458
+ ._h1 {
459
+ font-size: 2em;
460
+ }
461
+
462
+ ._h2 {
463
+ font-size: 1.5em;
464
+ }
465
+
466
+ ._h3 {
467
+ font-size: 1.17em;
468
+ }
469
+
470
+ ._h5 {
471
+ font-size: 0.83em;
472
+ }
473
+
474
+ ._h6 {
475
+ font-size: 0.67em;
476
+ }
477
+
478
+ ._h1,
479
+ ._h2,
480
+ ._h3,
481
+ ._h4,
482
+ ._h5,
483
+ ._h6 {
484
+ display: block;
485
+ font-weight: bold;
486
+ }
487
+
488
+ ._image {
489
+ height: 1px;
490
+ }
491
+
492
+ ._ins {
493
+ text-decoration: underline;
494
+ }
495
+
496
+ ._li {
497
+ display: list-item;
498
+ }
499
+
500
+ ._ol {
501
+ list-style-type: decimal;
502
+ }
503
+
504
+ ._ol,
505
+ ._ul {
506
+ display: block;
507
+ padding-left: 40px;
508
+ margin: 1em 0;
509
+ }
510
+
511
+ ._q::before {
512
+ content: '"';
513
+ }
514
+
515
+ ._q::after {
516
+ content: '"';
517
+ }
518
+
519
+ ._sub {
520
+ font-size: smaller;
521
+ vertical-align: sub;
522
+ }
523
+
524
+ ._sup {
525
+ font-size: smaller;
526
+ vertical-align: super;
527
+ }
528
+
529
+ ._thead,
530
+ ._tbody,
531
+ ._tfoot {
532
+ display: table-row-group;
533
+ }
534
+
535
+ ._tr {
536
+ display: table-row;
537
+ }
538
+
539
+ ._td,
540
+ ._th {
541
+ display: table-cell;
542
+ vertical-align: middle;
543
+ }
544
+
545
+ ._th {
546
+ font-weight: bold;
547
+ text-align: center;
548
+ }
549
+
550
+ ._ul {
551
+ list-style-type: disc;
552
+ }
553
+
554
+ ._ul ._ul {
555
+ margin: 0;
556
+ list-style-type: circle;
557
+ }
558
+
559
+ ._ul ._ul ._ul {
560
+ list-style-type: square;
561
+ }
562
+
563
+ ._abbr,
564
+ ._b,
565
+ ._code,
566
+ ._del,
567
+ ._em,
568
+ ._i,
569
+ ._ins,
570
+ ._label,
571
+ ._q,
572
+ ._span,
573
+ ._strong,
574
+ ._sub,
575
+ ._sup {
576
+ display: inline;
577
+ }
578
+
579
+ /* #ifdef APP-PLUS */
580
+ ._video {
581
+ width: 300px;
582
+ height: 225px;
583
+ }
584
+ /* #endif */
585
+ </style>