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