@tencentcloud/ai-desk-customer-vue 0.1.2 → 0.1.4

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