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