@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,86 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IMessageModel,
|
|
3
|
+
SetConversationDraftParams,
|
|
4
|
+
StoreName,
|
|
5
|
+
TUIConversationService,
|
|
6
|
+
TUIStore,
|
|
7
|
+
TUITranslateService,
|
|
8
|
+
} from '@tencentcloud/chat-uikit-engine';
|
|
9
|
+
import { transformTextWithKeysToEmojiNames } from '../emoji-config';
|
|
10
|
+
import { JSONToObject } from '../../../utils/index';
|
|
11
|
+
|
|
12
|
+
class ConversationDraftManager {
|
|
13
|
+
private static instance: ConversationDraftManager | null = null;
|
|
14
|
+
private quoteMessageMap = new Map<string, IMessageModel>();
|
|
15
|
+
|
|
16
|
+
private constructor() { }
|
|
17
|
+
|
|
18
|
+
public static getInstance(): ConversationDraftManager {
|
|
19
|
+
if (!ConversationDraftManager.instance) {
|
|
20
|
+
ConversationDraftManager.instance = new ConversationDraftManager();
|
|
21
|
+
}
|
|
22
|
+
return ConversationDraftManager.instance;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
public setStore(conversationID: string, draftContent: string, abstract: string, quoteMessage?: { type: 'quote' | 'reply'; message: IMessageModel }) {
|
|
26
|
+
if (conversationID && (this.isEditorNotEmpty(draftContent) || quoteMessage?.message?.ID)) {
|
|
27
|
+
let additionalDraftInfo = {};
|
|
28
|
+
if (quoteMessage?.message?.ID) {
|
|
29
|
+
this.quoteMessageMap.set(quoteMessage.message.ID, quoteMessage.message);
|
|
30
|
+
additionalDraftInfo = { messageID: quoteMessage.message.ID, type: quoteMessage.type };
|
|
31
|
+
}
|
|
32
|
+
const draftParams: SetConversationDraftParams = {
|
|
33
|
+
conversationID: conversationID,
|
|
34
|
+
draftInfo: {
|
|
35
|
+
html: draftContent,
|
|
36
|
+
abstract: abstract,
|
|
37
|
+
...additionalDraftInfo,
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
TUIConversationService.setConversationDraft(draftParams);
|
|
41
|
+
TUIStore.update(StoreName.CHAT, 'quoteMessage', { message: undefined, type: 'quote' });
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
public getStore(conversationID: string, setEditorContentCallback: (...args: any[]) => void) {
|
|
46
|
+
const conversation = TUIStore.getConversationModel(conversationID);
|
|
47
|
+
if (!conversation) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (conversation.conversationID && conversation.draftText) {
|
|
51
|
+
const draftObject = JSONToObject(conversation.draftText);
|
|
52
|
+
TUIStore.update(StoreName.CHAT, 'quoteMessage', { message: this.quoteMessageMap.get(draftObject.messageID) || undefined, type: draftObject.type });
|
|
53
|
+
setEditorContentCallback(draftObject.html);
|
|
54
|
+
}
|
|
55
|
+
TUIConversationService.setConversationDraft({ conversationID: conversation.conversationID });
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
public generateAbstract(editorContent: Array<{ type: string; payload: { text?: string; file?: File } }>): string {
|
|
59
|
+
let abstract = '';
|
|
60
|
+
editorContent?.forEach((item: { type: string; payload: { text?: string; file?: File } }) => {
|
|
61
|
+
switch (item.type) {
|
|
62
|
+
case 'text':
|
|
63
|
+
abstract += transformTextWithKeysToEmojiNames(item.payload.text || '');
|
|
64
|
+
break;
|
|
65
|
+
case 'image':
|
|
66
|
+
abstract += TUITranslateService.t('TUIChat.图片');
|
|
67
|
+
break;
|
|
68
|
+
case 'video':
|
|
69
|
+
abstract += TUITranslateService.t('TUIChat.视频');
|
|
70
|
+
break;
|
|
71
|
+
case 'file':
|
|
72
|
+
abstract += TUITranslateService.t('TUIChat.文件');
|
|
73
|
+
break;
|
|
74
|
+
default:
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
return abstract;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
private isEditorNotEmpty(editorHTML: string) {
|
|
82
|
+
return editorHTML && !editorHTML.includes('is-empty') && editorHTML !== '<p></p>';
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export default ConversationDraftManager.getInstance();
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import TUIChatEngine, {
|
|
2
|
+
TUIChatService,
|
|
3
|
+
TUIStore,
|
|
4
|
+
StoreName,
|
|
5
|
+
IConversationModel,
|
|
6
|
+
SendMessageParams,
|
|
7
|
+
} from '@tencentcloud/chat-uikit-engine';
|
|
8
|
+
import { isEnabledMessageReadReceiptGlobal } from '../../../utils/utils';
|
|
9
|
+
import { ITipTapEditorContent } from '../../../interface';
|
|
10
|
+
import { enableSampleTaskStatus } from '../../../utils/enableSampleTaskStatus';
|
|
11
|
+
|
|
12
|
+
export const sendMessageErrorCodeMap: Map<number, string> = new Map([
|
|
13
|
+
[3123, '文本包含本地审核拦截词'],
|
|
14
|
+
[4004, '图片消息失败,无效的图片格式'],
|
|
15
|
+
[4005, '文件消息失败,禁止发送违规封禁的文件'],
|
|
16
|
+
[7004, '文件不存在,请检查文件路径是否正确'],
|
|
17
|
+
[7005, '文件大小超出了限制,如果上传文件,最大限制是100MB'],
|
|
18
|
+
[8001, '消息长度超出限制,消息长度不要超过12K'],
|
|
19
|
+
[80001, '消息或者资料中文本存在敏感内容,发送失败'],
|
|
20
|
+
[80004, '消息中图片存在敏感内容,发送失败'],
|
|
21
|
+
]);
|
|
22
|
+
|
|
23
|
+
export const createOfflinePushInfo = (conversation: IConversationModel) => {
|
|
24
|
+
const androidInfo = {
|
|
25
|
+
sound: 'private_ring.mp3',
|
|
26
|
+
XiaoMiChannelID: 'high_custom_1',
|
|
27
|
+
OPPOChannelID: 'tuikit',
|
|
28
|
+
};
|
|
29
|
+
const apnsInfo = {
|
|
30
|
+
sound: '01.caf',
|
|
31
|
+
image: 'https://web.sdk.qcloud.com/im/demo/latest/faviconnew.png',
|
|
32
|
+
};
|
|
33
|
+
const userInfo = TUIStore.getData(StoreName.USER, 'userProfile');
|
|
34
|
+
const entity = {
|
|
35
|
+
sender: conversation.type === TUIChatEngine.TYPES.CONV_GROUP ? conversation.groupProfile?.groupID : userInfo.userID,
|
|
36
|
+
nickName: userInfo.nick,
|
|
37
|
+
chatType: conversation.type === TUIChatEngine.TYPES.CONV_GROUP ? 2 : 1,
|
|
38
|
+
version: 1,
|
|
39
|
+
action: 1,
|
|
40
|
+
};
|
|
41
|
+
return {
|
|
42
|
+
extension: JSON.stringify({ entity }),
|
|
43
|
+
androidInfo,
|
|
44
|
+
apnsInfo,
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* This function only processes five message types: Text/TextAt/Image/Video/File
|
|
50
|
+
* @param messageList
|
|
51
|
+
* @param currentConversation
|
|
52
|
+
*/
|
|
53
|
+
export const sendMessages = async (
|
|
54
|
+
messageList: ITipTapEditorContent[],
|
|
55
|
+
currentConversation: IConversationModel,
|
|
56
|
+
) => {
|
|
57
|
+
// In case of messageJumping, the sent message is automatically cleared and returns to the bottom
|
|
58
|
+
if (TUIStore.getData(StoreName.CHAT, 'messageSource')) {
|
|
59
|
+
TUIStore.update(StoreName.CHAT, 'messageSource', undefined);
|
|
60
|
+
}
|
|
61
|
+
messageList?.forEach(async (content: ITipTapEditorContent) => {
|
|
62
|
+
try {
|
|
63
|
+
const options: SendMessageParams = {
|
|
64
|
+
to: currentConversation?.groupProfile?.groupID || currentConversation?.userProfile?.userID,
|
|
65
|
+
conversationType: currentConversation?.type as any,
|
|
66
|
+
payload: {},
|
|
67
|
+
needReadReceipt: isEnabledMessageReadReceiptGlobal(),
|
|
68
|
+
};
|
|
69
|
+
// handle message typing
|
|
70
|
+
let textMessageContent;
|
|
71
|
+
const sendMessageOptions = {
|
|
72
|
+
offlinePushInfo: {},
|
|
73
|
+
};
|
|
74
|
+
switch (content?.type) {
|
|
75
|
+
case 'text':
|
|
76
|
+
textMessageContent = JSON.parse(JSON.stringify(content.payload?.text));
|
|
77
|
+
// Do not send empty messages
|
|
78
|
+
if (!textMessageContent) {
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
options.payload = {
|
|
82
|
+
text: textMessageContent,
|
|
83
|
+
};
|
|
84
|
+
if (content.payload?.atUserList) {
|
|
85
|
+
options.payload.atUserList = content.payload.atUserList;
|
|
86
|
+
await TUIChatService.sendTextAtMessage(options, sendMessageOptions);
|
|
87
|
+
} else {
|
|
88
|
+
await TUIChatService.sendTextMessage(options, sendMessageOptions);
|
|
89
|
+
}
|
|
90
|
+
break;
|
|
91
|
+
case 'image':
|
|
92
|
+
options.payload = {
|
|
93
|
+
file: content.payload?.file,
|
|
94
|
+
};
|
|
95
|
+
await TUIChatService.sendImageMessage(options, sendMessageOptions);
|
|
96
|
+
break;
|
|
97
|
+
case 'video':
|
|
98
|
+
options.payload = {
|
|
99
|
+
file: content.payload?.file,
|
|
100
|
+
};
|
|
101
|
+
await TUIChatService.sendVideoMessage(options, sendMessageOptions);
|
|
102
|
+
break;
|
|
103
|
+
case 'file':
|
|
104
|
+
options.payload = {
|
|
105
|
+
file: content.payload?.file,
|
|
106
|
+
};
|
|
107
|
+
await TUIChatService.sendFileMessage(options, sendMessageOptions);
|
|
108
|
+
break;
|
|
109
|
+
default:
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
enableSampleTaskStatus('sendMessage');
|
|
113
|
+
} catch (error: any) {
|
|
114
|
+
console.error(error);
|
|
115
|
+
// If the message fails to be sent and the message is a reference message, clear the reference message information
|
|
116
|
+
if (TUIStore.getData(StoreName.CHAT, 'quoteMessage')) {
|
|
117
|
+
TUIStore.update(StoreName.CHAT, 'quoteMessage', {});
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export const handleMessageWithTyping = (cloudCustomData: any) => {
|
|
124
|
+
if (!cloudCustomData) {
|
|
125
|
+
cloudCustomData = {};
|
|
126
|
+
}
|
|
127
|
+
cloudCustomData.messageFeature = {
|
|
128
|
+
needTyping: 1,
|
|
129
|
+
version: 1,
|
|
130
|
+
};
|
|
131
|
+
return cloudCustomData;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
export const sendTyping = (inputContentEmpty: boolean, inputBlur: boolean) => {
|
|
135
|
+
if (!inputContentEmpty && !inputBlur) {
|
|
136
|
+
TUIChatService.enterTypingState();
|
|
137
|
+
} else {
|
|
138
|
+
TUIChatService.leaveTypingState();
|
|
139
|
+
}
|
|
140
|
+
};
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="avatar-container"
|
|
4
|
+
:style="{
|
|
5
|
+
width: avatarSize,
|
|
6
|
+
height: avatarSize,
|
|
7
|
+
borderRadius: avatarBorderRadius,
|
|
8
|
+
}"
|
|
9
|
+
>
|
|
10
|
+
<template v-if="isUniFrameWork">
|
|
11
|
+
<image
|
|
12
|
+
v-if="!loadErrorInUniapp"
|
|
13
|
+
class="avatar-image"
|
|
14
|
+
:src="avatarImageUrl || defaultAvatarUrl"
|
|
15
|
+
@load="avatarLoadSuccess"
|
|
16
|
+
@error="avatarLoadFailed"
|
|
17
|
+
/>
|
|
18
|
+
<image
|
|
19
|
+
v-else
|
|
20
|
+
class="avatar-image"
|
|
21
|
+
:src="defaultAvatarUrl"
|
|
22
|
+
@load="avatarLoadSuccess"
|
|
23
|
+
@error="avatarLoadFailed"
|
|
24
|
+
/>
|
|
25
|
+
</template>
|
|
26
|
+
<img
|
|
27
|
+
v-else
|
|
28
|
+
class="avatar-image"
|
|
29
|
+
:src="avatarImageUrl || defaultAvatarUrl"
|
|
30
|
+
@load="avatarLoadSuccess"
|
|
31
|
+
@error="avatarLoadFailed"
|
|
32
|
+
>
|
|
33
|
+
<div
|
|
34
|
+
v-if="useAvatarSkeletonAnimation && !isImgLoaded"
|
|
35
|
+
:class="{
|
|
36
|
+
placeholder: true,
|
|
37
|
+
hidden: isImgLoaded,
|
|
38
|
+
'skeleton-animation': useAvatarSkeletonAnimation,
|
|
39
|
+
}"
|
|
40
|
+
/>
|
|
41
|
+
</div>
|
|
42
|
+
</template>
|
|
43
|
+
|
|
44
|
+
<script setup lang="ts">
|
|
45
|
+
import vue from '../../../adapter-vue';
|
|
46
|
+
import { isUniFrameWork } from '../../../utils/env';
|
|
47
|
+
const { ref, toRefs } = vue;
|
|
48
|
+
|
|
49
|
+
interface IProps {
|
|
50
|
+
url: string;
|
|
51
|
+
size?: string;
|
|
52
|
+
borderRadius?: string;
|
|
53
|
+
useSkeletonAnimation?: boolean;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
interface IEmits {
|
|
57
|
+
(key: 'onLoad', e: Event): void;
|
|
58
|
+
(key: 'onError', e: Event): void;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const defaultAvatarUrl = ref(
|
|
62
|
+
'https://web.sdk.qcloud.com/component/TUIKit/assets/avatar_21.png',
|
|
63
|
+
);
|
|
64
|
+
const emits = defineEmits<IEmits>();
|
|
65
|
+
const props = withDefaults(defineProps<IProps>(), {
|
|
66
|
+
// uniapp vue2 does not support constants in defineProps
|
|
67
|
+
url: 'https://web.sdk.qcloud.com/component/TUIKit/assets/avatar_21.png',
|
|
68
|
+
size: '36px',
|
|
69
|
+
borderRadius: '50%',
|
|
70
|
+
useSkeletonAnimation: false,
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
const {
|
|
74
|
+
size: avatarSize,
|
|
75
|
+
url: avatarImageUrl,
|
|
76
|
+
borderRadius: avatarBorderRadius,
|
|
77
|
+
useSkeletonAnimation: useAvatarSkeletonAnimation,
|
|
78
|
+
} = toRefs(props);
|
|
79
|
+
|
|
80
|
+
let reloadAvatarTime = 0;
|
|
81
|
+
const isImgLoaded = ref<boolean>(false);
|
|
82
|
+
const loadErrorInUniapp = ref<boolean>(false);
|
|
83
|
+
|
|
84
|
+
function avatarLoadSuccess(e: Event) {
|
|
85
|
+
isImgLoaded.value = true;
|
|
86
|
+
emits('onLoad', e);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function avatarLoadFailed(e: Event) {
|
|
90
|
+
reloadAvatarTime += 1;
|
|
91
|
+
if (reloadAvatarTime > 3) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (isUniFrameWork) {
|
|
95
|
+
loadErrorInUniapp.value = true;
|
|
96
|
+
} else {
|
|
97
|
+
(e.currentTarget as HTMLImageElement).src = defaultAvatarUrl.value;
|
|
98
|
+
}
|
|
99
|
+
emits('onError', e);
|
|
100
|
+
}
|
|
101
|
+
</script>
|
|
102
|
+
|
|
103
|
+
<style scoped lang="scss">
|
|
104
|
+
:not(not) {
|
|
105
|
+
display: flex;
|
|
106
|
+
flex-direction: column;
|
|
107
|
+
box-sizing: border-box;
|
|
108
|
+
min-width: 0;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.avatar-container {
|
|
112
|
+
position: relative;
|
|
113
|
+
justify-content: center;
|
|
114
|
+
align-items: center;
|
|
115
|
+
overflow: hidden;
|
|
116
|
+
flex: 0 0 auto;
|
|
117
|
+
|
|
118
|
+
.placeholder {
|
|
119
|
+
position: absolute;
|
|
120
|
+
top: 0;
|
|
121
|
+
left: 0;
|
|
122
|
+
width: 100%;
|
|
123
|
+
height: 100%;
|
|
124
|
+
background-color: #ececec;
|
|
125
|
+
transition: opacity 0.3s, background-color 0.1s ease-out;
|
|
126
|
+
|
|
127
|
+
&.skeleton-animation {
|
|
128
|
+
animation: breath 2s linear 0.3s infinite;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
&.hidden {
|
|
132
|
+
opacity: 0;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.avatar-image {
|
|
137
|
+
width: 100%;
|
|
138
|
+
height: 100%;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
@keyframes breath {
|
|
143
|
+
50% {
|
|
144
|
+
/* stylelint-disable-next-line scss/no-global-function-names */
|
|
145
|
+
background-color: darken(#ececec, 10%);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
</style>
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
移动端 底部弹出对话框 组件
|
|
3
|
+
- pc 端,仅展示【插槽】内容,无弹出对话框,无对话框相关 header footer
|
|
4
|
+
- mobile 端,底部弹出对话框,支持 对话框相关 header footer 定制展示,详情请参见参数列表
|
|
5
|
+
-->
|
|
6
|
+
<template>
|
|
7
|
+
<div v-if="props.show">
|
|
8
|
+
<div
|
|
9
|
+
v-if="!isPC"
|
|
10
|
+
:class="[
|
|
11
|
+
'bottom-popup',
|
|
12
|
+
isUniFrameWork && 'bottom-popup-uni',
|
|
13
|
+
!isPC && 'bottom-popup-h5',
|
|
14
|
+
!isPC && props.modal && 'bottom-popup-modal',
|
|
15
|
+
]"
|
|
16
|
+
@click="closeBottomPopup"
|
|
17
|
+
>
|
|
18
|
+
<div
|
|
19
|
+
ref="dialogRef"
|
|
20
|
+
:class="['bottom-popup-main', !isPC && 'bottom-popup-h5-main']"
|
|
21
|
+
:style="{
|
|
22
|
+
height: props.height,
|
|
23
|
+
borderTopLeftRadius: props.borderRadius,
|
|
24
|
+
borderTopRightRadius: props.borderRadius,
|
|
25
|
+
}"
|
|
26
|
+
@click.stop
|
|
27
|
+
>
|
|
28
|
+
<div
|
|
29
|
+
v-if="title || showHeaderCloseButton"
|
|
30
|
+
class="header"
|
|
31
|
+
>
|
|
32
|
+
<div
|
|
33
|
+
v-if="title"
|
|
34
|
+
class="header-title"
|
|
35
|
+
>
|
|
36
|
+
{{ title }}
|
|
37
|
+
</div>
|
|
38
|
+
<div
|
|
39
|
+
v-if="showHeaderCloseButton"
|
|
40
|
+
class="header-close"
|
|
41
|
+
@click="closeBottomPopup"
|
|
42
|
+
>
|
|
43
|
+
{{ TUITranslateService.t("关闭") }}
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
<slot />
|
|
47
|
+
<div
|
|
48
|
+
v-if="showFooterSubmitButton"
|
|
49
|
+
class="footer"
|
|
50
|
+
>
|
|
51
|
+
<div
|
|
52
|
+
class="footer-submit"
|
|
53
|
+
@click="submit"
|
|
54
|
+
>
|
|
55
|
+
{{ submitButtonContent }}
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
<slot v-else />
|
|
61
|
+
</div>
|
|
62
|
+
</template>
|
|
63
|
+
<script setup lang="ts">
|
|
64
|
+
import vue from '../../../adapter-vue';
|
|
65
|
+
import { TUITranslateService } from '@tencentcloud/chat-uikit-engine';
|
|
66
|
+
import { outsideClick } from '@tencentcloud/universal-api';
|
|
67
|
+
import { isPC, isH5, isUniFrameWork } from '../../../utils/env';
|
|
68
|
+
const { ref, watch, nextTick } = vue;
|
|
69
|
+
|
|
70
|
+
const props = defineProps({
|
|
71
|
+
// Whether to display the bottom pop-up dialog box
|
|
72
|
+
show: {
|
|
73
|
+
type: Boolean,
|
|
74
|
+
default: false,
|
|
75
|
+
},
|
|
76
|
+
// Whether a mask layer is required, the default is true
|
|
77
|
+
modal: {
|
|
78
|
+
type: Boolean,
|
|
79
|
+
default: true,
|
|
80
|
+
},
|
|
81
|
+
// Popup box content area height (excluding mask), default is fit-content
|
|
82
|
+
height: {
|
|
83
|
+
type: String,
|
|
84
|
+
default: 'fit-content',
|
|
85
|
+
},
|
|
86
|
+
// Whether the pop-up dialog box can be closed by clicking outside, the default is true
|
|
87
|
+
// uniapp only supports closing the pop-up dialog box by clicking the mask
|
|
88
|
+
closeByClickOutside: {
|
|
89
|
+
type: Boolean,
|
|
90
|
+
default: true,
|
|
91
|
+
},
|
|
92
|
+
// The rounded angle of the top border corners is 0px by default, i.e. right angle by default
|
|
93
|
+
borderRadius: {
|
|
94
|
+
type: String,
|
|
95
|
+
default: '0px',
|
|
96
|
+
},
|
|
97
|
+
title: {
|
|
98
|
+
type: String,
|
|
99
|
+
default: '',
|
|
100
|
+
},
|
|
101
|
+
// Whether to display the top close button, not displayed by default
|
|
102
|
+
showHeaderCloseButton: {
|
|
103
|
+
type: Boolean,
|
|
104
|
+
default: false,
|
|
105
|
+
},
|
|
106
|
+
// Whether to display the submit button at the bottom, not displayed by default
|
|
107
|
+
showFooterSubmitButton: {
|
|
108
|
+
type: Boolean,
|
|
109
|
+
default: false,
|
|
110
|
+
},
|
|
111
|
+
// Bottom submit button text, only valid when showFooterSubmitButton is true
|
|
112
|
+
submitButtonContent: {
|
|
113
|
+
type: String,
|
|
114
|
+
default: () => TUITranslateService.t('确定'),
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
const emits = defineEmits(['onOpen', 'onClose', 'onSubmit']);
|
|
119
|
+
const dialogRef = ref();
|
|
120
|
+
|
|
121
|
+
watch(
|
|
122
|
+
() => props.show,
|
|
123
|
+
(newVal: boolean, oldVal: boolean) => {
|
|
124
|
+
if (newVal === oldVal) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
switch (newVal) {
|
|
128
|
+
case true:
|
|
129
|
+
emits('onOpen', dialogRef);
|
|
130
|
+
nextTick(() => {
|
|
131
|
+
// Effective under web h5
|
|
132
|
+
if (isH5 && !isUniFrameWork) {
|
|
133
|
+
if (props.closeByClickOutside) {
|
|
134
|
+
outsideClick.listen({
|
|
135
|
+
domRefs: dialogRef.value,
|
|
136
|
+
handler: closeBottomPopup,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
break;
|
|
142
|
+
case false:
|
|
143
|
+
emits('onClose', dialogRef);
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
const closeBottomPopup = () => {
|
|
150
|
+
if (isUniFrameWork || isH5) {
|
|
151
|
+
emits('onClose', dialogRef);
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
const submit = () => {
|
|
156
|
+
emits('onSubmit');
|
|
157
|
+
closeBottomPopup();
|
|
158
|
+
};
|
|
159
|
+
</script>
|
|
160
|
+
<style scoped lang="scss" src="./style/index.scss"></style>
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
.bottom-popup-h5 {
|
|
2
|
+
width:100%;
|
|
3
|
+
height: 100%;
|
|
4
|
+
position: fixed;
|
|
5
|
+
left: 0;
|
|
6
|
+
top: 0;
|
|
7
|
+
bottom: 0;
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
justify-content: flex-end;
|
|
12
|
+
align-items: stretch;
|
|
13
|
+
margin: 0;
|
|
14
|
+
padding: 0;
|
|
15
|
+
z-index: 999999;
|
|
16
|
+
border-radius: 5px 5px 0 0;
|
|
17
|
+
|
|
18
|
+
&-main {
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
justify-content: center;
|
|
22
|
+
align-items: stretch;
|
|
23
|
+
height: fit-content;
|
|
24
|
+
background-color: #fff;
|
|
25
|
+
background-image: url("../../../../assets/form-dialog-bg.png");
|
|
26
|
+
background-size: cover;
|
|
27
|
+
max-height:80vh;
|
|
28
|
+
overflow-y: auto;
|
|
29
|
+
.header {
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-direction: row;
|
|
32
|
+
justify-content: space-between;
|
|
33
|
+
padding: 20px;
|
|
34
|
+
font-size: 16px;
|
|
35
|
+
|
|
36
|
+
.header-close {
|
|
37
|
+
font-family: PingFangSC-Regular;
|
|
38
|
+
font-weight: 400;
|
|
39
|
+
color: #006eff;
|
|
40
|
+
font-size: 18px;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.footer {
|
|
45
|
+
padding: 20px;
|
|
46
|
+
|
|
47
|
+
.footer-submit {
|
|
48
|
+
color: #fff;
|
|
49
|
+
padding: 12px 0;
|
|
50
|
+
width: 100%;
|
|
51
|
+
background: #006eff;
|
|
52
|
+
text-align: center;
|
|
53
|
+
border-radius: 5px;
|
|
54
|
+
font-size: 16px;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.bottom-popup-uni {
|
|
61
|
+
padding-bottom: var(--window-bottom);
|
|
62
|
+
}
|