@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.
- package/.code.yml +17 -0
- package/.eslintignore +6 -0
- package/.stylelintrc.json +40 -0
- package/CHANGELOG.md +5 -0
- package/README.md +12 -0
- package/adapter-vue-web.ts +73 -0
- package/adapter-vue.ts +10 -0
- package/assets/audio-before-delete.svg +4 -0
- package/assets/audio-blue.png +0 -0
- package/assets/audio-bubble-blue.svg +3 -0
- package/assets/audio-bubble-red.svg +3 -0
- package/assets/audio-delete.svg +10 -0
- package/assets/audio.svg +6 -0
- package/assets/back.svg +16 -0
- package/assets/background_mobile.png +0 -0
- package/assets/camera-uni.png +0 -0
- package/assets/close-quote-icon.svg +3 -0
- package/assets/customer_avatar.png +0 -0
- package/assets/customer_avatar_mobile.png +0 -0
- package/assets/dialog-close.png +0 -0
- package/assets/double-arrow.svg +1 -0
- package/assets/download.svg +6 -0
- package/assets/emoji.png +0 -0
- package/assets/face-uni.png +0 -0
- package/assets/face.png +0 -0
- package/assets/file-h5.png +0 -0
- package/assets/files.png +0 -0
- package/assets/form-dialog-bg.png +0 -0
- package/assets/icon-arrow-left.svg +7 -0
- package/assets/icon-close.svg +6 -0
- package/assets/iconRight.svg +3 -0
- package/assets/icon_form.png +0 -0
- package/assets/icon_form_filled.png +0 -0
- package/assets/icon_question.png +0 -0
- package/assets/icon_refresh.png +0 -0
- package/assets/icon_success.png +0 -0
- package/assets/imRobotGuess.svg +4 -0
- package/assets/image-uni.png +0 -0
- package/assets/image.png +0 -0
- package/assets/keyboard_icon.png +0 -0
- package/assets/loading.png +0 -0
- package/assets/more-uni.png +0 -0
- package/assets/more_tools.png +0 -0
- package/assets/msg-audio.svg +1 -0
- package/assets/msg-copy.svg +30 -0
- package/assets/msg-del.svg +33 -0
- package/assets/msg-quote.svg +8 -0
- package/assets/msg-revoke.svg +29 -0
- package/assets/radio-check.png +0 -0
- package/assets/radio-uncheck.png +0 -0
- package/assets/radio.svg +6 -0
- package/assets/refresh.svg +4 -0
- package/assets/rotate-left.svg +7 -0
- package/assets/rotate-right.svg +7 -0
- package/assets/star.png +0 -0
- package/assets/starLine.png +0 -0
- package/assets/translate.svg +12 -0
- package/assets/video-play.png +0 -0
- package/assets/video-uni.png +0 -0
- package/assets/video.png +0 -0
- package/assets/zoom-in.svg +9 -0
- package/assets/zoom-out.svg +9 -0
- package/components/CustomerServiceChat/chat-header/index-web.vue +141 -0
- package/components/CustomerServiceChat/emoji-config/custom-emoji.ts +15 -0
- package/components/CustomerServiceChat/emoji-config/default-emoji.ts +114 -0
- package/components/CustomerServiceChat/emoji-config/index.ts +140 -0
- package/components/CustomerServiceChat/emoji-config/locales/en.ts +66 -0
- package/components/CustomerServiceChat/emoji-config/locales/zh_cn.ts +66 -0
- package/components/CustomerServiceChat/index-web.vue +250 -0
- package/components/CustomerServiceChat/message-input/index-web.vue +214 -0
- package/components/CustomerServiceChat/message-input/index.ts +2 -0
- package/components/CustomerServiceChat/message-input/message-input-button.vue +95 -0
- package/components/CustomerServiceChat/message-input/message-input-editor-web.vue +884 -0
- package/components/CustomerServiceChat/message-input/message-input-file-web.ts +38 -0
- package/components/CustomerServiceChat/message-input/message-input-quote/index.vue +204 -0
- package/components/CustomerServiceChat/message-input-toolbar/emoji-dialog-mobile/emoji-dialog-mobile.vue +145 -0
- package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/emoji-picker-dialog.vue +180 -0
- package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/index.ts +2 -0
- package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/index.vue +90 -0
- package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/style/h5.scss +26 -0
- package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/style/index.scss +4 -0
- package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/style/web.scss +55 -0
- package/components/CustomerServiceChat/message-input-toolbar/file-upload/index.ts +2 -0
- package/components/CustomerServiceChat/message-input-toolbar/file-upload/index.vue +77 -0
- package/components/CustomerServiceChat/message-input-toolbar/image-upload/index.ts +2 -0
- package/components/CustomerServiceChat/message-input-toolbar/image-upload/index.vue +185 -0
- package/components/CustomerServiceChat/message-input-toolbar/index-web.vue +191 -0
- package/components/CustomerServiceChat/message-input-toolbar/index.ts +2 -0
- package/components/CustomerServiceChat/message-input-toolbar/style/uni.scss +111 -0
- package/components/CustomerServiceChat/message-input-toolbar/toolbar-item-container/index.vue +149 -0
- package/components/CustomerServiceChat/message-input-toolbar/toolbar-item-container/style/color.scss +6 -0
- package/components/CustomerServiceChat/message-input-toolbar/toolbar-item-container/style/h5.scss +20 -0
- package/components/CustomerServiceChat/message-input-toolbar/toolbar-item-container/style/index.scss +5 -0
- package/components/CustomerServiceChat/message-input-toolbar/toolbar-item-container/style/uni.scss +36 -0
- package/components/CustomerServiceChat/message-input-toolbar/toolbar-item-container/style/web.scss +19 -0
- package/components/CustomerServiceChat/message-input-toolbar/video-upload/index.ts +2 -0
- package/components/CustomerServiceChat/message-input-toolbar/video-upload/index.vue +146 -0
- package/components/CustomerServiceChat/message-list/index-web.vue +712 -0
- package/components/CustomerServiceChat/message-list/link/index.ts +23 -0
- package/components/CustomerServiceChat/message-list/message-elements/message-audio-web.vue +223 -0
- package/components/CustomerServiceChat/message-list/message-elements/message-bubble-web.vue +504 -0
- package/components/CustomerServiceChat/message-list/message-elements/message-custom.vue +5 -0
- package/components/CustomerServiceChat/message-list/message-elements/message-face.vue +45 -0
- package/components/CustomerServiceChat/message-list/message-elements/message-file.vue +151 -0
- package/components/CustomerServiceChat/message-list/message-elements/message-image-web.vue +97 -0
- package/components/CustomerServiceChat/message-list/message-elements/message-location.vue +34 -0
- package/components/CustomerServiceChat/message-list/message-elements/message-quote/index-web.vue +286 -0
- package/components/CustomerServiceChat/message-list/message-elements/message-quote/interface.ts +60 -0
- package/components/CustomerServiceChat/message-list/message-elements/message-record/index.vue +139 -0
- package/components/CustomerServiceChat/message-list/message-elements/message-text.vue +94 -0
- package/components/CustomerServiceChat/message-list/message-elements/message-timestamp.vue +76 -0
- package/components/CustomerServiceChat/message-list/message-elements/message-video-web.vue +319 -0
- package/components/CustomerServiceChat/message-list/message-elements/plugins/plugin-components/index.ts +9 -0
- package/components/CustomerServiceChat/message-list/message-elements/plugins/plugin-components/message-customer/index.ts +5 -0
- package/components/CustomerServiceChat/message-list/message-elements/plugins/plugin-components/message-customer/message-customer-service.vue +22 -0
- package/components/CustomerServiceChat/message-list/message-elements/plugins/plugin-components/message-plugin-layout-web.vue +133 -0
- package/components/CustomerServiceChat/message-list/message-elements/plugins/plugin-components/message-plugin-web.vue +83 -0
- package/components/CustomerServiceChat/message-list/message-elements/read-status/index.vue +193 -0
- package/components/CustomerServiceChat/message-list/message-elements/simple-message-list/index.vue +462 -0
- package/components/CustomerServiceChat/message-list/message-elements/simple-message-list/message-container.vue +105 -0
- package/components/CustomerServiceChat/message-list/message-elements/video-play.vue +59 -0
- package/components/CustomerServiceChat/message-list/message-tool/index-web.vue +312 -0
- package/components/CustomerServiceChat/message-list/message-tool/message-revoked.vue +63 -0
- package/components/CustomerServiceChat/message-list/scroll-button/index.vue +201 -0
- package/components/CustomerServiceChat/message-list/style/color.scss +32 -0
- package/components/CustomerServiceChat/message-list/style/h5.scss +16 -0
- package/components/CustomerServiceChat/message-list/style/index.scss +11 -0
- package/components/CustomerServiceChat/message-list/style/web.scss +180 -0
- package/components/CustomerServiceChat/style/common.scss +59 -0
- package/components/CustomerServiceChat/style/h5.scss +51 -0
- package/components/CustomerServiceChat/style/index.scss +12 -0
- package/components/CustomerServiceChat/style/uni.scss +13 -0
- package/components/CustomerServiceChat/style/web.scss +46 -0
- package/components/CustomerServiceChat/style/wx.scss +5 -0
- package/components/CustomerServiceChat/utils/conversationDraft.ts +86 -0
- package/components/CustomerServiceChat/utils/sendMessage.ts +140 -0
- package/components/common/Avatar/index.vue +148 -0
- package/components/common/BottomPopup/index.ts +3 -0
- package/components/common/BottomPopup/index.vue +160 -0
- package/components/common/BottomPopup/style/h5.scss +62 -0
- package/components/common/BottomPopup/style/index.scss +3 -0
- package/components/common/BottomPopup/style/modal.scss +5 -0
- package/components/common/Dialog/index.ts +3 -0
- package/components/common/Dialog/index.vue +120 -0
- package/components/common/Dialog/style/color.scss +43 -0
- package/components/common/Dialog/style/dialog.scss +4 -0
- package/components/common/Dialog/style/h5.scss +56 -0
- package/components/common/Dialog/style/web.scss +61 -0
- package/components/common/Drawer/index.vue +164 -0
- package/components/common/Icon.vue +83 -0
- package/components/common/ImagePreviewer/image-item-web.vue +42 -0
- package/components/common/ImagePreviewer/index-web.vue +682 -0
- package/components/common/ImagePreviewer/index.ts +3 -0
- package/components/common/Overlay/index.vue +126 -0
- package/components/common/ProgressMessage/index.vue +95 -0
- package/components/common/RadioSelect/index.vue +59 -0
- package/components/common/RichText/LICENSE +21 -0
- package/components/common/RichText/README.md +244 -0
- package/components/common/RichText/dist/mp-alipay/index.acss +1 -0
- package/components/common/RichText/dist/mp-alipay/index.axml +1 -0
- package/components/common/RichText/dist/mp-alipay/index.js +8 -0
- package/components/common/RichText/dist/mp-alipay/index.json +1 -0
- package/components/common/RichText/dist/mp-alipay/node/node.acss +1 -0
- package/components/common/RichText/dist/mp-alipay/node/node.axml +1 -0
- package/components/common/RichText/dist/mp-alipay/node/node.js +1 -0
- package/components/common/RichText/dist/mp-alipay/node/node.json +1 -0
- package/components/common/RichText/dist/mp-alipay/parser.js +1 -0
- package/components/common/RichText/dist/mp-baidu/index.css +1 -0
- package/components/common/RichText/dist/mp-baidu/index.js +8 -0
- package/components/common/RichText/dist/mp-baidu/index.json +1 -0
- package/components/common/RichText/dist/mp-baidu/index.swan +1 -0
- package/components/common/RichText/dist/mp-baidu/node/node.css +1 -0
- package/components/common/RichText/dist/mp-baidu/node/node.js +1 -0
- package/components/common/RichText/dist/mp-baidu/node/node.json +1 -0
- package/components/common/RichText/dist/mp-baidu/node/node.swan +1 -0
- package/components/common/RichText/dist/mp-baidu/parser.js +1 -0
- package/components/common/RichText/dist/mp-qq/index.js +8 -0
- package/components/common/RichText/dist/mp-qq/index.json +1 -0
- package/components/common/RichText/dist/mp-qq/index.qml +1 -0
- package/components/common/RichText/dist/mp-qq/index.qss +1 -0
- package/components/common/RichText/dist/mp-qq/node/node.js +1 -0
- package/components/common/RichText/dist/mp-qq/node/node.json +1 -0
- package/components/common/RichText/dist/mp-qq/node/node.qml +1 -0
- package/components/common/RichText/dist/mp-qq/node/node.qss +1 -0
- package/components/common/RichText/dist/mp-qq/parser.js +1 -0
- package/components/common/RichText/dist/mp-toutiao/index.js +8 -0
- package/components/common/RichText/dist/mp-toutiao/index.json +1 -0
- package/components/common/RichText/dist/mp-toutiao/index.ttml +1 -0
- package/components/common/RichText/dist/mp-toutiao/index.ttss +1 -0
- package/components/common/RichText/dist/mp-toutiao/node/node.js +1 -0
- package/components/common/RichText/dist/mp-toutiao/node/node.json +1 -0
- package/components/common/RichText/dist/mp-toutiao/node/node.ttml +1 -0
- package/components/common/RichText/dist/mp-toutiao/node/node.ttss +1 -0
- package/components/common/RichText/dist/mp-toutiao/parser.js +1 -0
- package/components/common/RichText/dist/mp-weixin/index.js +8 -0
- package/components/common/RichText/dist/mp-weixin/index.json +1 -0
- package/components/common/RichText/dist/mp-weixin/index.wxml +1 -0
- package/components/common/RichText/dist/mp-weixin/index.wxss +1 -0
- package/components/common/RichText/dist/mp-weixin/node/node.js +1 -0
- package/components/common/RichText/dist/mp-weixin/node/node.json +1 -0
- package/components/common/RichText/dist/mp-weixin/node/node.wxml +1 -0
- package/components/common/RichText/dist/mp-weixin/node/node.wxss +1 -0
- package/components/common/RichText/dist/mp-weixin/parser.js +1 -0
- package/components/common/RichText/dist/uni-app/components/mp-html/mp-html.vue +498 -0
- package/components/common/RichText/dist/uni-app/components/mp-html/node/node.vue +587 -0
- package/components/common/RichText/dist/uni-app/components/mp-html/parser.js +1393 -0
- package/components/common/RichText/dist/uni-app/static/app-plus/mp-html/js/handler.js +1 -0
- package/components/common/RichText/dist/uni-app/static/app-plus/mp-html/js/uni.webview.min.js +1 -0
- package/components/common/RichText/dist/uni-app/static/app-plus/mp-html/local.html +1 -0
- package/components/common/RichText/docs/.nojekyll +0 -0
- package/components/common/RichText/docs/index.html +50 -0
- package/components/common/RichText/docs/lib/docsify.min.js +1 -0
- package/components/common/RichText/docs/lib/prism-bash.min.js +1 -0
- package/components/common/RichText/docs/lib/search.min.js +1 -0
- package/components/common/RichText/docs/lib/vue.css +858 -0
- package/components/common/RichText/gulpfile.js +113 -0
- package/components/common/RichText/lint.js +63 -0
- package/components/common/RichText/package.json +74 -0
- package/components/common/RichText/plugins/README.md +2 -0
- package/components/common/RichText/plugins/audio/README.md +25 -0
- package/components/common/RichText/plugins/audio/build.js +11 -0
- package/components/common/RichText/plugins/audio/context.js +7 -0
- package/components/common/RichText/plugins/audio/index.js +34 -0
- package/components/common/RichText/plugins/audio/miniprogram/audio.js +189 -0
- package/components/common/RichText/plugins/audio/miniprogram/audio.json +3 -0
- package/components/common/RichText/plugins/audio/miniprogram/audio.wxml +17 -0
- package/components/common/RichText/plugins/audio/miniprogram/audio.wxss +127 -0
- package/components/common/RichText/plugins/audio/miniprogram/build.js +3 -0
- package/components/common/RichText/plugins/audio/uni-app/audio.vue +269 -0
- package/components/common/RichText/plugins/audio/uni-app/build.js +3 -0
- package/components/common/RichText/plugins/card/README.md +30 -0
- package/components/common/RichText/plugins/card/build.js +14 -0
- package/components/common/RichText/plugins/card/index.js +7 -0
- package/components/common/RichText/plugins/card/miniprogram/build.js +3 -0
- package/components/common/RichText/plugins/card/miniprogram/card.js +26 -0
- package/components/common/RichText/plugins/card/miniprogram/card.json +3 -0
- package/components/common/RichText/plugins/card/miniprogram/card.wxml +9 -0
- package/components/common/RichText/plugins/card/miniprogram/card.wxss +55 -0
- package/components/common/RichText/plugins/card/uni-app/build.js +3 -0
- package/components/common/RichText/plugins/card/uni-app/card.vue +122 -0
- package/components/common/RichText/plugins/editable/README.md +137 -0
- package/components/common/RichText/plugins/editable/config.js +15 -0
- package/components/common/RichText/plugins/editable/miniprogram/build.js +813 -0
- package/components/common/RichText/plugins/editable/miniprogram/index.js +551 -0
- package/components/common/RichText/plugins/editable/uni-app/build.js +744 -0
- package/components/common/RichText/plugins/editable/uni-app/index.js +553 -0
- package/components/common/RichText/plugins/emoji/README.md +15 -0
- package/components/common/RichText/plugins/emoji/index.js +203 -0
- package/components/common/RichText/plugins/highlight/README.md +26 -0
- package/components/common/RichText/plugins/highlight/config.js +5 -0
- package/components/common/RichText/plugins/highlight/index.js +96 -0
- package/components/common/RichText/plugins/highlight/miniprogram/build.js +88 -0
- package/components/common/RichText/plugins/highlight/prism.css +125 -0
- package/components/common/RichText/plugins/highlight/prism.min.js +7 -0
- package/components/common/RichText/plugins/highlight/uni-app/build.js +88 -0
- package/components/common/RichText/plugins/img-cache/README.md +24 -0
- package/components/common/RichText/plugins/img-cache/build.js +16 -0
- package/components/common/RichText/plugins/img-cache/index.js +138 -0
- package/components/common/RichText/plugins/latex/README.md +16 -0
- package/components/common/RichText/plugins/latex/build.js +14 -0
- package/components/common/RichText/plugins/latex/index.js +77 -0
- package/components/common/RichText/plugins/latex/katex.css +1070 -0
- package/components/common/RichText/plugins/latex/katex.min.js +1 -0
- package/components/common/RichText/plugins/markdown/README.md +17 -0
- package/components/common/RichText/plugins/markdown/index.js +34 -0
- package/components/common/RichText/plugins/markdown/marked.min.js +6 -0
- package/components/common/RichText/plugins/markdown/miniprogram/build.js +70 -0
- package/components/common/RichText/plugins/markdown/uni-app/build.js +68 -0
- package/components/common/RichText/plugins/search/README.md +46 -0
- package/components/common/RichText/plugins/search/miniprogram/index.js +137 -0
- package/components/common/RichText/plugins/search/uni-app/index.js +132 -0
- package/components/common/RichText/plugins/style/README.md +30 -0
- package/components/common/RichText/plugins/style/index.js +129 -0
- package/components/common/RichText/plugins/style/parser.js +175 -0
- package/components/common/RichText/plugins/template/README.md +2 -0
- package/components/common/RichText/plugins/template/build.js +65 -0
- package/components/common/RichText/plugins/template/index.js +67 -0
- package/components/common/RichText/plugins/txv-video/README.md +18 -0
- package/components/common/RichText/plugins/txv-video/build.js +3 -0
- package/components/common/RichText/plugins/txv-video/index.js +46 -0
- package/components/common/RichText/plugins/txv-video/miniprogram/build.js +6 -0
- package/components/common/RichText/plugins/txv-video/uni-app/build.js +3 -0
- package/components/common/RichText/src/miniprogram/index.js +396 -0
- package/components/common/RichText/src/miniprogram/index.json +6 -0
- package/components/common/RichText/src/miniprogram/index.wxml +7 -0
- package/components/common/RichText/src/miniprogram/index.wxss +13 -0
- package/components/common/RichText/src/miniprogram/node/node.js +247 -0
- package/components/common/RichText/src/miniprogram/node/node.json +6 -0
- package/components/common/RichText/src/miniprogram/node/node.wxml +112 -0
- package/components/common/RichText/src/miniprogram/node/node.wxss +164 -0
- package/components/common/RichText/src/miniprogram/parser.js +1269 -0
- package/components/common/RichText/src/uni-app/components/mp-html/mp-html.vue +498 -0
- package/components/common/RichText/src/uni-app/components/mp-html/node/node.vue +585 -0
- package/components/common/RichText/src/uni-app/components/mp-html/parser.js +1393 -0
- package/components/common/RichText/src/uni-app/static/app-plus/mp-html/js/handler.js +254 -0
- package/components/common/RichText/src/uni-app/static/app-plus/mp-html/js/uni.webview.min.js +1 -0
- package/components/common/RichText/src/uni-app/static/app-plus/mp-html/local.html +33 -0
- package/components/common/RichText/tools/config.js +82 -0
- package/components/common/RichText/tools/converter.js +205 -0
- package/components/common/RichText/tools/ifdef.js +115 -0
- package/components/common/RichText/tools/minifier.js +40 -0
- package/components/common/RichText/tools/plugin.js +248 -0
- package/components/common/Toast/index-web.ts +122 -0
- package/components/common/Toast/index-web.vue +178 -0
- package/components/common/Toast/type.ts +8 -0
- package/components/common/common.scss +59 -0
- package/components/customer-icon.vue +56 -0
- package/components/message-branch.vue +120 -0
- package/components/message-customer-service.vue +114 -0
- package/components/message-form/form-branch.vue +68 -0
- package/components/message-form/form-input.vue +242 -0
- package/components/message-form/index.vue +80 -0
- package/components/message-multi-branch/branch-pc.vue +79 -0
- package/components/message-multi-branch/index.vue +60 -0
- package/components/message-multi-form/component-mobile/form-popup.vue +37 -0
- package/components/message-multi-form/component-mobile/input-mobile.vue +102 -0
- package/components/message-multi-form/component-mobile/label-mobile.vue +32 -0
- package/components/message-multi-form/component-mobile/radios-mobile.vue +161 -0
- package/components/message-multi-form/component-pc/input-pc.vue +93 -0
- package/components/message-multi-form/component-pc/label-pc.vue +33 -0
- package/components/message-multi-form/component-pc/radio-pc.vue +98 -0
- package/components/message-multi-form/form-mobile.vue +385 -0
- package/components/message-multi-form/form-pc.vue +184 -0
- package/components/message-multi-form/index.vue +61 -0
- package/components/message-product-card.vue +129 -0
- package/components/message-rating/index.vue +56 -0
- package/components/message-rating/message-rating-number.vue +247 -0
- package/components/message-rating/message-rating-star.vue +237 -0
- package/components/message-rich-text.vue +155 -0
- package/components/message-robot-welcome.vue +181 -0
- package/components/message-stream.vue +109 -0
- package/constant.ts +122 -0
- package/excluded-list.txt +6 -0
- package/index.ts +30 -0
- package/index.vue +60 -0
- package/interface.ts +176 -0
- package/logger/index.ts +12 -0
- package/logger/main.ts +120 -0
- package/package.json +62 -0
- package/script/fileCopy.js +60 -0
- package/script/syncVersion.js +35 -0
- package/server.ts +128 -0
- package/styles/common.scss +116 -0
- package/tsconfig.json +34 -0
- package/typings.d.ts +20 -0
- package/utils/chatStorage.ts +70 -0
- package/utils/copy-web.ts +141 -0
- package/utils/enableSampleTaskStatus.ts +8 -0
- package/utils/env.ts +15 -0
- package/utils/index.ts +59 -0
- package/utils/utils.ts +162 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div v-if="!isUniFrameWork">
|
|
4
|
+
<div
|
|
5
|
+
class="rich-text"
|
|
6
|
+
v-html="formatedContent"
|
|
7
|
+
/>
|
|
8
|
+
<div v-if="image" class="rich-image-previewer" @click="closeImage">
|
|
9
|
+
<img
|
|
10
|
+
class="rich-image-preview"
|
|
11
|
+
:style="{
|
|
12
|
+
transform: `scale(1) rotate(0deg)`,
|
|
13
|
+
}"
|
|
14
|
+
:src="imageSrc"
|
|
15
|
+
/>
|
|
16
|
+
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
<div v-else>
|
|
20
|
+
<!-- <mpHtml :content="formatedContent"/> -->
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<script lang="ts">
|
|
28
|
+
import vue from '../adapter-vue';
|
|
29
|
+
import { marked } from 'marked';
|
|
30
|
+
import { customerServicePayloadType } from '../interface';
|
|
31
|
+
import {isUniFrameWork,isWeChat} from '../utils/env';
|
|
32
|
+
// import mpHtml from './common/RichText/dist/uni-app/components/mp-html/mp-html.vue';
|
|
33
|
+
const { computed,ref } = vue;
|
|
34
|
+
interface Props {
|
|
35
|
+
payload: customerServicePayloadType;
|
|
36
|
+
}
|
|
37
|
+
export default {
|
|
38
|
+
components: {
|
|
39
|
+
// mpHtml
|
|
40
|
+
},
|
|
41
|
+
props: {
|
|
42
|
+
payload: {
|
|
43
|
+
type: Object as () => customerServicePayloadType,
|
|
44
|
+
default: () => ({}),
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
setup(props: Props) {
|
|
48
|
+
const image = ref(false);
|
|
49
|
+
const imageSrc = ref('');
|
|
50
|
+
const imageList = [];
|
|
51
|
+
const formatedContent = computed(() => {
|
|
52
|
+
const rendererMD = new marked.Renderer();
|
|
53
|
+
marked.setOptions({
|
|
54
|
+
renderer: rendererMD,
|
|
55
|
+
gfm: true,
|
|
56
|
+
breaks: true,
|
|
57
|
+
pedantic: false,
|
|
58
|
+
sanitize: false,
|
|
59
|
+
smartLists: true,
|
|
60
|
+
smartypants: false,
|
|
61
|
+
});
|
|
62
|
+
if(!isUniFrameWork){
|
|
63
|
+
// @ts-ignore
|
|
64
|
+
window.handleImageClick = function(e,href:string) {
|
|
65
|
+
image.value = !image.value;
|
|
66
|
+
imageSrc.value = href;
|
|
67
|
+
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
rendererMD.image = (href, title, text) => {
|
|
72
|
+
if(isUniFrameWork){
|
|
73
|
+
return `
|
|
74
|
+
<img src="${href}" alt="${text}" style="max-width: 100%;">
|
|
75
|
+
`
|
|
76
|
+
}
|
|
77
|
+
return `
|
|
78
|
+
<div onclick="handleImageClick(event,'${href}')">
|
|
79
|
+
<img src="${href}" alt="${text}" style="max-width: 100%;">
|
|
80
|
+
</div>
|
|
81
|
+
`
|
|
82
|
+
}
|
|
83
|
+
let richtext = marked.parse(props.payload.content);
|
|
84
|
+
return richtext;
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
const closeImage = () => {
|
|
88
|
+
image.value = !image.value;
|
|
89
|
+
imageSrc.value = '';
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
return {
|
|
94
|
+
props,
|
|
95
|
+
formatedContent,
|
|
96
|
+
image,
|
|
97
|
+
imageSrc,
|
|
98
|
+
closeImage,
|
|
99
|
+
isUniFrameWork,
|
|
100
|
+
imageList
|
|
101
|
+
};
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
</script>
|
|
105
|
+
<style lang="scss">
|
|
106
|
+
.rich-text {
|
|
107
|
+
div,
|
|
108
|
+
ul,
|
|
109
|
+
ol,
|
|
110
|
+
dt,
|
|
111
|
+
dd,
|
|
112
|
+
li,
|
|
113
|
+
dl,
|
|
114
|
+
h1,
|
|
115
|
+
h2,
|
|
116
|
+
h3,
|
|
117
|
+
h4,
|
|
118
|
+
p,
|
|
119
|
+
img,
|
|
120
|
+
a {
|
|
121
|
+
max-width: 100%;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
a {
|
|
125
|
+
color: blue;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.rich-image-previewer {
|
|
130
|
+
position: fixed;
|
|
131
|
+
z-index: 101;
|
|
132
|
+
width: 100vw;
|
|
133
|
+
height: 100vh;
|
|
134
|
+
background: rgba(#000, 0.3);
|
|
135
|
+
top: 0;
|
|
136
|
+
left: 0;
|
|
137
|
+
display: flex;
|
|
138
|
+
flex-direction: column;
|
|
139
|
+
align-items: center;
|
|
140
|
+
justify-content: center;
|
|
141
|
+
user-select: none;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.rich-image-preview {
|
|
145
|
+
width: 80%;
|
|
146
|
+
height:auto;
|
|
147
|
+
display: flex;
|
|
148
|
+
align-items: center;
|
|
149
|
+
justify-content: center;
|
|
150
|
+
overflow: hidden;
|
|
151
|
+
transition: transform 0.1s ease 0s;
|
|
152
|
+
pointer-events: auto;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
</style>
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="welcome-card">
|
|
3
|
+
<div class="welcome-title">
|
|
4
|
+
<div class="welcome-title-left-container">
|
|
5
|
+
<Icon :src="iconQuestion" />
|
|
6
|
+
<p
|
|
7
|
+
v-if="title"
|
|
8
|
+
class="card-title"
|
|
9
|
+
>
|
|
10
|
+
{{ title }}
|
|
11
|
+
</p>
|
|
12
|
+
</div>
|
|
13
|
+
<div
|
|
14
|
+
class="change-wrapper"
|
|
15
|
+
@click="changeBranchList()"
|
|
16
|
+
>
|
|
17
|
+
<div style="margin-right: 3px;">
|
|
18
|
+
换一换
|
|
19
|
+
</div>
|
|
20
|
+
<Icon :src="iconRefresh" />
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
<div
|
|
24
|
+
v-for="(item, index) in showList"
|
|
25
|
+
:key="index"
|
|
26
|
+
class="welcome-item"
|
|
27
|
+
@click="handleContentListItemClick(item)"
|
|
28
|
+
>
|
|
29
|
+
<div>{{ item.content }}</div>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<script lang="ts">
|
|
35
|
+
import vue from '../adapter-vue';
|
|
36
|
+
import imRobotGuess from '../assets/imRobotGuess.svg';
|
|
37
|
+
import refresh from '../assets/refresh.svg';
|
|
38
|
+
import iconRight from '../assets/iconRight.svg';
|
|
39
|
+
import Icon from './customer-icon.vue';
|
|
40
|
+
import iconQuestion from '../assets/icon_question.png';
|
|
41
|
+
import iconRefresh from '../assets/icon_refresh.png';
|
|
42
|
+
import { customerServicePayloadType } from '../interface';
|
|
43
|
+
const { reactive, toRefs } = vue;
|
|
44
|
+
|
|
45
|
+
interface Props {
|
|
46
|
+
payload: customerServicePayloadType;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
interface welcomeBranchItem {
|
|
50
|
+
id: string;
|
|
51
|
+
content: string;
|
|
52
|
+
answer: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export default {
|
|
56
|
+
components: {
|
|
57
|
+
Icon,
|
|
58
|
+
},
|
|
59
|
+
props: {
|
|
60
|
+
payload: {
|
|
61
|
+
type: Object as () => customerServicePayloadType,
|
|
62
|
+
default: () => ({ content: { title: '', items: [] } }),
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
emits: ['sendMessage'],
|
|
66
|
+
setup(props: Props, { emit }) {
|
|
67
|
+
const data = reactive({
|
|
68
|
+
// title
|
|
69
|
+
title: props.payload?.content?.title || '',
|
|
70
|
+
// all branch list
|
|
71
|
+
list: props.payload?.content?.items || [],
|
|
72
|
+
// current branch list
|
|
73
|
+
showList: (props.payload?.content?.items || []).slice(0, 3),
|
|
74
|
+
// current page number
|
|
75
|
+
pageNumber: 1,
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
const handleContentListItemClick = (branch: welcomeBranchItem) => {
|
|
79
|
+
emit('sendMessage', { text: branch.content });
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const changeBranchList = () => {
|
|
83
|
+
if (data.pageNumber * 3 >= data.list?.length) {
|
|
84
|
+
data.pageNumber = 0;
|
|
85
|
+
}
|
|
86
|
+
data.showList = data.list?.slice(
|
|
87
|
+
data.pageNumber * 3,
|
|
88
|
+
data.pageNumber * 3 + 3,
|
|
89
|
+
);
|
|
90
|
+
data.pageNumber += 1;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
return {
|
|
94
|
+
...toRefs(data),
|
|
95
|
+
handleContentListItemClick,
|
|
96
|
+
imRobotGuess,
|
|
97
|
+
refresh,
|
|
98
|
+
iconRight,
|
|
99
|
+
changeBranchList,
|
|
100
|
+
iconQuestion,
|
|
101
|
+
iconRefresh
|
|
102
|
+
};
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
</script>
|
|
106
|
+
|
|
107
|
+
<style lang="scss">
|
|
108
|
+
.welcome-card {
|
|
109
|
+
min-width: 300px;
|
|
110
|
+
max-width: 400px;
|
|
111
|
+
|
|
112
|
+
.welcome-title {
|
|
113
|
+
display: flex;
|
|
114
|
+
height: 20px;
|
|
115
|
+
margin-bottom: 10px;
|
|
116
|
+
justify-content: space-between;
|
|
117
|
+
align-items: center;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.welcome-title-left-container {
|
|
121
|
+
display: flex;
|
|
122
|
+
align-items: center;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.card-title {
|
|
126
|
+
display: inline-block;
|
|
127
|
+
margin-left: 8px;
|
|
128
|
+
font-size: 16px;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.el-link {
|
|
132
|
+
display: block;
|
|
133
|
+
font-weight: 400;
|
|
134
|
+
padding-top: 5px;
|
|
135
|
+
padding-bottom: 5px;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/* stylelint-disable */
|
|
139
|
+
.el-link__inner {
|
|
140
|
+
display: flex;
|
|
141
|
+
justify-content: space-between;
|
|
142
|
+
align-items: center;
|
|
143
|
+
}
|
|
144
|
+
/* stylelint-enable */
|
|
145
|
+
|
|
146
|
+
.branch-number {
|
|
147
|
+
margin-left: 15px;
|
|
148
|
+
margin-right: 15px;
|
|
149
|
+
font-size: 20px;
|
|
150
|
+
display: inline-block;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.change-wrapper {
|
|
154
|
+
display: flex;
|
|
155
|
+
cursor: pointer;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.welcome-item {
|
|
159
|
+
padding: 6px;
|
|
160
|
+
display: flex;
|
|
161
|
+
justify-content: center;
|
|
162
|
+
align-items: center;
|
|
163
|
+
cursor: pointer;
|
|
164
|
+
background-color: #ffffff;
|
|
165
|
+
margin-bottom: 10px;
|
|
166
|
+
border:1px solid #adcfff;
|
|
167
|
+
border-radius: 20px;
|
|
168
|
+
font-weight: 500;
|
|
169
|
+
color: #1c66e5;
|
|
170
|
+
gap: 10px;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.welcome-item:hover {
|
|
174
|
+
background: #f2f7ff;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.welcome-item:last-child {
|
|
178
|
+
margin-bottom: 0;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
</style>
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="message-stream">
|
|
3
|
+
{{ displayedContent }}<span
|
|
4
|
+
v-if="!isFinished"
|
|
5
|
+
class="blinking-cursor"
|
|
6
|
+
/>
|
|
7
|
+
</div>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
import vue from '../adapter-vue';
|
|
12
|
+
import { customerServicePayloadType } from '../interface';
|
|
13
|
+
const { ref, watchEffect, onBeforeUnmount, onMounted } = vue;
|
|
14
|
+
|
|
15
|
+
interface Props {
|
|
16
|
+
payload: customerServicePayloadType;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default {
|
|
20
|
+
props: {
|
|
21
|
+
payload: {
|
|
22
|
+
type: Object as () => customerServicePayloadType,
|
|
23
|
+
default: () => ({}),
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
setup(props: Props) {
|
|
27
|
+
const content = ref<string>('');
|
|
28
|
+
const displayedContent = ref<string>('');
|
|
29
|
+
const isFinished = ref<boolean>(false);
|
|
30
|
+
let intervalId: number | null = null;
|
|
31
|
+
let currentIndex = 0;
|
|
32
|
+
|
|
33
|
+
const updateDisplayedContent = () => {
|
|
34
|
+
if (intervalId) {
|
|
35
|
+
clearInterval(intervalId);
|
|
36
|
+
}
|
|
37
|
+
// @ts-ignore
|
|
38
|
+
intervalId = setInterval(() => {
|
|
39
|
+
if (currentIndex < content.value.length) {
|
|
40
|
+
displayedContent.value += content.value[currentIndex];
|
|
41
|
+
currentIndex++;
|
|
42
|
+
} else {
|
|
43
|
+
clearInterval(intervalId!);
|
|
44
|
+
intervalId = null;
|
|
45
|
+
}
|
|
46
|
+
}, 50);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
onMounted(() => {
|
|
50
|
+
content.value = props?.payload?.chunks?.join('') ?? '';
|
|
51
|
+
displayedContent.value = content.value;
|
|
52
|
+
currentIndex = content.value.length;
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
watchEffect(() => {
|
|
56
|
+
const newContent = props?.payload?.chunks?.join('') ?? '';
|
|
57
|
+
if (newContent.length > currentIndex) {
|
|
58
|
+
content.value = newContent;
|
|
59
|
+
updateDisplayedContent();
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
watchEffect(() => {
|
|
64
|
+
isFinished.value = props?.payload?.isFinished === 1;
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
onBeforeUnmount(() => {
|
|
68
|
+
if (intervalId) {
|
|
69
|
+
clearInterval(intervalId);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
return {
|
|
74
|
+
content,
|
|
75
|
+
props,
|
|
76
|
+
isFinished,
|
|
77
|
+
displayedContent,
|
|
78
|
+
};
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
</script>
|
|
82
|
+
<style lang="scss" scoped>
|
|
83
|
+
.message-stream {
|
|
84
|
+
overflow-wrap: break-word;
|
|
85
|
+
word-break: keep-all;
|
|
86
|
+
white-space: normal;
|
|
87
|
+
font-size: 14px;
|
|
88
|
+
|
|
89
|
+
.blinking-cursor {
|
|
90
|
+
display: inline-block;
|
|
91
|
+
width: 1px;
|
|
92
|
+
height: 16px;
|
|
93
|
+
background-color: black;
|
|
94
|
+
animation: blink 1s step-end infinite;
|
|
95
|
+
vertical-align: sub;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@keyframes blink {
|
|
99
|
+
0%,
|
|
100
|
+
100% {
|
|
101
|
+
background-color: transparent;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
50% {
|
|
105
|
+
background-color: black;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
</style>
|
package/constant.ts
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// https://cloud.tencent.com/document/product/269/96058
|
|
2
|
+
export const CUSTOM_MESSAGE_SRC = {
|
|
3
|
+
OFFICIAL_ACCOUNT: '1',
|
|
4
|
+
MINI_APP: '2',
|
|
5
|
+
MINI_APP_SERVICE_ACCOUNT: '3',
|
|
6
|
+
BACKEND_INTERNAL: '4',
|
|
7
|
+
WEB: '5',
|
|
8
|
+
SESSION_MESSAGE_SLICE: '6',
|
|
9
|
+
MINI_APP_AUTO: '7',
|
|
10
|
+
INTERNAL: '8',
|
|
11
|
+
MENU: '9',
|
|
12
|
+
MENU_SELECTED: '10',
|
|
13
|
+
CLIENT_STATE: '11',
|
|
14
|
+
TYPING_STATE: '12',
|
|
15
|
+
ROBOT: '13',
|
|
16
|
+
BRANCH: '15',
|
|
17
|
+
BRANCH_NUMBER: 15,
|
|
18
|
+
MEMBER: '17',
|
|
19
|
+
NO_SEAT_ONLINE: '18',
|
|
20
|
+
END: '19',
|
|
21
|
+
TIMEOUT: '20',
|
|
22
|
+
FROM_INPUT: '21',
|
|
23
|
+
PRODUCT_CARD: '22',
|
|
24
|
+
SATISFACTION_CON: '23',
|
|
25
|
+
USER_SATISFACTION: '24',
|
|
26
|
+
ROBOT_MSG: '29',
|
|
27
|
+
RICH_TEXT: '30',
|
|
28
|
+
STREAM_TEXT: '31',
|
|
29
|
+
MULTI_BRANCH:'32',
|
|
30
|
+
MULTI_FORM:'33',
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// im message extra type
|
|
34
|
+
export const IM_MESSAGE_EXTRA_TYPE = {
|
|
35
|
+
INFO: 'INFO',
|
|
36
|
+
ROBERT_REPLAY_PLACEHOLDER: 'ROBOT_REPLAY_PLACEHOLDER',
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
// rating template type
|
|
40
|
+
export const RATING_TEMPLATE_TYPE = {
|
|
41
|
+
STAR: 1,
|
|
42
|
+
NUMBER: 2,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// rating state
|
|
46
|
+
export const RATING_STATE = {
|
|
47
|
+
NONE: 1,
|
|
48
|
+
IN_PROGRESS: 2,
|
|
49
|
+
DONE: 3,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// rating send rule
|
|
53
|
+
export const RATING_SEND_RULE = {
|
|
54
|
+
ALLOW_AUTO_SEND: 1,
|
|
55
|
+
ALLOW_SERVICE_SEND: 2,
|
|
56
|
+
ALLOW_CLIENT_SEND: 4,
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
// send rating error code
|
|
60
|
+
export const SEND_RATING_ERROR_CODE = {
|
|
61
|
+
SESSION_EXPIRED_OR_NOT_START: 10150,
|
|
62
|
+
ACCESS_DATA_ERROR: 10151,
|
|
63
|
+
DUPLICATE_SUBMIT: 10152,
|
|
64
|
+
INTERNAL_ERROR: 10153,
|
|
65
|
+
NO_STAFF: 10154,
|
|
66
|
+
};
|
|
67
|
+
// clent state
|
|
68
|
+
export const CLIENT_STATE = {
|
|
69
|
+
ONLINE: '1',
|
|
70
|
+
OFFLINE: '2',
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
// IM message type
|
|
74
|
+
export const IM_TYPE = {
|
|
75
|
+
WEB: 'web',
|
|
76
|
+
H5: 'h5',
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
// IM message status
|
|
80
|
+
export const IM_STATUS = {
|
|
81
|
+
SUCCESS: 'success',
|
|
82
|
+
FAIL: 'fail',
|
|
83
|
+
UN_SEND: 'unSend',
|
|
84
|
+
READ: 'read',
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
// robot command
|
|
88
|
+
export const ROBOT_COMMAND = {
|
|
89
|
+
UPDATE_BUBBLE: 'updateBubble',
|
|
90
|
+
UPDATE_SEARCH_TIPS: 'updateSearchTips',
|
|
91
|
+
SHOW_DIALOG: 'showDialog',
|
|
92
|
+
FEEDBACK: 'feedback',
|
|
93
|
+
SELECT_RECOMMEND: 'selectRecommend',
|
|
94
|
+
SELECT_SEARCH_TIP: 'selectSearchTips',
|
|
95
|
+
UPDATE_BOT_STATUS: 'updateBotStatus',
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
// robot message type
|
|
99
|
+
export const ROBOT_MESSAGE_TYPE = {
|
|
100
|
+
SIMPLE_TEXT: 'simpleText',
|
|
101
|
+
RICH_TEXT: 'richText',
|
|
102
|
+
MULTI_LINE_TEXT: 'multiLineText',
|
|
103
|
+
CANDIDATE_ANSWER: 'candidateAnswer',
|
|
104
|
+
QUESTION_LIST: 'questionList',
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
// robot status
|
|
108
|
+
export const ROBOT_STATUS = {
|
|
109
|
+
IN: 'inBot',
|
|
110
|
+
LEAVE: 'leaveBot',
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
// message type
|
|
114
|
+
export const TYPES = {
|
|
115
|
+
MSG_CUSTOM: 'TIMCustomElem',
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export const EMOJI_TYPE = {
|
|
119
|
+
BASIC: 'basic',
|
|
120
|
+
BIG: 'big',
|
|
121
|
+
CUSTOM: 'CUSTOM',
|
|
122
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
.\node_modules\@tencentcloud\tui-customer-service-plugin\node_modules
|
|
2
|
+
.\node_modules\@tencentcloud\tui-customer-service-plugin\package.json
|
|
3
|
+
.\node_modules\@tencentcloud\tui-customer-service-plugin\excluded-list.txt
|
|
4
|
+
.\node_modules\@tencentcloud\tui-customer-service-plugin\script
|
|
5
|
+
|
|
6
|
+
|
package/index.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
declare const uni: any;
|
|
2
|
+
import TUICustomerPluginServer from './server';
|
|
3
|
+
import { isMessageInvisible } from './utils/index';
|
|
4
|
+
// #ifndef APP || APP-PLUS || MP || H5
|
|
5
|
+
import CustomerChatWeb from './components/CustomerServiceChat/index-web.vue';
|
|
6
|
+
// #endif
|
|
7
|
+
|
|
8
|
+
const TUICustomerServer = TUICustomerPluginServer.getInstance();
|
|
9
|
+
|
|
10
|
+
const isCustomerServicePluginMessage = TUICustomerServer.isCustomerServicePluginMessage.bind(TUICustomerServer);
|
|
11
|
+
|
|
12
|
+
const setCustomerServiceAccounts = TUICustomerServer.setCustomerServiceAccounts.bind(TUICustomerServer);
|
|
13
|
+
|
|
14
|
+
const getCustomerServiceAccounts = TUICustomerServer.getCustomerServiceAccounts.bind(TUICustomerServer);
|
|
15
|
+
|
|
16
|
+
const isCustomerConversation = TUICustomerServer.isCustomerConversation.bind(TUICustomerServer);
|
|
17
|
+
|
|
18
|
+
let CustomerServiceChat = {};
|
|
19
|
+
if (typeof uni === 'undefined') {
|
|
20
|
+
CustomerServiceChat = CustomerChatWeb;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export {
|
|
24
|
+
isCustomerServicePluginMessage,
|
|
25
|
+
isMessageInvisible,
|
|
26
|
+
setCustomerServiceAccounts,
|
|
27
|
+
getCustomerServiceAccounts,
|
|
28
|
+
CustomerServiceChat,
|
|
29
|
+
isCustomerConversation
|
|
30
|
+
};
|
package/index.vue
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="message-custom">
|
|
3
|
+
<MessageRating
|
|
4
|
+
v-if="isMessageRating(props.message)"
|
|
5
|
+
:message="props.message"
|
|
6
|
+
@sendMessage="sendCustomMessage"
|
|
7
|
+
/>
|
|
8
|
+
<MessageCustomerService
|
|
9
|
+
v-else-if="isCustomerServiceMessage(props.message)"
|
|
10
|
+
:message="props.message"
|
|
11
|
+
@sendMessage="sendTextMessage"
|
|
12
|
+
@sendCustomMessage="sendCustomMessage"
|
|
13
|
+
@showFormPopup="handleShowFormPopup"
|
|
14
|
+
/>
|
|
15
|
+
</div>
|
|
16
|
+
</template>
|
|
17
|
+
<script lang="ts">
|
|
18
|
+
import { isCustomerServiceMessage, isMessageRating } from './utils/index';
|
|
19
|
+
import { CustomMessagePayload, TextMessagePayload, IMessageModel } from './interface';
|
|
20
|
+
import MessageCustomerService from './components/message-customer-service.vue';
|
|
21
|
+
import MessageRating from './components/message-rating/index.vue';
|
|
22
|
+
import {
|
|
23
|
+
TUIChatService,
|
|
24
|
+
} from '@tencentcloud/chat-uikit-engine';
|
|
25
|
+
interface Props {
|
|
26
|
+
message: IMessageModel;
|
|
27
|
+
}
|
|
28
|
+
export default {
|
|
29
|
+
components: {
|
|
30
|
+
MessageCustomerService,
|
|
31
|
+
MessageRating,
|
|
32
|
+
},
|
|
33
|
+
props: {
|
|
34
|
+
message: {
|
|
35
|
+
type: Object as () => IMessageModel,
|
|
36
|
+
default: () => ({}),
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
emits: ['showFormPopup'],
|
|
40
|
+
setup(props: Props, { emit }) {
|
|
41
|
+
const sendTextMessage = (payload: TextMessagePayload) => {
|
|
42
|
+
TUIChatService.sendTextMessage({payload});
|
|
43
|
+
};
|
|
44
|
+
const sendCustomMessage = (payload: CustomMessagePayload) => {
|
|
45
|
+
TUIChatService.sendCustomMessage({payload});
|
|
46
|
+
};
|
|
47
|
+
const handleShowFormPopup = (data: boolean) => {
|
|
48
|
+
emit('showFormPopup', data);
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
props,
|
|
52
|
+
sendTextMessage,
|
|
53
|
+
sendCustomMessage,
|
|
54
|
+
isCustomerServiceMessage,
|
|
55
|
+
isMessageRating,
|
|
56
|
+
handleShowFormPopup
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
</script>
|