@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,24 @@
|
|
|
1
|
+
功能:图片本地缓存
|
|
2
|
+
大小:*≈4KB*
|
|
3
|
+
作者:[@PentaTea](https://github.com/PentaTea)
|
|
4
|
+
支持平台:
|
|
5
|
+
|
|
6
|
+
| 微信小程序 | QQ 小程序 | 百度小程序 | 支付宝小程序 | 头条小程序 | uni-app |
|
|
7
|
+
|:---:|:---:|:---:|:---:|:---:|:---:|
|
|
8
|
+
| | | | | | √(仅支持 app 的 vue 页面) |
|
|
9
|
+
|
|
10
|
+
说明:
|
|
11
|
+
引入本插件后,会给组件添加一个 *img-cache* 属性,将该属性设置为 *true* 后,将自动下载引用的图片并将 *src* 属性更换为本地地址
|
|
12
|
+
同时在组件实例上挂载了 *imgCache* 对象,扩充缓存控制能力
|
|
13
|
+
|
|
14
|
+
*imgCache* 对象属性和方法:
|
|
15
|
+
|
|
16
|
+
| 属性 | 功能 |
|
|
17
|
+
|:---:|:---:|
|
|
18
|
+
| list | 当前缓存的 url 列表 |
|
|
19
|
+
| get(url) | 传入 url 获得本地地址 |
|
|
20
|
+
| delete(url) | 传入 url 删除缓存记录 |
|
|
21
|
+
| add(url) | 传入 url 并下载目标为缓存 |
|
|
22
|
+
| clear() | 清空所有缓存 |
|
|
23
|
+
|
|
24
|
+
!> 请尽量确保 *src* 中含有文件后缀名,不以后缀结尾也没关系,插件会从路径中推测合理的图片后缀,如果完全不包含后缀信息可能会无法保存到相册
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
main: 'index.js',
|
|
3
|
+
platform: ['uni-app'],
|
|
4
|
+
handler (file, platform) {
|
|
5
|
+
if (platform === 'uni-app') {
|
|
6
|
+
// 添加 img-cache 属性
|
|
7
|
+
if (file.path.includes('mp-html.vue')) {
|
|
8
|
+
file.contents = Buffer.from(
|
|
9
|
+
file.contents
|
|
10
|
+
.toString()
|
|
11
|
+
.replace(/props\s*:\s*{/, 'props: {\n ImgCache: Boolean,')
|
|
12
|
+
)
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
const data = {
|
|
2
|
+
name: 'imgcache',
|
|
3
|
+
prefix: 'imgcache_'
|
|
4
|
+
}
|
|
5
|
+
function ImgCache (vm) {
|
|
6
|
+
this.vm = vm // 保存实例在其他周期使用
|
|
7
|
+
this.i = 0 // 用于标记第几张图
|
|
8
|
+
vm.imgCache = {
|
|
9
|
+
get list () {
|
|
10
|
+
return uni
|
|
11
|
+
.getStorageInfoSync()
|
|
12
|
+
.keys.filter((key) => key.startsWith(data.prefix))
|
|
13
|
+
.map((key) => key.split(data.prefix)[1])
|
|
14
|
+
},
|
|
15
|
+
get (url) {
|
|
16
|
+
return uni.getStorageSync(data.prefix + url)
|
|
17
|
+
},
|
|
18
|
+
delete (url) {
|
|
19
|
+
const path = uni.getStorageSync(data.prefix + url)
|
|
20
|
+
if (!path) return false
|
|
21
|
+
plus.io.resolveLocalFileSystemURL(path, (entry) => {
|
|
22
|
+
entry.remove()
|
|
23
|
+
})
|
|
24
|
+
uni.removeStorageSync(data.prefix + url)
|
|
25
|
+
return true
|
|
26
|
+
},
|
|
27
|
+
async add (url) {
|
|
28
|
+
const filename = await download(url)
|
|
29
|
+
if (filename) {
|
|
30
|
+
uni.setStorageSync(data.prefix + url, filename)
|
|
31
|
+
return 'file://' + plus.io.convertLocalFileSystemURL(filename)
|
|
32
|
+
}
|
|
33
|
+
return null
|
|
34
|
+
},
|
|
35
|
+
clear () {
|
|
36
|
+
uni
|
|
37
|
+
.getStorageInfoSync()
|
|
38
|
+
.keys.filter((key) => key.startsWith(data.prefix))
|
|
39
|
+
.forEach((key) => {
|
|
40
|
+
uni.removeStorageSync(key)
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
plus.io.resolveLocalFileSystemURL(`_doc/${data.name}/`, (entry) => {
|
|
44
|
+
entry.removeRecursively(
|
|
45
|
+
(entry) => {
|
|
46
|
+
console.log(`${data.name}缓存删除成功`, entry)
|
|
47
|
+
},
|
|
48
|
+
(e) => {
|
|
49
|
+
console.log(`${data.name}缓存删除失败`, e)
|
|
50
|
+
}
|
|
51
|
+
)
|
|
52
|
+
})
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// #ifdef APP-PLUS
|
|
58
|
+
ImgCache.prototype.onParse = function (node, parser) {
|
|
59
|
+
// 启用本插件 && 解析图片标签 && 拥有src属性 && 是网络图片
|
|
60
|
+
if (
|
|
61
|
+
this.vm.ImgCache &&
|
|
62
|
+
node.name === 'img' &&
|
|
63
|
+
node.attrs.src &&
|
|
64
|
+
/^https?:\/\//.test(node.attrs.src)
|
|
65
|
+
) {
|
|
66
|
+
const src = node.attrs.src
|
|
67
|
+
node.attrs.src = ''
|
|
68
|
+
node.attrs.i = this.vm.imgList.length + this.i++
|
|
69
|
+
parser.expose()
|
|
70
|
+
|
|
71
|
+
async function getUrl (path) {
|
|
72
|
+
if (await resolveFile(path)) return path
|
|
73
|
+
const filename = await download(src)
|
|
74
|
+
filename && uni.setStorageSync(data.prefix + src, filename)
|
|
75
|
+
return filename
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
uni.getStorage({
|
|
79
|
+
key: data.prefix + src,
|
|
80
|
+
success: async (res) => {
|
|
81
|
+
const path = await getUrl(res.data)
|
|
82
|
+
const url = path
|
|
83
|
+
? 'file://' + plus.io.convertLocalFileSystemURL(path)
|
|
84
|
+
: src
|
|
85
|
+
node.attrs.src = url
|
|
86
|
+
this.vm.imgList[node.attrs.i] = path || src
|
|
87
|
+
},
|
|
88
|
+
fail: async () => {
|
|
89
|
+
const path = await getUrl()
|
|
90
|
+
const url = path
|
|
91
|
+
? 'file://' + plus.io.convertLocalFileSystemURL(path)
|
|
92
|
+
: src
|
|
93
|
+
node.attrs.src = url
|
|
94
|
+
this.vm.imgList[node.attrs.i] = path || src
|
|
95
|
+
}
|
|
96
|
+
})
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const taskQueue = new Set()
|
|
101
|
+
|
|
102
|
+
function download (url) {
|
|
103
|
+
return new Promise((resolve) => {
|
|
104
|
+
if (taskQueue.has(url)) return
|
|
105
|
+
taskQueue.add(url)
|
|
106
|
+
const suffix = /.+\.(jpg|jpeg|png|bmp|gif|webp)/.exec(url)
|
|
107
|
+
const name = `${makeid(8)}_${Date.now()}${suffix ? '.' + suffix[1] : ''}`
|
|
108
|
+
const task = plus.downloader.createDownload(
|
|
109
|
+
url,
|
|
110
|
+
{ filename: `_doc/${data.name}/${name}` },
|
|
111
|
+
(download, status) => {
|
|
112
|
+
taskQueue.delete(url)
|
|
113
|
+
resolve(status === 200 ? download.filename : null)
|
|
114
|
+
}
|
|
115
|
+
)
|
|
116
|
+
task.start()
|
|
117
|
+
})
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// 判断文件存在
|
|
121
|
+
function resolveFile (url) {
|
|
122
|
+
return new Promise((resolve) => {
|
|
123
|
+
plus.io.resolveLocalFileSystemURL(url, resolve, () => resolve(null))
|
|
124
|
+
})
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// 生成uuid
|
|
128
|
+
function makeid (length) {
|
|
129
|
+
let result = ''
|
|
130
|
+
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
|
|
131
|
+
for (let i = 0; i < length; i++) {
|
|
132
|
+
result += characters.charAt(Math.floor(Math.random() * characters.length))
|
|
133
|
+
}
|
|
134
|
+
return result
|
|
135
|
+
}
|
|
136
|
+
// #endif
|
|
137
|
+
|
|
138
|
+
module.exports = ImgCache
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# latex
|
|
2
|
+
功能:渲染 *latex* 公式
|
|
3
|
+
大小:**≈300KB**
|
|
4
|
+
作者:[@Zeng-J](https://github.com/Zeng-J)
|
|
5
|
+
支持平台:
|
|
6
|
+
|
|
7
|
+
| 微信小程序 | QQ 小程序 | 百度小程序 | 支付宝小程序 | 头条小程序 | uni-app |
|
|
8
|
+
|:---:|:---:|:---:|:---:|:---:|:---:|
|
|
9
|
+
| √ | √ | √ | √ | √ | √ |
|
|
10
|
+
|
|
11
|
+
说明:
|
|
12
|
+
引入本插件后,会将 *$xxx$* 的文本内容按照 *latex* 规则进行解析和渲染
|
|
13
|
+
|
|
14
|
+
> 与 *editable* 插件共用时,编辑状态下,公式不会渲染,可以直接修改公式文本
|
|
15
|
+
|
|
16
|
+
> 本插件通过 [katex-mini](https://github.com/rojer95/katex-mini) 解析 *latex* 文本,[字体文件](https://github.com/KaTeX/KaTeX/tree/main/fonts) 建议自行转存
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
import: 'katex.css',
|
|
3
|
+
handler (file) {
|
|
4
|
+
if (file.isBuffer()) {
|
|
5
|
+
let content = file.contents.toString()
|
|
6
|
+
if (file.basename === 'node.wxml') {
|
|
7
|
+
content = content.replace(/(n.?)\.name==='a'\|\|/g, "$1.name==='a'||$1.l||")
|
|
8
|
+
} else if (file.basename === 'node.vue') {
|
|
9
|
+
content = content.replace(/!handler.isInline\((.*?)\)/, '(n.l||!handler.isInline($1))')
|
|
10
|
+
}
|
|
11
|
+
file.contents = Buffer.from(content)
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview latex 插件
|
|
3
|
+
* katex.min.js来源 https://github.com/rojer95/katex-mini
|
|
4
|
+
*/
|
|
5
|
+
const parse = require('./katex.min')
|
|
6
|
+
|
|
7
|
+
function Latex () {
|
|
8
|
+
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
Latex.prototype.onParse = function (node, vm) {
|
|
12
|
+
// $...$包裹的内容为latex公式
|
|
13
|
+
if (!vm.options.editable && node.type === 'text' && node.text.includes('$')) {
|
|
14
|
+
const part = node.text.split(/(\${1,2})/)
|
|
15
|
+
const children = []
|
|
16
|
+
let status = 0
|
|
17
|
+
for (let i = 0; i < part.length; i++) {
|
|
18
|
+
if (i % 2 === 0) {
|
|
19
|
+
// 文本内容
|
|
20
|
+
if (part[i]) {
|
|
21
|
+
if (status === 0) {
|
|
22
|
+
children.push({
|
|
23
|
+
type: 'text',
|
|
24
|
+
text: part[i]
|
|
25
|
+
})
|
|
26
|
+
} else {
|
|
27
|
+
const nodes = parse.default(part[i])
|
|
28
|
+
if (status === 1) {
|
|
29
|
+
// 行内公式
|
|
30
|
+
children.push({
|
|
31
|
+
name: 'span',
|
|
32
|
+
attrs: {},
|
|
33
|
+
l: 'T',
|
|
34
|
+
f: 'display:inline-block',
|
|
35
|
+
children: nodes
|
|
36
|
+
})
|
|
37
|
+
} else {
|
|
38
|
+
// 块公式
|
|
39
|
+
children.push({
|
|
40
|
+
name: 'div',
|
|
41
|
+
attrs: {
|
|
42
|
+
style: 'text-align:center'
|
|
43
|
+
},
|
|
44
|
+
children: nodes
|
|
45
|
+
})
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
} else {
|
|
50
|
+
// 分隔符
|
|
51
|
+
if (part[i] === '$' && part[i + 2] === '$') {
|
|
52
|
+
// 行内公式
|
|
53
|
+
status = 1
|
|
54
|
+
part[i + 2] = ''
|
|
55
|
+
} else if (part[i] === '$$' && part[i + 2] === '$$') {
|
|
56
|
+
// 块公式
|
|
57
|
+
status = 2
|
|
58
|
+
part[i + 2] = ''
|
|
59
|
+
} else {
|
|
60
|
+
if (part[i] && part[i] !== '$$') {
|
|
61
|
+
// 普通$符号
|
|
62
|
+
part[i + 1] = part[i] + part[i + 1]
|
|
63
|
+
}
|
|
64
|
+
// 重置状态
|
|
65
|
+
status = 0
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
node.type = undefined
|
|
70
|
+
node.text = undefined
|
|
71
|
+
node.name = 'span'
|
|
72
|
+
node.attrs = {}
|
|
73
|
+
node.children = children
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
module.exports = Latex
|