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,555 @@
1
+ <template>
2
+ <view v-show="visible" class="devtools-ui-host">
3
+ <view v-if="loading.show" class="loading-mask" :class="{ passthrough: !loading.mask }">
4
+ <view class="loading-card">
5
+ <view class="loading-spinner"></view>
6
+ <text class="loading-text">{{ loading.title || '加载中...' }}</text>
7
+ </view>
8
+ </view>
9
+
10
+ <view v-if="modal.show" class="modal-mask" @click="onModalMaskClick">
11
+ <view class="modal-card" :class="`tone-${modal.tone}`" @click.stop>
12
+ <view class="modal-head">
13
+ <view class="modal-head-dot"></view>
14
+ <text class="modal-title">{{ modal.title }}</text>
15
+ </view>
16
+ <text class="modal-content">{{ modal.content }}</text>
17
+ <view class="modal-actions">
18
+ <view v-if="modal.showCancel" class="modal-btn cancel" @click="closeModal(false)">
19
+ <text class="modal-btn-text" :style="{ color: modal.cancelColor }">{{ modal.cancelText }}</text>
20
+ </view>
21
+ <view class="modal-btn confirm" @click="closeModal(true)">
22
+ <text class="modal-btn-text" :style="{ color: modal.confirmColor }">{{ modal.confirmText }}</text>
23
+ </view>
24
+ </view>
25
+ </view>
26
+ </view>
27
+
28
+ <view v-if="actionSheet.show" class="action-sheet-mask" @click="closeActionSheet(-1)">
29
+ <view class="action-sheet-wrap" @click.stop>
30
+ <view class="action-sheet-card">
31
+ <text v-if="actionSheet.title" class="action-sheet-title">
32
+ {{ actionSheet.title }}
33
+ </text>
34
+ <view
35
+ v-for="(item, index) in actionSheet.itemList"
36
+ :key="`${index}_${item.title}`"
37
+ class="action-sheet-item"
38
+ @click="closeActionSheet(index)"
39
+ >
40
+ <view class="action-sheet-item-content">
41
+ <text
42
+ class="action-sheet-item-text"
43
+ :style="{
44
+ color:
45
+ index === actionSheet.destructiveIndex
46
+ ? '#dc2626'
47
+ : index === actionSheet.selectedIndex
48
+ ? actionSheet.selectedColor || '#2563eb'
49
+ : actionSheet.itemColor || '#1e3a8a'
50
+ }"
51
+ >
52
+ {{ item.title }}
53
+ </text>
54
+ <text v-if="item.msg" class="action-sheet-item-msg">
55
+ {{ item.msg }}
56
+ </text>
57
+ </view>
58
+ </view>
59
+ </view>
60
+ <view class="action-sheet-cancel" @click="closeActionSheet(-1)">
61
+ <text class="action-sheet-cancel-text">{{ actionSheet.cancelText || '取消' }}</text>
62
+ </view>
63
+ </view>
64
+ </view>
65
+
66
+ <view v-if="toast.show" class="toast-wrap">
67
+ <view class="toast-card" :class="`type-${toastType}`">
68
+ <view class="toast-dot"></view>
69
+ <text class="toast-text">{{ toast.title }}</text>
70
+ </view>
71
+ </view>
72
+ </view>
73
+ </template>
74
+
75
+ <script setup>
76
+ import { computed, onBeforeUnmount, onMounted, reactive } from 'vue'
77
+
78
+ const EVENT_HOST_READY = 'devTools_ui_host_ready'
79
+ const EVENT_HOST_DESTROYED = 'devTools_ui_host_destroyed'
80
+ const EVENT_MODAL_SHOW = 'devTools_ui_modal_show'
81
+ const EVENT_TOAST_SHOW = 'devTools_ui_toast_show'
82
+ const EVENT_LOADING_SHOW = 'devTools_ui_loading_show'
83
+ const EVENT_LOADING_HIDE = 'devTools_ui_loading_hide'
84
+ const EVENT_ACTION_SHEET_SHOW = 'devTools_ui_action_sheet_show'
85
+
86
+ let toastTimer = 0
87
+ let activeModalEvent = ''
88
+ let activeActionSheetEvent = ''
89
+
90
+ const modal = reactive({
91
+ show: false,
92
+ title: '提示',
93
+ content: '',
94
+ tone: 'default',
95
+ showCancel: true,
96
+ cancelText: '取消',
97
+ cancelColor: '#6b7280',
98
+ confirmText: '确定',
99
+ confirmColor: '#3b82f6'
100
+ })
101
+
102
+ const toast = reactive({
103
+ show: false,
104
+ title: '',
105
+ icon: 'none'
106
+ })
107
+
108
+ const loading = reactive({
109
+ show: false,
110
+ title: '加载中...',
111
+ mask: false
112
+ })
113
+
114
+ const actionSheet = reactive({
115
+ show: false,
116
+ title: '',
117
+ itemList: [],
118
+ itemColor: '#1e3a8a',
119
+ selectedIndex: -1,
120
+ selectedColor: '#2563eb',
121
+ cancelText: '取消',
122
+ destructiveIndex: -1
123
+ })
124
+
125
+ const visible = computed(() => modal.show || toast.show || loading.show || actionSheet.show)
126
+ const toastType = computed(() => {
127
+ if (toast.icon === 'success') return 'success'
128
+ if (toast.icon === 'error') return 'error'
129
+ return 'info'
130
+ })
131
+
132
+ function openModal(payload = {}) {
133
+ const options = payload.options || {}
134
+ activeModalEvent = payload.resultEvent || ''
135
+ modal.show = true
136
+ modal.title = options.title || '提示'
137
+ modal.content = options.content || ''
138
+ modal.tone = options.tone || 'default'
139
+ modal.showCancel = options.showCancel !== false
140
+ modal.cancelText = options.cancelText || '取消'
141
+ modal.cancelColor = options.cancelColor || '#6b7280'
142
+ modal.confirmText = options.confirmText || '确定'
143
+ modal.confirmColor = options.confirmColor || '#3b82f6'
144
+ }
145
+
146
+ function closeModal(confirm) {
147
+ const res = {
148
+ confirm,
149
+ cancel: !confirm,
150
+ errMsg: 'showModal:ok'
151
+ }
152
+ const eventName = activeModalEvent
153
+ modal.show = false
154
+ activeModalEvent = ''
155
+ if (eventName) {
156
+ uni.$emit(eventName, res)
157
+ // 兼容未实现 $once 的运行时,确保 $on 监听也能及时释放
158
+ uni.$off(eventName)
159
+ }
160
+ }
161
+
162
+ function onModalMaskClick() {
163
+ if (!modal.showCancel) return
164
+ closeModal(false)
165
+ }
166
+
167
+ function openActionSheet(payload = {}) {
168
+ const options = payload.options || {}
169
+ activeActionSheetEvent = payload.resultEvent || ''
170
+ actionSheet.show = true
171
+ actionSheet.title = options.title || ''
172
+ actionSheet.itemList = Array.isArray(options.itemList)
173
+ ? options.itemList.map((item) => {
174
+ if (item && typeof item === 'object') {
175
+ return {
176
+ title: String(item.title || item.text || ''),
177
+ msg: item.msg ? String(item.msg) : ''
178
+ }
179
+ }
180
+ return {
181
+ title: String(item),
182
+ msg: ''
183
+ }
184
+ })
185
+ : []
186
+ actionSheet.itemColor = options.itemColor || '#1e3a8a'
187
+ actionSheet.selectedIndex = typeof options.selectedIndex === 'number' ? options.selectedIndex : -1
188
+ actionSheet.selectedColor = options.selectedColor || '#2563eb'
189
+ actionSheet.cancelText = options.cancelText || '取消'
190
+ actionSheet.destructiveIndex = typeof options.destructiveIndex === 'number' ? options.destructiveIndex : -1
191
+ }
192
+
193
+ function closeActionSheet(tapIndex = -1) {
194
+ const eventName = activeActionSheetEvent
195
+ actionSheet.show = false
196
+ activeActionSheetEvent = ''
197
+ const res = {
198
+ tapIndex,
199
+ cancel: tapIndex < 0,
200
+ errMsg: tapIndex < 0 ? 'showActionSheet:fail cancel' : 'showActionSheet:ok'
201
+ }
202
+ if (eventName) {
203
+ uni.$emit(eventName, res)
204
+ uni.$off(eventName)
205
+ }
206
+ }
207
+
208
+ function openToast(options = {}) {
209
+ toast.show = true
210
+ toast.title = options.title || ''
211
+ toast.icon = options.icon || 'none'
212
+ if (toastTimer) {
213
+ clearTimeout(toastTimer)
214
+ toastTimer = 0
215
+ }
216
+ const duration = typeof options.duration === 'number' ? options.duration : 1500
217
+ toastTimer = setTimeout(() => {
218
+ toast.show = false
219
+ }, Math.max(duration, 300))
220
+ }
221
+
222
+ function showLoading(options = {}) {
223
+ loading.show = true
224
+ loading.title = options.title || '加载中...'
225
+ loading.mask = options.mask === true
226
+ }
227
+
228
+ function hideLoading() {
229
+ loading.show = false
230
+ }
231
+
232
+ onMounted(() => {
233
+ uni.$on(EVENT_MODAL_SHOW, openModal)
234
+ uni.$on(EVENT_ACTION_SHEET_SHOW, openActionSheet)
235
+ uni.$on(EVENT_TOAST_SHOW, openToast)
236
+ uni.$on(EVENT_LOADING_SHOW, showLoading)
237
+ uni.$on(EVENT_LOADING_HIDE, hideLoading)
238
+ uni.$emit(EVENT_HOST_READY)
239
+ })
240
+
241
+ onBeforeUnmount(() => {
242
+ if (toastTimer) {
243
+ clearTimeout(toastTimer)
244
+ toastTimer = 0
245
+ }
246
+ uni.$off(EVENT_MODAL_SHOW, openModal)
247
+ uni.$off(EVENT_ACTION_SHEET_SHOW, openActionSheet)
248
+ uni.$off(EVENT_TOAST_SHOW, openToast)
249
+ uni.$off(EVENT_LOADING_SHOW, showLoading)
250
+ uni.$off(EVENT_LOADING_HIDE, hideLoading)
251
+ uni.$emit(EVENT_HOST_DESTROYED)
252
+ })
253
+ </script>
254
+
255
+ <style scoped lang="scss">
256
+ .devtools-ui-host {
257
+ position: fixed;
258
+ inset: 0;
259
+ z-index: 2147483647;
260
+ pointer-events: none;
261
+ }
262
+
263
+ .modal-mask,
264
+ .loading-mask,
265
+ .action-sheet-mask {
266
+ position: absolute;
267
+ inset: 0;
268
+ display: flex;
269
+ align-items: flex-end;
270
+ justify-content: center;
271
+ pointer-events: auto;
272
+ }
273
+
274
+ .modal-mask,
275
+ .loading-mask {
276
+ align-items: center;
277
+ }
278
+
279
+ .modal-mask {
280
+ background: rgba(15, 23, 42, 0.52);
281
+ backdrop-filter: blur(2px);
282
+ }
283
+
284
+ .modal-card {
285
+ width: 640rpx;
286
+ border-radius: 22rpx;
287
+ background: linear-gradient(180deg, #f8fbff 0%, #ffffff 45%);
288
+ overflow: hidden;
289
+ border: 1px solid rgba(59, 130, 246, 0.28);
290
+ box-shadow: 0 14rpx 36rpx rgba(15, 23, 42, 0.25);
291
+ }
292
+
293
+ .modal-card.tone-warning {
294
+ border-color: rgba(220, 38, 38, 0.35);
295
+ background: linear-gradient(180deg, #fff7f7 0%, #ffffff 45%);
296
+ }
297
+
298
+ .modal-head {
299
+ display: flex;
300
+ align-items: center;
301
+ gap: 10rpx;
302
+ padding: 24rpx 28rpx 4rpx;
303
+ }
304
+
305
+ .modal-head-dot {
306
+ width: 12rpx;
307
+ height: 12rpx;
308
+ border-radius: 50%;
309
+ background: #3b82f6;
310
+ box-shadow: 0 0 0 6rpx #dbeafe;
311
+ }
312
+
313
+ .modal-card.tone-warning .modal-head-dot {
314
+ background: #ef4444;
315
+ box-shadow: 0 0 0 6rpx rgba(254, 226, 226, 0.95);
316
+ }
317
+
318
+ .modal-title {
319
+ display: block;
320
+ font-size: 30rpx;
321
+ line-height: 38rpx;
322
+ color: #0f172a;
323
+ font-weight: 600;
324
+ }
325
+
326
+ .modal-card.tone-warning .modal-title {
327
+ color: #b91c1c;
328
+ }
329
+
330
+ .modal-content {
331
+ display: block;
332
+ padding: 6rpx 28rpx 28rpx;
333
+ font-size: 26rpx;
334
+ line-height: 36rpx;
335
+ color: #334155;
336
+ }
337
+
338
+ .modal-card.tone-warning .modal-content {
339
+ color: #dc2626;
340
+ }
341
+
342
+ .modal-actions {
343
+ display: flex;
344
+ border-top: 1px solid rgba(148, 163, 184, 0.28);
345
+ background: #f8fafc;
346
+ }
347
+
348
+ .modal-btn {
349
+ flex: 1;
350
+ height: 88rpx;
351
+ display: flex;
352
+ align-items: center;
353
+ justify-content: center;
354
+ transition: background-color 0.15s ease;
355
+ &:active {
356
+ background: rgba(59, 130, 246, 0.09);
357
+ }
358
+ }
359
+
360
+ .modal-btn.cancel {
361
+ border-right: 1px solid rgba(148, 163, 184, 0.28);
362
+ }
363
+
364
+ .modal-btn-text {
365
+ font-size: 28rpx;
366
+ line-height: 28rpx;
367
+ font-weight: 500;
368
+ }
369
+
370
+ .toast-wrap {
371
+ position: absolute;
372
+ left: 50%;
373
+ bottom: 210rpx;
374
+ transform: translateX(-50%);
375
+ pointer-events: none;
376
+ }
377
+
378
+ .toast-card {
379
+ min-width: 220rpx;
380
+ max-width: 560rpx;
381
+ padding: 16rpx 24rpx;
382
+ border-radius: 14rpx;
383
+ display: flex;
384
+ flex-direction: row;
385
+ align-items: center;
386
+ gap: 12rpx;
387
+ border: 1px solid rgba(148, 163, 184, 0.35);
388
+ box-shadow: 0 8rpx 24rpx rgba(15, 23, 42, 0.22);
389
+ }
390
+
391
+ .toast-card.type-info {
392
+ background: rgba(15, 23, 42, 0.9);
393
+ }
394
+
395
+ .toast-card.type-success {
396
+ background: rgba(22, 163, 74, 0.95);
397
+ }
398
+
399
+ .toast-card.type-error {
400
+ background: rgba(220, 38, 38, 0.96);
401
+ }
402
+
403
+ .toast-dot {
404
+ width: 10rpx;
405
+ height: 10rpx;
406
+ border-radius: 50%;
407
+ background: rgba(255, 255, 255, 0.9);
408
+ }
409
+
410
+ .toast-text {
411
+ display: inline-block;
412
+ font-size: 24rpx;
413
+ line-height: 32rpx;
414
+ color: #fff;
415
+ text-align: left;
416
+ word-break: break-all;
417
+ }
418
+
419
+ .loading-mask {
420
+ background: rgba(15, 23, 42, 0.36);
421
+ }
422
+
423
+ .action-sheet-mask {
424
+ background: rgba(15, 23, 42, 0.52);
425
+ backdrop-filter: blur(2px);
426
+ }
427
+
428
+ .action-sheet-wrap {
429
+ width: 710rpx;
430
+ margin-bottom: 26rpx;
431
+ display: flex;
432
+ flex-direction: column;
433
+ gap: 14rpx;
434
+ }
435
+
436
+ .action-sheet-card {
437
+ border-radius: 20rpx;
438
+ overflow: hidden;
439
+ background: linear-gradient(180deg, #f8fbff 0%, #ffffff 40%);
440
+ border: 1px solid rgba(59, 130, 246, 0.2);
441
+ box-shadow: 0 14rpx 36rpx rgba(15, 23, 42, 0.26);
442
+ }
443
+
444
+ .action-sheet-title {
445
+ display: block;
446
+ padding: 24rpx 26rpx 16rpx;
447
+ font-size: 22rpx;
448
+ line-height: 32rpx;
449
+ color: #64748b;
450
+ text-align: center;
451
+ border-bottom: 1px solid rgba(148, 163, 184, 0.2);
452
+ }
453
+
454
+ .action-sheet-item {
455
+ min-height: 92rpx;
456
+ display: flex;
457
+ align-items: center;
458
+ justify-content: center;
459
+ border-bottom: 1px solid rgba(148, 163, 184, 0.16);
460
+ &:last-child {
461
+ border-bottom: none;
462
+ }
463
+ &:active {
464
+ background: rgba(59, 130, 246, 0.08);
465
+ }
466
+ }
467
+
468
+ .action-sheet-item-content {
469
+ width: 100%;
470
+ padding: 14rpx 16rpx;
471
+ display: flex;
472
+ flex-direction: column;
473
+ align-items: center;
474
+ justify-content: center;
475
+ }
476
+
477
+ .action-sheet-item-text {
478
+ font-size: 30rpx;
479
+ line-height: 38rpx;
480
+ font-weight: 500;
481
+ }
482
+
483
+ .action-sheet-item-msg {
484
+ margin-top: 6rpx;
485
+ font-size: 23rpx;
486
+ line-height: 31rpx;
487
+ color: #94a3b8;
488
+ }
489
+
490
+ .action-sheet-cancel {
491
+ height: 92rpx;
492
+ border-radius: 20rpx;
493
+ background: #fff;
494
+ border: 1px solid rgba(148, 163, 184, 0.24);
495
+ box-shadow: 0 10rpx 26rpx rgba(15, 23, 42, 0.18);
496
+ display: flex;
497
+ align-items: center;
498
+ justify-content: center;
499
+ &:active {
500
+ background: #f8fafc;
501
+ }
502
+ }
503
+
504
+ .action-sheet-cancel-text {
505
+ font-size: 30rpx;
506
+ line-height: 38rpx;
507
+ color: #334155;
508
+ font-weight: 500;
509
+ }
510
+
511
+ .loading-mask.passthrough {
512
+ pointer-events: none;
513
+ background: transparent;
514
+ }
515
+
516
+ .loading-card {
517
+ width: 210rpx;
518
+ min-height: 176rpx;
519
+ padding: 24rpx 18rpx;
520
+ border-radius: 18rpx;
521
+ background: rgba(15, 23, 42, 0.9);
522
+ border: 1px solid rgba(59, 130, 246, 0.35);
523
+ display: flex;
524
+ flex-direction: column;
525
+ align-items: center;
526
+ justify-content: center;
527
+ box-shadow: 0 10rpx 26rpx rgba(15, 23, 42, 0.35);
528
+ }
529
+
530
+ .loading-spinner {
531
+ width: 48rpx;
532
+ height: 48rpx;
533
+ border-radius: 50%;
534
+ border: 4rpx solid rgba(59, 130, 246, 0.25);
535
+ border-top-color: #60a5fa;
536
+ animation: spin 0.66s linear infinite;
537
+ }
538
+
539
+ .loading-text {
540
+ margin-top: 14rpx;
541
+ font-size: 23rpx;
542
+ line-height: 31rpx;
543
+ color: #e2e8f0;
544
+ text-align: center;
545
+ }
546
+
547
+ @keyframes spin {
548
+ from {
549
+ transform: rotate(0deg);
550
+ }
551
+ to {
552
+ transform: rotate(360deg);
553
+ }
554
+ }
555
+ </style>
@@ -0,0 +1,61 @@
1
+ let config = {
2
+ status: true, //调试工具总开关
3
+ bubble: {
4
+ //调试弹窗气泡设置
5
+ status: true, // 气泡标签是否显示,生产环境建议关闭
6
+ text: 'DevTools', // 气泡上展示的文字
7
+ color: '#ffffff', // 气泡文字颜色
8
+ bgColor: 'rgba(250, 53, 52,0.7)' // 气泡背景颜色
9
+ },
10
+
11
+ // 注意: 以下配置不建议更改
12
+ console: {
13
+ //console日志配置
14
+ status: true, //功能总开关
15
+ isOutput: true, //打印的日志是否对外输出到浏览器调试界面,建议在生产环境时关闭
16
+ cache: {
17
+ status: true, //是否启用本地缓存
18
+ size: 512 * 1024, //缓存上限,单位byte
19
+ rowSize: 1024 * 4 //单条记录缓存上限,单位byte
20
+ }
21
+ },
22
+ uniBus: {
23
+ // uni event bus 监听设置
24
+ status: true,
25
+ cache: {
26
+ status: true,
27
+ size: 1024 * 512, // bus调用日志上限 byte
28
+ rowSize: 1024 * 10,
29
+ countMaxSize: 1024 * 10 // bus统计上限 byte
30
+ }
31
+ },
32
+ error: {
33
+ //报错拦截配置
34
+ status: true,
35
+ cache: {
36
+ status: true,
37
+ size: 512 * 1024,
38
+ rowSize: 1024 * 4
39
+ }
40
+ },
41
+ network: {
42
+ //请求拦截配置
43
+ status: true,
44
+ cache: {
45
+ status: true,
46
+ size: 512 * 1024,
47
+ rowSize: 1024 * 4
48
+ }
49
+ },
50
+ logs: {
51
+ //运行日志
52
+ status: true,
53
+ cache: {
54
+ status: true,
55
+ size: 512 * 1024,
56
+ rowSize: 1024 * 4
57
+ }
58
+ }
59
+ }
60
+
61
+ export default config