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