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.
Files changed (183) hide show
  1. package/attributes.json +1 -1
  2. package/components/common/abstracts/variable.scss +13 -2
  3. package/components/oxy-checkbox/index.scss +37 -2
  4. package/components/oxy-sort-button/index.scss +3 -4
  5. package/components/oxy-tag/index.scss +157 -17
  6. package/components/oxy-tag/oxy-tag.vue +14 -2
  7. package/components/oxy-tag/types.ts +9 -0
  8. package/dev-tools.ts +2 -0
  9. package/devTools/components/DevToolsOverlay.vue +56 -0
  10. package/devTools/components/DevToolsUiHost.vue +589 -0
  11. package/devTools/config.js +55 -0
  12. package/devTools/core/components/mpDevBubble.vue +174 -0
  13. package/devTools/core/libs/createH5Bubble.js +156 -0
  14. package/devTools/core/libs/devCache.js +151 -0
  15. package/devTools/core/libs/devOptions.js +163 -0
  16. package/devTools/core/libs/devUi.js +219 -0
  17. package/devTools/core/libs/drawView.js +140 -0
  18. package/devTools/core/libs/errorReport.js +64 -0
  19. package/devTools/core/libs/jsonCompress.js +334 -0
  20. package/devTools/core/libs/logReport.js +59 -0
  21. package/devTools/core/libs/pageLinkList.js +125 -0
  22. package/devTools/core/libs/timeFormat.js +94 -0
  23. package/devTools/core/proxy/console.js +430 -0
  24. package/devTools/core/proxy/index.js +36 -0
  25. package/devTools/core/proxy/request.js +495 -0
  26. package/devTools/core/proxy/storage.js +113 -0
  27. package/devTools/core/proxy/uniBus.js +153 -0
  28. package/devTools/core/proxy/uniListen.js +192 -0
  29. package/devTools/core/proxy/vueMixin.js +120 -0
  30. package/devTools/index.js +168 -0
  31. package/devTools/page/components/bottomTools.vue +1046 -0
  32. package/devTools/page/components/dialog/addStorage.vue +204 -0
  33. package/devTools/page/components/dialog/createDir.vue +366 -0
  34. package/devTools/page/components/dialog/editDialog.vue +192 -0
  35. package/devTools/page/components/dialog/routeDialog.vue +184 -0
  36. package/devTools/page/components/dialog/sendRequest.vue +603 -0
  37. package/devTools/page/components/dialog/textFileEditDialog.vue +391 -0
  38. package/devTools/page/components/libs/appDelDir.js +86 -0
  39. package/devTools/page/components/libs/dirReader.js +248 -0
  40. package/devTools/page/components/libs/fileSize.js +15 -0
  41. package/devTools/page/components/libs/getRuntimeInfo.js +134 -0
  42. package/devTools/page/components/listItem/consoleItem.vue +314 -0
  43. package/devTools/page/components/listItem/errorItem.vue +292 -0
  44. package/devTools/page/components/listItem/fileSysItem.vue +533 -0
  45. package/devTools/page/components/listItem/infoList.vue +100 -0
  46. package/devTools/page/components/listItem/jsRunnerItem.vue +255 -0
  47. package/devTools/page/components/listItem/logItem.vue +193 -0
  48. package/devTools/page/components/listItem/networkItem.vue +398 -0
  49. package/devTools/page/components/listItem/objectAnalysis.vue +651 -0
  50. package/devTools/page/components/listItem/pages.vue +319 -0
  51. package/devTools/page/components/listItem/routeItem.vue +153 -0
  52. package/devTools/page/components/listItem/setting.vue +734 -0
  53. package/devTools/page/components/listItem/storageList.vue +681 -0
  54. package/devTools/page/components/listItem/tools.vue +315 -0
  55. package/devTools/page/components/listItem/vuexList.vue +599 -0
  56. package/devTools/page/components/main.vue +1867 -0
  57. package/devTools/page/components/mixins/animationControl.js +91 -0
  58. package/devTools/page/components/mixins/mp.js +83 -0
  59. package/devTools/page/components/ui/btnTabs.vue +90 -0
  60. package/devTools/page/components/ui/codeHisPicker.vue +172 -0
  61. package/devTools/page/components/ui/h5Cell.vue +13 -0
  62. package/devTools/page/components/ui/menuBtn.vue +94 -0
  63. package/devTools/page/components/ui/mobileSwiperScroll.vue +74 -0
  64. package/devTools/page/components/ui/requestSpeedLimit.vue +52 -0
  65. package/devTools/page/components/ui/requestTimeoutMock.vue +55 -0
  66. package/devTools/page/components/ui/subTitleBar.vue +101 -0
  67. package/devTools/page/static/copy.png +0 -0
  68. package/devTools/page/static/delete.png +0 -0
  69. package/devTools/page/static/fileSys/AI.png +0 -0
  70. package/devTools/page/static/fileSys/DWG.png +0 -0
  71. package/devTools/page/static/fileSys/EXE.png +0 -0
  72. package/devTools/page/static/fileSys/GIF.png +0 -0
  73. package/devTools/page/static/fileSys/HTML.png +0 -0
  74. package/devTools/page/static/fileSys/PSD.png +0 -0
  75. package/devTools/page/static/fileSys/RVT.png +0 -0
  76. package/devTools/page/static/fileSys/SKP.png +0 -0
  77. package/devTools/page/static/fileSys/SVG.png +0 -0
  78. package/devTools/page/static/fileSys/excel.png +0 -0
  79. package/devTools/page/static/fileSys/pdf.png +0 -0
  80. package/devTools/page/static/fileSys/pptl.png +0 -0
  81. package/devTools/page/static/fileSys/shipin.png +0 -0
  82. package/devTools/page/static/fileSys/tupian.png +0 -0
  83. package/devTools/page/static/fileSys/txt.png +0 -0
  84. package/devTools/page/static/fileSys/weizhiwenjian.png +0 -0
  85. package/devTools/page/static/fileSys/wenjianjia.png +0 -0
  86. package/devTools/page/static/fileSys/word.png +0 -0
  87. package/devTools/page/static/fileSys/yasuo.png +0 -0
  88. package/devTools/page/static/fileSys/yinpin.png +0 -0
  89. package/devTools/page/static/fold.png +0 -0
  90. package/devTools/page/static/menu.png +0 -0
  91. package/devTools/page/static/refresh.png +0 -0
  92. package/devTools/page/static/unfold.png +0 -0
  93. package/devTools/tools.vue +25 -0
  94. package/devTools/type/devTools.d.ts +406 -0
  95. package/oxy-dev-tools/components/DevToolsUiHost.vue +555 -0
  96. package/oxy-dev-tools/config.js +61 -0
  97. package/oxy-dev-tools/core/components/mpDevBubble.vue +176 -0
  98. package/oxy-dev-tools/core/libs/createH5Bubble.js +156 -0
  99. package/oxy-dev-tools/core/libs/devCache.js +149 -0
  100. package/oxy-dev-tools/core/libs/devOptions.js +160 -0
  101. package/oxy-dev-tools/core/libs/devUi.js +219 -0
  102. package/oxy-dev-tools/core/libs/drawView.js +144 -0
  103. package/oxy-dev-tools/core/libs/errorReport.js +60 -0
  104. package/oxy-dev-tools/core/libs/jsonCompress.js +328 -0
  105. package/oxy-dev-tools/core/libs/logReport.js +55 -0
  106. package/oxy-dev-tools/core/libs/pageLinkList.js +121 -0
  107. package/oxy-dev-tools/core/libs/timeFormat.js +93 -0
  108. package/oxy-dev-tools/core/proxy/console.js +398 -0
  109. package/oxy-dev-tools/core/proxy/index.js +33 -0
  110. package/oxy-dev-tools/core/proxy/request.js +473 -0
  111. package/oxy-dev-tools/core/proxy/storage.js +96 -0
  112. package/oxy-dev-tools/core/proxy/uniBus.js +148 -0
  113. package/oxy-dev-tools/core/proxy/uniListen.js +190 -0
  114. package/oxy-dev-tools/core/proxy/vueMixin.js +115 -0
  115. package/oxy-dev-tools/index.ts +183 -0
  116. package/oxy-dev-tools/oxy-dev-tools.vue +62 -0
  117. package/oxy-dev-tools/page/components/bottomTools.vue +933 -0
  118. package/oxy-dev-tools/page/components/dialog/addStorage.vue +184 -0
  119. package/oxy-dev-tools/page/components/dialog/createDir.vue +352 -0
  120. package/oxy-dev-tools/page/components/dialog/editDialog.vue +178 -0
  121. package/oxy-dev-tools/page/components/dialog/routeDialog.vue +170 -0
  122. package/oxy-dev-tools/page/components/dialog/sendRequest.vue +530 -0
  123. package/oxy-dev-tools/page/components/dialog/textFileEditDialog.vue +379 -0
  124. package/oxy-dev-tools/page/components/libs/appDelDir.js +77 -0
  125. package/oxy-dev-tools/page/components/libs/dirReader.js +239 -0
  126. package/oxy-dev-tools/page/components/libs/fileSize.js +15 -0
  127. package/oxy-dev-tools/page/components/libs/getRuntimeInfo.js +132 -0
  128. package/oxy-dev-tools/page/components/listItem/consoleItem.vue +292 -0
  129. package/oxy-dev-tools/page/components/listItem/errorItem.vue +268 -0
  130. package/oxy-dev-tools/page/components/listItem/fileSysItem.vue +511 -0
  131. package/oxy-dev-tools/page/components/listItem/infoList.vue +89 -0
  132. package/oxy-dev-tools/page/components/listItem/jsRunnerItem.vue +236 -0
  133. package/oxy-dev-tools/page/components/listItem/logItem.vue +185 -0
  134. package/oxy-dev-tools/page/components/listItem/networkItem.vue +362 -0
  135. package/oxy-dev-tools/page/components/listItem/objectAnalysis.vue +642 -0
  136. package/oxy-dev-tools/page/components/listItem/pages.vue +285 -0
  137. package/oxy-dev-tools/page/components/listItem/routeItem.vue +140 -0
  138. package/oxy-dev-tools/page/components/listItem/setting.vue +687 -0
  139. package/oxy-dev-tools/page/components/listItem/storageList.vue +623 -0
  140. package/oxy-dev-tools/page/components/listItem/tools.vue +273 -0
  141. package/oxy-dev-tools/page/components/listItem/vuexList.vue +559 -0
  142. package/oxy-dev-tools/page/components/main.vue +1824 -0
  143. package/oxy-dev-tools/page/components/mixins/animationControl.js +80 -0
  144. package/oxy-dev-tools/page/components/mixins/mp.js +76 -0
  145. package/oxy-dev-tools/page/components/ui/btnTabs.vue +77 -0
  146. package/oxy-dev-tools/page/components/ui/codeHisPicker.vue +161 -0
  147. package/oxy-dev-tools/page/components/ui/h5Cell.vue +13 -0
  148. package/oxy-dev-tools/page/components/ui/menuBtn.vue +87 -0
  149. package/oxy-dev-tools/page/components/ui/mobileSwiperScroll.vue +71 -0
  150. package/oxy-dev-tools/page/components/ui/requestSpeedLimit.vue +47 -0
  151. package/oxy-dev-tools/page/components/ui/requestTimeoutMock.vue +50 -0
  152. package/oxy-dev-tools/page/components/ui/subTitleBar.vue +87 -0
  153. package/oxy-dev-tools/page/static/copy.png +0 -0
  154. package/oxy-dev-tools/page/static/delete.png +0 -0
  155. package/oxy-dev-tools/page/static/fileSys/AI.png +0 -0
  156. package/oxy-dev-tools/page/static/fileSys/DWG.png +0 -0
  157. package/oxy-dev-tools/page/static/fileSys/EXE.png +0 -0
  158. package/oxy-dev-tools/page/static/fileSys/GIF.png +0 -0
  159. package/oxy-dev-tools/page/static/fileSys/HTML.png +0 -0
  160. package/oxy-dev-tools/page/static/fileSys/PSD.png +0 -0
  161. package/oxy-dev-tools/page/static/fileSys/RVT.png +0 -0
  162. package/oxy-dev-tools/page/static/fileSys/SKP.png +0 -0
  163. package/oxy-dev-tools/page/static/fileSys/SVG.png +0 -0
  164. package/oxy-dev-tools/page/static/fileSys/excel.png +0 -0
  165. package/oxy-dev-tools/page/static/fileSys/pdf.png +0 -0
  166. package/oxy-dev-tools/page/static/fileSys/pptl.png +0 -0
  167. package/oxy-dev-tools/page/static/fileSys/shipin.png +0 -0
  168. package/oxy-dev-tools/page/static/fileSys/tupian.png +0 -0
  169. package/oxy-dev-tools/page/static/fileSys/txt.png +0 -0
  170. package/oxy-dev-tools/page/static/fileSys/weizhiwenjian.png +0 -0
  171. package/oxy-dev-tools/page/static/fileSys/wenjianjia.png +0 -0
  172. package/oxy-dev-tools/page/static/fileSys/word.png +0 -0
  173. package/oxy-dev-tools/page/static/fileSys/yasuo.png +0 -0
  174. package/oxy-dev-tools/page/static/fileSys/yinpin.png +0 -0
  175. package/oxy-dev-tools/page/static/fold.png +0 -0
  176. package/oxy-dev-tools/page/static/menu.png +0 -0
  177. package/oxy-dev-tools/page/static/refresh.png +0 -0
  178. package/oxy-dev-tools/page/static/unfold.png +0 -0
  179. package/oxy-dev-tools/tools.vue +22 -0
  180. package/oxy-dev-tools/type/devTools.d.ts +406 -0
  181. package/package.json +1 -1
  182. package/tags.json +1 -1
  183. package/web-types.json +1 -1
@@ -0,0 +1,1046 @@
1
+ <template>
2
+ <view
3
+ v-if="isShow"
4
+ class="bottomTools"
5
+ :style="{
6
+ 'padding-bottom': pb,
7
+ }"
8
+ >
9
+ <!-- Error -->
10
+ <template v-if="tabTitle == 'Error'">
11
+ <view
12
+ class="miniBtn mr warn"
13
+ @click="emptyLogs('error')"
14
+ >
15
+ <text class="miniBtnText">清空 x</text>
16
+ </view>
17
+ <btnTabs
18
+ :list="errorTypeList"
19
+ :value="errorTypeIndex"
20
+ @indexChange="errorTypeIndexChange"
21
+ />
22
+ </template>
23
+
24
+ <!-- Console -->
25
+ <template v-if="tabTitle == 'Console'">
26
+ <view
27
+ class="miniBtn mr warn"
28
+ @click="emptyLogs('console')"
29
+ >
30
+ <text class="miniBtnText">清空 x</text>
31
+ </view>
32
+ <btnTabs
33
+ :list="consoleTypeList"
34
+ :value="consoleTypeListIndex"
35
+ @indexChange="consoleTypeIndexChange"
36
+ />
37
+ </template>
38
+
39
+ <!-- Network -->
40
+ <template v-if="tabTitle == 'Network'">
41
+ <view
42
+ class="miniBtn mr warn"
43
+ @click="emptyLogs('network')"
44
+ >
45
+ <text class="miniBtnText">清空 x</text>
46
+ </view>
47
+ <MenuBtn
48
+ :list="networkFilterType"
49
+ :value="networkTypeListIndex"
50
+ @indexChange="networkTypeIndexChange"
51
+ title="筛选:"
52
+ />
53
+ <view class="mr"></view>
54
+ <RequestSpeedLimit />
55
+ <view class="mr"></view>
56
+ <RequestTimeoutMock />
57
+ </template>
58
+
59
+ <!-- Pages -->
60
+ <template v-if="tabTitle == 'Pages'">
61
+ <view
62
+ class="miniBtn mr primary"
63
+ @click="goPage"
64
+ >
65
+ <text class="miniBtnText">跳转页面</text>
66
+ </view>
67
+ </template>
68
+
69
+ <!-- Logs -->
70
+ <template v-if="tabTitle == 'Logs'">
71
+ <view
72
+ class="miniBtn mr warn"
73
+ @click="emptyLogs('logs')"
74
+ >
75
+ <text class="miniBtnText">清空 x</text>
76
+ </view>
77
+ </template>
78
+
79
+ <!-- Storage -->
80
+ <template v-if="tabTitle == 'Storage'">
81
+ <view
82
+ class="miniBtn mr warn"
83
+ @click="emptyLogs('storage')"
84
+ >
85
+ <text class="miniBtnText">清空 x</text>
86
+ </view>
87
+ <!-- #ifdef H5 -->
88
+ <btnTabs
89
+ :list="storageFilterTypeList"
90
+ :value="storageTypeListIndex"
91
+ @indexChange="storageTypeIndexChange"
92
+ />
93
+ <!-- #endif -->
94
+ <view
95
+ class="miniBtn primary ml"
96
+ @click="addStorage"
97
+ >
98
+ <text class="miniBtnText">新增数据+</text>
99
+ </view>
100
+ </template>
101
+
102
+ <!-- UniBus -->
103
+ <template v-if="tabTitle == 'UniBus'">
104
+ <view
105
+ class="miniBtn mr warn"
106
+ @click="emptyLogs('UniBus')"
107
+ >
108
+ <text class="miniBtnText">清空 x</text>
109
+ </view>
110
+ <btnTabs
111
+ :list="busFilterType"
112
+ :value="busTypeListIndex"
113
+ @indexChange="busTypeIndexChange"
114
+ />
115
+ </template>
116
+
117
+ <!-- FileSys -->
118
+ <template v-if="tabTitle == 'FileSys'">
119
+ <!-- #ifdef APP-PLUS || MP-WEIXIN -->
120
+ <view class="fileSysTopRow">
121
+ <scroll-view
122
+ scroll-x
123
+ class="dirList"
124
+ >
125
+ <view class="dirScrollItem">
126
+ <text
127
+ class="dirName"
128
+ style="color: #999"
129
+ @click="$emit('goChildDir', '_goIndex_0')"
130
+ >
131
+ {{ options.fileSysDirType }}
132
+ </text>
133
+ <text class="delimiter">/</text>
134
+ <view
135
+ v-for="(item, index) in options.fileSysDirList"
136
+ :key="index"
137
+ class="dirItem"
138
+ >
139
+ <text
140
+ v-if="index != 0"
141
+ class="delimiter"
142
+ >
143
+ /
144
+ </text>
145
+ <text
146
+ class="dirName"
147
+ @click="$emit('goChildDir', '_goIndex_' + (index + 1))"
148
+ >
149
+ {{ item }}
150
+ </text>
151
+ </view>
152
+ </view>
153
+ </scroll-view>
154
+ <view
155
+ class="miniBtn ml warn fileSysClearBtn"
156
+ @click="emptyFolder"
157
+ >
158
+ <text class="miniBtnText">清空 x</text>
159
+ </view>
160
+ </view>
161
+ <view class="fileSysBottomRow">
162
+ <!-- #ifdef APP-PLUS -->
163
+ <btnTabs
164
+ :list="dirTypeList"
165
+ :value="fileTypeListIndex"
166
+ @indexChange="$emit('changeFileDirType', dirTypeList[$event].type)"
167
+ />
168
+ <view style="width: 20rpx"></view>
169
+ <!-- #endif -->
170
+ <view
171
+ class="miniBtn primary"
172
+ @click="createDir"
173
+ >
174
+ <text class="miniBtnText">新建文件(夹)</text>
175
+ </view>
176
+ </view>
177
+ <!-- #endif -->
178
+ </template>
179
+
180
+ <!-- JsRunner -->
181
+ <template v-if="tabTitle == 'JsRunner'">
182
+ <view class="jsRunnerTools">
183
+ <view class="runOptions">
184
+ <view class="radiusList">
185
+ <text class="runType">运行环境:</text>
186
+ <radio-group
187
+ @change="jsRunType = $event.detail.value"
188
+ class="radiusList"
189
+ style="display: flex; flex-direction: row"
190
+ >
191
+ <view
192
+ v-for="(item, index) in jsRunTypeList"
193
+ :key="index"
194
+ class="radiusItem"
195
+ @click="jsRunType = item"
196
+ >
197
+ <radio
198
+ class="radiusRadio"
199
+ :value="item"
200
+ :checked="jsRunType == item"
201
+ color="#3b82f6"
202
+ />
203
+ <text
204
+ class="radiusText"
205
+ :style="{
206
+ color: jsRunType == item ? '#3b82f6' : '#333',
207
+ }"
208
+ >
209
+ {{ item }}
210
+ </text>
211
+ </view>
212
+ </radio-group>
213
+ </view>
214
+ <view
215
+ class="hisEmpty"
216
+ @click="$emit('emptyCodeHis')"
217
+ v-if="options.codeHisLength > 0"
218
+ >
219
+ <image
220
+ class="hisEmptyIcon"
221
+ src="@/devTools/page/static/delete.png"
222
+ />
223
+ <text class="hisEmptyText">清空记录</text>
224
+ </view>
225
+ <view
226
+ class="logList"
227
+ @click="showHisCode"
228
+ >
229
+ <text class="hisText">历史代码</text>
230
+ <image
231
+ class="unfold"
232
+ src="@/devTools/page/static/unfold.png"
233
+ />
234
+ </view>
235
+ </view>
236
+ <view class="code">
237
+ <textarea
238
+ v-model="waitSendCode"
239
+ class="codeInput"
240
+ placeholder="js code ..."
241
+ maxlength="-1"
242
+ />
243
+ <view
244
+ class="codeSend"
245
+ @click="runJs"
246
+ >
247
+ <text class="codeSendText">run</text>
248
+ </view>
249
+ </view>
250
+ </view>
251
+ </template>
252
+
253
+ <!-- Vuex -->
254
+ <template v-if="tabTitle == 'Vuex'">
255
+ <btnTabs
256
+ :list="stateTypeList"
257
+ :value="stateTypeListIndex"
258
+ @indexChange="stateTypeIndexChange"
259
+ />
260
+ </template>
261
+
262
+ <codeHisPicker ref="codeHisPicker" />
263
+ </view>
264
+ </template>
265
+ <script>
266
+ import devCache from "../../core/libs/devCache";
267
+ import appDelDir from "./libs/appDelDir";
268
+ import btnTabs from "./ui/btnTabs.vue";
269
+ import codeHisPicker from "./ui/codeHisPicker.vue";
270
+ import MenuBtn from "./ui/menuBtn.vue";
271
+ import RequestSpeedLimit from "./ui/requestSpeedLimit.vue";
272
+ import RequestTimeoutMock from "./ui/requestTimeoutMock.vue";
273
+ import devUi from "../../core/libs/devUi.js";
274
+ export default {
275
+ components: {
276
+ btnTabs,
277
+ codeHisPicker,
278
+ MenuBtn,
279
+ RequestSpeedLimit,
280
+ RequestTimeoutMock,
281
+ },
282
+ props: {
283
+ /**
284
+ * 列表索引
285
+ */
286
+ tabIndex: {
287
+ type: Number,
288
+ default: 0,
289
+ },
290
+ /**
291
+ * 当前标题
292
+ */
293
+ tabTitle: {
294
+ type: String,
295
+ default: "",
296
+ },
297
+ /**
298
+ * 配置项
299
+ */
300
+ options: {
301
+ type: Object,
302
+ default: () => ({
303
+ errorFilterType: "",
304
+ consoleFilterType: "",
305
+ networkFilterType: "",
306
+ busFilterType: "",
307
+ fileSysDirList: [],
308
+ fileSysDirType: "",
309
+ storageType: "",
310
+ }),
311
+ },
312
+ /**
313
+ * 是否渲染
314
+ */
315
+ isShow: {
316
+ type: Boolean,
317
+ default: false,
318
+ },
319
+ /**
320
+ * Vuex变量类型
321
+ */
322
+ stateType: {
323
+ type: String,
324
+ default: "vuex",
325
+ },
326
+ },
327
+ data() {
328
+ const sys = uni.getSystemInfoSync();
329
+ const safeAreaBottom = (sys.safeArea && sys.safeArea.bottom) || sys.windowHeight;
330
+ const safeBottomPx = Math.max((sys.windowHeight || 0) - safeAreaBottom, 0);
331
+ // 底部工具栏高度至少覆盖系统安全区,避免被手势横线遮挡。
332
+ let pb = `${Math.max(safeBottomPx, 8)}px`;
333
+ let jsRunTypeList = [];
334
+ // #ifdef H5
335
+ jsRunTypeList = ["h5"];
336
+ // #endif
337
+ // #ifdef APP-PLUS
338
+ jsRunTypeList = ["webview"];
339
+ // #endif
340
+ return {
341
+ /**
342
+ * 底部边距
343
+ */
344
+ pb,
345
+ /**
346
+ * 错误类型列表
347
+ */
348
+ errorTypeList: [
349
+ { title: "全部", type: "" },
350
+ { title: "error", type: "ve" },
351
+ { title: "warn", type: "vw" },
352
+ { title: "jsError", type: "oe" },
353
+ { title: "unknown", type: "n" },
354
+ ],
355
+ /**
356
+ * console过滤类型
357
+ */
358
+ consoleTypeList: [
359
+ { title: "全部", type: "" },
360
+ { title: "log", type: "log" },
361
+ { title: "info", type: "info" },
362
+ { title: "warn", type: "warn" },
363
+ { title: "error", type: "error" },
364
+ ],
365
+ /**
366
+ * 请求过滤类型
367
+ */
368
+ networkFilterType: [
369
+ { title: "全部请求", type: "", msg: "不使用筛选" },
370
+ { title: "请求失败", type: "请求失败", msg: "仅展示请求失败的记录" },
371
+ { title: "1s+", type: "1s+", msg: "仅展示响应超过1秒的记录" },
372
+ { title: "5s+", type: "5s+", msg: "仅展示响应超过5秒的记录" },
373
+ { title: "10s+", type: "10s+", msg: "仅展示响应超过10秒的记录" },
374
+ { title: "500KB+", type: "500KB+", msg: "仅展示响应内容超过500KB的记录" },
375
+ { title: "1MB+", type: "1MB+", msg: "仅展示响应内容超过1MB的记录" },
376
+ { title: "get", type: "get", msg: "仅展示get请求" },
377
+ { title: "post", type: "post", msg: "仅展示post请求" },
378
+ { title: "other", type: "other", msg: "除了get和post的其他请求" },
379
+ ],
380
+ /**
381
+ * uni bus 过滤类型
382
+ */
383
+ busFilterType: [
384
+ { title: "全部", type: "" },
385
+ { title: "on", type: "on" },
386
+ { title: "once", type: "once" },
387
+ { title: "emit", type: "emit" },
388
+ { title: "off", type: "off" },
389
+ ],
390
+ /**
391
+ * 文件类型
392
+ */
393
+ dirTypeList: [
394
+ { title: "_doc", type: "PRIVATE_DOC" },
395
+ { title: "_www", type: "PRIVATE_WWW" },
396
+ { title: "公共文档", type: "PUBLIC_DOCUMENTS" },
397
+ { title: "公共下载", type: "PUBLIC_DOWNLOADS" },
398
+ ],
399
+ /**
400
+ * 缓存类型
401
+ */
402
+ storageFilterTypeList: [
403
+ { title: "localStorage", type: "localStorage" },
404
+ { title: "sessionStorage", type: "sessionStorage" },
405
+ { title: "cookie", type: "cookie" },
406
+ ],
407
+ /**
408
+ * 等待执行的js代码
409
+ */
410
+ waitSendCode: "",
411
+ /**
412
+ * js运行类型
413
+ */
414
+ jsRunType: jsRunTypeList[0],
415
+ jsRunTypeList,
416
+ /**
417
+ * Vuex变量类型
418
+ */
419
+ stateTypeList: [
420
+ { title: "vuex", type: "vuex" },
421
+ { title: "pinia", type: "pinia" },
422
+ { title: "globalData", type: "globalData" },
423
+ ],
424
+ };
425
+ },
426
+ computed: {
427
+ /**
428
+ * 错误筛选分类index
429
+ */
430
+ errorTypeIndex() {
431
+ return this.errorTypeList.findIndex((x) => x.type == this.options.errorFilterType);
432
+ },
433
+ /**
434
+ * 日志分类索引
435
+ */
436
+ consoleTypeListIndex() {
437
+ return this.consoleTypeList.findIndex((x) => x.type == this.options.consoleFilterType);
438
+ },
439
+ /**
440
+ * 网络筛选索引
441
+ */
442
+ networkTypeListIndex() {
443
+ return this.networkFilterType.findIndex((x) => x.type == this.options.networkFilterType);
444
+ },
445
+ /**
446
+ * bus分类索引
447
+ */
448
+ busTypeListIndex() {
449
+ return this.busFilterType.findIndex((x) => x.type == this.options.busFilterType);
450
+ },
451
+ /**
452
+ * 文件分类索引
453
+ */
454
+ fileTypeListIndex() {
455
+ return this.dirTypeList.findIndex((x) => x.type == this.options.fileSysDirType);
456
+ },
457
+ /**
458
+ * 缓存类型索引
459
+ */
460
+ storageTypeListIndex() {
461
+ return this.storageFilterTypeList.findIndex((x) => x.type == this.options.storageType);
462
+ },
463
+ /**
464
+ * Vuex变量类型
465
+ */
466
+ stateTypeListIndex() {
467
+ return this.stateTypeList.findIndex((x) => x.type == this.stateType);
468
+ },
469
+ panelExtraBottomPx() {
470
+ let h = 70;
471
+ if (this.tabTitle == "JsRunner") {
472
+ h = 210;
473
+ } else if (this.tabTitle == "FileSys") {
474
+ h = 120;
475
+ }
476
+ const safeBottomPx = this.getSafeBottomPx();
477
+ return `${h + safeBottomPx}px`;
478
+ },
479
+ },
480
+ watch: {
481
+ panelExtraBottomPx: {
482
+ handler(v) {
483
+ this.$emit("update:panelExtraBottomPx", v);
484
+ },
485
+ immediate: true,
486
+ },
487
+ },
488
+ methods: {
489
+ getSafeBottomPx() {
490
+ try {
491
+ const sys = uni.getSystemInfoSync();
492
+ const safeAreaBottom = (sys.safeArea && sys.safeArea.bottom) || sys.windowHeight || 0;
493
+ return Math.max((sys.windowHeight || 0) - safeAreaBottom, 0);
494
+ } catch (e) {
495
+ return 0;
496
+ }
497
+ },
498
+ /**
499
+ * 过滤类型改变
500
+ */
501
+ filterTypeChange(type) {
502
+ this.$emit("filterTypeChange", type);
503
+ },
504
+ /**
505
+ * 错误类型索引改变
506
+ */
507
+ errorTypeIndexChange(e) {
508
+ this.filterTypeChange(this.errorTypeList[e].type);
509
+ },
510
+ /**
511
+ * 日志分类索引改变
512
+ */
513
+ consoleTypeIndexChange(e) {
514
+ this.filterTypeChange(this.consoleTypeList[e].type);
515
+ },
516
+ /**
517
+ * 网络状态筛选改变事件
518
+ */
519
+ networkTypeIndexChange(e) {
520
+ this.filterTypeChange(this.networkFilterType[e].type);
521
+ },
522
+ /**
523
+ * bus筛选改变事件
524
+ */
525
+ busTypeIndexChange(e) {
526
+ this.filterTypeChange(this.busFilterType[e].type);
527
+ },
528
+ /**
529
+ * 文件分类改变事件
530
+ */
531
+ fileTypeIndexChange(e) {
532
+ this.$emit("changeFileDirType", this.dirTypeList[e].type);
533
+ },
534
+ /**
535
+ * 缓存类型改变事件
536
+ */
537
+ storageTypeIndexChange(e) {
538
+ this.$emit("changeStorageType", this.storageFilterTypeList[e].type);
539
+ },
540
+ /**
541
+ * Vuex变量类型改变事件
542
+ */
543
+ stateTypeIndexChange(e) {
544
+ this.$emit("changeStateType", this.stateTypeList[e].type);
545
+ },
546
+ /**
547
+ * 清空日志
548
+ */
549
+ emptyLogs(type) {
550
+ let that = this;
551
+ let title = {
552
+ error: "报错记录",
553
+ console: "console",
554
+ network: "请求日志",
555
+ logs: "Logs",
556
+ UniBus: "UniBus",
557
+ storage: "Storage",
558
+ };
559
+ // #ifdef H5
560
+ if (type == "storage") {
561
+ title[type] = this.options.storageType;
562
+ }
563
+ // #endif
564
+
565
+ devUi.showModal({
566
+ title: "警告",
567
+ content: `是否确认清空${title[type]}全部数据?`,
568
+ success(e) {
569
+ if (e.confirm) {
570
+ devUi.showLoading({
571
+ title: "处理中...",
572
+ });
573
+
574
+ let ms = 500;
575
+ if (type == "error") {
576
+ devCache.clearItem("errorReport");
577
+ } else if (type == "console") {
578
+ uni.$emit("devTools_delConsoleAll");
579
+ } else if (type == "network") {
580
+ uni.$emit("devTools_delNetworkAll");
581
+ } else if (type == "logs") {
582
+ devCache.clearItem("logReport");
583
+ } else if (type == "UniBus") {
584
+ uni.$emit("devTools_delUniBusAll");
585
+ } else if (type == "storage") {
586
+ that.delStorage();
587
+ ms = 2000;
588
+ }
589
+
590
+ setTimeout(() => {
591
+ that.$emit("getPage");
592
+ }, ms + 500);
593
+ setTimeout(() => {
594
+ devUi.hideLoading();
595
+ devUi.showToast({
596
+ title: "清空成功!",
597
+ icon: "success",
598
+ });
599
+ }, ms);
600
+ }
601
+ },
602
+ });
603
+ },
604
+ /**
605
+ * 清空全部缓存
606
+ */
607
+ delStorage() {
608
+ // #ifdef APP-PLUS
609
+ let keys = plus.storage.getAllKeys();
610
+ for (let i = 0; i < keys.length; i++) {
611
+ const key = String(keys[i]);
612
+ if (key.indexOf("devTools_") == 0) {
613
+ continue;
614
+ }
615
+ uni.removeStorageSync(key);
616
+ }
617
+ // #endif
618
+
619
+ // #ifdef H5
620
+ if (this.options.storageType == "localStorage") {
621
+ for (let i = 0; i < localStorage.length; i++) {
622
+ let key = String(localStorage.key(i));
623
+ if (key.indexOf("devTools_") == 0) {
624
+ continue;
625
+ }
626
+ uni.removeStorageSync(key);
627
+ }
628
+ } else if (this.options.storageType == "sessionStorage") {
629
+ for (let i = 0; i < sessionStorage.length; i++) {
630
+ let key = String(sessionStorage.key(i));
631
+ if (key.indexOf("devTools_") == 0) {
632
+ continue;
633
+ }
634
+ sessionStorage.removeItem(key);
635
+ }
636
+ } else if (this.options.storageType == "cookie") {
637
+ let keys = [];
638
+ document.cookie.split(";").forEach((cookieStr) => {
639
+ const [name, value] = cookieStr.trim().split("=");
640
+ keys.push(name);
641
+ });
642
+ keys.map((k) => {
643
+ document.cookie = `${k}=;expires=` + new Date(new Date().getTime() + 200).toGMTString() + ";path=/";
644
+ });
645
+ }
646
+
647
+ // #endif
648
+
649
+ // #ifdef MP
650
+ let keyList = devCache.get("storage");
651
+ if (!keyList) keyList = [];
652
+ for (let i = 0; i < keyList.length; i++) {
653
+ const key = keyList[i];
654
+ if (key.indexOf("devTools_") == 0) {
655
+ continue;
656
+ }
657
+ uni.removeStorageSync(key);
658
+ }
659
+ // #endif
660
+ },
661
+ /**
662
+ * 清空文件夹
663
+ */
664
+ emptyFolder() {
665
+ let that = this;
666
+ if (that.options.fileSysDirType == "PRIVATE_WWW") {
667
+ return devUi.showToast({
668
+ title: "该目录不可删除",
669
+ icon: "none",
670
+ });
671
+ }
672
+ devUi.showModal({
673
+ title: "提示",
674
+ content: "是否确认清空全部文件?",
675
+ success(res) {
676
+ if (res.confirm) {
677
+ devUi.showLoading({
678
+ title: "清空中",
679
+ });
680
+ let path = "";
681
+ switch (that.options.fileSysDirType) {
682
+ case "wx":
683
+ path = wx.env.USER_DATA_PATH;
684
+ break;
685
+ case "PRIVATE_DOC":
686
+ path = "_doc";
687
+ break;
688
+ case "PUBLIC_DOCUMENTS":
689
+ path = "_documents";
690
+ break;
691
+ case "PUBLIC_DOWNLOADS":
692
+ path = "_downloads";
693
+ break;
694
+ default:
695
+ break;
696
+ }
697
+ // #ifdef APP-PLUS
698
+ appDelDir(path + "/", false)
699
+ .then(() => {
700
+ devUi.hideLoading();
701
+ devUi.showToast({
702
+ title: "清空成功!",
703
+ icon: "success",
704
+ });
705
+ that.$emit("getPage");
706
+ })
707
+ .catch(() => {
708
+ devUi.hideLoading();
709
+ devUi.showToast({
710
+ title: "清空失败!",
711
+ icon: "none",
712
+ });
713
+ });
714
+ // #endif
715
+ // #ifdef MP-WEIXIN
716
+ let fs = wx.getFileSystemManager();
717
+ fs.rmdir({
718
+ dirPath: path + "/",
719
+ recursive: true,
720
+ success() {
721
+ devUi.hideLoading();
722
+ devUi.showToast({
723
+ title: "清空成功!",
724
+ icon: "success",
725
+ });
726
+ that.$emit("getPage");
727
+ },
728
+ fail() {
729
+ devUi.hideLoading();
730
+ devUi.showToast({
731
+ title: "清空失败!",
732
+ icon: "none",
733
+ });
734
+ },
735
+ });
736
+ // #endif
737
+ }
738
+ },
739
+ });
740
+ },
741
+ /**
742
+ * 创建文件夹
743
+ */
744
+ createDir() {
745
+ let that = this;
746
+ let menu = [
747
+ {
748
+ text: `新建文件`,
749
+ click() {
750
+ that.$emit("editDirName", {
751
+ isEdit: false,
752
+ isDir: false,
753
+ });
754
+ },
755
+ },
756
+ {
757
+ text: `新建文件夹`,
758
+ click() {
759
+ that.$emit("editDirName", {
760
+ isEdit: false,
761
+ isDir: true,
762
+ });
763
+ },
764
+ },
765
+ ];
766
+ devUi.showActionSheet({
767
+ itemList: menu.map((x) => x.text),
768
+ success({ tapIndex }) {
769
+ menu[tapIndex].click();
770
+ },
771
+ });
772
+ },
773
+ /**
774
+ * 新增缓存
775
+ */
776
+ addStorage() {
777
+ uni.$emit("devTools_showAddStorageDialog");
778
+ },
779
+ /**
780
+ * 执行js
781
+ */
782
+ runJs() {
783
+ let that = this;
784
+ if (this.waitSendCode == "") {
785
+ return devUi.showToast({
786
+ title: "请先输入需要执行的js代码",
787
+ icon: "none",
788
+ });
789
+ } else {
790
+ let code = String(this.waitSendCode);
791
+ this.$emit("runJs", { code, type: that.jsRunType });
792
+ this.waitSendCode = "";
793
+ }
794
+ },
795
+ /**
796
+ * 获取历史代码运行记录
797
+ */
798
+ showHisCode() {
799
+ let that = this;
800
+ let his = devCache.get("codeRunHis");
801
+ if (!his) his = [];
802
+ if (his.length == 0) {
803
+ return devUi.showToast({
804
+ title: "暂无记录!",
805
+ icon: "none",
806
+ });
807
+ }
808
+ that.$refs.codeHisPicker.show(his).then((res) => {
809
+ that.waitSendCode = res;
810
+ });
811
+ },
812
+ /**
813
+ * 跳转指定页面
814
+ */
815
+ goPage() {
816
+ uni.$emit("devTools_showRouteDialog");
817
+ },
818
+ },
819
+ };
820
+ </script>
821
+ <style lang="scss" scoped>
822
+ .bottomTools {
823
+ position: fixed;
824
+ z-index: 3;
825
+ bottom: 0;
826
+ left: 0;
827
+ right: 0;
828
+ width: 100%;
829
+ box-sizing: border-box;
830
+ overflow-x: hidden;
831
+ border-top: 1px solid rgba(15, 23, 42, 0.1);
832
+ background-color: #f3f6fb;
833
+ padding-top: 10rpx;
834
+ padding-left: 16rpx;
835
+ padding-right: 16rpx;
836
+ display: flex;
837
+ flex-wrap: wrap;
838
+ flex-direction: row;
839
+ align-items: center;
840
+ row-gap: 8rpx;
841
+ box-shadow: 0 -8rpx 18rpx rgba(15, 23, 42, 0.06);
842
+ .mr {
843
+ margin-right: 10rpx;
844
+ }
845
+ .mt {
846
+ margin-left: 12rpx;
847
+ }
848
+ .ml {
849
+ margin-left: 10rpx;
850
+ }
851
+ .miniBtn {
852
+ height: 54rpx;
853
+ border-radius: 14rpx;
854
+ padding: 0 16rpx;
855
+ border: 1px solid #d5dde8;
856
+ background-color: #fff;
857
+ display: flex;
858
+ align-items: center;
859
+ justify-content: center;
860
+ box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset;
861
+ &:active {
862
+ opacity: 0.88;
863
+ }
864
+ &.warn {
865
+ background-color: #fff5f5;
866
+ border-color: #fca5a5;
867
+ .miniBtnText {
868
+ color: #dc2626;
869
+ }
870
+ &:active {
871
+ background-color: #fee2e2;
872
+ }
873
+ }
874
+ &.primary {
875
+ background-color: #fff;
876
+ border-color: #d5dde8;
877
+ }
878
+ .miniBtnText {
879
+ font-size: 24rpx;
880
+ height: 54rpx;
881
+ line-height: 54rpx;
882
+ color: #475569;
883
+ }
884
+ }
885
+ }
886
+ .dirList {
887
+ display: flex;
888
+ flex-direction: row;
889
+ align-items: center;
890
+ flex: 1;
891
+ min-width: 0;
892
+ width: auto;
893
+ height: 34rpx;
894
+ /* #ifndef APP-PLUS */
895
+ white-space: nowrap;
896
+ /* #endif */
897
+ .dirScrollItem {
898
+ display: flex;
899
+ flex-direction: row;
900
+ align-items: center;
901
+ height: 34rpx;
902
+ }
903
+ .dirItem {
904
+ display: flex;
905
+ flex-direction: row;
906
+ align-items: center;
907
+ }
908
+ .delimiter {
909
+ color: #999;
910
+ margin: 0 6rpx;
911
+ font-size: 24rpx;
912
+ line-height: 34rpx;
913
+ }
914
+ .dirName {
915
+ color: #333;
916
+ font-size: 24rpx;
917
+ line-height: 34rpx;
918
+ height: 34rpx;
919
+ padding: 0 6rpx;
920
+ background-color: rgba(148, 163, 184, 0.12);
921
+ border-radius: 8rpx;
922
+ }
923
+ }
924
+ .fileSysTopRow {
925
+ width: 100%;
926
+ display: flex;
927
+ flex-direction: row;
928
+ align-items: center;
929
+ margin-bottom: 8rpx;
930
+ }
931
+ .fileSysClearBtn {
932
+ flex-shrink: 0;
933
+ }
934
+ .fileSysBottomRow {
935
+ width: 100%;
936
+ display: flex;
937
+ flex-direction: row;
938
+ align-items: center;
939
+ flex-wrap: nowrap;
940
+ }
941
+ .jsRunnerTools {
942
+ display: flex;
943
+ flex-direction: column;
944
+ width: 100%;
945
+ .runOptions {
946
+ display: flex;
947
+ flex-direction: row;
948
+ align-items: center;
949
+ width: 100%;
950
+ justify-content: space-between;
951
+ padding-bottom: 10rpx;
952
+ .radiusList {
953
+ display: flex;
954
+ flex-direction: row;
955
+ align-items: center;
956
+ .runType {
957
+ font-size: 24rpx;
958
+ line-height: 24rpx;
959
+ color: #333;
960
+ }
961
+ .radiusItem {
962
+ display: flex;
963
+ flex-direction: row;
964
+ align-items: center;
965
+ margin-left: 10rpx;
966
+ .radiusText {
967
+ font-size: 24rpx;
968
+ line-height: 24rpx;
969
+ color: #333;
970
+ }
971
+ .radiusRadio {
972
+ transform: scale(0.5);
973
+ }
974
+ }
975
+ }
976
+ .hisEmpty {
977
+ display: flex;
978
+ flex-direction: row;
979
+ align-items: center;
980
+ .hisEmptyIcon {
981
+ width: 16rpx;
982
+ height: 16rpx;
983
+ }
984
+ .hisEmptyText {
985
+ font-size: 24rpx;
986
+ margin-left: 5rpx;
987
+ color: #dc2626;
988
+ }
989
+ }
990
+ .logList {
991
+ // margin-right: 120rpx;
992
+ display: flex;
993
+ flex-direction: row;
994
+ align-items: center;
995
+ .hisText {
996
+ font-size: 24rpx;
997
+ color: #777;
998
+ line-height: 24rpx;
999
+ margin-right: 5rpx;
1000
+ }
1001
+ .unfold {
1002
+ width: 24rpx;
1003
+ height: 24rpx;
1004
+ }
1005
+ }
1006
+ }
1007
+ .code {
1008
+ display: flex;
1009
+ flex-direction: row;
1010
+ align-items: center;
1011
+ justify-content: space-between;
1012
+ width: 100%;
1013
+ .codeInput {
1014
+ width: calc(100% - 120rpx);
1015
+ height: 100rpx;
1016
+ font-size: 24rpx;
1017
+ line-height: 28rpx;
1018
+ color: #333;
1019
+ padding: 10rpx;
1020
+ background-color: #f8fafc;
1021
+ border: 1px solid #e2e8f0;
1022
+ border-radius: 15rpx;
1023
+ }
1024
+ .codeSend {
1025
+ width: 100rpx;
1026
+ height: 100rpx;
1027
+ border-radius: 15rpx;
1028
+ border: 1px solid #3b82f6;
1029
+ display: flex;
1030
+ flex-direction: row;
1031
+ align-items: center;
1032
+ justify-content: center;
1033
+ .codeSendText {
1034
+ color: #3b82f6;
1035
+ font-size: 28rpx;
1036
+ font-weight: bold;
1037
+ }
1038
+ }
1039
+ .codeSend:active {
1040
+ background-color: rgba(0, 0, 0, 0.03);
1041
+ }
1042
+ }
1043
+ }
1044
+ .menuBtn {
1045
+ }
1046
+ </style>