@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,40 @@
|
|
|
1
|
+
const uglify = require('uglify-js')
|
|
2
|
+
const through2 = require('through2')
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @description 压缩内联 wxs 脚本
|
|
6
|
+
*/
|
|
7
|
+
function wxs () {
|
|
8
|
+
return through2.obj(function (file, _, callback) {
|
|
9
|
+
if (file.isBuffer()) {
|
|
10
|
+
file.contents = Buffer.from(file.contents.toString().replace(/<wxs(.*?)>([\s\S]+?)<\/wxs>/, (_, $1, $2) => {
|
|
11
|
+
return `<wxs${$1}>${uglify.minify($2, {
|
|
12
|
+
fromString: true,
|
|
13
|
+
mangle: {
|
|
14
|
+
toplevel: true
|
|
15
|
+
}
|
|
16
|
+
}).code}</wxs>`
|
|
17
|
+
}))
|
|
18
|
+
}
|
|
19
|
+
this.push(file)
|
|
20
|
+
callback()
|
|
21
|
+
})
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @description 压缩 json 文件
|
|
26
|
+
*/
|
|
27
|
+
function json () {
|
|
28
|
+
return through2.obj(function (file, _, callback) {
|
|
29
|
+
if (file.isBuffer()) {
|
|
30
|
+
file.contents = Buffer.from(JSON.stringify(JSON.parse(file.contents.toString())))
|
|
31
|
+
}
|
|
32
|
+
this.push(file)
|
|
33
|
+
callback()
|
|
34
|
+
})
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
module.exports = {
|
|
38
|
+
wxs,
|
|
39
|
+
json
|
|
40
|
+
}
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview 处理插件
|
|
3
|
+
*/
|
|
4
|
+
const path = require('path')
|
|
5
|
+
const through2 = require('through2')
|
|
6
|
+
|
|
7
|
+
const config = require('./config')
|
|
8
|
+
|
|
9
|
+
config.plugins.sort((a, b) => {
|
|
10
|
+
// editable 置于最后面
|
|
11
|
+
if (a === 'editable') return 1
|
|
12
|
+
if (b === 'editable') return -1
|
|
13
|
+
// markdown 置于最前面
|
|
14
|
+
if (a === 'markdown') return -1
|
|
15
|
+
if (b === 'markdown') return 1
|
|
16
|
+
// 剩余任意顺序
|
|
17
|
+
return 0
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
// 提取和替换标签名选择器(组件中仅支持 class 选择器)
|
|
21
|
+
const tagSelector = {}
|
|
22
|
+
let tagI = 0
|
|
23
|
+
if (config.externStyle) {
|
|
24
|
+
config.externStyle = config.externStyle.replace(/[^,\s}]+(?=[^}]*{)/g, $ => {
|
|
25
|
+
if (!/[a-zA-Z_]/.test($[0])) return $
|
|
26
|
+
if (tagSelector[$]) return '.' + tagSelector[$]
|
|
27
|
+
tagSelector[$] = '_' + tagI++
|
|
28
|
+
return '.' + tagSelector[$]
|
|
29
|
+
})
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
module.exports = {
|
|
33
|
+
/**
|
|
34
|
+
* @description 构建插件
|
|
35
|
+
* @param {string} platform 使用平台
|
|
36
|
+
*/
|
|
37
|
+
build (platform) {
|
|
38
|
+
const builds = {} // 构建模块
|
|
39
|
+
let pluginImports = '' // 插件引入
|
|
40
|
+
let plugins = '' // 插件列表
|
|
41
|
+
let voidTags = '' // 增加的自闭合标签
|
|
42
|
+
let wxml = '' // 要引入到 node.wxml 中的内容
|
|
43
|
+
let js = '' // 要引入到 node.js 中的内容
|
|
44
|
+
let wxss = config.externStyle // 要引入到 node.wxss 中的内容
|
|
45
|
+
const json = {} // 要引入到 node.json 中的内容
|
|
46
|
+
|
|
47
|
+
// 收集插件中要写入模板文件的内容
|
|
48
|
+
for (let i = 0; i < config.plugins.length; i++) {
|
|
49
|
+
const plugin = config.plugins[i]
|
|
50
|
+
let build = {}
|
|
51
|
+
try {
|
|
52
|
+
// 专用 build
|
|
53
|
+
if (platform === 'uni-app') {
|
|
54
|
+
build = require(`../plugins/${plugin}/uni-app/build.js`)
|
|
55
|
+
} else {
|
|
56
|
+
build = require(`../plugins/${plugin}/miniprogram/build.js`)
|
|
57
|
+
}
|
|
58
|
+
} catch (e) { }
|
|
59
|
+
try {
|
|
60
|
+
// 通用 build
|
|
61
|
+
build = Object.assign(require(`../plugins/${plugin}/build.js`), build)
|
|
62
|
+
} catch (e) { }
|
|
63
|
+
// 可以在当前平台使用
|
|
64
|
+
if (!build.platform || build.platform.includes(platform)) {
|
|
65
|
+
builds[plugin] = build
|
|
66
|
+
if (platform === 'uni-app') {
|
|
67
|
+
plugins += plugin.replace(/-([a-z])/g, ($, $1) => $1.toUpperCase()) + ','
|
|
68
|
+
pluginImports += `import ${plugin.replace(/-([a-z])/g, ($, $1) => $1.toUpperCase())} from './${plugin}/${build.main ? build.main : 'index.js'}'\n`
|
|
69
|
+
} else {
|
|
70
|
+
plugins += `require('./${plugin}/${build.main ? build.main : 'index.js'}'),`
|
|
71
|
+
}
|
|
72
|
+
if (build.template) {
|
|
73
|
+
wxml += build.template.replace('wx:if', 'wx:elif').replace('v-if', 'v-else-if')
|
|
74
|
+
}
|
|
75
|
+
if (build.methods) {
|
|
76
|
+
for (const method in build.methods) {
|
|
77
|
+
js += build.methods[method].toString() + ','
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (build.usingComponents) {
|
|
81
|
+
Object.assign(json, build.usingComponents)
|
|
82
|
+
}
|
|
83
|
+
if (build.style) {
|
|
84
|
+
wxss += build.style
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// 加入其他自定义标签
|
|
90
|
+
for (const item of config.customElements) {
|
|
91
|
+
if (platform === 'uni-app') {
|
|
92
|
+
if (item.platforms) {
|
|
93
|
+
wxml += '<!-- #ifdef ' + item.platforms.join(' || ').toUpperCase() + ' -->'
|
|
94
|
+
}
|
|
95
|
+
voidTags += item.name + ','
|
|
96
|
+
wxml += '<' + item.name + ' v-else-if="n.name==\'' + item.name + '\'" :class="n.attrs.class" :style="n.attrs.style"'
|
|
97
|
+
if (item.attrs) {
|
|
98
|
+
for (const attr of item.attrs) {
|
|
99
|
+
wxml += ' :' + attr + '="n.attrs'
|
|
100
|
+
if (attr.includes('-')) {
|
|
101
|
+
wxml += '[\'' + attr + '\']"'
|
|
102
|
+
} else {
|
|
103
|
+
wxml += '.' + attr + '"'
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
wxml += ' />'
|
|
108
|
+
if (item.platforms) {
|
|
109
|
+
wxml += '<!-- #endif -->'
|
|
110
|
+
}
|
|
111
|
+
} else if (!item.platforms || item.platforms.join(',').toLowerCase().includes(platform)) {
|
|
112
|
+
voidTags += item.name + ','
|
|
113
|
+
wxml += '<' + item.name + ' wx:elif="{{n.name==\'' + item.name + '\'}}" class="{{n.attrs.class}}" style="{{n.attrs.style}}"'
|
|
114
|
+
if (item.attrs) {
|
|
115
|
+
for (const attr of item.attrs) {
|
|
116
|
+
wxml += ' ' + attr + '="{{n.attrs'
|
|
117
|
+
if (attr.includes('-')) {
|
|
118
|
+
wxml += '[\'' + attr + '\']}}"'
|
|
119
|
+
} else {
|
|
120
|
+
wxml += '.' + attr + '}}"'
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
wxml += ' />'
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return through2.obj(function (file, _, callback) {
|
|
129
|
+
if (file.isBuffer()) {
|
|
130
|
+
// src 目录
|
|
131
|
+
if (file.base.includes('src')) {
|
|
132
|
+
let content = file.contents.toString()
|
|
133
|
+
if (file.basename === 'index.js' || file.basename === 'mp-html.vue') {
|
|
134
|
+
// 注册插件列表
|
|
135
|
+
if (platform === 'uni-app') {
|
|
136
|
+
content = content.replace(/const\s*plugins\s*=\s*\[\]/, `${pluginImports}const plugins=[${plugins}]`)
|
|
137
|
+
} else {
|
|
138
|
+
content = content.replace(/plugins\s*=\s*\[\]/, `plugins=[${plugins}]`)
|
|
139
|
+
}
|
|
140
|
+
} else if (file.basename === 'parser.js') {
|
|
141
|
+
// 设置标签名选择器
|
|
142
|
+
content = content.replace(/tagSelector\s*=\s*{}/, `tagSelector=${JSON.stringify(tagSelector)}`)
|
|
143
|
+
// 设置自闭合标签
|
|
144
|
+
.replace(/voidTags\s*:\s*makeMap\('/, 'voidTags: makeMap(\'' + voidTags)
|
|
145
|
+
} else if (file.basename === 'node.wxml') {
|
|
146
|
+
// 引入模板
|
|
147
|
+
content = content.replace(/<!--\s*insert\s*-->/, wxml)
|
|
148
|
+
} else if (file.basename === 'node.js') {
|
|
149
|
+
// 引入方法
|
|
150
|
+
content = content.replace(/methods\s*:\s*{/, 'methods:{' + js)
|
|
151
|
+
} else if (file.basename === 'node.wxss') {
|
|
152
|
+
// 引入样式
|
|
153
|
+
content = wxss + content
|
|
154
|
+
} else if (file.basename === 'node.json') {
|
|
155
|
+
// 引入组件声明
|
|
156
|
+
const comps = JSON.stringify(json).slice(1, -1)
|
|
157
|
+
if (comps) {
|
|
158
|
+
content = content.replace(/"usingComponents"\s*:\s*{/, '"usingComponents":{' + comps + ',')
|
|
159
|
+
}
|
|
160
|
+
} else if (file.basename === 'node.vue') {
|
|
161
|
+
// 引入 vue
|
|
162
|
+
content = content.replace(/<!--\s*insert\s*-->/, wxml)
|
|
163
|
+
.replace(/methods\s*:\s*{/, 'methods:{' + js)
|
|
164
|
+
.replace('<style>', '<style>' + wxss.replace(/\.[a-zA-Z_][^)}]*?[{,]/g, '/deep/ $&')).replace(/,url/g, ', url')
|
|
165
|
+
let importComp = ''
|
|
166
|
+
let comps = ''
|
|
167
|
+
for (let item in json) {
|
|
168
|
+
const val = json[item]
|
|
169
|
+
// 插件无法通过这种方式引入
|
|
170
|
+
if (val.includes('plugin://')) continue
|
|
171
|
+
item = item.replace(/-([a-z])/g, (_, $1) => $1.toUpperCase())
|
|
172
|
+
importComp += 'import ' + item + " from '" + val + "'\n"
|
|
173
|
+
comps += item + ',\n'
|
|
174
|
+
}
|
|
175
|
+
content = content.replace('<script>', '<script>\n' + importComp)
|
|
176
|
+
.replace(/components\s*:\s*{/, 'components: {\n' + comps)
|
|
177
|
+
} else if (file.basename === 'local.html' && wxss) {
|
|
178
|
+
// 引入样式
|
|
179
|
+
content = '<style>' + wxss + '</style>' + content
|
|
180
|
+
}
|
|
181
|
+
file.contents = Buffer.from(content)
|
|
182
|
+
for (const item in builds) {
|
|
183
|
+
if (builds[item].handler) {
|
|
184
|
+
builds[item].handler(file, platform)
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
} else {
|
|
188
|
+
// plugins 目录
|
|
189
|
+
const name = file.relative.split(path.sep)[0]
|
|
190
|
+
const build = builds[name]
|
|
191
|
+
// 本平台不支持使用
|
|
192
|
+
if (!build || file.extname === '.md' || file.basename === 'build.js') {
|
|
193
|
+
callback()
|
|
194
|
+
return
|
|
195
|
+
}
|
|
196
|
+
// import
|
|
197
|
+
if (build.import) {
|
|
198
|
+
if (typeof build.import === 'string') {
|
|
199
|
+
if (file.relative.includes(build.import)) {
|
|
200
|
+
file.import = true
|
|
201
|
+
}
|
|
202
|
+
} else {
|
|
203
|
+
for (let i = 0; i < build.import.length; i++) {
|
|
204
|
+
if (file.relative.includes(build.import[i])) {
|
|
205
|
+
file.import = true
|
|
206
|
+
break
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
if (build.handler) {
|
|
212
|
+
build.handler(file, platform)
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
this.push(file)
|
|
217
|
+
callback()
|
|
218
|
+
})
|
|
219
|
+
},
|
|
220
|
+
/**
|
|
221
|
+
* @description 引入样式文件到 node.wxss 中
|
|
222
|
+
*/
|
|
223
|
+
importCss () {
|
|
224
|
+
let css = ''
|
|
225
|
+
return through2.obj(function (file, _, callback) {
|
|
226
|
+
if (file.isBuffer()) {
|
|
227
|
+
let content = file.contents.toString()
|
|
228
|
+
// 要被引入的文件
|
|
229
|
+
if (file.import) {
|
|
230
|
+
css += content
|
|
231
|
+
callback()
|
|
232
|
+
return
|
|
233
|
+
}
|
|
234
|
+
// 引入到对应位置
|
|
235
|
+
if (file.basename === 'node.wxss') {
|
|
236
|
+
content = css + content
|
|
237
|
+
} else if (file.basename === 'node.vue') {
|
|
238
|
+
content = content.replace('<style>', '<style>' + css.replace(/\.[a-z_][^)}]+?[{,]/g, '/deep/ $&')).replace(/,url/g, ', url')
|
|
239
|
+
} else if (file.basename === 'local.html' && css) {
|
|
240
|
+
content = '<style>' + css + '</style>' + content
|
|
241
|
+
}
|
|
242
|
+
file.contents = Buffer.from(content)
|
|
243
|
+
}
|
|
244
|
+
this.push(file)
|
|
245
|
+
callback()
|
|
246
|
+
})
|
|
247
|
+
}
|
|
248
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/* eslint-disable no-case-declarations */
|
|
2
|
+
import vue from '../../../adapter-vue';
|
|
3
|
+
import { TUIGlobal } from '@tencentcloud/universal-api';
|
|
4
|
+
import TOAST_TYPE from './type';
|
|
5
|
+
import MessageConstructor from './index-web.vue';
|
|
6
|
+
//@ts-ignore
|
|
7
|
+
import { vueVersion } from '../../../adapter-vue-web';
|
|
8
|
+
import { VNode } from 'vue';
|
|
9
|
+
//@ts-ignore
|
|
10
|
+
const { createVNode, render } = vue;
|
|
11
|
+
|
|
12
|
+
interface IToast {
|
|
13
|
+
message: string;
|
|
14
|
+
type: string;
|
|
15
|
+
offset?: number;
|
|
16
|
+
duration?: number;
|
|
17
|
+
onClose?(): void;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface IToastReturnType {
|
|
21
|
+
close?(): void;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const instances: any[] = [];
|
|
25
|
+
let seed = 1;
|
|
26
|
+
|
|
27
|
+
const vueVersionInt = Math.trunc(vueVersion);
|
|
28
|
+
const appendTo: HTMLElement | null = document.body;
|
|
29
|
+
|
|
30
|
+
const Toast = function (options: IToast): IToastReturnType {
|
|
31
|
+
let verticalOffset = options.offset || 20;
|
|
32
|
+
instances.forEach(({ vm }: any) => {
|
|
33
|
+
verticalOffset += (vm?.el?.offsetHeight || vm?.$el?.offsetHeight || 0) + 20;
|
|
34
|
+
});
|
|
35
|
+
verticalOffset += 20;
|
|
36
|
+
const id = `message_${(seed += 1)}`;
|
|
37
|
+
const userOnClose = options.onClose;
|
|
38
|
+
const props: any = {
|
|
39
|
+
zIndex: 20 + seed,
|
|
40
|
+
offset: verticalOffset,
|
|
41
|
+
id,
|
|
42
|
+
...options,
|
|
43
|
+
onClose: () => {
|
|
44
|
+
Toast.close(id, userOnClose);
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
let vm: { component: any; props: any; data: any };
|
|
48
|
+
let container: HTMLDivElement;
|
|
49
|
+
switch (vueVersionInt) {
|
|
50
|
+
case 2:
|
|
51
|
+
const Vue = TUIGlobal?.Vue;
|
|
52
|
+
if (!Vue) {
|
|
53
|
+
return {};
|
|
54
|
+
}
|
|
55
|
+
const Constructor = Vue.extend(MessageConstructor);
|
|
56
|
+
const instance = new Constructor({ propsData: props });
|
|
57
|
+
instance.$mount();
|
|
58
|
+
appendTo.appendChild(instance.$el);
|
|
59
|
+
instance.$el.style.zIndex = props.zIndex;
|
|
60
|
+
instance.verticalOffset = props.verticalOffset;
|
|
61
|
+
instance.visible = true;
|
|
62
|
+
instances.push({ vm: instance });
|
|
63
|
+
return {
|
|
64
|
+
close: () => {
|
|
65
|
+
instance.visible = false;
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
case 3:
|
|
69
|
+
// @ts-ignore
|
|
70
|
+
vm = createVNode(MessageConstructor, props);
|
|
71
|
+
container = document.createElement('div');
|
|
72
|
+
vm?.props
|
|
73
|
+
&& (vm.props!.onDestroy = () => {
|
|
74
|
+
render(null, container);
|
|
75
|
+
});
|
|
76
|
+
vm?.data
|
|
77
|
+
&& (vm.data!.onDestroy = () => {
|
|
78
|
+
render(null, container);
|
|
79
|
+
});
|
|
80
|
+
// @ts-ignore
|
|
81
|
+
render(vm, container);
|
|
82
|
+
instances.push({ vm });
|
|
83
|
+
appendTo.appendChild(container.firstElementChild!);
|
|
84
|
+
return {
|
|
85
|
+
close: () => {
|
|
86
|
+
vm?.component?.proxy && (vm.component!.proxy.visible = false);
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
return {};
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export function close(id: string, userOnClose?: (vm: VNode) => void): void {
|
|
94
|
+
const idx = instances?.findIndex(
|
|
95
|
+
({ vm }: any) => id === vm?.component?.props?.id || id === vm?._props?.id,
|
|
96
|
+
);
|
|
97
|
+
if (idx === -1) return;
|
|
98
|
+
const { vm } = instances[idx];
|
|
99
|
+
if (!vm) return;
|
|
100
|
+
userOnClose?.(vm);
|
|
101
|
+
const removedHeight = vm?.el?.offsetHeight || vm?.$el?.offsetHeight;
|
|
102
|
+
instances.splice(idx, 1);
|
|
103
|
+
// adjust other instances vertical offset
|
|
104
|
+
const len = instances.length;
|
|
105
|
+
if (len < 1) return;
|
|
106
|
+
for (let i = idx; i < len; i++) {
|
|
107
|
+
const pos
|
|
108
|
+
= Number.parseInt(
|
|
109
|
+
instances[i]?.vm?.el?.style?.top || instances[i]?.vm?.$el?.style?.top,
|
|
110
|
+
10,
|
|
111
|
+
)
|
|
112
|
+
- removedHeight
|
|
113
|
+
- 16;
|
|
114
|
+
instances[i]?.vm?.component?.props?.offset
|
|
115
|
+
&& (instances[i].vm.component!.props.offset = pos);
|
|
116
|
+
instances[i]?.vm?._props?.offset && (instances[i].vm._props.offset = pos);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
Toast.close = close;
|
|
121
|
+
|
|
122
|
+
export { Toast, TOAST_TYPE };
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<transition
|
|
3
|
+
name="fade"
|
|
4
|
+
@after-leave="$emit('destroy')"
|
|
5
|
+
>
|
|
6
|
+
<div
|
|
7
|
+
v-show="visible"
|
|
8
|
+
class="message"
|
|
9
|
+
:class="[handleStyle(type), isH5 && 'message-h5']"
|
|
10
|
+
:style="customStyle"
|
|
11
|
+
>
|
|
12
|
+
<p v-if="!isH5">
|
|
13
|
+
{{ message }}
|
|
14
|
+
</p>
|
|
15
|
+
<span v-if="isH5">{{ message }}</span>
|
|
16
|
+
</div>
|
|
17
|
+
</transition>
|
|
18
|
+
</template>
|
|
19
|
+
<script lang="ts" setup>
|
|
20
|
+
import vue from '../../../adapter-vue';
|
|
21
|
+
import { isH5 } from '../../../utils/env';
|
|
22
|
+
import TOAST_TYPE from './type';
|
|
23
|
+
const { computed, onMounted, ref, watch } = vue;
|
|
24
|
+
|
|
25
|
+
const props = defineProps({
|
|
26
|
+
message: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: '',
|
|
29
|
+
},
|
|
30
|
+
duration: {
|
|
31
|
+
type: Number,
|
|
32
|
+
default: 3000,
|
|
33
|
+
},
|
|
34
|
+
repeatNum: {
|
|
35
|
+
type: Number,
|
|
36
|
+
default: 1,
|
|
37
|
+
},
|
|
38
|
+
id: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: '',
|
|
41
|
+
},
|
|
42
|
+
onClose: {
|
|
43
|
+
type: Function,
|
|
44
|
+
required: false,
|
|
45
|
+
},
|
|
46
|
+
offset: {
|
|
47
|
+
type: Number,
|
|
48
|
+
default: 20,
|
|
49
|
+
},
|
|
50
|
+
zIndex: {
|
|
51
|
+
type: Number,
|
|
52
|
+
default: 0,
|
|
53
|
+
},
|
|
54
|
+
type: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: '',
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
const visible = ref(false);
|
|
60
|
+
let timer: any;
|
|
61
|
+
|
|
62
|
+
const startTimer = () => {
|
|
63
|
+
if (props.duration > 0) {
|
|
64
|
+
timer = setTimeout(() => {
|
|
65
|
+
if (visible.value) {
|
|
66
|
+
close();
|
|
67
|
+
}
|
|
68
|
+
}, props.duration);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const clearTimer = () => {
|
|
73
|
+
clearTimeout(timer);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const close = () => {
|
|
77
|
+
visible.value = false;
|
|
78
|
+
if (typeof props.onClose === 'function') {
|
|
79
|
+
props.onClose();
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
watch(
|
|
84
|
+
() => props.repeatNum,
|
|
85
|
+
() => {
|
|
86
|
+
clearTimer();
|
|
87
|
+
startTimer();
|
|
88
|
+
},
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
const customStyle = computed<CSSProperties>(() => ({
|
|
92
|
+
top: `${props.offset}px`,
|
|
93
|
+
zIndex: props.zIndex,
|
|
94
|
+
}));
|
|
95
|
+
|
|
96
|
+
onMounted(() => {
|
|
97
|
+
startTimer();
|
|
98
|
+
visible.value = true;
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
const handleStyle = (type?: string) => {
|
|
102
|
+
if (
|
|
103
|
+
type
|
|
104
|
+
&& (type === TOAST_TYPE.ERROR
|
|
105
|
+
|| type === TOAST_TYPE.SUCCESS
|
|
106
|
+
|| type === TOAST_TYPE.WARNING)
|
|
107
|
+
)
|
|
108
|
+
return type;
|
|
109
|
+
return TOAST_TYPE.NORMAL;
|
|
110
|
+
};
|
|
111
|
+
</script>
|
|
112
|
+
<style lang="scss" scoped>
|
|
113
|
+
@import "../common";
|
|
114
|
+
|
|
115
|
+
.message {
|
|
116
|
+
position: fixed;
|
|
117
|
+
left: 0;
|
|
118
|
+
right: 0;
|
|
119
|
+
margin: 0 auto;
|
|
120
|
+
max-width: 450px;
|
|
121
|
+
width: fit-content;
|
|
122
|
+
justify-content: center;
|
|
123
|
+
align-items: center;
|
|
124
|
+
|
|
125
|
+
p {
|
|
126
|
+
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.2);
|
|
127
|
+
border-radius: 3px;
|
|
128
|
+
padding: 10px 15px;
|
|
129
|
+
width: fit-content;
|
|
130
|
+
word-break: break-all;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.message-h5 {
|
|
135
|
+
position: absolute;
|
|
136
|
+
top: 20px !important;
|
|
137
|
+
margin: 0 auto;
|
|
138
|
+
max-width: 80%;
|
|
139
|
+
width: fit-content;
|
|
140
|
+
justify-content: center;
|
|
141
|
+
align-items: center;
|
|
142
|
+
border-radius: 5px;
|
|
143
|
+
padding: 10px 15px;
|
|
144
|
+
|
|
145
|
+
span {
|
|
146
|
+
font-family: PingFangSC-Regular;
|
|
147
|
+
font-weight: 400;
|
|
148
|
+
font-size: 14px;
|
|
149
|
+
letter-spacing: 0;
|
|
150
|
+
text-align: center;
|
|
151
|
+
word-break: break-all;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.success {
|
|
156
|
+
border: 1px solid #e4f2da;
|
|
157
|
+
background: #f2f9ec;
|
|
158
|
+
color: #7ebf50;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.error {
|
|
162
|
+
border: 1px solid #fde2e2;
|
|
163
|
+
background: #fef0f0;
|
|
164
|
+
color: #f46c6e;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.normal {
|
|
168
|
+
border: 1px solid #e9e9eb;
|
|
169
|
+
background: #f4f4f5;
|
|
170
|
+
color: #909398;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.warning {
|
|
174
|
+
border: 1px solid #faf0e2;
|
|
175
|
+
background: #fdf8f1;
|
|
176
|
+
color: #e4b877;
|
|
177
|
+
}
|
|
178
|
+
</style>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
body, div, ul, ol, dt, dd, li, dl, h1, h2, h3, h4, p {
|
|
2
|
+
margin:0;
|
|
3
|
+
padding:0;
|
|
4
|
+
font-style:normal;
|
|
5
|
+
|
|
6
|
+
/* font:12px/22px"\5B8B\4F53",Arial,Helvetica,sans-serif; */
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
ol, ul, li {
|
|
10
|
+
list-style:none;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
img {
|
|
14
|
+
border:0;
|
|
15
|
+
vertical-align:middle;
|
|
16
|
+
pointer-events:none;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
body {
|
|
20
|
+
color:#000;
|
|
21
|
+
background:#FFF;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.clear {
|
|
25
|
+
clear:both;
|
|
26
|
+
height:1px;
|
|
27
|
+
width:100%;
|
|
28
|
+
overflow:hidden;
|
|
29
|
+
margin-top:-1px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
a {
|
|
33
|
+
color:#000;
|
|
34
|
+
text-decoration:none;
|
|
35
|
+
cursor: pointer;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
a:hover {
|
|
39
|
+
text-decoration:none;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
input, textarea {
|
|
43
|
+
user-select: auto;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
input:focus, input:active, textarea:focus, textarea:active {
|
|
47
|
+
outline: none;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.chat-aside {
|
|
51
|
+
position: absolute;
|
|
52
|
+
top: 50px;
|
|
53
|
+
right: 0;
|
|
54
|
+
box-sizing: border-box;
|
|
55
|
+
width: 360px !important;
|
|
56
|
+
border-radius: 8px 0 0 8px;
|
|
57
|
+
z-index: 9999;
|
|
58
|
+
max-height: calc(100% - 50px);
|
|
59
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!--本地 icon 资源, uniapp 打包到 app 仅支持标签 image, 打包小程序和 H5 均可支持标签 img -->
|
|
3
|
+
<div class="common-icon-container">
|
|
4
|
+
<image
|
|
5
|
+
v-if="isApp"
|
|
6
|
+
class="common-icon"
|
|
7
|
+
:src="props.src"
|
|
8
|
+
:style="{ width: props.width, height: props.height }"
|
|
9
|
+
/>
|
|
10
|
+
<img
|
|
11
|
+
v-else
|
|
12
|
+
class="common-icon"
|
|
13
|
+
:src="props.src"
|
|
14
|
+
:style="{ width: props.width, height: props.height }"
|
|
15
|
+
>
|
|
16
|
+
</div>
|
|
17
|
+
</template>
|
|
18
|
+
<script lang="ts">
|
|
19
|
+
import { isApp } from '../utils/env';
|
|
20
|
+
|
|
21
|
+
interface Props {
|
|
22
|
+
src: string;
|
|
23
|
+
width?: string;
|
|
24
|
+
height?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default {
|
|
28
|
+
props: {
|
|
29
|
+
src: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: '',
|
|
32
|
+
},
|
|
33
|
+
width: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: '16px',
|
|
36
|
+
},
|
|
37
|
+
height: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: '16px',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
setup(props: Props) {
|
|
43
|
+
return {
|
|
44
|
+
props,
|
|
45
|
+
isApp,
|
|
46
|
+
};
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
</script>
|
|
50
|
+
<style lang="scss" scoped>
|
|
51
|
+
.common-icon-container {
|
|
52
|
+
display: flex;
|
|
53
|
+
justify-content: center;
|
|
54
|
+
align-items: center;
|
|
55
|
+
}
|
|
56
|
+
</style>
|