oxy-uni-ui 2.1.1 → 2.1.3
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/attributes.json +1 -1
- package/components/common/AbortablePromise.ts +4 -0
- package/components/common/abstracts/variable.scss +185 -68
- package/components/common/base64.ts +6 -0
- package/components/common/clickoutside.ts +5 -0
- package/components/common/interceptor.ts +9 -0
- package/components/common/path.ts +4 -0
- package/components/common/props.ts +23 -0
- package/components/common/util.ts +18 -1
- package/components/composables/index.ts +2 -0
- package/components/composables/useCell.ts +8 -1
- package/components/composables/useChildren.ts +27 -1
- package/components/composables/useCountDown.ts +10 -1
- package/components/composables/useDynamicVirtualScroll.ts +9 -0
- package/components/composables/useGlobalLoading.ts +6 -0
- package/components/composables/useGlobalMessage.ts +6 -0
- package/components/composables/useGlobalToast.ts +6 -0
- package/components/composables/useLockScroll.ts +9 -0
- package/components/composables/useParent.ts +65 -14
- package/components/composables/usePopover.ts +9 -0
- package/components/composables/useQueue.ts +8 -0
- package/components/composables/useRaf.ts +10 -0
- package/components/composables/useSharedState.ts +284 -0
- package/components/composables/useTouch.ts +8 -0
- package/components/composables/useTranslate.ts +9 -0
- package/components/composables/useUpload.ts +83 -11
- package/components/composables/useVirtualScroll.ts +7 -0
- package/components/composables/useWindowResize.ts +9 -0
- package/components/oxy-action-sheet/index.scss +5 -5
- package/components/oxy-action-sheet/oxy-action-sheet.vue +11 -0
- package/components/oxy-backtop/index.scss +2 -2
- package/components/oxy-backtop/oxy-backtop.vue +2 -0
- package/components/oxy-badge/oxy-badge.vue +2 -0
- package/components/oxy-badge/types.ts +3 -0
- package/components/oxy-button/index.scss +13 -13
- package/components/oxy-button/oxy-button.vue +11 -0
- package/components/oxy-button/types.ts +3 -3
- package/components/oxy-calendar/index.scss +17 -17
- package/components/oxy-calendar/oxy-calendar.vue +31 -0
- package/components/oxy-calendar/types.ts +3 -0
- package/components/oxy-calendar-view/month/month.vue +2 -0
- package/components/oxy-calendar-view/monthPanel/month-panel.vue +3 -1
- package/components/oxy-calendar-view/monthPanel/types.ts +10 -7
- package/components/oxy-calendar-view/oxy-calendar-view.vue +2 -0
- package/components/oxy-calendar-view/types.ts +3 -1
- package/components/oxy-calendar-view/year/types.ts +33 -1
- package/components/oxy-calendar-view/year/year.vue +2 -0
- package/components/oxy-calendar-view/yearPanel/year-panel.vue +2 -0
- package/components/oxy-card/index.scss +1 -1
- package/components/oxy-card/oxy-card.vue +2 -0
- package/components/oxy-cell/index.scss +3 -1
- package/components/oxy-cell/oxy-cell.vue +6 -4
- package/components/oxy-cell-group/oxy-cell-group.vue +2 -0
- package/components/oxy-checkbox/index.scss +41 -6
- package/components/oxy-checkbox/oxy-checkbox.vue +22 -16
- package/components/oxy-checkbox/types.ts +9 -0
- package/components/oxy-checkbox-group/index.scss +1 -1
- package/components/oxy-checkbox-group/oxy-checkbox-group.vue +2 -0
- package/components/oxy-circle/oxy-circle.vue +2 -0
- package/components/oxy-col/oxy-col.vue +3 -1
- package/components/oxy-col-picker/index.scss +3 -3
- package/components/oxy-col-picker/oxy-col-picker.vue +17 -1
- package/components/oxy-col-picker/types.ts +3 -0
- package/components/oxy-collapse/index.scss +2 -2
- package/components/oxy-collapse/oxy-collapse.vue +9 -0
- package/components/oxy-collapse-item/oxy-collapse-item.vue +4 -2
- package/components/oxy-config-provider/oxy-config-provider.vue +18 -0
- package/components/oxy-config-provider/types.ts +18 -0
- package/components/oxy-corner/index.scss +50 -32
- package/components/oxy-corner/oxy-corner.vue +2 -0
- package/components/oxy-count-down/oxy-count-down.vue +2 -0
- package/components/oxy-count-to/oxy-count-to.vue +12 -1
- package/components/oxy-count-to/types.ts +14 -4
- package/components/oxy-curtain/index.scss +10 -9
- package/components/oxy-curtain/oxy-curtain.vue +2 -0
- package/components/oxy-date-strip/oxy-date-strip.vue +22 -1
- package/components/oxy-date-strip-item/index.scss +4 -4
- package/components/oxy-date-strip-item/oxy-date-strip-item.vue +2 -0
- package/components/oxy-datetime-picker/index.scss +3 -3
- package/components/oxy-datetime-picker/oxy-datetime-picker.vue +11 -1
- package/components/oxy-datetime-picker-view/oxy-datetime-picker-view.vue +2 -0
- package/components/oxy-divider/oxy-divider.vue +2 -0
- package/components/oxy-drop-menu/index.scss +2 -2
- package/components/oxy-drop-menu/oxy-drop-menu.vue +3 -0
- package/components/oxy-drop-menu-item/index.scss +1 -1
- package/components/oxy-drop-menu-item/oxy-drop-menu-item.vue +17 -9
- package/components/oxy-echarts/oxy-echarts.vue +2 -0
- package/components/oxy-fab/index.scss +1 -1
- package/components/oxy-fab/oxy-fab.vue +27 -0
- package/components/oxy-file-list/index.scss +9 -9
- package/components/oxy-file-list/oxy-file-list.vue +29 -17
- package/components/oxy-floating-panel/oxy-floating-panel.vue +34 -10
- package/components/oxy-footer/index.scss +7 -0
- package/components/oxy-footer/oxy-footer.vue +4 -2
- package/components/oxy-footer/types.ts +9 -6
- package/components/oxy-form/oxy-form.vue +13 -1
- package/components/oxy-form-item/oxy-form-item.vue +5 -3
- package/components/oxy-gap/oxy-gap.vue +2 -0
- package/components/oxy-global-loading/oxy-global-loading.vue +18 -5
- package/components/oxy-global-message/oxy-global-message.vue +30 -17
- package/components/oxy-global-toast/oxy-global-toast.vue +18 -5
- package/components/oxy-grid/oxy-grid.vue +6 -0
- package/components/oxy-grid-item/index.scss +1 -1
- package/components/oxy-grid-item/oxy-grid-item.vue +22 -20
- package/components/oxy-guidance/index.scss +9 -9
- package/components/oxy-guidance/oxy-guidance.vue +22 -16
- package/components/oxy-icon/oxy-icon.vue +2 -0
- package/components/oxy-icon/types.ts +3 -0
- package/components/oxy-image-preview/index.scss +75 -0
- package/components/oxy-image-preview/index.ts +56 -0
- package/components/oxy-image-preview/oxy-image-preview.vue +221 -0
- package/components/oxy-image-preview/types.ts +164 -0
- package/components/oxy-img/oxy-img.vue +2 -0
- package/components/oxy-img-cropper/index.scss +2 -2
- package/components/oxy-img-cropper/oxy-img-cropper.vue +6 -0
- package/components/oxy-img-lazy/oxy-img-lazy.vue +9 -0
- package/components/oxy-index-anchor/index.scss +1 -1
- package/components/oxy-index-anchor/oxy-index-anchor.vue +2 -2
- package/components/oxy-index-bar/index.scss +1 -1
- package/components/oxy-index-bar/oxy-index-bar.vue +18 -0
- package/components/oxy-input/index.scss +2 -1
- package/components/oxy-input/oxy-input.vue +18 -4
- package/components/oxy-input/types.ts +6 -0
- package/components/oxy-input-number/index.scss +3 -1
- package/components/oxy-input-number/oxy-input-number.vue +2 -0
- package/components/oxy-keyboard/index.scss +3 -3
- package/components/oxy-keyboard/key/index.vue +2 -0
- package/components/oxy-keyboard/oxy-keyboard.vue +11 -2
- package/components/oxy-link/index.scss +8 -4
- package/components/oxy-link/oxy-link.vue +9 -3
- package/components/oxy-link/types.ts +2 -2
- package/components/oxy-list/oxy-list.vue +2 -0
- package/components/oxy-list/types.ts +7 -0
- package/components/oxy-loading/oxy-loading.vue +6 -0
- package/components/oxy-loadmore/index.scss +1 -1
- package/components/oxy-loadmore/oxy-loadmore.vue +2 -0
- package/components/oxy-long-press-menu/index.scss +1 -1
- package/components/oxy-long-press-menu/oxy-long-press-menu.vue +42 -13
- package/components/oxy-message-box/index.scss +223 -36
- package/components/oxy-message-box/index.ts +49 -23
- package/components/oxy-message-box/oxy-message-box.vue +181 -56
- package/components/oxy-message-box/types.ts +60 -2
- package/components/oxy-navbar/index.scss +1 -1
- package/components/oxy-navbar/oxy-navbar.vue +9 -6
- package/components/oxy-navbar-capsule/oxy-navbar-capsule.vue +2 -0
- package/components/oxy-notice-bar/index.scss +1 -1
- package/components/oxy-notice-bar/oxy-notice-bar.vue +29 -0
- package/components/oxy-notify/index.ts +16 -12
- package/components/oxy-notify/oxy-notify.vue +11 -4
- package/components/oxy-overlay/oxy-overlay.vue +34 -2
- package/components/oxy-pagination/oxy-pagination.vue +2 -0
- package/components/oxy-password-input/oxy-password-input.vue +2 -0
- package/components/oxy-picker/index.scss +7 -7
- package/components/oxy-picker/oxy-picker.vue +11 -0
- package/components/oxy-picker-view/index.scss +1 -1
- package/components/oxy-picker-view/oxy-picker-view.vue +2 -0
- package/components/oxy-popover/index.scss +2 -2
- package/components/oxy-popover/oxy-popover.vue +4 -1
- package/components/oxy-popup/oxy-popup.vue +8 -0
- package/components/oxy-progress/index.scss +2 -2
- package/components/oxy-progress/oxy-progress.vue +7 -0
- package/components/oxy-qrcode/draw.ts +15 -1
- package/components/oxy-qrcode/oxy-qrcode.vue +10 -3
- package/components/oxy-radio/index.scss +8 -8
- package/components/oxy-radio/oxy-radio.vue +13 -11
- package/components/oxy-radio-group/index.scss +1 -1
- package/components/oxy-radio-group/oxy-radio-group.vue +2 -0
- package/components/oxy-rate/oxy-rate.vue +5 -0
- package/components/oxy-rate/types.ts +2 -2
- package/components/oxy-resize/oxy-resize.vue +12 -0
- package/components/oxy-rich-text/index.scss +9 -9
- package/components/oxy-rich-text/oxy-rich-text.vue +6 -0
- package/components/oxy-rich-text/types.ts +15 -0
- package/components/oxy-root-portal/oxy-root-portal.vue +23 -15
- package/components/oxy-row/oxy-row.vue +2 -0
- package/components/oxy-search/index.scss +3 -3
- package/components/oxy-search/oxy-search.vue +19 -0
- package/components/oxy-segmented/index.scss +4 -4
- package/components/oxy-segmented/oxy-segmented.vue +2 -0
- package/components/oxy-select/index.scss +25 -25
- package/components/oxy-select/oxy-select.vue +27 -0
- package/components/oxy-select/types.ts +3 -0
- package/components/oxy-select-picker/index.scss +5 -5
- package/components/oxy-select-picker/oxy-select-picker.vue +7 -0
- package/components/oxy-sidebar/oxy-sidebar.vue +2 -0
- package/components/oxy-sidebar-item/index.scss +3 -3
- package/components/oxy-sidebar-item/oxy-sidebar-item.vue +17 -31
- package/components/oxy-signature/oxy-signature.vue +17 -0
- package/components/oxy-skeleton/oxy-skeleton.vue +7 -1
- package/components/oxy-slide-verify/index.scss +95 -0
- package/components/oxy-slide-verify/oxy-slide-verify.vue +244 -0
- package/components/oxy-slide-verify/types.ts +98 -0
- package/components/oxy-slider/oxy-slider.vue +3 -0
- package/components/oxy-sort-button/index.scss +6 -5
- package/components/oxy-sort-button/oxy-sort-button.vue +6 -0
- package/components/oxy-splitter/index.scss +9 -0
- package/components/oxy-splitter/oxy-splitter.vue +23 -2
- package/components/oxy-splitter-panel/index.scss +7 -5
- package/components/oxy-splitter-panel/oxy-splitter-panel.vue +93 -89
- package/components/oxy-status-tip/index.scss +3 -3
- package/components/oxy-status-tip/oxy-status-tip.vue +2 -0
- package/components/oxy-step/index.scss +4 -4
- package/components/oxy-step/oxy-step.vue +15 -13
- package/components/oxy-steps/oxy-steps.vue +2 -0
- package/components/oxy-sticky/oxy-sticky.vue +5 -3
- package/components/oxy-stream-render/oxy-stream-render.vue +29 -0
- package/components/oxy-swipe-action/oxy-swipe-action.vue +8 -0
- package/components/oxy-swiper/oxy-swiper.vue +6 -0
- package/components/oxy-swiper-nav/index.scss +4 -4
- package/components/oxy-switch/index.scss +6 -3
- package/components/oxy-switch/oxy-switch.vue +10 -0
- package/components/oxy-tab/index.scss +1 -7
- package/components/oxy-tab/oxy-tab.vue +12 -10
- package/components/oxy-tabbar/oxy-tabbar.vue +5 -0
- package/components/oxy-tabbar-item/oxy-tabbar-item.vue +11 -9
- package/components/oxy-table/index.scss +1 -1
- package/components/oxy-table/oxy-table.vue +8 -0
- package/components/oxy-table/types.ts +3 -0
- package/components/oxy-table-col/oxy-table-col.vue +21 -19
- package/components/oxy-tabs/index.scss +11 -11
- package/components/oxy-tabs/oxy-tabs.vue +17 -0
- package/components/oxy-tag/index.scss +176 -17
- package/components/oxy-tag/oxy-tag.vue +29 -2
- package/components/oxy-tag/types.ts +16 -0
- package/components/oxy-text/oxy-text.vue +12 -1
- package/components/oxy-textarea/index.scss +3 -2
- package/components/oxy-textarea/oxy-textarea.vue +10 -4
- package/components/oxy-toast/index.ts +21 -20
- package/components/oxy-toast/oxy-toast.vue +30 -5
- package/components/oxy-toast/types.ts +20 -9
- package/components/oxy-tooltip/index.scss +1 -1
- package/components/oxy-tooltip/oxy-tooltip.vue +2 -0
- package/components/oxy-transition/index.scss +3 -1
- package/components/oxy-transition/oxy-transition.vue +14 -0
- package/components/oxy-tree/index.scss +3 -3
- package/components/oxy-tree/oxy-tree.vue +28 -5
- package/components/oxy-tree/types.ts +57 -1
- package/components/oxy-upload/index.scss +9 -9
- package/components/oxy-upload/oxy-upload.vue +5 -3
- package/components/oxy-verification-code/oxy-verification-code.vue +24 -0
- package/components/oxy-video-preview/index.scss +12 -7
- package/components/oxy-video-preview/index.ts +64 -0
- package/components/oxy-video-preview/oxy-video-preview.vue +102 -31
- package/components/oxy-video-preview/types.ts +54 -8
- package/components/oxy-virtual-scroll/index.scss +1 -1
- package/components/oxy-virtual-scroll/oxy-virtual-scroll.vue +2 -0
- package/components/oxy-voice-player/index.scss +64 -64
- package/components/oxy-voice-player/oxy-voice-player.vue +38 -10
- package/components/oxy-waterfall/oxy-waterfall.vue +13 -0
- package/components/oxy-waterfall/types.ts +7 -0
- package/components/oxy-waterfall-item/oxy-waterfall-item.vue +9 -0
- package/components/oxy-watermark/oxy-watermark.vue +2 -0
- package/dev-tools.ts +2 -0
- package/devTools/components/DevToolsOverlay.vue +56 -0
- package/devTools/components/DevToolsUiHost.vue +589 -0
- package/devTools/config.js +55 -0
- package/devTools/core/components/mpDevBubble.vue +174 -0
- package/devTools/core/libs/createH5Bubble.js +156 -0
- package/devTools/core/libs/devCache.js +151 -0
- package/devTools/core/libs/devOptions.js +163 -0
- package/devTools/core/libs/devUi.js +219 -0
- package/devTools/core/libs/drawView.js +140 -0
- package/devTools/core/libs/errorReport.js +64 -0
- package/devTools/core/libs/jsonCompress.js +334 -0
- package/devTools/core/libs/logReport.js +59 -0
- package/devTools/core/libs/pageLinkList.js +125 -0
- package/devTools/core/libs/timeFormat.js +94 -0
- package/devTools/core/proxy/console.js +430 -0
- package/devTools/core/proxy/index.js +36 -0
- package/devTools/core/proxy/request.js +495 -0
- package/devTools/core/proxy/storage.js +113 -0
- package/devTools/core/proxy/uniBus.js +153 -0
- package/devTools/core/proxy/uniListen.js +192 -0
- package/devTools/core/proxy/vueMixin.js +120 -0
- package/devTools/index.js +168 -0
- package/devTools/page/components/bottomTools.vue +1046 -0
- package/devTools/page/components/dialog/addStorage.vue +204 -0
- package/devTools/page/components/dialog/createDir.vue +366 -0
- package/devTools/page/components/dialog/editDialog.vue +192 -0
- package/devTools/page/components/dialog/routeDialog.vue +184 -0
- package/devTools/page/components/dialog/sendRequest.vue +603 -0
- package/devTools/page/components/dialog/textFileEditDialog.vue +391 -0
- package/devTools/page/components/libs/appDelDir.js +86 -0
- package/devTools/page/components/libs/dirReader.js +248 -0
- package/devTools/page/components/libs/fileSize.js +15 -0
- package/devTools/page/components/libs/getRuntimeInfo.js +134 -0
- package/devTools/page/components/listItem/consoleItem.vue +314 -0
- package/devTools/page/components/listItem/errorItem.vue +292 -0
- package/devTools/page/components/listItem/fileSysItem.vue +533 -0
- package/devTools/page/components/listItem/infoList.vue +100 -0
- package/devTools/page/components/listItem/jsRunnerItem.vue +255 -0
- package/devTools/page/components/listItem/logItem.vue +193 -0
- package/devTools/page/components/listItem/networkItem.vue +398 -0
- package/devTools/page/components/listItem/objectAnalysis.vue +651 -0
- package/devTools/page/components/listItem/pages.vue +319 -0
- package/devTools/page/components/listItem/routeItem.vue +153 -0
- package/devTools/page/components/listItem/setting.vue +734 -0
- package/devTools/page/components/listItem/storageList.vue +681 -0
- package/devTools/page/components/listItem/tools.vue +315 -0
- package/devTools/page/components/listItem/vuexList.vue +599 -0
- package/devTools/page/components/main.vue +1867 -0
- package/devTools/page/components/mixins/animationControl.js +91 -0
- package/devTools/page/components/mixins/mp.js +83 -0
- package/devTools/page/components/ui/btnTabs.vue +90 -0
- package/devTools/page/components/ui/codeHisPicker.vue +172 -0
- package/devTools/page/components/ui/h5Cell.vue +13 -0
- package/devTools/page/components/ui/menuBtn.vue +94 -0
- package/devTools/page/components/ui/mobileSwiperScroll.vue +74 -0
- package/devTools/page/components/ui/requestSpeedLimit.vue +52 -0
- package/devTools/page/components/ui/requestTimeoutMock.vue +55 -0
- package/devTools/page/components/ui/subTitleBar.vue +101 -0
- package/devTools/page/static/copy.png +0 -0
- package/devTools/page/static/delete.png +0 -0
- package/devTools/page/static/fileSys/AI.png +0 -0
- package/devTools/page/static/fileSys/DWG.png +0 -0
- package/devTools/page/static/fileSys/EXE.png +0 -0
- package/devTools/page/static/fileSys/GIF.png +0 -0
- package/devTools/page/static/fileSys/HTML.png +0 -0
- package/devTools/page/static/fileSys/PSD.png +0 -0
- package/devTools/page/static/fileSys/RVT.png +0 -0
- package/devTools/page/static/fileSys/SKP.png +0 -0
- package/devTools/page/static/fileSys/SVG.png +0 -0
- package/devTools/page/static/fileSys/excel.png +0 -0
- package/devTools/page/static/fileSys/pdf.png +0 -0
- package/devTools/page/static/fileSys/pptl.png +0 -0
- package/devTools/page/static/fileSys/shipin.png +0 -0
- package/devTools/page/static/fileSys/tupian.png +0 -0
- package/devTools/page/static/fileSys/txt.png +0 -0
- package/devTools/page/static/fileSys/weizhiwenjian.png +0 -0
- package/devTools/page/static/fileSys/wenjianjia.png +0 -0
- package/devTools/page/static/fileSys/word.png +0 -0
- package/devTools/page/static/fileSys/yasuo.png +0 -0
- package/devTools/page/static/fileSys/yinpin.png +0 -0
- package/devTools/page/static/fold.png +0 -0
- package/devTools/page/static/menu.png +0 -0
- package/devTools/page/static/refresh.png +0 -0
- package/devTools/page/static/unfold.png +0 -0
- package/devTools/tools.vue +25 -0
- package/devTools/type/devTools.d.ts +406 -0
- package/global.d.ts +2 -0
- package/index.ts +2 -0
- package/locale/lang/en-US.ts +51 -2
- package/locale/lang/zh-CN.ts +51 -2
- package/oxy-dev-tools/components/DevToolsUiHost.vue +555 -0
- package/oxy-dev-tools/config.js +61 -0
- package/oxy-dev-tools/core/components/mpDevBubble.vue +176 -0
- package/oxy-dev-tools/core/libs/createH5Bubble.js +156 -0
- package/oxy-dev-tools/core/libs/devCache.js +149 -0
- package/oxy-dev-tools/core/libs/devOptions.js +160 -0
- package/oxy-dev-tools/core/libs/devUi.js +219 -0
- package/oxy-dev-tools/core/libs/drawView.js +144 -0
- package/oxy-dev-tools/core/libs/errorReport.js +60 -0
- package/oxy-dev-tools/core/libs/jsonCompress.js +328 -0
- package/oxy-dev-tools/core/libs/logReport.js +55 -0
- package/oxy-dev-tools/core/libs/pageLinkList.js +121 -0
- package/oxy-dev-tools/core/libs/timeFormat.js +93 -0
- package/oxy-dev-tools/core/proxy/console.js +398 -0
- package/oxy-dev-tools/core/proxy/index.js +33 -0
- package/oxy-dev-tools/core/proxy/request.js +473 -0
- package/oxy-dev-tools/core/proxy/storage.js +96 -0
- package/oxy-dev-tools/core/proxy/uniBus.js +148 -0
- package/oxy-dev-tools/core/proxy/uniListen.js +190 -0
- package/oxy-dev-tools/core/proxy/vueMixin.js +115 -0
- package/oxy-dev-tools/index.ts +183 -0
- package/oxy-dev-tools/oxy-dev-tools.vue +62 -0
- package/oxy-dev-tools/page/components/bottomTools.vue +933 -0
- package/oxy-dev-tools/page/components/dialog/addStorage.vue +184 -0
- package/oxy-dev-tools/page/components/dialog/createDir.vue +352 -0
- package/oxy-dev-tools/page/components/dialog/editDialog.vue +178 -0
- package/oxy-dev-tools/page/components/dialog/routeDialog.vue +170 -0
- package/oxy-dev-tools/page/components/dialog/sendRequest.vue +530 -0
- package/oxy-dev-tools/page/components/dialog/textFileEditDialog.vue +379 -0
- package/oxy-dev-tools/page/components/libs/appDelDir.js +77 -0
- package/oxy-dev-tools/page/components/libs/dirReader.js +239 -0
- package/oxy-dev-tools/page/components/libs/fileSize.js +15 -0
- package/oxy-dev-tools/page/components/libs/getRuntimeInfo.js +132 -0
- package/oxy-dev-tools/page/components/listItem/consoleItem.vue +292 -0
- package/oxy-dev-tools/page/components/listItem/errorItem.vue +268 -0
- package/oxy-dev-tools/page/components/listItem/fileSysItem.vue +511 -0
- package/oxy-dev-tools/page/components/listItem/infoList.vue +89 -0
- package/oxy-dev-tools/page/components/listItem/jsRunnerItem.vue +236 -0
- package/oxy-dev-tools/page/components/listItem/logItem.vue +185 -0
- package/oxy-dev-tools/page/components/listItem/networkItem.vue +362 -0
- package/oxy-dev-tools/page/components/listItem/objectAnalysis.vue +642 -0
- package/oxy-dev-tools/page/components/listItem/pages.vue +285 -0
- package/oxy-dev-tools/page/components/listItem/routeItem.vue +140 -0
- package/oxy-dev-tools/page/components/listItem/setting.vue +687 -0
- package/oxy-dev-tools/page/components/listItem/storageList.vue +623 -0
- package/oxy-dev-tools/page/components/listItem/tools.vue +273 -0
- package/oxy-dev-tools/page/components/listItem/vuexList.vue +559 -0
- package/oxy-dev-tools/page/components/main.vue +1824 -0
- package/oxy-dev-tools/page/components/mixins/animationControl.js +80 -0
- package/oxy-dev-tools/page/components/mixins/mp.js +76 -0
- package/oxy-dev-tools/page/components/ui/btnTabs.vue +77 -0
- package/oxy-dev-tools/page/components/ui/codeHisPicker.vue +161 -0
- package/oxy-dev-tools/page/components/ui/h5Cell.vue +13 -0
- package/oxy-dev-tools/page/components/ui/menuBtn.vue +87 -0
- package/oxy-dev-tools/page/components/ui/mobileSwiperScroll.vue +71 -0
- package/oxy-dev-tools/page/components/ui/requestSpeedLimit.vue +47 -0
- package/oxy-dev-tools/page/components/ui/requestTimeoutMock.vue +50 -0
- package/oxy-dev-tools/page/components/ui/subTitleBar.vue +87 -0
- package/oxy-dev-tools/page/static/copy.png +0 -0
- package/oxy-dev-tools/page/static/delete.png +0 -0
- package/oxy-dev-tools/page/static/fileSys/AI.png +0 -0
- package/oxy-dev-tools/page/static/fileSys/DWG.png +0 -0
- package/oxy-dev-tools/page/static/fileSys/EXE.png +0 -0
- package/oxy-dev-tools/page/static/fileSys/GIF.png +0 -0
- package/oxy-dev-tools/page/static/fileSys/HTML.png +0 -0
- package/oxy-dev-tools/page/static/fileSys/PSD.png +0 -0
- package/oxy-dev-tools/page/static/fileSys/RVT.png +0 -0
- package/oxy-dev-tools/page/static/fileSys/SKP.png +0 -0
- package/oxy-dev-tools/page/static/fileSys/SVG.png +0 -0
- package/oxy-dev-tools/page/static/fileSys/excel.png +0 -0
- package/oxy-dev-tools/page/static/fileSys/pdf.png +0 -0
- package/oxy-dev-tools/page/static/fileSys/pptl.png +0 -0
- package/oxy-dev-tools/page/static/fileSys/shipin.png +0 -0
- package/oxy-dev-tools/page/static/fileSys/tupian.png +0 -0
- package/oxy-dev-tools/page/static/fileSys/txt.png +0 -0
- package/oxy-dev-tools/page/static/fileSys/weizhiwenjian.png +0 -0
- package/oxy-dev-tools/page/static/fileSys/wenjianjia.png +0 -0
- package/oxy-dev-tools/page/static/fileSys/word.png +0 -0
- package/oxy-dev-tools/page/static/fileSys/yasuo.png +0 -0
- package/oxy-dev-tools/page/static/fileSys/yinpin.png +0 -0
- package/oxy-dev-tools/page/static/fold.png +0 -0
- package/oxy-dev-tools/page/static/menu.png +0 -0
- package/oxy-dev-tools/page/static/refresh.png +0 -0
- package/oxy-dev-tools/page/static/unfold.png +0 -0
- package/oxy-dev-tools/tools.vue +22 -0
- package/oxy-dev-tools/type/devTools.d.ts +406 -0
- package/package.json +2 -2
- package/styles/all.scss +125 -0
- package/tags.json +1 -1
- package/vite-plugins/vite-plugin-host-class.ts +166 -0
- package/web-types.json +1 -1
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* json压缩工具
|
|
3
|
+
*/
|
|
4
|
+
export default {
|
|
5
|
+
/**
|
|
6
|
+
* 压缩js对象成json字符串,并控制json字节大小,多余部分裁剪
|
|
7
|
+
*/
|
|
8
|
+
compressObject(obj = {}, maxSize = 1024 * 10.24) {
|
|
9
|
+
try {
|
|
10
|
+
if (obj === undefined || obj === null) return obj
|
|
11
|
+
if (typeof obj == 'string') {
|
|
12
|
+
return this.truncateStrBySize(obj, maxSize)
|
|
13
|
+
}
|
|
14
|
+
if (typeof obj == 'number') {
|
|
15
|
+
return obj
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
let t = new Date().getTime()
|
|
19
|
+
|
|
20
|
+
const type = typeof obj
|
|
21
|
+
|
|
22
|
+
if (type === 'symbol') {
|
|
23
|
+
obj = 'Symbol->' + obj.toString()
|
|
24
|
+
} else if (type === 'bigint') {
|
|
25
|
+
obj = 'bigint->' + obj.toString()
|
|
26
|
+
} else if (typeof Error != 'undefined' && obj instanceof Error) {
|
|
27
|
+
obj = `Error->${obj.name}\n${obj.message}\n${obj.stack}`
|
|
28
|
+
} else if (typeof Date != 'undefined' && obj instanceof Date) {
|
|
29
|
+
obj = 'Date->' + obj.toISOString()
|
|
30
|
+
} else if (typeof obj == 'function') {
|
|
31
|
+
obj = 'Function->' + obj.toString()
|
|
32
|
+
} else if (typeof RegExp != 'undefined' && obj instanceof RegExp) {
|
|
33
|
+
obj = 'RegExp->' + obj.toString()
|
|
34
|
+
} else if (typeof Map != 'undefined' && obj instanceof Map) {
|
|
35
|
+
obj = `Map->(${obj.size}) { ${Array.from(obj.entries())
|
|
36
|
+
.map(([key, value]) => `${convertToString(key)} => ${convertToString(value)}`)
|
|
37
|
+
.join(', ')} }`
|
|
38
|
+
} else if (typeof Set != 'undefined' && obj instanceof Set) {
|
|
39
|
+
obj = `Set->(${obj.size}) { ${Array.from(obj.values())
|
|
40
|
+
.map((value) => convertToString(value))
|
|
41
|
+
.join(', ')} }`
|
|
42
|
+
} else if (typeof Blob != 'undefined' && obj instanceof Blob) {
|
|
43
|
+
obj = `Blob->{ size: ${obj.size}, type: ${obj.type} }`
|
|
44
|
+
} else if (typeof File != 'undefined' && obj instanceof File) {
|
|
45
|
+
obj = `File->{ name: "${obj.name}", size: ${obj.size}, type: ${obj.type}, lastModified: ${new Date(obj.lastModified).toISOString()} }`
|
|
46
|
+
} else if (typeof URL != 'undefined' && obj instanceof URL) {
|
|
47
|
+
obj = `URL->{ href: "${obj.href}", protocol: "${obj.protocol}", host: "${obj.host}", pathname: "${obj.pathname}", search: "${obj.search}", hash: "${obj.hash}" }`
|
|
48
|
+
} else if (typeof FormData != 'undefined' && obj instanceof FormData) {
|
|
49
|
+
const entries = []
|
|
50
|
+
obj.forEach((key, item) => {
|
|
51
|
+
entries.push(key)
|
|
52
|
+
})
|
|
53
|
+
obj = `FormData->{ ${entries.join(', ')} }`
|
|
54
|
+
} else if (typeof Location != 'undefined' && obj instanceof Location) {
|
|
55
|
+
obj = `Location->{ href: "${obj.href}", protocol: "${obj.protocol}", host: "${obj.host}", pathname: "${obj.pathname}", search: "${obj.search}", hash: "${obj.hash}" }`
|
|
56
|
+
} else if (typeof Document != 'undefined' && obj instanceof Document) {
|
|
57
|
+
obj = `Document->{ title: "${obj.title}", URL: "${obj.URL}" }`
|
|
58
|
+
} else if (typeof Window !== 'undefined' && obj instanceof Window) {
|
|
59
|
+
obj = `Window->{ location: ${this.compressObject(obj.location)}, document: ${this.compressObject(obj.document)} }`
|
|
60
|
+
} else if (typeof Element != 'undefined' && obj instanceof Element) {
|
|
61
|
+
obj = `Element->{ tagName: "${obj.tagName}", id: "${obj.id}", class: "${obj.className}" }`
|
|
62
|
+
} else if (typeof HTMLCanvasElement != 'undefined' && obj instanceof HTMLCanvasElement) {
|
|
63
|
+
obj = `Canvas->{ width: ${obj.width}, height: ${obj.height} }`
|
|
64
|
+
} else if (typeof HTMLAudioElement != 'undefined' && obj instanceof HTMLAudioElement) {
|
|
65
|
+
obj = `Audio->{ src: "${obj.src}", duration: ${obj.duration} }`
|
|
66
|
+
} else if (typeof HTMLVideoElement != 'undefined' && obj instanceof HTMLVideoElement) {
|
|
67
|
+
obj = `Video->{ src: "${obj.src}", width: ${obj.videoWidth}, height: ${obj.videoHeight}, duration: ${obj.duration} }`
|
|
68
|
+
} else if (typeof Storage != 'undefined' && obj instanceof Storage) {
|
|
69
|
+
obj = `Storage->{ length: ${obj.length} }`
|
|
70
|
+
} else if (
|
|
71
|
+
typeof Worker != 'undefined' &&
|
|
72
|
+
typeof ServiceWorker != 'undefined' &&
|
|
73
|
+
typeof SharedWorker != 'undefined' &&
|
|
74
|
+
(obj instanceof Worker || obj instanceof ServiceWorker || obj instanceof SharedWorker)
|
|
75
|
+
) {
|
|
76
|
+
obj = `Worker->${obj.constructor.name} { scriptURL: "${obj.scriptURL}" }`
|
|
77
|
+
} else if (typeof WebSocket != 'undefined' && obj instanceof WebSocket) {
|
|
78
|
+
obj = `WebSocket->{ url: "${obj.url}", readyState: ${obj.readyState} }`
|
|
79
|
+
} else if (typeof XMLHttpRequest != 'undefined' && obj instanceof XMLHttpRequest) {
|
|
80
|
+
obj = `XMLHttpRequest->{ readyState: ${obj.readyState}, status: ${obj.status} }`
|
|
81
|
+
} else if (typeof EventSource != 'undefined' && obj instanceof EventSource) {
|
|
82
|
+
obj = `EventSource->{ url: "${obj.url}", readyState: ${obj.readyState} }`
|
|
83
|
+
} else if (typeof MediaStream != 'undefined' && obj instanceof MediaStream) {
|
|
84
|
+
obj = `MediaStream->{ id: "${obj.id}", active: ${obj.active} }`
|
|
85
|
+
} else if (typeof RTCPeerConnection != 'undefined' && obj instanceof RTCPeerConnection) {
|
|
86
|
+
obj = `RTCPeerConnection->{ connectionState: "${obj.connectionState}" }`
|
|
87
|
+
} else if (typeof AudioContext != 'undefined' && obj instanceof AudioContext) {
|
|
88
|
+
obj = `AudioContext->{ state: "${obj.state}" }`
|
|
89
|
+
} else if (typeof Element != 'undefined' && obj instanceof Element) {
|
|
90
|
+
obj = `Element->{ tagName: "${obj.tagName}", id: "${obj.id}", class: "${obj.className}" }`
|
|
91
|
+
} else if (typeof HTMLCanvasElement != 'undefined' && obj instanceof HTMLCanvasElement) {
|
|
92
|
+
obj = `Canvas->{ width: ${obj.width}, height: ${obj.height} }`
|
|
93
|
+
} else if (typeof HTMLAudioElement != 'undefined' && obj instanceof HTMLAudioElement) {
|
|
94
|
+
obj = `Audio->{ src: "${obj.src}", duration: ${obj.duration} }`
|
|
95
|
+
} else if (typeof HTMLVideoElement != 'undefined' && obj instanceof HTMLVideoElement) {
|
|
96
|
+
obj = `Video->{ src: "${obj.src}", width: ${obj.videoWidth}, height: ${obj.videoHeight}, duration: ${obj.duration} }`
|
|
97
|
+
} else if (typeof Geolocation != 'undefined' && obj instanceof Geolocation) {
|
|
98
|
+
obj = 'Geolocation->{ }'
|
|
99
|
+
} else if (typeof Performance != 'undefined' && obj instanceof Performance) {
|
|
100
|
+
obj = `Performance->{ now: ${obj.now()} }`
|
|
101
|
+
} else if (typeof Event != 'undefined' && obj instanceof Event) {
|
|
102
|
+
obj = `Event->{ type: "${obj.type}", target: "${obj.target}" }`
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (typeof obj == 'string') {
|
|
106
|
+
return this.truncateStrBySize(obj, maxSize)
|
|
107
|
+
}
|
|
108
|
+
if (typeof obj != 'object') {
|
|
109
|
+
return obj
|
|
110
|
+
}
|
|
111
|
+
if (maxSize < 2) return {}
|
|
112
|
+
|
|
113
|
+
let addEndOut = false
|
|
114
|
+
if (maxSize > 50) {
|
|
115
|
+
let objSize = this.calculateStringByteSize(obj)
|
|
116
|
+
if (objSize > maxSize) {
|
|
117
|
+
maxSize = maxSize - 50
|
|
118
|
+
addEndOut = true
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
let sizeCount = 2
|
|
123
|
+
let str = this.safeJsonStringify(obj, (key, value) => {
|
|
124
|
+
let keySize = this.calculateStringByteSize(key)
|
|
125
|
+
if (typeof value == 'object') {
|
|
126
|
+
if (sizeCount + keySize + 6 > maxSize) {
|
|
127
|
+
return
|
|
128
|
+
}
|
|
129
|
+
sizeCount = sizeCount + keySize + 6
|
|
130
|
+
return value
|
|
131
|
+
}
|
|
132
|
+
let valueSize = this.calculateStringByteSize(value)
|
|
133
|
+
let rowSize = keySize + valueSize + 6
|
|
134
|
+
if (rowSize + sizeCount > maxSize) return
|
|
135
|
+
sizeCount = sizeCount + rowSize
|
|
136
|
+
return value
|
|
137
|
+
})
|
|
138
|
+
let outPut = JSON.parse(str)
|
|
139
|
+
if (addEndOut) {
|
|
140
|
+
if (Array.isArray(outPut)) {
|
|
141
|
+
outPut.push('(已截断其余部分)')
|
|
142
|
+
} else if (typeof outPut == 'object') {
|
|
143
|
+
outPut['*注意'] = '(已截断其余部分)'
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
// console.log("compressObject use time: " + (new Date().getTime() - t));
|
|
147
|
+
return outPut
|
|
148
|
+
} catch (error) {
|
|
149
|
+
console.log('compressObject error', error)
|
|
150
|
+
return ''
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
/**
|
|
154
|
+
* 压缩数组不超过特定大小
|
|
155
|
+
* @param {any[]} [arr=[]] 需要处理的数组
|
|
156
|
+
* @param {string} [delType='start'] 数组超出后删除的开始位置
|
|
157
|
+
* @param {number} [maxSize=1024 * 972] 数组最大字节数
|
|
158
|
+
*/
|
|
159
|
+
compressArray(arr = [], delType = 'start', maxSize = 1024 * 972) {
|
|
160
|
+
let t = new Date().getTime()
|
|
161
|
+
try {
|
|
162
|
+
if (!arr || arr.length == 0 || !arr[0]) return []
|
|
163
|
+
let i = 0
|
|
164
|
+
while (true) {
|
|
165
|
+
i = i + 1
|
|
166
|
+
if (i > 999999) return arr
|
|
167
|
+
if (!arr || arr.length == 0) {
|
|
168
|
+
return []
|
|
169
|
+
}
|
|
170
|
+
if (this.calculateStringByteSize(arr) <= maxSize) {
|
|
171
|
+
// consoleLog("compressArray t=>" + (new Date().getTime() - t) + " i=>" + i)
|
|
172
|
+
return arr
|
|
173
|
+
}
|
|
174
|
+
if (delType == 'start') {
|
|
175
|
+
arr.splice(0, 1)
|
|
176
|
+
} else {
|
|
177
|
+
arr.splice(arr.length - 1, 1)
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
} catch (error) {
|
|
181
|
+
console.log('compressArray error', error)
|
|
182
|
+
return []
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
/**
|
|
186
|
+
* 计算对象或字符串占用的字节大小,传入对象将自动转json
|
|
187
|
+
*/
|
|
188
|
+
calculateStringByteSize(str) {
|
|
189
|
+
try {
|
|
190
|
+
let type = typeof str
|
|
191
|
+
if (type == 'bigint' || type == 'number' || type == 'boolean') {
|
|
192
|
+
return str.toString().length
|
|
193
|
+
} else if (type == 'function') {
|
|
194
|
+
str = str.toString().length
|
|
195
|
+
} else if (str === null || str === undefined) {
|
|
196
|
+
return 0
|
|
197
|
+
} else {
|
|
198
|
+
try {
|
|
199
|
+
str = this.safeJsonStringify(str)
|
|
200
|
+
if (str && str.hasOwnProperty) {
|
|
201
|
+
return str.length
|
|
202
|
+
} else {
|
|
203
|
+
return 1024 * 20
|
|
204
|
+
}
|
|
205
|
+
} catch (error) {
|
|
206
|
+
console.log('calculateStringByteSize error', error)
|
|
207
|
+
return 1024 * 20
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
let size = 0
|
|
211
|
+
for (let i = 0; i < str.length; i++) {
|
|
212
|
+
const charCode = str.charCodeAt(i)
|
|
213
|
+
if (charCode < 0x0080) {
|
|
214
|
+
size += 1
|
|
215
|
+
} else if (charCode < 0x0800) {
|
|
216
|
+
size += 2
|
|
217
|
+
} else if (charCode >= 0xd800 && charCode <= 0xdfff) {
|
|
218
|
+
size += 4
|
|
219
|
+
i++
|
|
220
|
+
} else {
|
|
221
|
+
size += 3
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
return size
|
|
225
|
+
} catch (error) {
|
|
226
|
+
console.log('calculateStringByteSize error', error)
|
|
227
|
+
return 1024 * 1024
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
/**
|
|
231
|
+
* 安全的js对象转字符串
|
|
232
|
+
*/
|
|
233
|
+
safeJsonStringify(obj, handleValue) {
|
|
234
|
+
if (!obj) return '{}'
|
|
235
|
+
try {
|
|
236
|
+
if (handleValue) {
|
|
237
|
+
return JSON.stringify(obj, (key, value) => {
|
|
238
|
+
return handleValue(key, value)
|
|
239
|
+
})
|
|
240
|
+
} else {
|
|
241
|
+
return JSON.stringify(obj, (key, value) => {
|
|
242
|
+
return value
|
|
243
|
+
})
|
|
244
|
+
}
|
|
245
|
+
} catch (error) {
|
|
246
|
+
// 尝试解析json失败,可能是变量循环引用的问题,继续尝试增加WeakSet解析
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
try {
|
|
250
|
+
let seen = new WeakSet()
|
|
251
|
+
let jsonStr = JSON.stringify(obj, (key, value) => {
|
|
252
|
+
if (typeof value == 'object') {
|
|
253
|
+
try {
|
|
254
|
+
if (value instanceof File) {
|
|
255
|
+
value = 'js:File'
|
|
256
|
+
}
|
|
257
|
+
if (value && value.constructor && value.constructor.name && typeof value.constructor.name == 'string') {
|
|
258
|
+
let className = value.constructor.name
|
|
259
|
+
if (className == 'VueComponent') {
|
|
260
|
+
return 'js:Object:VueComponent'
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
} catch (error) {}
|
|
264
|
+
}
|
|
265
|
+
if (typeof value == 'function') {
|
|
266
|
+
try {
|
|
267
|
+
value = value.toString()
|
|
268
|
+
} catch (error) {
|
|
269
|
+
value = 'js:function'
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
if (typeof value === 'object' && value !== null) {
|
|
273
|
+
// 处理循环引用问题
|
|
274
|
+
if (seen.has(value)) {
|
|
275
|
+
return
|
|
276
|
+
}
|
|
277
|
+
seen.add(value)
|
|
278
|
+
}
|
|
279
|
+
if (handleValue && typeof handleValue == 'function') {
|
|
280
|
+
try {
|
|
281
|
+
return handleValue(key, value)
|
|
282
|
+
} catch (error) {
|
|
283
|
+
console.log('handleValue error', error)
|
|
284
|
+
}
|
|
285
|
+
return
|
|
286
|
+
}
|
|
287
|
+
return value
|
|
288
|
+
})
|
|
289
|
+
seen = null
|
|
290
|
+
return jsonStr
|
|
291
|
+
} catch (error) {
|
|
292
|
+
return '{}'
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
/**
|
|
296
|
+
* 根据限制的字节大小截取字符串
|
|
297
|
+
*/
|
|
298
|
+
truncateStrBySize(str = '', size = 20 * 1024) {
|
|
299
|
+
try {
|
|
300
|
+
if (size < 1) return ''
|
|
301
|
+
if (this.calculateStringByteSize(str) <= size) return str
|
|
302
|
+
let endStr = ''
|
|
303
|
+
if (size > 30) {
|
|
304
|
+
endStr = '(已截断多余部分)'
|
|
305
|
+
size = size - 30
|
|
306
|
+
}
|
|
307
|
+
let low = 0,
|
|
308
|
+
high = str.length,
|
|
309
|
+
mid
|
|
310
|
+
while (low < high) {
|
|
311
|
+
mid = Math.floor((low + high) / 2)
|
|
312
|
+
let currentSize = this.calculateStringByteSize(str.substring(0, mid))
|
|
313
|
+
if (currentSize > size) {
|
|
314
|
+
// 如果大于限制值,减小高边界
|
|
315
|
+
high = mid
|
|
316
|
+
} else {
|
|
317
|
+
// 如果小于或等于限制值,增加低边界
|
|
318
|
+
low = mid + 1
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
// 返回截断的字符串,注意low-1是因为low是最后一次检查超出大小时的位置
|
|
322
|
+
return str.substring(0, low - 1) + endStr
|
|
323
|
+
} catch (error) {
|
|
324
|
+
console.log('truncateStrBySize error', error)
|
|
325
|
+
return ''
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import devCache from './devCache'
|
|
2
|
+
import devOptions from './devOptions'
|
|
3
|
+
import jsonCompress from './jsonCompress'
|
|
4
|
+
/**
|
|
5
|
+
* ! 运行日志提交工具
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 日志上报
|
|
10
|
+
*/
|
|
11
|
+
function logReport(msg) {
|
|
12
|
+
try {
|
|
13
|
+
if (!msg) return false
|
|
14
|
+
let options = devOptions.getOptions()
|
|
15
|
+
if (!options.status) {
|
|
16
|
+
console.error('日志上报失败!dev工具未启用 msg:' + msg)
|
|
17
|
+
return
|
|
18
|
+
}
|
|
19
|
+
if (!options.logs.status) {
|
|
20
|
+
console.error('日志上报失败!dev logs未启用 msg:' + msg)
|
|
21
|
+
return
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (typeof msg == 'object') {
|
|
25
|
+
try {
|
|
26
|
+
msg = JSON.stringify(msg)
|
|
27
|
+
} catch (error) {
|
|
28
|
+
msg = 'logReport:error'
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
let log = {
|
|
33
|
+
t: new Date().getTime(),
|
|
34
|
+
m: ''
|
|
35
|
+
}
|
|
36
|
+
let logSize = jsonCompress.calculateStringByteSize(log)
|
|
37
|
+
|
|
38
|
+
msg = String(msg)
|
|
39
|
+
msg = jsonCompress.compressObject(msg, options.logs.cache.rowSize - logSize)
|
|
40
|
+
log.m = msg
|
|
41
|
+
|
|
42
|
+
let logs = devCache.get('logReport')
|
|
43
|
+
if (!logs) logs = []
|
|
44
|
+
|
|
45
|
+
logs.unshift(log)
|
|
46
|
+
|
|
47
|
+
logs = jsonCompress.compressArray(logs, 'end', options.logs.cache.size)
|
|
48
|
+
|
|
49
|
+
devCache.set('logReport', logs)
|
|
50
|
+
} catch (error) {
|
|
51
|
+
console.log('logReport error', error)
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export default logReport
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import devCache from './devCache'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
pageRouteMap: [],
|
|
5
|
+
pageRouteKeyMap: {},
|
|
6
|
+
/**
|
|
7
|
+
* 安装路径分析插件
|
|
8
|
+
*/
|
|
9
|
+
install() {
|
|
10
|
+
let allRoutes = this.getAllRoutes()
|
|
11
|
+
|
|
12
|
+
let pageRouteKeyMap = devCache.get('pageRouteKeyMap')
|
|
13
|
+
if (!pageRouteKeyMap || typeof pageRouteKeyMap != 'object') {
|
|
14
|
+
pageRouteKeyMap = {}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
let lastNo = 0
|
|
18
|
+
Object.keys(pageRouteKeyMap).forEach((key) => {
|
|
19
|
+
let item = Number(pageRouteKeyMap[key])
|
|
20
|
+
if (item > lastNo) {
|
|
21
|
+
lastNo = item
|
|
22
|
+
}
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
allRoutes.forEach((item) => {
|
|
26
|
+
if (!pageRouteKeyMap[item.path]) {
|
|
27
|
+
pageRouteKeyMap[item.path] = lastNo + 1
|
|
28
|
+
lastNo = lastNo + 1
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
devCache.set('pageRouteKeyMap', pageRouteKeyMap)
|
|
33
|
+
this.pageRouteKeyMap = pageRouteKeyMap
|
|
34
|
+
|
|
35
|
+
let pageRouteMap = devCache.get('pageRouteMap')
|
|
36
|
+
if (!pageRouteMap || typeof pageRouteMap != 'object') {
|
|
37
|
+
pageRouteMap = {}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
Object.keys(pageRouteMap).forEach((key) => {
|
|
41
|
+
try {
|
|
42
|
+
let n = Number(pageRouteMap[key])
|
|
43
|
+
if (!Number.isInteger(n) || n < 0) {
|
|
44
|
+
pageRouteMap[key] = 1
|
|
45
|
+
}
|
|
46
|
+
} catch (error) {}
|
|
47
|
+
})
|
|
48
|
+
this.pageRouteMap = pageRouteMap
|
|
49
|
+
|
|
50
|
+
this.saveData()
|
|
51
|
+
},
|
|
52
|
+
/**
|
|
53
|
+
* 获取APP注册的所有路由
|
|
54
|
+
* @returns {{path: string}[]} 返回路由列表
|
|
55
|
+
*/
|
|
56
|
+
getAllRoutes() {
|
|
57
|
+
let pages = []
|
|
58
|
+
// #ifdef H5 || APP-PLUS
|
|
59
|
+
try {
|
|
60
|
+
__uniRoutes.map((item) => {
|
|
61
|
+
let path = item.alias ? item.alias : item.path
|
|
62
|
+
pages.push({ path })
|
|
63
|
+
})
|
|
64
|
+
} catch (error) {
|
|
65
|
+
pages = []
|
|
66
|
+
}
|
|
67
|
+
// #endif
|
|
68
|
+
// #ifdef MP-WEIXIN
|
|
69
|
+
try {
|
|
70
|
+
let wxPages = __wxConfig.pages
|
|
71
|
+
wxPages.map((item) => {
|
|
72
|
+
pages.push({
|
|
73
|
+
path: '/' + item
|
|
74
|
+
})
|
|
75
|
+
})
|
|
76
|
+
} catch (error) {
|
|
77
|
+
pages = []
|
|
78
|
+
}
|
|
79
|
+
// #endif
|
|
80
|
+
return pages
|
|
81
|
+
},
|
|
82
|
+
/**
|
|
83
|
+
* 写入路由列表
|
|
84
|
+
*/
|
|
85
|
+
pushPageRouteMap(list = []) {
|
|
86
|
+
if (!list || list.length == 0) {
|
|
87
|
+
list = getCurrentPages()
|
|
88
|
+
}
|
|
89
|
+
let key = ''
|
|
90
|
+
list.forEach((item) => {
|
|
91
|
+
let path = item.route.indexOf('/') == 0 ? item.route : '/' + item.route
|
|
92
|
+
let keyItem = this.pageRouteKeyMap[path]
|
|
93
|
+
if (!keyItem) {
|
|
94
|
+
keyItem = path
|
|
95
|
+
}
|
|
96
|
+
if (key == '') {
|
|
97
|
+
key = keyItem + ''
|
|
98
|
+
} else {
|
|
99
|
+
key = key + ',' + keyItem
|
|
100
|
+
}
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
if (this.pageRouteMap[key]) {
|
|
104
|
+
this.pageRouteMap[key] = this.pageRouteMap[key] + 1
|
|
105
|
+
} else {
|
|
106
|
+
this.pageRouteMap[key] = 1
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
/**
|
|
110
|
+
* 保存路由缓存
|
|
111
|
+
*/
|
|
112
|
+
saveData() {
|
|
113
|
+
let that = this
|
|
114
|
+
setTimeout(() => {
|
|
115
|
+
devCache.set('pageRouteMap', that.pageRouteMap)
|
|
116
|
+
setTimeout(() => {
|
|
117
|
+
that.saveData()
|
|
118
|
+
}, 500)
|
|
119
|
+
}, Math.round(Math.random() * 3 * 1000) + 2000)
|
|
120
|
+
}
|
|
121
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// padStart 的 polyfill,因为某些机型或情况,还无法支持es7的padStart,比如电脑版的微信小程序
|
|
2
|
+
// 所以这里做一个兼容polyfill的兼容处理
|
|
3
|
+
try {
|
|
4
|
+
if (!String.prototype.padStart) {
|
|
5
|
+
// 为了方便表示这里 fillString 用了ES6 的默认参数,不影响理解
|
|
6
|
+
String.prototype.padStart = function (maxLength, fillString = ' ') {
|
|
7
|
+
if (Object.prototype.toString.call(fillString) !== '[object String]') throw new TypeError('fillString must be String')
|
|
8
|
+
let str = this
|
|
9
|
+
// 返回 String(str) 这里是为了使返回的值是字符串字面量,在控制台中更符合直觉
|
|
10
|
+
if (str.length >= maxLength) return String(str)
|
|
11
|
+
|
|
12
|
+
let fillLength = maxLength - str.length,
|
|
13
|
+
times = Math.ceil(fillLength / fillString.length)
|
|
14
|
+
while ((times >>= 1)) {
|
|
15
|
+
fillString += fillString
|
|
16
|
+
if (times === 1) {
|
|
17
|
+
fillString += fillString
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return fillString.slice(0, fillLength) + str
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
} catch (error) {
|
|
24
|
+
console.log('timeFormat fillString error', error)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// 其他更多是格式化有如下:
|
|
28
|
+
// yyyy:mm:dd|yyyy:mm|yyyy年mm月dd日|yyyy年mm月dd日 hh时MM分等,可自定义组合
|
|
29
|
+
export function timeFormat(dateTime = null, fmt = 'yyyy-mm-dd hh:MM:ss') {
|
|
30
|
+
try {
|
|
31
|
+
// 如果为null,则格式化当前时间
|
|
32
|
+
if (!dateTime) dateTime = Number(new Date())
|
|
33
|
+
// 如果dateTime长度为10或者13,则为秒和毫秒的时间戳,如果超过13位,则为其他的时间格式
|
|
34
|
+
if (dateTime.toString().length == 10) dateTime *= 1000
|
|
35
|
+
let date = new Date(dateTime)
|
|
36
|
+
let ret
|
|
37
|
+
let opt = {
|
|
38
|
+
'y+': date.getFullYear().toString(), // 年
|
|
39
|
+
'm+': (date.getMonth() + 1).toString(), // 月
|
|
40
|
+
'd+': date.getDate().toString(), // 日
|
|
41
|
+
'h+': date.getHours().toString(), // 时
|
|
42
|
+
'M+': date.getMinutes().toString(), // 分
|
|
43
|
+
's+': date.getSeconds().toString() // 秒
|
|
44
|
+
// 有其他格式化字符需求可以继续添加,必须转化成字符串
|
|
45
|
+
}
|
|
46
|
+
for (let k in opt) {
|
|
47
|
+
ret = new RegExp('(' + k + ')').exec(fmt)
|
|
48
|
+
if (ret) {
|
|
49
|
+
fmt = fmt.replace(ret[1], ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, '0'))
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return fmt
|
|
53
|
+
} catch (error) {
|
|
54
|
+
console.log('timeFormat error', error)
|
|
55
|
+
return 'unknown error'
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function timeFromNow(timestamp) {
|
|
60
|
+
try {
|
|
61
|
+
const now = new Date().getTime()
|
|
62
|
+
let diff = timestamp - now
|
|
63
|
+
|
|
64
|
+
// 确定是过去还是未来
|
|
65
|
+
const suffix = diff > 0 ? '后' : '前'
|
|
66
|
+
diff = Math.abs(diff)
|
|
67
|
+
|
|
68
|
+
// 计算时间差异
|
|
69
|
+
const seconds = Math.floor(diff / 1000)
|
|
70
|
+
const minutes = Math.floor(seconds / 60)
|
|
71
|
+
const hours = Math.floor(minutes / 60)
|
|
72
|
+
const days = Math.floor(hours / 24)
|
|
73
|
+
const months = Math.floor(days / 30)
|
|
74
|
+
const years = Math.floor(days / 365)
|
|
75
|
+
|
|
76
|
+
// 根据时间差异返回相应的字符串
|
|
77
|
+
if (seconds < 60) {
|
|
78
|
+
return `${seconds}秒${suffix}`
|
|
79
|
+
} else if (minutes < 60) {
|
|
80
|
+
return `${minutes}分钟${suffix}`
|
|
81
|
+
} else if (hours < 24) {
|
|
82
|
+
return `${hours}小时${suffix}`
|
|
83
|
+
} else if (days < 30) {
|
|
84
|
+
return `${days}天${suffix}`
|
|
85
|
+
} else if (months < 12) {
|
|
86
|
+
return `${months}个月${suffix}`
|
|
87
|
+
} else {
|
|
88
|
+
return `${years}年${suffix}`
|
|
89
|
+
}
|
|
90
|
+
} catch (error) {
|
|
91
|
+
console.log('timeFromNow error', error)
|
|
92
|
+
}
|
|
93
|
+
}
|