oxy-uni-ui 2.1.1 → 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 +13 -2
- package/components/oxy-checkbox/index.scss +37 -2
- package/components/oxy-sort-button/index.scss +3 -4
- package/components/oxy-tag/index.scss +157 -17
- package/components/oxy-tag/oxy-tag.vue +14 -2
- package/components/oxy-tag/types.ts +9 -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/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,153 @@
|
|
|
1
|
+
import devCache from "../libs/devCache";
|
|
2
|
+
import devOptions from "../libs/devOptions";
|
|
3
|
+
import jsonCompress from "../libs/jsonCompress";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
logList: [],
|
|
8
|
+
busCount: [],
|
|
9
|
+
|
|
10
|
+
options: null,
|
|
11
|
+
/**
|
|
12
|
+
* 挂载打印拦截器
|
|
13
|
+
*/
|
|
14
|
+
install() {
|
|
15
|
+
try {
|
|
16
|
+
let that = this;
|
|
17
|
+
|
|
18
|
+
this.options = devOptions.getOptions()
|
|
19
|
+
if (!this.options.uniBus.status) return;
|
|
20
|
+
|
|
21
|
+
this.logList = devCache.get("uniBus");
|
|
22
|
+
if (!this.logList) this.logList = [];
|
|
23
|
+
|
|
24
|
+
this.busCount = devCache.get("busCount");
|
|
25
|
+
if (!this.busCount) this.busCount = [];
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
this.syncReqData(); //同步缓存
|
|
29
|
+
|
|
30
|
+
let now = () => new Date().getTime();
|
|
31
|
+
|
|
32
|
+
const _on = uni.$on;
|
|
33
|
+
uni.$on = function () {
|
|
34
|
+
try {
|
|
35
|
+
let n = arguments[0];
|
|
36
|
+
if (n && typeof n == "string" && n.length < 200 && n.indexOf("devTools_") == -1) {
|
|
37
|
+
that.logList.unshift({
|
|
38
|
+
t: now(),
|
|
39
|
+
e: jsonCompress.compressObject(`on>${n}`, that.options.uniBus.cache.rowMax)
|
|
40
|
+
})
|
|
41
|
+
addCount(n, "on")
|
|
42
|
+
}
|
|
43
|
+
} catch (error) {
|
|
44
|
+
console.error("uni.$on出错", error);
|
|
45
|
+
}
|
|
46
|
+
_on(...arguments)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const _once = uni.$once;
|
|
50
|
+
uni.$once = function () {
|
|
51
|
+
try {
|
|
52
|
+
let n = arguments[0];
|
|
53
|
+
if (n && typeof n == "string" && n.length < 200 && n.indexOf("devTools_") == -1) {
|
|
54
|
+
that.logList.unshift({
|
|
55
|
+
t: now(),
|
|
56
|
+
e: jsonCompress.compressObject(`once>${n}`, that.options.uniBus.cache.rowMax)
|
|
57
|
+
})
|
|
58
|
+
addCount(n, "once")
|
|
59
|
+
}
|
|
60
|
+
} catch (error) {
|
|
61
|
+
console.error("uni.$once出错", error);
|
|
62
|
+
}
|
|
63
|
+
_once(...arguments)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const _emit = uni.$emit;
|
|
67
|
+
uni.$emit = function () {
|
|
68
|
+
try {
|
|
69
|
+
let n = arguments[0];
|
|
70
|
+
let p = arguments[1];
|
|
71
|
+
if (n && typeof n == "string" && n.length < 200 && n.indexOf("devTools_") == -1) {
|
|
72
|
+
that.logList.unshift({
|
|
73
|
+
t: now(),
|
|
74
|
+
e: jsonCompress.compressObject(`emit>${n}` + (p ? ('>' + JSON.stringify(p)) : ''), that.options.uniBus.cache.rowMax)
|
|
75
|
+
})
|
|
76
|
+
addCount(n, "emit")
|
|
77
|
+
}
|
|
78
|
+
} catch (error) {
|
|
79
|
+
console.error("uni.$emit出错", error);
|
|
80
|
+
}
|
|
81
|
+
_emit(...arguments)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const _off = uni.$off;
|
|
85
|
+
uni.$off = function () {
|
|
86
|
+
try {
|
|
87
|
+
let n = arguments[0];
|
|
88
|
+
if (n && typeof n == "string" && n.length < 200 && n.indexOf("devTools_") == -1) {
|
|
89
|
+
that.logList.unshift({
|
|
90
|
+
t: now(),
|
|
91
|
+
e: jsonCompress.compressObject(`off>${n}` + arguments[0], that.options.uniBus.cache.rowMax)
|
|
92
|
+
})
|
|
93
|
+
addCount(n, "off")
|
|
94
|
+
}
|
|
95
|
+
} catch (error) {
|
|
96
|
+
console.error("uni.$off出错", error);
|
|
97
|
+
}
|
|
98
|
+
_off(...arguments)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* 统计总次数
|
|
103
|
+
*/
|
|
104
|
+
function addCount(name, type = "on") {
|
|
105
|
+
let i = that.busCount.findIndex(x => x.e == name)
|
|
106
|
+
if (i == -1) {
|
|
107
|
+
let item = {
|
|
108
|
+
e: name,
|
|
109
|
+
on: 0,
|
|
110
|
+
off: 0,
|
|
111
|
+
emit: 0,
|
|
112
|
+
once: 0,
|
|
113
|
+
};
|
|
114
|
+
item[type] = item[type] + 1;
|
|
115
|
+
that.busCount.push(item)
|
|
116
|
+
} else {
|
|
117
|
+
that.busCount[i][type] = that.busCount[i][type] + 1;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// ! 清空全部记录
|
|
122
|
+
uni.$on("devTools_delUniBusAll", () => {
|
|
123
|
+
that.logList = []
|
|
124
|
+
that.busCount = []
|
|
125
|
+
devCache.clearItem("uniBus");
|
|
126
|
+
devCache.clearItem("busCount");
|
|
127
|
+
})
|
|
128
|
+
} catch (error) {
|
|
129
|
+
console.log("devTools uniBus.install error", error);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
},
|
|
134
|
+
/**
|
|
135
|
+
* 同步请求信息到缓存数据中
|
|
136
|
+
*/
|
|
137
|
+
syncReqData() {
|
|
138
|
+
let that = this;
|
|
139
|
+
setTimeout(() => {
|
|
140
|
+
try {
|
|
141
|
+
|
|
142
|
+
that.logList = jsonCompress.compressArray(that.logList, "end", that.options.uniBus.cache.rowMax)
|
|
143
|
+
devCache.set("uniBus", that.logList)
|
|
144
|
+
|
|
145
|
+
that.busCount = jsonCompress.compressArray(that.busCount, "end", that.options.uniBus.cache.countMaxSize)
|
|
146
|
+
devCache.set("busCount", that.busCount)
|
|
147
|
+
} catch (error) {
|
|
148
|
+
console.log("devTools uniBus.syncReqData error", error);
|
|
149
|
+
}
|
|
150
|
+
that.syncReqData()
|
|
151
|
+
}, 5000);
|
|
152
|
+
},
|
|
153
|
+
}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import logReport from "../libs/logReport";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
/**
|
|
6
|
+
* 挂载uni大部分api监听器
|
|
7
|
+
*/
|
|
8
|
+
install() {
|
|
9
|
+
try {
|
|
10
|
+
this.addDefUniApiListen()
|
|
11
|
+
this.onNetworkStatusChange()
|
|
12
|
+
this.scanCodeListen()
|
|
13
|
+
this.onLocaleChange()
|
|
14
|
+
} catch (error) {
|
|
15
|
+
console.log("uniListen error", error);
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
/**
|
|
19
|
+
* 批量挂载api调用日志
|
|
20
|
+
*/
|
|
21
|
+
addDefUniApiListen() {
|
|
22
|
+
/**
|
|
23
|
+
* 需要挂载监听的api列表
|
|
24
|
+
*/
|
|
25
|
+
let diyListenApi = {
|
|
26
|
+
downloadFile(args) {
|
|
27
|
+
logReport("downloadFile>" + (args && args.url ? args.url : ''))
|
|
28
|
+
},
|
|
29
|
+
connectSocket(args) {
|
|
30
|
+
logReport("connectSocket>" + args.url)
|
|
31
|
+
},
|
|
32
|
+
makePhoneCall(args) {
|
|
33
|
+
logReport("makePhoneCall>" + args.phoneNumber)
|
|
34
|
+
},
|
|
35
|
+
addPhoneContact(args) {
|
|
36
|
+
logReport("addPhoneContact>" + args.name)
|
|
37
|
+
},
|
|
38
|
+
showToast(args) {
|
|
39
|
+
logReport("showToast>" + args.title)
|
|
40
|
+
},
|
|
41
|
+
showModal(args) {
|
|
42
|
+
logReport("showModal>" + args.title + '>' + args.content)
|
|
43
|
+
},
|
|
44
|
+
setLocale(args) {
|
|
45
|
+
logReport("setLocale>" + args)
|
|
46
|
+
},
|
|
47
|
+
saveFile(args) {
|
|
48
|
+
logReport("saveFile>" + args.tempFilePath)
|
|
49
|
+
},
|
|
50
|
+
login(args) {
|
|
51
|
+
logReport("login>" + JSON.stringify(args))
|
|
52
|
+
},
|
|
53
|
+
share(args) {
|
|
54
|
+
logReport("share>" + JSON.stringify(args))
|
|
55
|
+
},
|
|
56
|
+
shareWithSystem(args) {
|
|
57
|
+
logReport("shareWithSystem>" + JSON.stringify(args))
|
|
58
|
+
},
|
|
59
|
+
requestPayment(args) {
|
|
60
|
+
logReport("requestPayment>" + JSON.stringify(args))
|
|
61
|
+
},
|
|
62
|
+
authorize(args) {
|
|
63
|
+
logReport("requestPayment>" + args.scope)
|
|
64
|
+
},
|
|
65
|
+
navigateToMiniProgram(args) {
|
|
66
|
+
logReport("navigateToMiniProgram>" + args.appId + '>' + args.path)
|
|
67
|
+
},
|
|
68
|
+
openDocument(args) {
|
|
69
|
+
logReport("openDocument>" + args.filePath)
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* 需要监听打印日志的api名称列表
|
|
74
|
+
*/
|
|
75
|
+
let waitListenApiNames = [
|
|
76
|
+
"uploadFile",
|
|
77
|
+
"closeSocket",
|
|
78
|
+
"getLocation",
|
|
79
|
+
"chooseLocation",
|
|
80
|
+
"openLocation",
|
|
81
|
+
"chooseImage",
|
|
82
|
+
"previewImage",
|
|
83
|
+
"saveImageToPhotosAlbum",
|
|
84
|
+
"chooseFile",
|
|
85
|
+
"chooseVideo",
|
|
86
|
+
"chooseMedia",
|
|
87
|
+
"saveVideoToPhotosAlbum",
|
|
88
|
+
"openVideoEditor",
|
|
89
|
+
"openAppAuthorizeSetting",
|
|
90
|
+
"startAccelerometer",
|
|
91
|
+
"startCompass",
|
|
92
|
+
"startGyroscope",
|
|
93
|
+
"setScreenBrightness",
|
|
94
|
+
"vibrate",
|
|
95
|
+
"vibrateLong",
|
|
96
|
+
"vibrateShort",
|
|
97
|
+
"openBluetoothAdapter",
|
|
98
|
+
"startBeaconDiscovery",
|
|
99
|
+
"startSoterAuthentication",
|
|
100
|
+
"hideKeyboard",
|
|
101
|
+
"showActionSheet",
|
|
102
|
+
"startPullDownRefresh",
|
|
103
|
+
"showShareMenu",
|
|
104
|
+
"startFacialRecognitionVerify",
|
|
105
|
+
"openSetting",
|
|
106
|
+
"chooseAddress",
|
|
107
|
+
"chooseInvoiceTitle",
|
|
108
|
+
"openEmbeddedMiniProgram",
|
|
109
|
+
|
|
110
|
+
]
|
|
111
|
+
|
|
112
|
+
for (const key in diyListenApi) {
|
|
113
|
+
uni.addInterceptor(key, {
|
|
114
|
+
invoke(_args) {
|
|
115
|
+
try {
|
|
116
|
+
diyListenApi[key](_args)
|
|
117
|
+
} catch (error) {
|
|
118
|
+
console.error("addInterceptor=>" + key, error);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
})
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
waitListenApiNames.map(key => {
|
|
126
|
+
uni.addInterceptor(key, {
|
|
127
|
+
invoke(args) {
|
|
128
|
+
try {
|
|
129
|
+
logReport(key)
|
|
130
|
+
} catch (error) {
|
|
131
|
+
console.error("addInterceptor>" + key, error);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
})
|
|
135
|
+
})
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
},
|
|
139
|
+
/**
|
|
140
|
+
* 添加网络状态监听
|
|
141
|
+
*/
|
|
142
|
+
onNetworkStatusChange() {
|
|
143
|
+
uni.onNetworkStatusChange((res) => {
|
|
144
|
+
try {
|
|
145
|
+
logReport("onNetworkStatusChange>isConnected:" + (res.isConnected ? 'true' : 'false') + '>networkType:' + res.networkType)
|
|
146
|
+
} catch (error) {
|
|
147
|
+
console.log("onNetworkStatusChange", error);
|
|
148
|
+
}
|
|
149
|
+
})
|
|
150
|
+
},
|
|
151
|
+
/**
|
|
152
|
+
* 添加系统主题切换监听
|
|
153
|
+
*/
|
|
154
|
+
onThemeChange() {
|
|
155
|
+
uni.onThemeChange((res) => {
|
|
156
|
+
try {
|
|
157
|
+
logReport("onThemeChange>" + res.theme)
|
|
158
|
+
} catch (error) {
|
|
159
|
+
console.log("onThemeChange", error);
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
},
|
|
163
|
+
/**
|
|
164
|
+
* 监听扫码结果
|
|
165
|
+
*/
|
|
166
|
+
scanCodeListen() {
|
|
167
|
+
uni.addInterceptor('scanCode', {
|
|
168
|
+
success(res) {
|
|
169
|
+
try {
|
|
170
|
+
logReport("scanCodeSuccess>" + JSON.stringify({
|
|
171
|
+
scanType: res.scanType,
|
|
172
|
+
result: res.result,
|
|
173
|
+
}))
|
|
174
|
+
} catch (error) {
|
|
175
|
+
console.log("scanCode", error);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
})
|
|
179
|
+
},
|
|
180
|
+
/**
|
|
181
|
+
* 监听系统语言切换
|
|
182
|
+
*/
|
|
183
|
+
onLocaleChange() {
|
|
184
|
+
uni.onLocaleChange((locale) => {
|
|
185
|
+
try {
|
|
186
|
+
logReport("onLocaleChange>" + locale)
|
|
187
|
+
} catch (error) {
|
|
188
|
+
console.log("onLocaleChange", error);
|
|
189
|
+
}
|
|
190
|
+
})
|
|
191
|
+
},
|
|
192
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import logReport from "../libs/logReport";
|
|
2
|
+
import pageLinkList from "../libs/pageLinkList";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* ! Vue页面混入,监听生命周期
|
|
8
|
+
*/
|
|
9
|
+
export default {
|
|
10
|
+
data() {
|
|
11
|
+
return {
|
|
12
|
+
/**
|
|
13
|
+
* 挂载dev页面对象
|
|
14
|
+
*/
|
|
15
|
+
devTools_pageData: {
|
|
16
|
+
route: '', // 页面路径
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
/**
|
|
21
|
+
* *页面载入事件
|
|
22
|
+
*/
|
|
23
|
+
onLoad(pageInitParams) {
|
|
24
|
+
let that = this;
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
// ! 注入 Eruda
|
|
28
|
+
let isInjectEruda = uni.getStorageSync("devTools_isInjectEruda") == "yes";
|
|
29
|
+
if (isInjectEruda) {
|
|
30
|
+
let ErudaCode = `
|
|
31
|
+
if(!window.isInjectEruda){
|
|
32
|
+
window.isInjectEruda = true;
|
|
33
|
+
var script = document.createElement('script');
|
|
34
|
+
script.src="https://cdn.jsdelivr.net/npm/eruda";
|
|
35
|
+
document.body.append(script);
|
|
36
|
+
script.onload = function () {
|
|
37
|
+
eruda.init();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
`
|
|
41
|
+
let fun = 'e' + ['v'][0] + 'a' + ['l'][0];
|
|
42
|
+
try {
|
|
43
|
+
// #ifdef H5
|
|
44
|
+
window[fun](ErudaCode);
|
|
45
|
+
// #endif
|
|
46
|
+
// #ifdef APP-PLUS
|
|
47
|
+
let endPageWebView = getCurrentPages().pop();
|
|
48
|
+
if (endPageWebView) {
|
|
49
|
+
let nowPageWebview = endPageWebView.$getAppWebview();
|
|
50
|
+
if (nowPageWebview) {
|
|
51
|
+
nowPageWebview[fun + 'JS'](ErudaCode)
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
// #endif
|
|
55
|
+
} catch (error) {
|
|
56
|
+
console.log("devTools mixin onLoad injectEruda error ", error);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// ! 注入 vConsole
|
|
61
|
+
let isInjectVConsole = uni.getStorageSync("devTools_isInjectVConsole") == "yes";
|
|
62
|
+
if (isInjectVConsole) {
|
|
63
|
+
let vConsoleCode = `
|
|
64
|
+
if(!window.isInjectVConsole){
|
|
65
|
+
window.isInjectVConsole = true;
|
|
66
|
+
var script = document.createElement('script');
|
|
67
|
+
script.src="https://cdn.jsdelivr.net/npm/vconsole@latest/dist/vconsole.min.js";
|
|
68
|
+
document.body.append(script);
|
|
69
|
+
script.onload = function () {
|
|
70
|
+
let vConsoleObj = new window.VConsole();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
`
|
|
74
|
+
let fun = 'e' + ['v'][0] + 'a' + ['l'][0];
|
|
75
|
+
try {
|
|
76
|
+
// #ifdef H5
|
|
77
|
+
window[fun](vConsoleCode);
|
|
78
|
+
// #endif
|
|
79
|
+
// #ifdef APP-PLUS
|
|
80
|
+
let endPageWebView = getCurrentPages().pop();
|
|
81
|
+
if (endPageWebView) {
|
|
82
|
+
let nowPageWebview = endPageWebView.$getAppWebview();
|
|
83
|
+
if (nowPageWebview) {
|
|
84
|
+
nowPageWebview[fun + 'JS'](vConsoleCode)
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
// #endif
|
|
88
|
+
} catch (error) {
|
|
89
|
+
console.log("devTools mixin onLoad injectVConsole error ", error);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
try {
|
|
94
|
+
let pages = getCurrentPages();
|
|
95
|
+
let pageItem = pages && pages.length > 0 ? pages[pages.length - 1] : null;
|
|
96
|
+
if (pageItem) {
|
|
97
|
+
that.devTools_pageData.route = pageItem.route;
|
|
98
|
+
logReport(`onLoad>${pageItem.route}>` + (pageInitParams ? JSON.stringify(pageInitParams) : ''))
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
pageLinkList.pushPageRouteMap(pages)
|
|
102
|
+
|
|
103
|
+
} catch (error) {
|
|
104
|
+
console.log("devTools mixin onLoad error ", error);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
},
|
|
108
|
+
/**
|
|
109
|
+
* * 页面卸载事件
|
|
110
|
+
*/
|
|
111
|
+
onUnload() {
|
|
112
|
+
try {
|
|
113
|
+
let that = this;
|
|
114
|
+
logReport(`onUnload>${that.devTools_pageData.route}`)
|
|
115
|
+
that.devTools_pageData = null;
|
|
116
|
+
} catch (error) {
|
|
117
|
+
console.log("devTools mixin onUnload error ", error);
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
|
|
2
|
+
import drawView from "./core/libs/drawView";
|
|
3
|
+
import logReport from "./core/libs/logReport";
|
|
4
|
+
import errorReport from "./core/libs/errorReport";
|
|
5
|
+
import devOptions from "./core/libs/devOptions";
|
|
6
|
+
import createH5Bubble from "./core/libs/createH5Bubble";
|
|
7
|
+
import vueMixin from "./core/proxy/vueMixin";
|
|
8
|
+
import devToolsProxyInstall from "./core/proxy/index";
|
|
9
|
+
import pageLinkList from "./core/libs/pageLinkList";
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @type {Vue}
|
|
14
|
+
*/
|
|
15
|
+
let that;
|
|
16
|
+
let isVisible = false;
|
|
17
|
+
|
|
18
|
+
const devTools = {
|
|
19
|
+
options: null,
|
|
20
|
+
/**
|
|
21
|
+
* 挂载安装APP页面
|
|
22
|
+
*/
|
|
23
|
+
install(vm, options) {
|
|
24
|
+
try {
|
|
25
|
+
that = vm;
|
|
26
|
+
let _this = this;
|
|
27
|
+
|
|
28
|
+
if (vm && vm.config && vm.config.globalProperties) {
|
|
29
|
+
vm.config.globalProperties.$logReport = logReport;
|
|
30
|
+
} else {
|
|
31
|
+
vm.prototype.$logReport = logReport;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
//! 初始化配置项
|
|
35
|
+
devOptions.setOptions(options)
|
|
36
|
+
options = devOptions.getOptions()
|
|
37
|
+
_this.options = options;
|
|
38
|
+
|
|
39
|
+
if (!options || !options.status) {
|
|
40
|
+
return console.log("%c devTools 调试工具未运行!", 'padding: 4px;background-color: red;color: #fff;font-size: 15px;');
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
//! 挂载dev工具
|
|
44
|
+
if (vm && vm.config && vm.config.globalProperties) {
|
|
45
|
+
vm.config.globalProperties.$devTools = devTools;
|
|
46
|
+
} else {
|
|
47
|
+
vm.prototype.$devTools = devTools;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (options.error.status) {
|
|
51
|
+
|
|
52
|
+
//! 挂载vue报错
|
|
53
|
+
vm.config.errorHandler = (err, vm, trace) => {
|
|
54
|
+
errorReport(err, trace, "ve")
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
//! 挂载vue警告
|
|
58
|
+
vm.config.warnHandler = (err, vm, trace) => {
|
|
59
|
+
errorReport(err, trace, "vw")
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
//!混入生命周期监听器
|
|
65
|
+
vm.mixin(vueMixin)
|
|
66
|
+
|
|
67
|
+
//!绘制环境变量小标签
|
|
68
|
+
// #ifdef APP-PLUS
|
|
69
|
+
drawView(options, devTools)
|
|
70
|
+
// #endif
|
|
71
|
+
// #ifdef H5
|
|
72
|
+
createH5Bubble(options, devTools)
|
|
73
|
+
// #endif
|
|
74
|
+
|
|
75
|
+
//!调试工具全局拦截器挂载
|
|
76
|
+
devToolsProxyInstall(options)
|
|
77
|
+
|
|
78
|
+
//! 注册dev弹窗打开事件
|
|
79
|
+
uni.$on("devTools_showDialog", () => {
|
|
80
|
+
_this.show()
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
//! 注册dev弹窗关闭事件
|
|
84
|
+
uni.$on("devTools_closeDialog", (options) => {
|
|
85
|
+
_this.hide(options)
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
//! 挂载uni对象
|
|
89
|
+
uni.$dev = {
|
|
90
|
+
show() {
|
|
91
|
+
_this.show()
|
|
92
|
+
},
|
|
93
|
+
hide() {
|
|
94
|
+
_this.hide()
|
|
95
|
+
},
|
|
96
|
+
errorReport,
|
|
97
|
+
logReport,
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
//! 注册jsRunner执行事件
|
|
101
|
+
uni.$on("devTools_jsRunner", (code) => {
|
|
102
|
+
let result = undefined;
|
|
103
|
+
try {
|
|
104
|
+
let fun = (("ev" + "__混淆__" + "al").replace("__混淆__", ""));
|
|
105
|
+
result = globalThis[fun](code);
|
|
106
|
+
// result = eval(code);
|
|
107
|
+
} catch (error) {
|
|
108
|
+
if (error && error.message) {
|
|
109
|
+
result = error.message;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
uni.$emit("devTools_jsRunnerCallback", result)
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
// ! 页面路由列表
|
|
117
|
+
pageLinkList.install()
|
|
118
|
+
|
|
119
|
+
uni.$on("devTools_overlay_hidden", () => {
|
|
120
|
+
isVisible = false
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
} catch (error) {
|
|
124
|
+
console.log("devTools install error", error);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
},
|
|
128
|
+
/**
|
|
129
|
+
* 打开调试弹窗
|
|
130
|
+
*/
|
|
131
|
+
show() {
|
|
132
|
+
if (isVisible) {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
isVisible = true
|
|
136
|
+
uni.$emit("devTools_overlay_show")
|
|
137
|
+
return true
|
|
138
|
+
},
|
|
139
|
+
/**
|
|
140
|
+
* 隐藏调试弹窗
|
|
141
|
+
*/
|
|
142
|
+
hide(options) {
|
|
143
|
+
if (!isVisible) {
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
isVisible = false
|
|
147
|
+
uni.$emit("devTools_overlay_hide")
|
|
148
|
+
|
|
149
|
+
if (options && options.navigateToUrl) {
|
|
150
|
+
let t = 600;
|
|
151
|
+
// #ifndef APP-PLUS
|
|
152
|
+
t = 200;
|
|
153
|
+
// #endif
|
|
154
|
+
setTimeout(() => {
|
|
155
|
+
uni.navigateTo({
|
|
156
|
+
url: options.navigateToUrl,
|
|
157
|
+
})
|
|
158
|
+
}, t);
|
|
159
|
+
}
|
|
160
|
+
return true
|
|
161
|
+
|
|
162
|
+
},
|
|
163
|
+
errorReport,
|
|
164
|
+
logReport,
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
export default devTools;
|