oxy-uni-ui 2.1.0 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (269) hide show
  1. package/attributes.json +1 -1
  2. package/components/common/abstracts/variable.scss +145 -100
  3. package/components/common/util.ts +25 -0
  4. package/components/composables/useDynamicVirtualScroll.ts +80 -0
  5. package/components/oxy-action-sheet/index.scss +6 -6
  6. package/components/oxy-backtop/index.scss +1 -1
  7. package/components/oxy-badge/index.scss +2 -2
  8. package/components/oxy-button/index.scss +3 -6
  9. package/components/oxy-calendar/index.scss +2 -2
  10. package/components/oxy-calendar/oxy-calendar.vue +3 -3
  11. package/components/oxy-calendar-view/monthPanel/month-panel.vue +72 -37
  12. package/components/oxy-calendar-view/monthPanel/types.ts +43 -1
  13. package/components/oxy-calendar-view/types.ts +1 -1
  14. package/components/oxy-calendar-view/utils.ts +12 -1
  15. package/components/oxy-calendar-view/yearPanel/types.ts +36 -2
  16. package/components/oxy-calendar-view/yearPanel/year-panel.vue +64 -45
  17. package/components/oxy-card/index.scss +4 -4
  18. package/components/oxy-cell/index.scss +1 -1
  19. package/components/oxy-cell-group/index.scss +2 -2
  20. package/components/oxy-checkbox/index.scss +87 -197
  21. package/components/oxy-collapse/index.scss +1 -1
  22. package/components/oxy-collapse-item/index.scss +2 -2
  23. package/components/oxy-corner/index.scss +3 -3
  24. package/components/oxy-count-to/oxy-count-to.vue +3 -3
  25. package/components/oxy-count-to/types.ts +1 -1
  26. package/components/oxy-date-strip-item/index.scss +4 -4
  27. package/components/oxy-datetime-picker/types.ts +1 -1
  28. package/components/oxy-datetime-picker-view/types.ts +2 -2
  29. package/components/oxy-fab/index.scss +1 -5
  30. package/components/oxy-file-list/index.scss +2 -2
  31. package/components/oxy-footer/index.scss +2 -2
  32. package/components/oxy-footer/oxy-footer.vue +2 -3
  33. package/components/oxy-form-item/index.scss +0 -5
  34. package/components/oxy-grid/oxy-grid.vue +1 -1
  35. package/components/oxy-grid-item/index.scss +1 -1
  36. package/components/oxy-guidance/index.scss +2 -2
  37. package/components/oxy-img/index.scss +2 -2
  38. package/components/oxy-img-cropper/index.scss +0 -2
  39. package/components/oxy-img-lazy/index.scss +0 -1
  40. package/components/oxy-index-anchor/index.scss +3 -3
  41. package/components/oxy-input/index.scss +2 -2
  42. package/components/oxy-input-number/index.scss +21 -3
  43. package/components/oxy-input-number/oxy-input-number.vue +9 -1
  44. package/components/oxy-keyboard/index.scss +1 -1
  45. package/components/oxy-link/index.scss +11 -10
  46. package/components/oxy-loading/index.scss +1 -1
  47. package/components/oxy-loadmore/index.scss +1 -1
  48. package/components/oxy-message-box/index.scss +7 -7
  49. package/components/oxy-navbar/index.scss +1 -1
  50. package/components/oxy-navbar/oxy-navbar.vue +2 -3
  51. package/components/oxy-password-input/index.scss +4 -4
  52. package/components/oxy-picker/types.ts +1 -1
  53. package/components/oxy-picker-view/oxy-picker-view.vue +8 -5
  54. package/components/oxy-picker-view/types.ts +2 -2
  55. package/components/oxy-progress/index.scss +2 -2
  56. package/components/oxy-radio/index.scss +8 -4
  57. package/components/oxy-radio-group/index.scss +0 -1
  58. package/components/oxy-rich-text/index.scss +2 -6
  59. package/components/oxy-rich-text/mp-html/mp-html.d.ts +2 -0
  60. package/components/oxy-rich-text/mp-html/mp-html.vue +2 -1
  61. package/components/oxy-rich-text/mp-html/node/node.vue +23 -0
  62. package/components/oxy-rich-text/mp-html/parser.js +6 -6
  63. package/components/oxy-rich-text/oxy-rich-text.vue +23 -0
  64. package/components/oxy-search/index.scss +1 -1
  65. package/components/oxy-segmented/index.scss +4 -8
  66. package/components/oxy-select/index.scss +6 -6
  67. package/components/oxy-sidebar-item/index.scss +20 -11
  68. package/components/oxy-slider/index.scss +4 -5
  69. package/components/oxy-sort-button/index.scss +6 -9
  70. package/components/oxy-splitter-panel/index.scss +8 -8
  71. package/components/oxy-step/index.scss +9 -9
  72. package/components/oxy-swiper-nav/index.scss +2 -2
  73. package/components/oxy-switch/index.scss +3 -3
  74. package/components/oxy-tab/index.scss +8 -2
  75. package/components/oxy-tabbar/index.scss +3 -3
  76. package/components/oxy-tabbar/oxy-tabbar.vue +3 -3
  77. package/components/oxy-table/index.scss +0 -1
  78. package/components/oxy-table-col/index.scss +1 -2
  79. package/components/oxy-tabs/index.scss +3 -3
  80. package/components/oxy-tag/index.scss +160 -20
  81. package/components/oxy-tag/oxy-tag.vue +14 -2
  82. package/components/oxy-tag/types.ts +9 -0
  83. package/components/oxy-text/index.scss +1 -1
  84. package/components/oxy-textarea/index.scss +2 -6
  85. package/components/oxy-toast/index.scss +1 -1
  86. package/components/oxy-tree/index.scss +31 -11
  87. package/components/oxy-tree/oxy-tree.vue +113 -2
  88. package/components/oxy-tree/types.ts +1 -0
  89. package/components/oxy-upload/index.scss +3 -3
  90. package/components/oxy-video-preview/index.scss +3 -3
  91. package/components/oxy-virtual-scroll/index.scss +1 -1
  92. package/components/oxy-voice-player/index.scss +36 -36
  93. package/components/oxy-watermark/index.scss +1 -1
  94. package/dev-tools.ts +2 -0
  95. package/devTools/components/DevToolsOverlay.vue +56 -0
  96. package/devTools/components/DevToolsUiHost.vue +589 -0
  97. package/devTools/config.js +55 -0
  98. package/devTools/core/components/mpDevBubble.vue +174 -0
  99. package/devTools/core/libs/createH5Bubble.js +156 -0
  100. package/devTools/core/libs/devCache.js +151 -0
  101. package/devTools/core/libs/devOptions.js +163 -0
  102. package/devTools/core/libs/devUi.js +219 -0
  103. package/devTools/core/libs/drawView.js +140 -0
  104. package/devTools/core/libs/errorReport.js +64 -0
  105. package/devTools/core/libs/jsonCompress.js +334 -0
  106. package/devTools/core/libs/logReport.js +59 -0
  107. package/devTools/core/libs/pageLinkList.js +125 -0
  108. package/devTools/core/libs/timeFormat.js +94 -0
  109. package/devTools/core/proxy/console.js +430 -0
  110. package/devTools/core/proxy/index.js +36 -0
  111. package/devTools/core/proxy/request.js +495 -0
  112. package/devTools/core/proxy/storage.js +113 -0
  113. package/devTools/core/proxy/uniBus.js +153 -0
  114. package/devTools/core/proxy/uniListen.js +192 -0
  115. package/devTools/core/proxy/vueMixin.js +120 -0
  116. package/devTools/index.js +168 -0
  117. package/devTools/page/components/bottomTools.vue +1046 -0
  118. package/devTools/page/components/dialog/addStorage.vue +204 -0
  119. package/devTools/page/components/dialog/createDir.vue +366 -0
  120. package/devTools/page/components/dialog/editDialog.vue +192 -0
  121. package/devTools/page/components/dialog/routeDialog.vue +184 -0
  122. package/devTools/page/components/dialog/sendRequest.vue +603 -0
  123. package/devTools/page/components/dialog/textFileEditDialog.vue +391 -0
  124. package/devTools/page/components/libs/appDelDir.js +86 -0
  125. package/devTools/page/components/libs/dirReader.js +248 -0
  126. package/devTools/page/components/libs/fileSize.js +15 -0
  127. package/devTools/page/components/libs/getRuntimeInfo.js +134 -0
  128. package/devTools/page/components/listItem/consoleItem.vue +314 -0
  129. package/devTools/page/components/listItem/errorItem.vue +292 -0
  130. package/devTools/page/components/listItem/fileSysItem.vue +533 -0
  131. package/devTools/page/components/listItem/infoList.vue +100 -0
  132. package/devTools/page/components/listItem/jsRunnerItem.vue +255 -0
  133. package/devTools/page/components/listItem/logItem.vue +193 -0
  134. package/devTools/page/components/listItem/networkItem.vue +398 -0
  135. package/devTools/page/components/listItem/objectAnalysis.vue +651 -0
  136. package/devTools/page/components/listItem/pages.vue +319 -0
  137. package/devTools/page/components/listItem/routeItem.vue +153 -0
  138. package/devTools/page/components/listItem/setting.vue +734 -0
  139. package/devTools/page/components/listItem/storageList.vue +681 -0
  140. package/devTools/page/components/listItem/tools.vue +315 -0
  141. package/devTools/page/components/listItem/vuexList.vue +599 -0
  142. package/devTools/page/components/main.vue +1867 -0
  143. package/devTools/page/components/mixins/animationControl.js +91 -0
  144. package/devTools/page/components/mixins/mp.js +83 -0
  145. package/devTools/page/components/ui/btnTabs.vue +90 -0
  146. package/devTools/page/components/ui/codeHisPicker.vue +172 -0
  147. package/devTools/page/components/ui/h5Cell.vue +13 -0
  148. package/devTools/page/components/ui/menuBtn.vue +94 -0
  149. package/devTools/page/components/ui/mobileSwiperScroll.vue +74 -0
  150. package/devTools/page/components/ui/requestSpeedLimit.vue +52 -0
  151. package/devTools/page/components/ui/requestTimeoutMock.vue +55 -0
  152. package/devTools/page/components/ui/subTitleBar.vue +101 -0
  153. package/devTools/page/static/copy.png +0 -0
  154. package/devTools/page/static/delete.png +0 -0
  155. package/devTools/page/static/fileSys/AI.png +0 -0
  156. package/devTools/page/static/fileSys/DWG.png +0 -0
  157. package/devTools/page/static/fileSys/EXE.png +0 -0
  158. package/devTools/page/static/fileSys/GIF.png +0 -0
  159. package/devTools/page/static/fileSys/HTML.png +0 -0
  160. package/devTools/page/static/fileSys/PSD.png +0 -0
  161. package/devTools/page/static/fileSys/RVT.png +0 -0
  162. package/devTools/page/static/fileSys/SKP.png +0 -0
  163. package/devTools/page/static/fileSys/SVG.png +0 -0
  164. package/devTools/page/static/fileSys/excel.png +0 -0
  165. package/devTools/page/static/fileSys/pdf.png +0 -0
  166. package/devTools/page/static/fileSys/pptl.png +0 -0
  167. package/devTools/page/static/fileSys/shipin.png +0 -0
  168. package/devTools/page/static/fileSys/tupian.png +0 -0
  169. package/devTools/page/static/fileSys/txt.png +0 -0
  170. package/devTools/page/static/fileSys/weizhiwenjian.png +0 -0
  171. package/devTools/page/static/fileSys/wenjianjia.png +0 -0
  172. package/devTools/page/static/fileSys/word.png +0 -0
  173. package/devTools/page/static/fileSys/yasuo.png +0 -0
  174. package/devTools/page/static/fileSys/yinpin.png +0 -0
  175. package/devTools/page/static/fold.png +0 -0
  176. package/devTools/page/static/menu.png +0 -0
  177. package/devTools/page/static/refresh.png +0 -0
  178. package/devTools/page/static/unfold.png +0 -0
  179. package/devTools/tools.vue +25 -0
  180. package/devTools/type/devTools.d.ts +406 -0
  181. package/oxy-dev-tools/components/DevToolsUiHost.vue +555 -0
  182. package/oxy-dev-tools/config.js +61 -0
  183. package/oxy-dev-tools/core/components/mpDevBubble.vue +176 -0
  184. package/oxy-dev-tools/core/libs/createH5Bubble.js +156 -0
  185. package/oxy-dev-tools/core/libs/devCache.js +149 -0
  186. package/oxy-dev-tools/core/libs/devOptions.js +160 -0
  187. package/oxy-dev-tools/core/libs/devUi.js +219 -0
  188. package/oxy-dev-tools/core/libs/drawView.js +144 -0
  189. package/oxy-dev-tools/core/libs/errorReport.js +60 -0
  190. package/oxy-dev-tools/core/libs/jsonCompress.js +328 -0
  191. package/oxy-dev-tools/core/libs/logReport.js +55 -0
  192. package/oxy-dev-tools/core/libs/pageLinkList.js +121 -0
  193. package/oxy-dev-tools/core/libs/timeFormat.js +93 -0
  194. package/oxy-dev-tools/core/proxy/console.js +398 -0
  195. package/oxy-dev-tools/core/proxy/index.js +33 -0
  196. package/oxy-dev-tools/core/proxy/request.js +473 -0
  197. package/oxy-dev-tools/core/proxy/storage.js +96 -0
  198. package/oxy-dev-tools/core/proxy/uniBus.js +148 -0
  199. package/oxy-dev-tools/core/proxy/uniListen.js +190 -0
  200. package/oxy-dev-tools/core/proxy/vueMixin.js +115 -0
  201. package/oxy-dev-tools/index.ts +183 -0
  202. package/oxy-dev-tools/oxy-dev-tools.vue +62 -0
  203. package/oxy-dev-tools/page/components/bottomTools.vue +933 -0
  204. package/oxy-dev-tools/page/components/dialog/addStorage.vue +184 -0
  205. package/oxy-dev-tools/page/components/dialog/createDir.vue +352 -0
  206. package/oxy-dev-tools/page/components/dialog/editDialog.vue +178 -0
  207. package/oxy-dev-tools/page/components/dialog/routeDialog.vue +170 -0
  208. package/oxy-dev-tools/page/components/dialog/sendRequest.vue +530 -0
  209. package/oxy-dev-tools/page/components/dialog/textFileEditDialog.vue +379 -0
  210. package/oxy-dev-tools/page/components/libs/appDelDir.js +77 -0
  211. package/oxy-dev-tools/page/components/libs/dirReader.js +239 -0
  212. package/oxy-dev-tools/page/components/libs/fileSize.js +15 -0
  213. package/oxy-dev-tools/page/components/libs/getRuntimeInfo.js +132 -0
  214. package/oxy-dev-tools/page/components/listItem/consoleItem.vue +292 -0
  215. package/oxy-dev-tools/page/components/listItem/errorItem.vue +268 -0
  216. package/oxy-dev-tools/page/components/listItem/fileSysItem.vue +511 -0
  217. package/oxy-dev-tools/page/components/listItem/infoList.vue +89 -0
  218. package/oxy-dev-tools/page/components/listItem/jsRunnerItem.vue +236 -0
  219. package/oxy-dev-tools/page/components/listItem/logItem.vue +185 -0
  220. package/oxy-dev-tools/page/components/listItem/networkItem.vue +362 -0
  221. package/oxy-dev-tools/page/components/listItem/objectAnalysis.vue +642 -0
  222. package/oxy-dev-tools/page/components/listItem/pages.vue +285 -0
  223. package/oxy-dev-tools/page/components/listItem/routeItem.vue +140 -0
  224. package/oxy-dev-tools/page/components/listItem/setting.vue +687 -0
  225. package/oxy-dev-tools/page/components/listItem/storageList.vue +623 -0
  226. package/oxy-dev-tools/page/components/listItem/tools.vue +273 -0
  227. package/oxy-dev-tools/page/components/listItem/vuexList.vue +559 -0
  228. package/oxy-dev-tools/page/components/main.vue +1824 -0
  229. package/oxy-dev-tools/page/components/mixins/animationControl.js +80 -0
  230. package/oxy-dev-tools/page/components/mixins/mp.js +76 -0
  231. package/oxy-dev-tools/page/components/ui/btnTabs.vue +77 -0
  232. package/oxy-dev-tools/page/components/ui/codeHisPicker.vue +161 -0
  233. package/oxy-dev-tools/page/components/ui/h5Cell.vue +13 -0
  234. package/oxy-dev-tools/page/components/ui/menuBtn.vue +87 -0
  235. package/oxy-dev-tools/page/components/ui/mobileSwiperScroll.vue +71 -0
  236. package/oxy-dev-tools/page/components/ui/requestSpeedLimit.vue +47 -0
  237. package/oxy-dev-tools/page/components/ui/requestTimeoutMock.vue +50 -0
  238. package/oxy-dev-tools/page/components/ui/subTitleBar.vue +87 -0
  239. package/oxy-dev-tools/page/static/copy.png +0 -0
  240. package/oxy-dev-tools/page/static/delete.png +0 -0
  241. package/oxy-dev-tools/page/static/fileSys/AI.png +0 -0
  242. package/oxy-dev-tools/page/static/fileSys/DWG.png +0 -0
  243. package/oxy-dev-tools/page/static/fileSys/EXE.png +0 -0
  244. package/oxy-dev-tools/page/static/fileSys/GIF.png +0 -0
  245. package/oxy-dev-tools/page/static/fileSys/HTML.png +0 -0
  246. package/oxy-dev-tools/page/static/fileSys/PSD.png +0 -0
  247. package/oxy-dev-tools/page/static/fileSys/RVT.png +0 -0
  248. package/oxy-dev-tools/page/static/fileSys/SKP.png +0 -0
  249. package/oxy-dev-tools/page/static/fileSys/SVG.png +0 -0
  250. package/oxy-dev-tools/page/static/fileSys/excel.png +0 -0
  251. package/oxy-dev-tools/page/static/fileSys/pdf.png +0 -0
  252. package/oxy-dev-tools/page/static/fileSys/pptl.png +0 -0
  253. package/oxy-dev-tools/page/static/fileSys/shipin.png +0 -0
  254. package/oxy-dev-tools/page/static/fileSys/tupian.png +0 -0
  255. package/oxy-dev-tools/page/static/fileSys/txt.png +0 -0
  256. package/oxy-dev-tools/page/static/fileSys/weizhiwenjian.png +0 -0
  257. package/oxy-dev-tools/page/static/fileSys/wenjianjia.png +0 -0
  258. package/oxy-dev-tools/page/static/fileSys/word.png +0 -0
  259. package/oxy-dev-tools/page/static/fileSys/yasuo.png +0 -0
  260. package/oxy-dev-tools/page/static/fileSys/yinpin.png +0 -0
  261. package/oxy-dev-tools/page/static/fold.png +0 -0
  262. package/oxy-dev-tools/page/static/menu.png +0 -0
  263. package/oxy-dev-tools/page/static/refresh.png +0 -0
  264. package/oxy-dev-tools/page/static/unfold.png +0 -0
  265. package/oxy-dev-tools/tools.vue +22 -0
  266. package/oxy-dev-tools/type/devTools.d.ts +406 -0
  267. package/package.json +1 -1
  268. package/tags.json +1 -1
  269. package/web-types.json +1 -1
@@ -0,0 +1,734 @@
1
+ <template>
2
+ <view class="settingView">
3
+ <view
4
+ v-if="loading"
5
+ class="loading"
6
+ >
7
+ <text class="loadingText">加载中</text>
8
+ </view>
9
+ <template v-else>
10
+ <subTitleBar
11
+ :isOpen="exportIsShow"
12
+ @click="exportIsShow = !exportIsShow"
13
+ title="导出全部日志"
14
+ />
15
+ <template v-if="exportIsShow">
16
+ <view
17
+ class="delBtn exportBtn"
18
+ @click="exportJsonFile"
19
+ >
20
+ <text class="delBtnText">导出日志文件(.json)</text>
21
+ </view>
22
+ </template>
23
+ <view class="divisionLine"></view>
24
+
25
+ <subTitleBar
26
+ :isOpen="cacheListIsShow"
27
+ title="清空全部缓存"
28
+ @click="cacheListIsShow = !cacheListIsShow"
29
+ />
30
+ <template v-if="cacheListIsShow">
31
+ <view
32
+ v-for="(item, index) in cacheSelectList"
33
+ :key="index"
34
+ @click.stop="doSelectCache(index)"
35
+ class="checkboxItem"
36
+ >
37
+ <checkbox
38
+ :value="item.check ? '1' : '0'"
39
+ :checked="item.check"
40
+ color="#3b82f6"
41
+ />
42
+ <text
43
+ class="name"
44
+ :style="{
45
+ color: item.count ? '#333' : '#888',
46
+ }"
47
+ >
48
+ {{ item.name }}
49
+ </text>
50
+
51
+ <text v-if="item.key == 'file'"></text>
52
+ <text
53
+ v-else-if="item.count"
54
+ class="count"
55
+ >
56
+ ({{ item.count }})
57
+ </text>
58
+ <text
59
+ v-else
60
+ class="empty"
61
+ >
62
+ (空)
63
+ </text>
64
+ </view>
65
+ <view
66
+ class="delBtn"
67
+ @click="delCache"
68
+ >
69
+ <text class="delBtnText">清空选中</text>
70
+ </view>
71
+ </template>
72
+ <view class="divisionLine"></view>
73
+
74
+ <subTitleBar
75
+ :isOpen="configIsShow"
76
+ title="DevTools当前配置参数"
77
+ @click="configIsShow = !configIsShow"
78
+ />
79
+ <view
80
+ v-if="configIsShow"
81
+ class="objectAnalysisView"
82
+ >
83
+ <objectAnalysis
84
+ :isOpenFirst="true"
85
+ :data="config"
86
+ :width="710"
87
+ />
88
+ </view>
89
+
90
+ <view style="height: 100rpx"></view>
91
+ </template>
92
+ </view>
93
+ </template>
94
+ <script>
95
+ import devCache from "../../../core/libs/devCache";
96
+ import devOptions from "../../../core/libs/devOptions";
97
+ import jsonCompress from "../../../core/libs/jsonCompress";
98
+ import appDelDir from "../libs/appDelDir";
99
+ import subTitleBar from "../ui/subTitleBar.vue";
100
+ import objectAnalysis from "./objectAnalysis.vue";
101
+ import getRuntimeInfo from "../libs/getRuntimeInfo";
102
+ import devUi from "../../../core/libs/devUi.js";
103
+ export default {
104
+ components: {
105
+ subTitleBar,
106
+ objectAnalysis,
107
+ },
108
+ data() {
109
+ return {
110
+ /**
111
+ * 是否加载中
112
+ */
113
+ loading: false,
114
+ /**
115
+ * 缓存列表是否展示
116
+ */
117
+ cacheListIsShow: false,
118
+ /**
119
+ * 缓存列表
120
+ */
121
+ cacheSelectList: [],
122
+ /**
123
+ * 配置文件是否显示
124
+ */
125
+ configIsShow: false,
126
+ /**
127
+ * 当前配置
128
+ */
129
+ config: devOptions.getOptions(),
130
+ /**
131
+ * 是否显示导出日志按钮
132
+ */
133
+ exportIsShow: false,
134
+ };
135
+ },
136
+ methods: {
137
+ /**
138
+ * 加载页面
139
+ */
140
+ async getPage() {
141
+ let that = this;
142
+ that.loading = true;
143
+ that.cacheSelectList = await that.countCache();
144
+ that.loading = false;
145
+ },
146
+ /**
147
+ * 统计缓存信息
148
+ */
149
+ countCache() {
150
+ let that = this;
151
+ return new Promise(async (yes) => {
152
+ let cacheSelectList = [];
153
+
154
+ // dev 工具日志
155
+ let keys = {
156
+ errorReport: "Error错误日志",
157
+ console: "Console打印日志",
158
+ request: "Request请求日志",
159
+ logReport: "Logs日志",
160
+ uniBus: "UniBus函数日志",
161
+ };
162
+ Object.keys(keys).map((key) => {
163
+ let logs = devCache.get(key);
164
+ cacheSelectList.push({
165
+ name: keys[key],
166
+ check: logs.length > 0,
167
+ count: logs.length,
168
+ key,
169
+ });
170
+ });
171
+ // #ifdef H5
172
+ let indexDBList = await this.getIndexDBList();
173
+ let cookieLength = document.cookie.split(";").length;
174
+ if (document.cookie == "") {
175
+ cookieLength = 0;
176
+ }
177
+ // #endif
178
+
179
+ cacheSelectList = cacheSelectList.concat([
180
+ that.countStorageCache(),
181
+ // #ifdef H5
182
+ {
183
+ key: "sessionStorage",
184
+ name: "SessionStorage临时缓存",
185
+ check: sessionStorage.length > 0,
186
+ count: sessionStorage.length,
187
+ },
188
+ // #endif
189
+ // #ifdef APP-PLUS
190
+ {
191
+ key: "file",
192
+ name: "FileSys本地文件(_doc)",
193
+ check: false,
194
+ count: "未知 // TODO",
195
+ },
196
+ // #endif
197
+ // #ifdef MP-WEIXIN
198
+ {
199
+ name: "FileSys本地文件(FileSystemManager)",
200
+ check: false,
201
+ key: "file",
202
+ count: "未知 // TODO",
203
+ },
204
+ // #endif
205
+ // #ifdef H5
206
+ {
207
+ key: "cookie",
208
+ name: "Cookie",
209
+ check: cookieLength > 0,
210
+ count: cookieLength,
211
+ },
212
+ {
213
+ key: "IndexDB",
214
+ name: "IndexDB",
215
+ check: indexDBList.length > 0,
216
+ count: indexDBList.length,
217
+ },
218
+ // #endif
219
+ ]);
220
+
221
+ yes(cacheSelectList);
222
+ });
223
+ },
224
+ /**
225
+ * 统计本地缓存
226
+ */
227
+ countStorageCache() {
228
+ let n = 0;
229
+ // #ifdef APP-PLUS
230
+ let keys = plus.storage.getAllKeys();
231
+ for (let i = 0; i < keys.length; i++) {
232
+ const key = keys[i];
233
+ if (key.indexOf("devTools_") == 0) {
234
+ // 忽略以 devTools_ 开头的key
235
+ continue;
236
+ }
237
+ n++;
238
+ }
239
+ // #endif
240
+ // #ifdef H5
241
+ for (let i = 0; i < localStorage.length; i++) {
242
+ let key = localStorage.key(i);
243
+ if (key.indexOf("devTools_") == 0) {
244
+ continue;
245
+ }
246
+ n++;
247
+ }
248
+ // #endif
249
+ // #ifdef MP
250
+ let keyList = devCache.get("storage");
251
+ if (!keyList) keyList = [];
252
+ for (let i = 0; i < keyList.length; i++) {
253
+ const key = keyList[i];
254
+ if (key.indexOf("devTools_") == 0) {
255
+ continue;
256
+ }
257
+ n++;
258
+ }
259
+ // #endif
260
+ return {
261
+ key: "localStorage",
262
+ name: "localStorage本地缓存",
263
+ check: n > 0,
264
+ count: n,
265
+ };
266
+ },
267
+ /**
268
+ * 获取indexDB列表
269
+ */
270
+ getIndexDBList() {
271
+ return new Promise((yes) => {
272
+ try {
273
+ indexedDB.databases().then((list) => {
274
+ yes(list);
275
+ });
276
+ } catch (error) {
277
+ console.log("getIndexDBList error", error);
278
+ yes([]);
279
+ }
280
+ });
281
+ },
282
+ /**
283
+ * 选择清空的缓存项目
284
+ */
285
+ doSelectCache(index) {
286
+ this.cacheSelectList[index].check = !this.cacheSelectList[index].check;
287
+ },
288
+ /**
289
+ * 清空缓存
290
+ */
291
+ delCache() {
292
+ let that = this;
293
+
294
+ let selectedKey = [];
295
+ that.cacheSelectList.map((item) => {
296
+ if (item.check) {
297
+ selectedKey.push(item.key);
298
+ }
299
+ });
300
+
301
+ let keyDelFun = {
302
+ errorReport() {
303
+ devCache.clearItem("errorReport");
304
+ },
305
+ console() {
306
+ uni.$emit("devTools_delConsoleAll");
307
+ },
308
+ request() {
309
+ uni.$emit("devTools_delNetworkAll");
310
+ },
311
+ logReport() {
312
+ devCache.clearItem("logReport");
313
+ },
314
+ uniBus() {
315
+ uni.$emit("devTools_delUniBusAll");
316
+ },
317
+ localStorage() {
318
+ // #ifdef APP-PLUS
319
+ let keys = plus.storage.getAllKeys();
320
+ for (let i = 0; i < keys.length; i++) {
321
+ const key = String(keys[i]);
322
+ if (key.indexOf("devTools_") == 0) {
323
+ continue;
324
+ }
325
+ uni.removeStorageSync(key);
326
+ }
327
+ // #endif
328
+
329
+ // #ifdef H5
330
+ for (let i = 0; i < localStorage.length; i++) {
331
+ let key = String(localStorage.key(i));
332
+ if (key.indexOf("devTools_") == 0) {
333
+ continue;
334
+ }
335
+ setTimeout(() => {
336
+ localStorage.removeItem(key);
337
+ }, i * 2 + 1);
338
+ }
339
+ // #endif
340
+
341
+ // #ifdef MP
342
+ let keyList = devCache.get("storage");
343
+ if (!keyList) keyList = [];
344
+ for (let i = 0; i < keyList.length; i++) {
345
+ const key = keyList[i];
346
+ if (key.indexOf("devTools_") == 0) {
347
+ continue;
348
+ }
349
+ uni.removeStorageSync(key);
350
+ }
351
+ // #endif
352
+ },
353
+ sessionStorage() {
354
+ for (let i = 0; i < sessionStorage.length; i++) {
355
+ let key = String(sessionStorage.key(i));
356
+ if (key.indexOf("devTools_") == 0) {
357
+ continue;
358
+ }
359
+ sessionStorage.removeItem(key);
360
+ }
361
+ },
362
+ file() {
363
+ // #ifdef APP-PLUS
364
+ appDelDir("_doc/");
365
+ // #endif
366
+ // #ifdef MP-WEIXIN
367
+ let fs = wx.getFileSystemManager();
368
+ fs.rmdir({
369
+ dirPath: wx.env.USER_DATA_PATH + "/",
370
+ recursive: true,
371
+ });
372
+ // #endif
373
+ },
374
+ cookie() {
375
+ let keys = [];
376
+ document.cookie.split(";").forEach((cookieStr) => {
377
+ const [name, value] = cookieStr.trim().split("=");
378
+ keys.push(name);
379
+ });
380
+ keys.map((k) => {
381
+ document.cookie = `${k}=;expires=` + new Date(new Date().getTime() + 200).toGMTString() + ";path=/";
382
+ });
383
+ },
384
+ IndexDB() {
385
+ indexedDB.databases().then((list) => {
386
+ list.map((item) => {
387
+ indexedDB.deleteDatabase(item.name);
388
+ });
389
+ });
390
+ },
391
+ };
392
+
393
+ if (selectedKey.length == 0) {
394
+ return devUi.showToast({
395
+ title: "请先勾选需要清空的项目!",
396
+ icon: "none",
397
+ });
398
+ }
399
+ devUi.showLoading({
400
+ title: "清空中...",
401
+ mask: true,
402
+ });
403
+
404
+ setTimeout(() => {
405
+ devUi.hideLoading();
406
+ devUi.showToast({
407
+ title: "清空成功!",
408
+ icon: "success",
409
+ });
410
+ that.getPage();
411
+ }, 5100);
412
+
413
+ selectedKey.map((key) => {
414
+ keyDelFun[key]();
415
+ });
416
+ },
417
+ /**
418
+ * 导出日志文件到json
419
+ */
420
+ async exportJsonFile() {
421
+ let that = this;
422
+
423
+ // #ifdef MP
424
+ if (1) {
425
+ devUi.showToast({
426
+ title: "小程序平台不支持导出日志,建议直接上传至服务器!",
427
+ icon: "none",
428
+ });
429
+ return;
430
+ }
431
+ // #endif
432
+
433
+ devUi.showLoading({
434
+ title: "打包中...",
435
+ });
436
+
437
+ try {
438
+ let devOp = devOptions.getOptions();
439
+ let waitExportObject = {
440
+ exportOptions: {
441
+ version: devOp.version,
442
+ config: devOp,
443
+ exportTime: new Date().getTime(),
444
+ // #ifdef APP-PLUS
445
+ platform: "app",
446
+ // #endif
447
+ // #ifdef H5
448
+ platform: "h5",
449
+ // #endif
450
+ // #ifdef MP
451
+ platform: "mp",
452
+ // #endif
453
+ // #ifdef MP-WEIXIN
454
+ platform: "wx",
455
+ // #endif
456
+ // #ifdef MP-QQ
457
+ platform: "qq",
458
+ // #endif
459
+ },
460
+ error: devCache.get("errorReport"),
461
+ console: devCache.get("console"),
462
+ network: devCache.get("request"),
463
+ logs: devCache.get("logReport"), // ! 运行日志
464
+ info: await getRuntimeInfo(), // ! 当前运行的系统信息
465
+ uniBus: devCache.get("uniBus"),
466
+ busCount: devCache.get("busCount"),
467
+ pageRouteMap: devCache.get("pageRouteMap"),
468
+ pageRouteKeyMap: devCache.get("pageRouteKeyMap"),
469
+ storage: {},
470
+ sessionStorage: {},
471
+ cookie: {},
472
+ ...that.getCache(),
473
+ };
474
+
475
+ try {
476
+ if (that.$store.state) {
477
+ waitExportObject.vuex = that.$store.state;
478
+ }
479
+ } catch (error) {}
480
+ try {
481
+ if (uni.Pinia) {
482
+ waitExportObject.pinia = uni.Pinia.getActivePinia().state.value;
483
+ } else if (that.$pinia.state.value) {
484
+ waitExportObject.pinia = that.$pinia.state.value;
485
+ }
486
+ } catch (error) {}
487
+ try {
488
+ if (getApp().globalData) {
489
+ waitExportObject.globalData = getApp().globalData;
490
+ }
491
+ } catch (error) {}
492
+
493
+ let data = jsonCompress.safeJsonStringify(waitExportObject);
494
+ data = JSON.parse(data);
495
+ data = JSON.stringify(data, null, 2);
496
+ let t = new Date().getTime();
497
+ let exportFileName = `export_devtools_log_${t}.json`;
498
+
499
+ // #ifdef H5
500
+ const blob = new Blob([data], { type: "application/json" });
501
+ const url = URL.createObjectURL(blob);
502
+ const a = document.createElement("a");
503
+ a.style = "display: none";
504
+ a.download = exportFileName;
505
+ a.href = url;
506
+ document.body.appendChild(a);
507
+ a.click();
508
+ devUi.showToast({
509
+ title: "导出成功!",
510
+ icon: "success",
511
+ });
512
+ // #endif
513
+
514
+ // #ifdef APP-PLUS
515
+ plus.io.resolveLocalFileSystemURL(
516
+ "_downloads/",
517
+ (entry) => {
518
+ entry.getFile(
519
+ exportFileName,
520
+ {
521
+ create: true,
522
+ },
523
+ (fileEntry) => {
524
+ fileEntry.createWriter((writer) => {
525
+ writer.onwrite = (e) => {
526
+ devUi.hideLoading();
527
+ devUi.showModal({
528
+ title: "导出成功",
529
+ content: "文件导出成功!已保存至公共下载路径,文件名称:" + exportFileName,
530
+ });
531
+ };
532
+ writer.onerror = () => {
533
+ devUi.hideLoading();
534
+ devUi.showToast({
535
+ title: "日志导出失败!_写入文件失败",
536
+ icon: "none",
537
+ });
538
+ };
539
+ writer.write(data);
540
+ });
541
+ }
542
+ );
543
+ },
544
+ (err) => {
545
+ console.log("err", err);
546
+ devUi.hideLoading();
547
+ devUi.showToast({
548
+ title: "文件保存失败!_打开目录失败",
549
+ icon: "none",
550
+ });
551
+ }
552
+ );
553
+ // #endif
554
+
555
+ devUi.hideLoading();
556
+ } catch (error) {
557
+ if (error && error.message) {
558
+ console.log("导出失败!", error.message);
559
+ } else {
560
+ console.log("导出失败!", error);
561
+ }
562
+
563
+ devUi.hideLoading();
564
+ devUi.showToast({
565
+ title: "导出失败!",
566
+ icon: "error",
567
+ });
568
+ }
569
+ },
570
+ /**
571
+ * 获取缓存数据
572
+ */
573
+ getCache() {
574
+ let data = {
575
+ storage: {},
576
+ sessionStorage: {},
577
+ cookie: {},
578
+ };
579
+
580
+ // #ifdef APP-PLUS
581
+ let keys = plus.storage.getAllKeys();
582
+ for (let i = 0; i < keys.length; i++) {
583
+ const key = keys[i];
584
+ if (key.indexOf("devTools_") == 0) {
585
+ // 忽略以 devTools_ 开头的key
586
+ continue;
587
+ }
588
+ data.storage[key] = uni.getStorageSync(key);
589
+ }
590
+ // #endif
591
+
592
+ // #ifdef H5
593
+
594
+ for (let i = 0; i < localStorage.length; i++) {
595
+ let key = localStorage.key(i);
596
+ if (key.indexOf("devTools_") == 0) {
597
+ continue;
598
+ }
599
+ let value = uni.getStorageSync(key);
600
+ data.storage[key] = value;
601
+ }
602
+
603
+ for (let i = 0; i < sessionStorage.length; i++) {
604
+ let key = sessionStorage.key(i);
605
+ if (key.indexOf("devTools_") == 0) {
606
+ continue;
607
+ }
608
+ let value = sessionStorage.getItem(key);
609
+ data.sessionStorage[key] = value;
610
+ }
611
+
612
+ document.cookie.split(";").forEach((cookieStr) => {
613
+ const [name, value] = cookieStr.trim().split("=");
614
+ data.cookie[name] = value;
615
+ });
616
+ // #endif
617
+
618
+ // #ifdef MP
619
+ let keyList = devCache.get("storage");
620
+ if (!keyList) keyList = [];
621
+ for (let i = 0; i < keyList.length; i++) {
622
+ const key = keyList[i];
623
+ if (key.indexOf("devTools_") == 0) {
624
+ continue;
625
+ }
626
+ let value = uni.getStorageSync(key);
627
+ if (value) {
628
+ data.storage[key] = value;
629
+ }
630
+ }
631
+ // #endif
632
+
633
+ return data;
634
+ },
635
+ },
636
+ };
637
+ </script>
638
+ <style lang="scss" scoped>
639
+ .settingView {
640
+ display: flex;
641
+ flex-direction: column;
642
+ width: 100%;
643
+ box-sizing: border-box;
644
+ padding: 0 20rpx;
645
+ .loading {
646
+ width: 100%;
647
+ margin: 10rpx 0;
648
+ height: 220rpx;
649
+ border-radius: 16rpx;
650
+ border: 1px solid rgba(148, 163, 184, 0.2);
651
+ background: #f8fafc;
652
+ display: flex;
653
+ flex-direction: row;
654
+ align-items: center;
655
+ justify-content: center;
656
+ .loadingText {
657
+ font-size: 24rpx;
658
+ color: #64748b;
659
+ }
660
+ }
661
+ .divisionLine {
662
+ width: 100%;
663
+ margin: 8rpx 0;
664
+ height: 12rpx;
665
+ border-radius: 999rpx;
666
+ background-color: #f1f5f9;
667
+ }
668
+ .checkboxItem {
669
+ display: flex;
670
+ flex-direction: row;
671
+ padding: 12rpx 16rpx;
672
+ width: 100%;
673
+ box-sizing: border-box;
674
+ margin-left: 0;
675
+ margin-bottom: 8rpx;
676
+ border-radius: 14rpx;
677
+ border: 1px solid rgba(148, 163, 184, 0.18);
678
+ background: #fff;
679
+ box-shadow: 0 2rpx 10rpx rgba(15, 23, 42, 0.04);
680
+ align-items: center;
681
+ &:active {
682
+ background-color: rgba(59, 130, 246, 0.04);
683
+ }
684
+ .name {
685
+ font-size: 24rpx;
686
+ margin-left: 10rpx;
687
+ line-height: 32rpx;
688
+ }
689
+ .count {
690
+ font-size: 22rpx;
691
+ margin-left: 10rpx;
692
+ color: #3b82f6;
693
+ }
694
+ .empty {
695
+ font-size: 22rpx;
696
+ margin-left: 10rpx;
697
+ color: #94a3b8;
698
+ }
699
+ }
700
+ .delBtn {
701
+ width: 100%;
702
+ margin-left: 0;
703
+ border-radius: 14rpx;
704
+ height: 64rpx;
705
+ display: flex;
706
+ flex-direction: row;
707
+ align-items: center;
708
+ justify-content: center;
709
+ background-color: #dc2626;
710
+ margin-top: 14rpx;
711
+ margin-bottom: 30rpx;
712
+ &:active {
713
+ background-color: rgba(220, 38, 38, 0.85);
714
+ }
715
+ .delBtnText {
716
+ font-size: 23rpx;
717
+ color: #fff;
718
+ }
719
+ }
720
+ .exportBtn {
721
+ background-color: rgb(59, 130, 246);
722
+ &:active {
723
+ background-color: rgba(59, 130, 246, 0.85);
724
+ }
725
+ }
726
+ }
727
+ .objectAnalysisView {
728
+ width: 100%;
729
+ box-sizing: border-box;
730
+ margin-left: 0;
731
+ margin-top: 8rpx;
732
+ margin-bottom: 20rpx;
733
+ }
734
+ </style>