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,334 @@
|
|
|
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()).map(([key, value]) => `${convertToString(key)} => ${convertToString(value)}`).join(', ')} }`;
|
|
36
|
+
} else if (typeof Set != "undefined" && obj instanceof Set) {
|
|
37
|
+
obj = `Set->(${obj.size}) { ${Array.from(obj.values()).map(value => convertToString(value)).join(', ')} }`;
|
|
38
|
+
} else if (typeof Blob != "undefined" && obj instanceof Blob) {
|
|
39
|
+
obj = `Blob->{ size: ${obj.size}, type: ${obj.type} }`;
|
|
40
|
+
} else if (typeof File != "undefined" && obj instanceof File) {
|
|
41
|
+
obj = `File->{ name: "${obj.name}", size: ${obj.size}, type: ${obj.type}, lastModified: ${new Date(obj.lastModified).toISOString()} }`;
|
|
42
|
+
} else if (typeof URL != "undefined" && obj instanceof URL) {
|
|
43
|
+
obj = `URL->{ href: "${obj.href}", protocol: "${obj.protocol}", host: "${obj.host}", pathname: "${obj.pathname}", search: "${obj.search}", hash: "${obj.hash}" }`;
|
|
44
|
+
} else if (typeof FormData != "undefined" && obj instanceof FormData) {
|
|
45
|
+
const entries = [];
|
|
46
|
+
obj.forEach((key, item) => {
|
|
47
|
+
entries.push(key)
|
|
48
|
+
})
|
|
49
|
+
obj = `FormData->{ ${entries.join(', ')} }`;
|
|
50
|
+
} else if (typeof Location != "undefined" && obj instanceof Location) {
|
|
51
|
+
obj = `Location->{ href: "${obj.href}", protocol: "${obj.protocol}", host: "${obj.host}", pathname: "${obj.pathname}", search: "${obj.search}", hash: "${obj.hash}" }`;
|
|
52
|
+
} else if (typeof Document != "undefined" && obj instanceof Document) {
|
|
53
|
+
obj = `Document->{ title: "${obj.title}", URL: "${obj.URL}" }`;
|
|
54
|
+
} else if (typeof Window !== "undefined" && obj instanceof Window) {
|
|
55
|
+
obj = `Window->{ location: ${this.compressObject(obj.location)}, document: ${this.compressObject(obj.document)} }`;
|
|
56
|
+
} else if (typeof Element != "undefined" && obj instanceof Element) {
|
|
57
|
+
obj = `Element->{ tagName: "${obj.tagName}", id: "${obj.id}", class: "${obj.className}" }`;
|
|
58
|
+
} else if (typeof HTMLCanvasElement != "undefined" && obj instanceof HTMLCanvasElement) {
|
|
59
|
+
obj = `Canvas->{ width: ${obj.width}, height: ${obj.height} }`;
|
|
60
|
+
} else if (typeof HTMLAudioElement != "undefined" && obj instanceof HTMLAudioElement) {
|
|
61
|
+
obj = `Audio->{ src: "${obj.src}", duration: ${obj.duration} }`;
|
|
62
|
+
} else if (typeof HTMLVideoElement != "undefined" && obj instanceof HTMLVideoElement) {
|
|
63
|
+
obj = `Video->{ src: "${obj.src}", width: ${obj.videoWidth}, height: ${obj.videoHeight}, duration: ${obj.duration} }`;
|
|
64
|
+
} else if (typeof Storage != "undefined" && obj instanceof Storage) {
|
|
65
|
+
obj = `Storage->{ length: ${obj.length} }`;
|
|
66
|
+
}
|
|
67
|
+
else if ((typeof Worker != "undefined" && typeof ServiceWorker != "undefined" && typeof SharedWorker != "undefined") && (obj instanceof Worker || obj instanceof ServiceWorker || obj instanceof SharedWorker)) {
|
|
68
|
+
obj = `Worker->${obj.constructor.name} { scriptURL: "${obj.scriptURL}" }`;
|
|
69
|
+
} else if (typeof WebSocket != "undefined" && obj instanceof WebSocket) {
|
|
70
|
+
obj = `WebSocket->{ url: "${obj.url}", readyState: ${obj.readyState} }`;
|
|
71
|
+
}
|
|
72
|
+
else if (typeof XMLHttpRequest != "undefined" && obj instanceof XMLHttpRequest) {
|
|
73
|
+
obj = `XMLHttpRequest->{ readyState: ${obj.readyState}, status: ${obj.status} }`;
|
|
74
|
+
}
|
|
75
|
+
else if (typeof EventSource != "undefined" && obj instanceof EventSource) {
|
|
76
|
+
obj = `EventSource->{ url: "${obj.url}", readyState: ${obj.readyState} }`;
|
|
77
|
+
}
|
|
78
|
+
else if (typeof MediaStream != "undefined" && obj instanceof MediaStream) {
|
|
79
|
+
obj = `MediaStream->{ id: "${obj.id}", active: ${obj.active} }`;
|
|
80
|
+
}
|
|
81
|
+
else if (typeof RTCPeerConnection != "undefined" && obj instanceof RTCPeerConnection) {
|
|
82
|
+
obj = `RTCPeerConnection->{ connectionState: "${obj.connectionState}" }`;
|
|
83
|
+
}
|
|
84
|
+
else if (typeof AudioContext != "undefined" && obj instanceof AudioContext) {
|
|
85
|
+
obj = `AudioContext->{ state: "${obj.state}" }`
|
|
86
|
+
}
|
|
87
|
+
else if (typeof Element != "undefined" && obj instanceof Element) {
|
|
88
|
+
obj = `Element->{ tagName: "${obj.tagName}", id: "${obj.id}", class: "${obj.className}" }`
|
|
89
|
+
}
|
|
90
|
+
else if (typeof HTMLCanvasElement != "undefined" && obj instanceof HTMLCanvasElement) {
|
|
91
|
+
obj = `Canvas->{ width: ${obj.width}, height: ${obj.height} }`
|
|
92
|
+
}
|
|
93
|
+
else if (typeof HTMLAudioElement != "undefined" && obj instanceof HTMLAudioElement) {
|
|
94
|
+
obj = `Audio->{ src: "${obj.src}", duration: ${obj.duration} }`;
|
|
95
|
+
}
|
|
96
|
+
else if (typeof HTMLVideoElement != "undefined" && obj instanceof HTMLVideoElement) {
|
|
97
|
+
obj = `Video->{ src: "${obj.src}", width: ${obj.videoWidth}, height: ${obj.videoHeight}, duration: ${obj.duration} }`;
|
|
98
|
+
}
|
|
99
|
+
else if (typeof Geolocation != "undefined" && obj instanceof Geolocation) {
|
|
100
|
+
obj = `Geolocation->{ }`;
|
|
101
|
+
}
|
|
102
|
+
else if (typeof Performance != "undefined" && obj instanceof Performance) {
|
|
103
|
+
obj = `Performance->{ now: ${obj.now()} }`
|
|
104
|
+
}
|
|
105
|
+
else if (typeof Event != "undefined" && obj instanceof Event) {
|
|
106
|
+
obj = `Event->{ type: "${obj.type}", target: "${obj.target}" }`;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (typeof obj == "string") {
|
|
110
|
+
return this.truncateStrBySize(obj, maxSize);
|
|
111
|
+
}
|
|
112
|
+
if (typeof obj != "object") {
|
|
113
|
+
return obj;
|
|
114
|
+
}
|
|
115
|
+
if (maxSize < 2) return {};
|
|
116
|
+
|
|
117
|
+
let addEndOut = false;
|
|
118
|
+
if (maxSize > 50) {
|
|
119
|
+
let objSize = this.calculateStringByteSize(obj);
|
|
120
|
+
if (objSize > maxSize) {
|
|
121
|
+
maxSize = maxSize - 50;
|
|
122
|
+
addEndOut = true;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
let sizeCount = 2;
|
|
127
|
+
let str = this.safeJsonStringify(obj, (key, value) => {
|
|
128
|
+
let keySize = this.calculateStringByteSize(key)
|
|
129
|
+
if (typeof value == "object") {
|
|
130
|
+
if (sizeCount + keySize + 6 > maxSize) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
sizeCount = sizeCount + keySize + 6;
|
|
134
|
+
return value;
|
|
135
|
+
}
|
|
136
|
+
let valueSize = this.calculateStringByteSize(value)
|
|
137
|
+
let rowSize = keySize + valueSize + 6;
|
|
138
|
+
if (rowSize + sizeCount > maxSize) return;
|
|
139
|
+
sizeCount = sizeCount + rowSize;
|
|
140
|
+
return value;
|
|
141
|
+
})
|
|
142
|
+
let outPut = JSON.parse(str)
|
|
143
|
+
if (addEndOut) {
|
|
144
|
+
if (Array.isArray(outPut)) {
|
|
145
|
+
outPut.push('(已截断其余部分)')
|
|
146
|
+
} else if (typeof outPut == "object") {
|
|
147
|
+
outPut["*注意"] = "(已截断其余部分)";
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
// console.log("compressObject use time: " + (new Date().getTime() - t));
|
|
151
|
+
return outPut;
|
|
152
|
+
} catch (error) {
|
|
153
|
+
console.log("compressObject error", error);
|
|
154
|
+
return "";
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
/**
|
|
158
|
+
* 压缩数组不超过特定大小
|
|
159
|
+
* @param {any[]} [arr=[]] 需要处理的数组
|
|
160
|
+
* @param {string} [delType='start'] 数组超出后删除的开始位置
|
|
161
|
+
* @param {number} [maxSize=1024 * 972] 数组最大字节数
|
|
162
|
+
*/
|
|
163
|
+
compressArray(arr = [], delType = "start", maxSize = 1024 * 972) {
|
|
164
|
+
let t = new Date().getTime()
|
|
165
|
+
try {
|
|
166
|
+
if (!arr || arr.length == 0 || !arr[0]) return [];
|
|
167
|
+
let i = 0;
|
|
168
|
+
while (true) {
|
|
169
|
+
i = i + 1;
|
|
170
|
+
if (i > 999999) return arr;
|
|
171
|
+
if (!arr || arr.length == 0) {
|
|
172
|
+
return [];
|
|
173
|
+
}
|
|
174
|
+
if (this.calculateStringByteSize(arr) <= maxSize) {
|
|
175
|
+
// consoleLog("compressArray t=>" + (new Date().getTime() - t) + " i=>" + i)
|
|
176
|
+
return arr;
|
|
177
|
+
}
|
|
178
|
+
if (delType == "start") {
|
|
179
|
+
arr.splice(0, 1);
|
|
180
|
+
} else {
|
|
181
|
+
arr.splice(arr.length - 1, 1);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
} catch (error) {
|
|
185
|
+
console.log("compressArray error", error);
|
|
186
|
+
return [];
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
/**
|
|
190
|
+
* 计算对象或字符串占用的字节大小,传入对象将自动转json
|
|
191
|
+
*/
|
|
192
|
+
calculateStringByteSize(str) {
|
|
193
|
+
try {
|
|
194
|
+
let type = typeof str;
|
|
195
|
+
if (
|
|
196
|
+
type == "bigint"
|
|
197
|
+
|| type == "number"
|
|
198
|
+
|| type == "boolean"
|
|
199
|
+
) {
|
|
200
|
+
return str.toString().length;
|
|
201
|
+
} else if (type == "function") {
|
|
202
|
+
str = str.toString().length
|
|
203
|
+
} else if (str === null || str === undefined) {
|
|
204
|
+
return 0;
|
|
205
|
+
} else {
|
|
206
|
+
try {
|
|
207
|
+
str = this.safeJsonStringify(str);
|
|
208
|
+
if (str && str.hasOwnProperty) {
|
|
209
|
+
return str.length;
|
|
210
|
+
} else {
|
|
211
|
+
return 1024 * 20;
|
|
212
|
+
}
|
|
213
|
+
} catch (error) {
|
|
214
|
+
console.log("calculateStringByteSize error", error);
|
|
215
|
+
return 1024 * 20;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
let size = 0;
|
|
219
|
+
for (let i = 0; i < str.length; i++) {
|
|
220
|
+
const charCode = str.charCodeAt(i);
|
|
221
|
+
if (charCode < 0x0080) {
|
|
222
|
+
size += 1;
|
|
223
|
+
} else if (charCode < 0x0800) {
|
|
224
|
+
size += 2;
|
|
225
|
+
} else if (charCode >= 0xD800 && charCode <= 0xDFFF) {
|
|
226
|
+
size += 4;
|
|
227
|
+
i++;
|
|
228
|
+
} else {
|
|
229
|
+
size += 3;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
return size;
|
|
233
|
+
} catch (error) {
|
|
234
|
+
console.log("calculateStringByteSize error", error);
|
|
235
|
+
return 1024 * 1024;
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
/**
|
|
239
|
+
* 安全的js对象转字符串
|
|
240
|
+
*/
|
|
241
|
+
safeJsonStringify(obj, handleValue) {
|
|
242
|
+
if (!obj) return "{}";
|
|
243
|
+
try {
|
|
244
|
+
if (handleValue) {
|
|
245
|
+
return JSON.stringify(obj, (key, value) => {
|
|
246
|
+
return handleValue(key, value)
|
|
247
|
+
})
|
|
248
|
+
} else {
|
|
249
|
+
return JSON.stringify(obj, (key, value) => {
|
|
250
|
+
return value;
|
|
251
|
+
})
|
|
252
|
+
}
|
|
253
|
+
} catch (error) {
|
|
254
|
+
// 尝试解析json失败,可能是变量循环引用的问题,继续尝试增加WeakSet解析
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
try {
|
|
258
|
+
let seen = new WeakSet();
|
|
259
|
+
let jsonStr = JSON.stringify(obj, (key, value) => {
|
|
260
|
+
if (typeof value == "object") {
|
|
261
|
+
try {
|
|
262
|
+
if (value instanceof File) {
|
|
263
|
+
value = "js:File";
|
|
264
|
+
}
|
|
265
|
+
if (value && value.constructor && value.constructor.name && typeof value.constructor.name == "string") {
|
|
266
|
+
let className = value.constructor.name;
|
|
267
|
+
if (className == "VueComponent") {
|
|
268
|
+
return "js:Object:VueComponent";
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
} catch (error) { }
|
|
272
|
+
}
|
|
273
|
+
if (typeof value == "function") {
|
|
274
|
+
try {
|
|
275
|
+
value = value.toString();
|
|
276
|
+
} catch (error) {
|
|
277
|
+
value = "js:function";
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
if (typeof value === "object" && value !== null) {
|
|
281
|
+
// 处理循环引用问题
|
|
282
|
+
if (seen.has(value)) {
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
seen.add(value);
|
|
286
|
+
}
|
|
287
|
+
if (handleValue && typeof handleValue == "function") {
|
|
288
|
+
try {
|
|
289
|
+
return handleValue(key, value);
|
|
290
|
+
} catch (error) {
|
|
291
|
+
console.log("handleValue error", error);
|
|
292
|
+
}
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
return value;
|
|
296
|
+
});
|
|
297
|
+
seen = null;
|
|
298
|
+
return jsonStr;
|
|
299
|
+
} catch (error) {
|
|
300
|
+
return "{}";
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
/**
|
|
304
|
+
* 根据限制的字节大小截取字符串
|
|
305
|
+
*/
|
|
306
|
+
truncateStrBySize(str = "", size = 20 * 1024) {
|
|
307
|
+
try {
|
|
308
|
+
if (size < 1) return "";
|
|
309
|
+
if (this.calculateStringByteSize(str) <= size) return str;
|
|
310
|
+
let endStr = "";
|
|
311
|
+
if (size > 30) {
|
|
312
|
+
endStr = "(已截断多余部分)"
|
|
313
|
+
size = size - 30;
|
|
314
|
+
}
|
|
315
|
+
let low = 0, high = str.length, mid;
|
|
316
|
+
while (low < high) {
|
|
317
|
+
mid = Math.floor((low + high) / 2);
|
|
318
|
+
let currentSize = this.calculateStringByteSize(str.substring(0, mid));
|
|
319
|
+
if (currentSize > size) {
|
|
320
|
+
// 如果大于限制值,减小高边界
|
|
321
|
+
high = mid;
|
|
322
|
+
} else {
|
|
323
|
+
// 如果小于或等于限制值,增加低边界
|
|
324
|
+
low = mid + 1;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
// 返回截断的字符串,注意low-1是因为low是最后一次检查超出大小时的位置
|
|
328
|
+
return str.substring(0, low - 1) + endStr;
|
|
329
|
+
} catch (error) {
|
|
330
|
+
console.log("truncateStrBySize error", error);
|
|
331
|
+
return "";
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import devCache from "./devCache";
|
|
2
|
+
import devOptions from "./devOptions";
|
|
3
|
+
import jsonCompress from "./jsonCompress";
|
|
4
|
+
/**
|
|
5
|
+
* ! 运行日志提交工具
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 日志上报
|
|
12
|
+
*/
|
|
13
|
+
function logReport(msg) {
|
|
14
|
+
try {
|
|
15
|
+
if (!msg) return false;
|
|
16
|
+
let options = devOptions.getOptions()
|
|
17
|
+
if (!options.status) {
|
|
18
|
+
console.error("日志上报失败!dev工具未启用 msg:" + msg);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (!options.logs.status) {
|
|
22
|
+
console.error("日志上报失败!dev logs未启用 msg:" + msg);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (typeof msg == "object") {
|
|
27
|
+
try {
|
|
28
|
+
msg = JSON.stringify(msg)
|
|
29
|
+
} catch (error) {
|
|
30
|
+
msg = "logReport:error"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
let log = {
|
|
35
|
+
t: new Date().getTime(),
|
|
36
|
+
m: "",
|
|
37
|
+
}
|
|
38
|
+
let logSize = jsonCompress.calculateStringByteSize(log)
|
|
39
|
+
|
|
40
|
+
msg = String(msg);
|
|
41
|
+
msg = jsonCompress.compressObject(msg, options.logs.cache.rowSize - logSize)
|
|
42
|
+
log.m = msg;
|
|
43
|
+
|
|
44
|
+
let logs = devCache.get("logReport");
|
|
45
|
+
if (!logs) logs = [];
|
|
46
|
+
|
|
47
|
+
logs.unshift(log);
|
|
48
|
+
|
|
49
|
+
logs = jsonCompress.compressArray(logs, "end", options.logs.cache.size)
|
|
50
|
+
|
|
51
|
+
devCache.set("logReport", logs)
|
|
52
|
+
} catch (error) {
|
|
53
|
+
console.log("logReport error", error);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
export default logReport;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import devCache from "./devCache"
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
pageRouteMap: [],
|
|
5
|
+
pageRouteKeyMap: {},
|
|
6
|
+
/**
|
|
7
|
+
* 安装路径分析插件
|
|
8
|
+
*/
|
|
9
|
+
install() {
|
|
10
|
+
|
|
11
|
+
let allRoutes = this.getAllRoutes();
|
|
12
|
+
|
|
13
|
+
let pageRouteKeyMap = devCache.get("pageRouteKeyMap")
|
|
14
|
+
if (!pageRouteKeyMap || typeof pageRouteKeyMap != "object") {
|
|
15
|
+
pageRouteKeyMap = {}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
let lastNo = 0;
|
|
19
|
+
Object.keys(pageRouteKeyMap).forEach((key) => {
|
|
20
|
+
let item = Number(pageRouteKeyMap[key])
|
|
21
|
+
if (item > lastNo) {
|
|
22
|
+
lastNo = item;
|
|
23
|
+
}
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
allRoutes.forEach(item => {
|
|
27
|
+
if (!pageRouteKeyMap[item.path]) {
|
|
28
|
+
pageRouteKeyMap[item.path] = lastNo + 1;
|
|
29
|
+
lastNo = lastNo + 1;
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
devCache.set("pageRouteKeyMap", pageRouteKeyMap)
|
|
34
|
+
this.pageRouteKeyMap = pageRouteKeyMap;
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
let pageRouteMap = devCache.get("pageRouteMap");
|
|
38
|
+
if (!pageRouteMap || typeof pageRouteMap != "object") {
|
|
39
|
+
pageRouteMap = {}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
Object.keys(pageRouteMap).forEach((key) => {
|
|
43
|
+
try {
|
|
44
|
+
let n = Number(pageRouteMap[key]);
|
|
45
|
+
if (!Number.isInteger(n) || n < 0) {
|
|
46
|
+
pageRouteMap[key] = 1;
|
|
47
|
+
}
|
|
48
|
+
} catch (error) { }
|
|
49
|
+
})
|
|
50
|
+
this.pageRouteMap = pageRouteMap;
|
|
51
|
+
|
|
52
|
+
this.saveData()
|
|
53
|
+
|
|
54
|
+
},
|
|
55
|
+
/**
|
|
56
|
+
* 获取APP注册的所有路由
|
|
57
|
+
* @returns {{path: string}[]} 返回路由列表
|
|
58
|
+
*/
|
|
59
|
+
getAllRoutes() {
|
|
60
|
+
let pages = [];
|
|
61
|
+
// #ifdef H5 || APP-PLUS
|
|
62
|
+
try {
|
|
63
|
+
__uniRoutes.map((item) => {
|
|
64
|
+
let path = item.alias ? item.alias : item.path;
|
|
65
|
+
pages.push({ path })
|
|
66
|
+
});
|
|
67
|
+
} catch (error) {
|
|
68
|
+
pages = [];
|
|
69
|
+
}
|
|
70
|
+
// #endif
|
|
71
|
+
// #ifdef MP-WEIXIN
|
|
72
|
+
try {
|
|
73
|
+
let wxPages = __wxConfig.pages;
|
|
74
|
+
wxPages.map((item) => {
|
|
75
|
+
pages.push({
|
|
76
|
+
path: "/" + item,
|
|
77
|
+
})
|
|
78
|
+
});
|
|
79
|
+
} catch (error) {
|
|
80
|
+
pages = [];
|
|
81
|
+
}
|
|
82
|
+
// #endif
|
|
83
|
+
return pages;
|
|
84
|
+
},
|
|
85
|
+
/**
|
|
86
|
+
* 写入路由列表
|
|
87
|
+
*/
|
|
88
|
+
pushPageRouteMap(list = []) {
|
|
89
|
+
if (!list || list.length == 0) {
|
|
90
|
+
list = getCurrentPages()
|
|
91
|
+
}
|
|
92
|
+
let key = ""
|
|
93
|
+
list.forEach((item) => {
|
|
94
|
+
let path = item.route.indexOf("/") == 0 ? item.route : "/" + item.route;
|
|
95
|
+
let keyItem = this.pageRouteKeyMap[path];
|
|
96
|
+
if (!keyItem) {
|
|
97
|
+
keyItem = path;
|
|
98
|
+
}
|
|
99
|
+
if (key == "") {
|
|
100
|
+
key = keyItem + ""
|
|
101
|
+
} else {
|
|
102
|
+
key = key + "," + keyItem
|
|
103
|
+
}
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
if (this.pageRouteMap[key]) {
|
|
107
|
+
this.pageRouteMap[key] = this.pageRouteMap[key] + 1;
|
|
108
|
+
} else {
|
|
109
|
+
this.pageRouteMap[key] = 1;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
},
|
|
113
|
+
/**
|
|
114
|
+
* 保存路由缓存
|
|
115
|
+
*/
|
|
116
|
+
saveData() {
|
|
117
|
+
let that = this;
|
|
118
|
+
setTimeout(() => {
|
|
119
|
+
devCache.set("pageRouteMap", that.pageRouteMap)
|
|
120
|
+
setTimeout(() => {
|
|
121
|
+
that.saveData()
|
|
122
|
+
}, 500);
|
|
123
|
+
}, Math.round(Math.random() * 3 * 1000) + 2000);
|
|
124
|
+
},
|
|
125
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
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(
|
|
8
|
+
'fillString must be String')
|
|
9
|
+
let str = this
|
|
10
|
+
// 返回 String(str) 这里是为了使返回的值是字符串字面量,在控制台中更符合直觉
|
|
11
|
+
if (str.length >= maxLength) return String(str)
|
|
12
|
+
|
|
13
|
+
let fillLength = maxLength - str.length,
|
|
14
|
+
times = Math.ceil(fillLength / fillString.length)
|
|
15
|
+
while (times >>= 1) {
|
|
16
|
+
fillString += fillString
|
|
17
|
+
if (times === 1) {
|
|
18
|
+
fillString += fillString
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return fillString.slice(0, fillLength) + str;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
} catch (error) {
|
|
25
|
+
console.log("timeFormat fillString error", error);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// 其他更多是格式化有如下:
|
|
29
|
+
// yyyy:mm:dd|yyyy:mm|yyyy年mm月dd日|yyyy年mm月dd日 hh时MM分等,可自定义组合
|
|
30
|
+
export function timeFormat(dateTime = null, fmt = 'yyyy-mm-dd hh:MM:ss') {
|
|
31
|
+
try {
|
|
32
|
+
// 如果为null,则格式化当前时间
|
|
33
|
+
if (!dateTime) dateTime = Number(new Date());
|
|
34
|
+
// 如果dateTime长度为10或者13,则为秒和毫秒的时间戳,如果超过13位,则为其他的时间格式
|
|
35
|
+
if (dateTime.toString().length == 10) dateTime *= 1000;
|
|
36
|
+
let date = new Date(dateTime);
|
|
37
|
+
let ret;
|
|
38
|
+
let opt = {
|
|
39
|
+
"y+": date.getFullYear().toString(), // 年
|
|
40
|
+
"m+": (date.getMonth() + 1).toString(), // 月
|
|
41
|
+
"d+": date.getDate().toString(), // 日
|
|
42
|
+
"h+": date.getHours().toString(), // 时
|
|
43
|
+
"M+": date.getMinutes().toString(), // 分
|
|
44
|
+
"s+": date.getSeconds().toString() // 秒
|
|
45
|
+
// 有其他格式化字符需求可以继续添加,必须转化成字符串
|
|
46
|
+
};
|
|
47
|
+
for (let k in opt) {
|
|
48
|
+
ret = new RegExp("(" + k + ")").exec(fmt);
|
|
49
|
+
if (ret) {
|
|
50
|
+
fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")))
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
return fmt;
|
|
54
|
+
} catch (error) {
|
|
55
|
+
console.log("timeFormat error", error);
|
|
56
|
+
return "unknown error"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function timeFromNow(timestamp) {
|
|
61
|
+
try {
|
|
62
|
+
const now = new Date().getTime();
|
|
63
|
+
let diff = timestamp - now;
|
|
64
|
+
|
|
65
|
+
// 确定是过去还是未来
|
|
66
|
+
const suffix = diff > 0 ? "后" : "前";
|
|
67
|
+
diff = Math.abs(diff);
|
|
68
|
+
|
|
69
|
+
// 计算时间差异
|
|
70
|
+
const seconds = Math.floor(diff / 1000);
|
|
71
|
+
const minutes = Math.floor(seconds / 60);
|
|
72
|
+
const hours = Math.floor(minutes / 60);
|
|
73
|
+
const days = Math.floor(hours / 24);
|
|
74
|
+
const months = Math.floor(days / 30);
|
|
75
|
+
const years = Math.floor(days / 365);
|
|
76
|
+
|
|
77
|
+
// 根据时间差异返回相应的字符串
|
|
78
|
+
if (seconds < 60) {
|
|
79
|
+
return `${seconds}秒${suffix}`;
|
|
80
|
+
} else if (minutes < 60) {
|
|
81
|
+
return `${minutes}分钟${suffix}`;
|
|
82
|
+
} else if (hours < 24) {
|
|
83
|
+
return `${hours}小时${suffix}`;
|
|
84
|
+
} else if (days < 30) {
|
|
85
|
+
return `${days}天${suffix}`;
|
|
86
|
+
} else if (months < 12) {
|
|
87
|
+
return `${months}个月${suffix}`;
|
|
88
|
+
} else {
|
|
89
|
+
return `${years}年${suffix}`;
|
|
90
|
+
}
|
|
91
|
+
} catch (error) {
|
|
92
|
+
console.log("timeFromNow error", error);
|
|
93
|
+
}
|
|
94
|
+
}
|