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