oxy-uni-ui 2.1.0 → 2.1.2
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/abstracts/variable.scss +145 -100
- package/components/common/util.ts +25 -0
- package/components/composables/useDynamicVirtualScroll.ts +80 -0
- package/components/oxy-action-sheet/index.scss +6 -6
- package/components/oxy-backtop/index.scss +1 -1
- package/components/oxy-badge/index.scss +2 -2
- package/components/oxy-button/index.scss +3 -6
- package/components/oxy-calendar/index.scss +2 -2
- package/components/oxy-calendar/oxy-calendar.vue +3 -3
- package/components/oxy-calendar-view/monthPanel/month-panel.vue +72 -37
- package/components/oxy-calendar-view/monthPanel/types.ts +43 -1
- package/components/oxy-calendar-view/types.ts +1 -1
- package/components/oxy-calendar-view/utils.ts +12 -1
- package/components/oxy-calendar-view/yearPanel/types.ts +36 -2
- package/components/oxy-calendar-view/yearPanel/year-panel.vue +64 -45
- package/components/oxy-card/index.scss +4 -4
- package/components/oxy-cell/index.scss +1 -1
- package/components/oxy-cell-group/index.scss +2 -2
- package/components/oxy-checkbox/index.scss +87 -197
- package/components/oxy-collapse/index.scss +1 -1
- package/components/oxy-collapse-item/index.scss +2 -2
- package/components/oxy-corner/index.scss +3 -3
- package/components/oxy-count-to/oxy-count-to.vue +3 -3
- package/components/oxy-count-to/types.ts +1 -1
- package/components/oxy-date-strip-item/index.scss +4 -4
- package/components/oxy-datetime-picker/types.ts +1 -1
- package/components/oxy-datetime-picker-view/types.ts +2 -2
- package/components/oxy-fab/index.scss +1 -5
- package/components/oxy-file-list/index.scss +2 -2
- package/components/oxy-footer/index.scss +2 -2
- package/components/oxy-footer/oxy-footer.vue +2 -3
- package/components/oxy-form-item/index.scss +0 -5
- package/components/oxy-grid/oxy-grid.vue +1 -1
- package/components/oxy-grid-item/index.scss +1 -1
- package/components/oxy-guidance/index.scss +2 -2
- package/components/oxy-img/index.scss +2 -2
- package/components/oxy-img-cropper/index.scss +0 -2
- package/components/oxy-img-lazy/index.scss +0 -1
- package/components/oxy-index-anchor/index.scss +3 -3
- package/components/oxy-input/index.scss +2 -2
- package/components/oxy-input-number/index.scss +21 -3
- package/components/oxy-input-number/oxy-input-number.vue +9 -1
- package/components/oxy-keyboard/index.scss +1 -1
- package/components/oxy-link/index.scss +11 -10
- package/components/oxy-loading/index.scss +1 -1
- package/components/oxy-loadmore/index.scss +1 -1
- package/components/oxy-message-box/index.scss +7 -7
- package/components/oxy-navbar/index.scss +1 -1
- package/components/oxy-navbar/oxy-navbar.vue +2 -3
- package/components/oxy-password-input/index.scss +4 -4
- package/components/oxy-picker/types.ts +1 -1
- package/components/oxy-picker-view/oxy-picker-view.vue +8 -5
- package/components/oxy-picker-view/types.ts +2 -2
- package/components/oxy-progress/index.scss +2 -2
- package/components/oxy-radio/index.scss +8 -4
- package/components/oxy-radio-group/index.scss +0 -1
- package/components/oxy-rich-text/index.scss +2 -6
- package/components/oxy-rich-text/mp-html/mp-html.d.ts +2 -0
- package/components/oxy-rich-text/mp-html/mp-html.vue +2 -1
- package/components/oxy-rich-text/mp-html/node/node.vue +23 -0
- package/components/oxy-rich-text/mp-html/parser.js +6 -6
- package/components/oxy-rich-text/oxy-rich-text.vue +23 -0
- package/components/oxy-search/index.scss +1 -1
- package/components/oxy-segmented/index.scss +4 -8
- package/components/oxy-select/index.scss +6 -6
- package/components/oxy-sidebar-item/index.scss +20 -11
- package/components/oxy-slider/index.scss +4 -5
- package/components/oxy-sort-button/index.scss +6 -9
- package/components/oxy-splitter-panel/index.scss +8 -8
- package/components/oxy-step/index.scss +9 -9
- package/components/oxy-swiper-nav/index.scss +2 -2
- package/components/oxy-switch/index.scss +3 -3
- package/components/oxy-tab/index.scss +8 -2
- package/components/oxy-tabbar/index.scss +3 -3
- package/components/oxy-tabbar/oxy-tabbar.vue +3 -3
- package/components/oxy-table/index.scss +0 -1
- package/components/oxy-table-col/index.scss +1 -2
- package/components/oxy-tabs/index.scss +3 -3
- package/components/oxy-tag/index.scss +160 -20
- package/components/oxy-tag/oxy-tag.vue +14 -2
- package/components/oxy-tag/types.ts +9 -0
- package/components/oxy-text/index.scss +1 -1
- package/components/oxy-textarea/index.scss +2 -6
- package/components/oxy-toast/index.scss +1 -1
- package/components/oxy-tree/index.scss +31 -11
- package/components/oxy-tree/oxy-tree.vue +113 -2
- package/components/oxy-tree/types.ts +1 -0
- package/components/oxy-upload/index.scss +3 -3
- package/components/oxy-video-preview/index.scss +3 -3
- package/components/oxy-virtual-scroll/index.scss +1 -1
- package/components/oxy-voice-player/index.scss +36 -36
- package/components/oxy-watermark/index.scss +1 -1
- 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/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 +1 -1
- package/tags.json +1 -1
- package/web-types.json +1 -1
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
import devCache from "../libs/devCache";
|
|
2
|
+
import devOptions from "../libs/devOptions";
|
|
3
|
+
import jsonCompress from "../libs/jsonCompress";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
logList: [],
|
|
7
|
+
options: null,
|
|
8
|
+
/**
|
|
9
|
+
* 挂载打印拦截器
|
|
10
|
+
*/
|
|
11
|
+
install() {
|
|
12
|
+
let that = this;
|
|
13
|
+
|
|
14
|
+
this.options = devOptions.getOptions()
|
|
15
|
+
if (!this.options.console.status) return;
|
|
16
|
+
|
|
17
|
+
this.logList = devCache.get("console");
|
|
18
|
+
if (!this.logList) this.logList = [];
|
|
19
|
+
this.syncReqData(); //同步缓存
|
|
20
|
+
|
|
21
|
+
if (uni.__log__) {
|
|
22
|
+
// ! VUE3在app端时有这个特殊的方法
|
|
23
|
+
that.mountUniConsole()
|
|
24
|
+
} else {
|
|
25
|
+
that.mountJsConsole()
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
//! 删除指定记录
|
|
29
|
+
uni.$on("devTools_delConsoleItem", (item) => {
|
|
30
|
+
let i = that.logList.findIndex(
|
|
31
|
+
(x) => {
|
|
32
|
+
let t = JSON.stringify(x.list)
|
|
33
|
+
return t == JSON.stringify(item.list) &&
|
|
34
|
+
x.time == item.time &&
|
|
35
|
+
x.page == item.page &&
|
|
36
|
+
x.type == item.type
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
if (i != -1) {
|
|
40
|
+
that.logList.splice(i, 1);
|
|
41
|
+
}
|
|
42
|
+
that.saveData()
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
//! 清空console日志
|
|
46
|
+
uni.$on("devTools_delConsoleAll", () => {
|
|
47
|
+
that.logList = []
|
|
48
|
+
devCache.clearItem("console");
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
/**
|
|
52
|
+
* 同步请求信息到缓存数据中
|
|
53
|
+
*/
|
|
54
|
+
syncReqData() {
|
|
55
|
+
let that = this;
|
|
56
|
+
setTimeout(() => {
|
|
57
|
+
try {
|
|
58
|
+
that.saveData()
|
|
59
|
+
} catch (error) {
|
|
60
|
+
console.log("console.syncReqData error", error);
|
|
61
|
+
}
|
|
62
|
+
that.syncReqData()
|
|
63
|
+
}, 3000);
|
|
64
|
+
},
|
|
65
|
+
/**
|
|
66
|
+
* 同步数据到缓存
|
|
67
|
+
*/
|
|
68
|
+
saveData() {
|
|
69
|
+
let that = this;
|
|
70
|
+
that.logList = jsonCompress.compressArray(that.logList, 'end', that.options.console.cache.size)
|
|
71
|
+
devCache.set("console", that.logList)
|
|
72
|
+
},
|
|
73
|
+
/**
|
|
74
|
+
* 挂载监听js自带的console函数
|
|
75
|
+
*/
|
|
76
|
+
mountJsConsole() {
|
|
77
|
+
let that = this;
|
|
78
|
+
try {
|
|
79
|
+
|
|
80
|
+
let l = console.log;
|
|
81
|
+
try {
|
|
82
|
+
globalThis.consoleLog = function () {
|
|
83
|
+
console.log(...arguments)
|
|
84
|
+
};
|
|
85
|
+
} catch (error) { }
|
|
86
|
+
try {
|
|
87
|
+
window.consoleLog = function () {
|
|
88
|
+
console.log(...arguments)
|
|
89
|
+
};
|
|
90
|
+
} catch (error) { }
|
|
91
|
+
console.log = function () {
|
|
92
|
+
replaceConsole("log", arguments)
|
|
93
|
+
};
|
|
94
|
+
let e = console.error;
|
|
95
|
+
function _error() {
|
|
96
|
+
try {
|
|
97
|
+
let args = [...arguments]
|
|
98
|
+
if (
|
|
99
|
+
args[0]
|
|
100
|
+
&& typeof args[0] == "string"
|
|
101
|
+
&& (
|
|
102
|
+
args[0] == "__ignoreReport__" //! 忽略错误日志上报
|
|
103
|
+
|| args[0].indexOf("__ignoreReport__") == 0
|
|
104
|
+
)
|
|
105
|
+
) {
|
|
106
|
+
let _args = []
|
|
107
|
+
if (args.length > 1) {
|
|
108
|
+
for (let i = 0; i < args.length; i++) {
|
|
109
|
+
if (i != 0) {
|
|
110
|
+
_args.push(args[i])
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
} else {
|
|
114
|
+
_args[0] = args[0];
|
|
115
|
+
_args[0] = _args[0].replace("__ignoreReport__", "");
|
|
116
|
+
}
|
|
117
|
+
if (that.options.console.isOutput) {
|
|
118
|
+
e(..._args)
|
|
119
|
+
}
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
replaceConsole("error", args)
|
|
123
|
+
} catch (error) {
|
|
124
|
+
e("监听console.error出错", error)
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
console.error = _error;
|
|
128
|
+
let w = console.warn;
|
|
129
|
+
console.warn = function () {
|
|
130
|
+
replaceConsole("warn", arguments)
|
|
131
|
+
};
|
|
132
|
+
let i = console.info;
|
|
133
|
+
console.info = function () {
|
|
134
|
+
replaceConsole("info", arguments)
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* 替换系统打印函数
|
|
140
|
+
*/
|
|
141
|
+
function replaceConsole(type, args) {
|
|
142
|
+
try {
|
|
143
|
+
let data = []
|
|
144
|
+
if (args && args.length > 0) {
|
|
145
|
+
|
|
146
|
+
let argList = args;
|
|
147
|
+
|
|
148
|
+
// #ifdef APP-PLUS
|
|
149
|
+
if (args.length == 1) {
|
|
150
|
+
argList = args[0].split("---COMMA---");
|
|
151
|
+
|
|
152
|
+
let endItem = argList[argList.length - 1];
|
|
153
|
+
if (
|
|
154
|
+
endItem
|
|
155
|
+
&& typeof endItem == "string"
|
|
156
|
+
&& endItem.indexOf(" at ") > -1
|
|
157
|
+
&& endItem.indexOf(":") > -1
|
|
158
|
+
) { // 可能包含路径信息
|
|
159
|
+
let endList = endItem.split(" at ");
|
|
160
|
+
if (endList.length == 2) {
|
|
161
|
+
argList.pop()
|
|
162
|
+
argList.push(endList[0])
|
|
163
|
+
argList.push("at " + endList[1])
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
argList = argList.map((item, index) => {
|
|
168
|
+
try {
|
|
169
|
+
if (typeof item == "string") {
|
|
170
|
+
if (item.indexOf("---BEGIN") > -1) {
|
|
171
|
+
let isJson = item.indexOf("---BEGIN:JSON---") > -1;
|
|
172
|
+
item = item.replace(/---BEGIN:.*?---/g, '')
|
|
173
|
+
item = item.replace(/---END:.*?---/g, '')
|
|
174
|
+
if (isJson) {
|
|
175
|
+
item = JSON.parse(item);
|
|
176
|
+
}
|
|
177
|
+
} else if (item == "---NULL---") {
|
|
178
|
+
item = null;
|
|
179
|
+
} else if (item == "---UNDEFINED---") {
|
|
180
|
+
item = undefined;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
} catch (error) {
|
|
184
|
+
console.log("replaceConsole 尝试解析对象出错:", error);
|
|
185
|
+
}
|
|
186
|
+
return item;
|
|
187
|
+
})
|
|
188
|
+
}
|
|
189
|
+
// #endif
|
|
190
|
+
|
|
191
|
+
let oneSize = that.options.console.cache.rowSize / argList.length;
|
|
192
|
+
for (let i = 0; i < argList.length; i++) {
|
|
193
|
+
let row = jsonCompress.compressObject(argList[i], oneSize)
|
|
194
|
+
data.push(row)
|
|
195
|
+
}
|
|
196
|
+
} else {
|
|
197
|
+
data = []
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
let page = "未知";
|
|
201
|
+
try {
|
|
202
|
+
let pages = getCurrentPages()
|
|
203
|
+
let item = pages[pages.length - 1];
|
|
204
|
+
if (item && item.route) {
|
|
205
|
+
page = item.route;
|
|
206
|
+
}
|
|
207
|
+
} catch (error) { }
|
|
208
|
+
that.logList.unshift({
|
|
209
|
+
list: data,
|
|
210
|
+
time: new Date().getTime(),
|
|
211
|
+
page,
|
|
212
|
+
type,
|
|
213
|
+
})
|
|
214
|
+
if (that.options.console.isOutput) {
|
|
215
|
+
if (type == "error") {
|
|
216
|
+
e(...args)
|
|
217
|
+
} else if (type == "warn") {
|
|
218
|
+
w(...args)
|
|
219
|
+
} else if (type == "info") {
|
|
220
|
+
i(...args)
|
|
221
|
+
} else {
|
|
222
|
+
l(...args)
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
} catch (error) {
|
|
227
|
+
if (that.options.console.isOutput) {
|
|
228
|
+
e("监听console出错", error)
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
} catch (error) {
|
|
235
|
+
console.log("console.install error", error);
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
/**
|
|
239
|
+
* 挂载监听uni自带的打印函数
|
|
240
|
+
*/
|
|
241
|
+
mountUniConsole() {
|
|
242
|
+
let that = this;
|
|
243
|
+
try {
|
|
244
|
+
|
|
245
|
+
let uniSysConsole = uni.__log__;
|
|
246
|
+
try {
|
|
247
|
+
globalThis.consoleLog = function () {
|
|
248
|
+
uni.__log__("log", "未知来源", ...arguments)
|
|
249
|
+
};
|
|
250
|
+
} catch (error) { }
|
|
251
|
+
try {
|
|
252
|
+
window.consoleLog = function () {
|
|
253
|
+
uni.__log__("log", "未知来源", ...arguments)
|
|
254
|
+
};
|
|
255
|
+
} catch (error) { }
|
|
256
|
+
|
|
257
|
+
uni.__log__ = function (type, line, ...args) {
|
|
258
|
+
try {
|
|
259
|
+
|
|
260
|
+
// 处理特殊情况 "__ignoreReport__" 忽略错误日志上报
|
|
261
|
+
if (type == "error") {
|
|
262
|
+
if (
|
|
263
|
+
args[0]
|
|
264
|
+
&& typeof args[0] == "string"
|
|
265
|
+
&& (
|
|
266
|
+
args[0] == "__ignoreReport__" //! 忽略错误日志上报
|
|
267
|
+
|| args[0].indexOf("__ignoreReport__") == 0
|
|
268
|
+
)
|
|
269
|
+
) {
|
|
270
|
+
let _args = []
|
|
271
|
+
if (args.length > 1) {
|
|
272
|
+
for (let i = 0; i < args.length; i++) {
|
|
273
|
+
if (i != 0) {
|
|
274
|
+
_args.push(args[i])
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
} else {
|
|
278
|
+
_args[0] = args[0];
|
|
279
|
+
_args[0] = _args[0].replace("__ignoreReport__", "");
|
|
280
|
+
}
|
|
281
|
+
if (that.options.console.isOutput) {
|
|
282
|
+
uniSysConsole(type, line, ..._args)
|
|
283
|
+
}
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
let data = []
|
|
289
|
+
if (args && args.length > 0) {
|
|
290
|
+
let argList = args;
|
|
291
|
+
let oneSize = that.options.console.cache.rowSize / argList.length;
|
|
292
|
+
for (let i = 0; i < argList.length; i++) {
|
|
293
|
+
let row = jsonCompress.compressObject(argList[i], oneSize)
|
|
294
|
+
data.push(row)
|
|
295
|
+
}
|
|
296
|
+
} else {
|
|
297
|
+
data = []
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
let page = "未知";
|
|
301
|
+
try {
|
|
302
|
+
let pages = getCurrentPages()
|
|
303
|
+
let item = pages[pages.length - 1];
|
|
304
|
+
if (item && item.route) {
|
|
305
|
+
page = item.route;
|
|
306
|
+
}
|
|
307
|
+
} catch (error) { }
|
|
308
|
+
|
|
309
|
+
data.push(line)
|
|
310
|
+
|
|
311
|
+
that.logList.unshift({
|
|
312
|
+
list: data,
|
|
313
|
+
time: new Date().getTime(),
|
|
314
|
+
page,
|
|
315
|
+
type,
|
|
316
|
+
})
|
|
317
|
+
if (that.options.console.isOutput) {
|
|
318
|
+
uniSysConsole(type, line, ...data)
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
} catch (error) {
|
|
322
|
+
if (that.options.console.isOutput) {
|
|
323
|
+
uniSysConsole("error", "监听console出错", error)
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* 替换系统打印函数
|
|
331
|
+
*/
|
|
332
|
+
function replaceConsole(type, args) {
|
|
333
|
+
try {
|
|
334
|
+
let data = []
|
|
335
|
+
if (args && args.length > 0) {
|
|
336
|
+
|
|
337
|
+
let argList = args;
|
|
338
|
+
|
|
339
|
+
// #ifdef APP-PLUS
|
|
340
|
+
if (args.length == 1) {
|
|
341
|
+
argList = args[0].split("---COMMA---");
|
|
342
|
+
|
|
343
|
+
let endItem = argList[argList.length - 1];
|
|
344
|
+
if (
|
|
345
|
+
endItem
|
|
346
|
+
&& typeof endItem == "string"
|
|
347
|
+
&& endItem.indexOf(" at ") > -1
|
|
348
|
+
&& endItem.indexOf(":") > -1
|
|
349
|
+
) { // 可能包含路径信息
|
|
350
|
+
let endList = endItem.split(" at ");
|
|
351
|
+
if (endList.length == 2) {
|
|
352
|
+
argList.pop()
|
|
353
|
+
argList.push(endList[0])
|
|
354
|
+
argList.push("at " + endList[1])
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
argList = argList.map((item, index) => {
|
|
359
|
+
try {
|
|
360
|
+
if (typeof item == "string") {
|
|
361
|
+
if (item.indexOf("---BEGIN") > -1) {
|
|
362
|
+
let isJson = item.indexOf("---BEGIN:JSON---") > -1;
|
|
363
|
+
item = item.replace(/---BEGIN:.*?---/g, '')
|
|
364
|
+
item = item.replace(/---END:.*?---/g, '')
|
|
365
|
+
if (isJson) {
|
|
366
|
+
item = JSON.parse(item);
|
|
367
|
+
}
|
|
368
|
+
} else if (item == "---NULL---") {
|
|
369
|
+
item = null;
|
|
370
|
+
} else if (item == "---UNDEFINED---") {
|
|
371
|
+
item = undefined;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
} catch (error) {
|
|
375
|
+
console.log("replaceConsole 尝试解析对象出错:", error);
|
|
376
|
+
}
|
|
377
|
+
return item;
|
|
378
|
+
})
|
|
379
|
+
}
|
|
380
|
+
// #endif
|
|
381
|
+
|
|
382
|
+
let oneSize = that.options.console.cache.rowSize / argList.length;
|
|
383
|
+
for (let i = 0; i < argList.length; i++) {
|
|
384
|
+
let row = jsonCompress.compressObject(argList[i], oneSize)
|
|
385
|
+
data.push(row)
|
|
386
|
+
}
|
|
387
|
+
} else {
|
|
388
|
+
data = []
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
let page = "未知";
|
|
392
|
+
try {
|
|
393
|
+
let pages = getCurrentPages()
|
|
394
|
+
let item = pages[pages.length - 1];
|
|
395
|
+
if (item && item.route) {
|
|
396
|
+
page = item.route;
|
|
397
|
+
}
|
|
398
|
+
} catch (error) { }
|
|
399
|
+
that.logList.unshift({
|
|
400
|
+
list: data,
|
|
401
|
+
time: new Date().getTime(),
|
|
402
|
+
page,
|
|
403
|
+
type,
|
|
404
|
+
})
|
|
405
|
+
if (that.options.console.isOutput) {
|
|
406
|
+
if (type == "error") {
|
|
407
|
+
e(...args)
|
|
408
|
+
} else if (type == "warn") {
|
|
409
|
+
w(...args)
|
|
410
|
+
} else if (type == "info") {
|
|
411
|
+
i(...args)
|
|
412
|
+
} else {
|
|
413
|
+
l(...args)
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
} catch (error) {
|
|
418
|
+
if (that.options.console.isOutput) {
|
|
419
|
+
e("监听console出错", error)
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
} catch (error) {
|
|
426
|
+
console.log("console.install error", error);
|
|
427
|
+
}
|
|
428
|
+
},
|
|
429
|
+
|
|
430
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import devCache from "../libs/devCache";
|
|
2
|
+
import console from "./console";
|
|
3
|
+
import request from "./request";
|
|
4
|
+
import storage from "./storage";
|
|
5
|
+
import uniBus from "./uniBus";
|
|
6
|
+
import uniListen from "./uniListen";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* dev调试工具初始化
|
|
10
|
+
*/
|
|
11
|
+
export default function devToolsProxyInstall(options) {
|
|
12
|
+
|
|
13
|
+
try {
|
|
14
|
+
if (options.network && options.network.status) {
|
|
15
|
+
request.install()
|
|
16
|
+
}
|
|
17
|
+
if (options.console && options.console.status) {
|
|
18
|
+
console.install()
|
|
19
|
+
}
|
|
20
|
+
if (options.logs && options.logs.status) {
|
|
21
|
+
uniListen.install()
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
storage.install()
|
|
25
|
+
|
|
26
|
+
if (options.uniBus && options.uniBus.status) {
|
|
27
|
+
uniBus.install()
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
devCache.syncLocalCache();
|
|
31
|
+
|
|
32
|
+
} catch (error) {
|
|
33
|
+
console.log("devToolsProxyInstall error", error);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
}
|