npmapps 1.1.6 → 1.2.0

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 (178) hide show
  1. package/package.json +1 -1
  2. package/app/wujie-wk/dev.log +0 -1979
  3. package/app/wujie-wk/wujie-react-child/README.md +0 -126
  4. package/app/wujie-wk/wujie-react-child/eslint.config.js +0 -28
  5. package/app/wujie-wk/wujie-react-child/index.html +0 -13
  6. package/app/wujie-wk/wujie-react-child/package-lock.json +0 -4344
  7. package/app/wujie-wk/wujie-react-child/package.json +0 -32
  8. package/app/wujie-wk/wujie-react-child/public/vite.svg +0 -1
  9. package/app/wujie-wk/wujie-react-child/src/App.css +0 -0
  10. package/app/wujie-wk/wujie-react-child/src/App.tsx +0 -72
  11. package/app/wujie-wk/wujie-react-child/src/assets/react.svg +0 -1
  12. package/app/wujie-wk/wujie-react-child/src/components/FeatureCards.css +0 -63
  13. package/app/wujie-wk/wujie-react-child/src/components/FeatureCards.tsx +0 -112
  14. package/app/wujie-wk/wujie-react-child/src/components/LightCard/index.tsx +0 -36
  15. package/app/wujie-wk/wujie-react-child/src/components/LightCard/style.css +0 -20
  16. package/app/wujie-wk/wujie-react-child/src/hooks/use3DCard.ts +0 -53
  17. package/app/wujie-wk/wujie-react-child/src/hooks/useLightCard.ts +0 -141
  18. package/app/wujie-wk/wujie-react-child/src/index.css +0 -0
  19. package/app/wujie-wk/wujie-react-child/src/main.tsx +0 -8
  20. package/app/wujie-wk/wujie-react-child/src/pages/ChildToParent/index.css +0 -55
  21. package/app/wujie-wk/wujie-react-child/src/pages/ChildToParent/index.tsx +0 -88
  22. package/app/wujie-wk/wujie-react-child/src/pages/Css.tsx +0 -28
  23. package/app/wujie-wk/wujie-react-child/src/pages/Home.tsx +0 -72
  24. package/app/wujie-wk/wujie-react-child/src/pages/ParentToChild.css +0 -85
  25. package/app/wujie-wk/wujie-react-child/src/pages/ParentToChild.tsx +0 -119
  26. package/app/wujie-wk/wujie-react-child/src/pages/RouterJump/index.css +0 -61
  27. package/app/wujie-wk/wujie-react-child/src/pages/RouterJump/index.tsx +0 -87
  28. package/app/wujie-wk/wujie-react-child/src/router/index.tsx +0 -63
  29. package/app/wujie-wk/wujie-react-child/src/types/wujie.d.ts +0 -26
  30. package/app/wujie-wk/wujie-react-child/src/vite-env.d.ts +0 -1
  31. package/app/wujie-wk/wujie-react-child/tsconfig.app.json +0 -26
  32. package/app/wujie-wk/wujie-react-child/tsconfig.json +0 -7
  33. package/app/wujie-wk/wujie-react-child/tsconfig.node.json +0 -24
  34. package/app/wujie-wk/wujie-react-child/vite.config.ts +0 -10
  35. package/app/wujie-wk/wujie-vue3-child/.claude/settings.local.json +0 -8
  36. package/app/wujie-wk/wujie-vue3-child/.vscode/extensions.json +0 -3
  37. package/app/wujie-wk/wujie-vue3-child/PROJECT_MEMORY.md +0 -427
  38. package/app/wujie-wk/wujie-vue3-child/README.md +0 -5
  39. package/app/wujie-wk/wujie-vue3-child/index.html +0 -13
  40. package/app/wujie-wk/wujie-vue3-child/package-lock.json +0 -5744
  41. package/app/wujie-wk/wujie-vue3-child/package.json +0 -28
  42. package/app/wujie-wk/wujie-vue3-child/public/vite.svg +0 -1
  43. package/app/wujie-wk/wujie-vue3-child/src/App.vue +0 -130
  44. package/app/wujie-wk/wujie-vue3-child/src/assets/vue.svg +0 -1
  45. package/app/wujie-wk/wujie-vue3-child/src/components/HelloWorld.vue +0 -43
  46. package/app/wujie-wk/wujie-vue3-child/src/components/SmartAnchorTabs/index.jsx +0 -224
  47. package/app/wujie-wk/wujie-vue3-child/src/components/SmartAnchorTabs/style.css +0 -154
  48. package/app/wujie-wk/wujie-vue3-child/src/components/tags-view.vue +0 -193
  49. package/app/wujie-wk/wujie-vue3-child/src/components/tags-view1.vue +0 -131
  50. package/app/wujie-wk/wujie-vue3-child/src/directives/aiLoading.js +0 -182
  51. package/app/wujie-wk/wujie-vue3-child/src/hooks/useClickOutside.js +0 -11
  52. package/app/wujie-wk/wujie-vue3-child/src/hooks/useTableDragSort.js +0 -28
  53. package/app/wujie-wk/wujie-vue3-child/src/main.js +0 -18
  54. package/app/wujie-wk/wujie-vue3-child/src/router/index.js +0 -104
  55. package/app/wujie-wk/wujie-vue3-child/src/store/tagsViewStroe.js +0 -34
  56. package/app/wujie-wk/wujie-vue3-child/src/style.css +0 -171
  57. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/collapseExpand/index.jsx +0 -108
  58. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/collapseExpand/index.module.scss +0 -97
  59. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/README.md +0 -836
  60. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/REFLEX_EXAMPLES.md +0 -728
  61. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/DepartmentPersonnelSelector.jsx +0 -687
  62. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/DepartmentPersonnelSelector.module.scss +0 -560
  63. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/DepartmentSelector.jsx +0 -570
  64. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/DepartmentSelector.module.scss +0 -330
  65. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/DepartmentSelectorV2.jsx +0 -378
  66. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/DepartmentSelectorV2.module.scss +0 -228
  67. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/OptionsSelector.jsx +0 -399
  68. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/OptionsSelector.module.scss +0 -252
  69. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/PersonnelSelector.jsx +0 -585
  70. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/PersonnelSelector.module.scss +0 -331
  71. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/PopoverSelector.jsx +0 -392
  72. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/PopoverSelector.module.scss +0 -39
  73. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/README.md +0 -248
  74. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/SelectorTrigger.jsx +0 -194
  75. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/index.jsx +0 -1459
  76. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/mockData.js +0 -301
  77. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/dialogueSegment/index.jsx +0 -182
  78. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/dialogueSegment/index.module.scss +0 -28
  79. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/index.jsx +0 -375
  80. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/ChartsPanel/index.jsx +0 -121
  81. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/ChartsPanel/index.module.scss +0 -76
  82. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/DonutChart/index.jsx +0 -104
  83. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/PracticeTable/index.jsx +0 -75
  84. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/PracticeTable/index.module.scss +0 -12
  85. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/RankBarChart/index.jsx +0 -62
  86. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/RankBarChart/index.module.scss +0 -43
  87. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/RankingGroup/index.jsx +0 -29
  88. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/RankingGroup/index.module.scss +0 -5
  89. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/RankingList/index.jsx +0 -58
  90. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/RankingList/index.module.scss +0 -85
  91. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/ScriptStatsPanel/index.jsx +0 -92
  92. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/ScriptStatsPanel/index.module.scss +0 -56
  93. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/StatCardsRow/index.jsx +0 -40
  94. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/StatCardsRow/index.module.scss +0 -53
  95. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/echarts/EchartsDonut.jsx +0 -106
  96. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/echarts/EchartsRankBar.jsx +0 -132
  97. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/practiceStatus/index.jsx +0 -176
  98. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/practiceStatus/index.module.scss +0 -96
  99. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/reportDetail/components/CoachReport/index.jsx +0 -162
  100. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/reportDetail/components/CoachReport/index.module.scss +0 -16
  101. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/reportDetail/components/ComprehensiveEvaluation/index.jsx +0 -29
  102. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/reportDetail/components/ComprehensiveEvaluation/index.module.scss +0 -25
  103. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/reportDetail/components/DialogueBubble/index.jsx +0 -106
  104. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/reportDetail/components/DialogueBubble/index.module.scss +0 -164
  105. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/reportDetail/components/DialogueRecord/index.jsx +0 -182
  106. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/reportDetail/components/DialogueRecord/index.module.scss +0 -203
  107. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/reportDetail/components/DimensionDetail/index.jsx +0 -145
  108. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/reportDetail/components/DimensionDetail/index.module.scss +0 -126
  109. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/reportDetail/components/DimensionScores/index.jsx +0 -67
  110. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/reportDetail/components/DimensionScores/index.module.scss +0 -105
  111. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/reportDetail/components/ReportHeader/index.jsx +0 -81
  112. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/reportDetail/components/ReportHeader/index.module.scss +0 -47
  113. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/reportDetail/components/RoleInfo/index.jsx +0 -64
  114. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/reportDetail/components/RoleInfo/index.module.scss +0 -85
  115. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/reportDetail/components/ScoreBadge/index.jsx +0 -39
  116. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/reportDetail/components/ScoreBadge/index.module.scss +0 -44
  117. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/reportDetail/components/SubDimensionItem/index.jsx +0 -83
  118. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/reportDetail/components/SubDimensionItem/index.module.scss +0 -101
  119. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/reportDetail/index.jsx +0 -50
  120. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/reportDetail/index.module.scss +0 -25
  121. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/scriptTable/index.jsx +0 -196
  122. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/scriptTable/index.module.scss +0 -41
  123. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/scriptTable/inputColumn/index.jsx +0 -183
  124. package/app/wujie-wk/wujie-vue3-child/src/views/aiCoach/scriptTable/inputColumn/index.module.scss +0 -115
  125. package/app/wujie-wk/wujie-vue3-child/src/views/child-to-parent.vue +0 -117
  126. package/app/wujie-wk/wujie-vue3-child/src/views/home.vue +0 -53
  127. package/app/wujie-wk/wujie-vue3-child/src/views/jsx/btnSelect/btnSelect.vue +0 -169
  128. package/app/wujie-wk/wujie-vue3-child/src/views/jsx/btnSelect/index.vue +0 -69
  129. package/app/wujie-wk/wujie-vue3-child/src/views/jsx/com.vue +0 -44
  130. package/app/wujie-wk/wujie-vue3-child/src/views/jsx/dialog.jsx +0 -66
  131. package/app/wujie-wk/wujie-vue3-child/src/views/jsx/index.vue +0 -72
  132. package/app/wujie-wk/wujie-vue3-child/src/views/jsx/props.vue +0 -33
  133. package/app/wujie-wk/wujie-vue3-child/src/views/parent-to-child.vue +0 -225
  134. package/app/wujie-wk/wujie-vue3-child/src/views/phone-code.vue +0 -318
  135. package/app/wujie-wk/wujie-vue3-child/src/views/router-jump.vue +0 -123
  136. package/app/wujie-wk/wujie-vue3-child/src/views/test.vue +0 -192
  137. package/app/wujie-wk/wujie-vue3-child/vite.config.js +0 -15
  138. package/app/wujie-wk/wujie-vue3-child copy/.vscode/extensions.json +0 -3
  139. package/app/wujie-wk/wujie-vue3-child copy/README.md +0 -5
  140. package/app/wujie-wk/wujie-vue3-child copy/index.html +0 -13
  141. package/app/wujie-wk/wujie-vue3-child copy/package-lock.json +0 -4617
  142. package/app/wujie-wk/wujie-vue3-child copy/package.json +0 -22
  143. package/app/wujie-wk/wujie-vue3-child copy/public/vite.svg +0 -1
  144. package/app/wujie-wk/wujie-vue3-child copy/src/App.vue +0 -124
  145. package/app/wujie-wk/wujie-vue3-child copy/src/assets/vue.svg +0 -1
  146. package/app/wujie-wk/wujie-vue3-child copy/src/components/HelloWorld.vue +0 -43
  147. package/app/wujie-wk/wujie-vue3-child copy/src/main.js +0 -12
  148. package/app/wujie-wk/wujie-vue3-child copy/src/router/index.js +0 -84
  149. package/app/wujie-wk/wujie-vue3-child copy/src/style.css +0 -4
  150. package/app/wujie-wk/wujie-vue3-child copy/src/views/child-to-parent.vue +0 -117
  151. package/app/wujie-wk/wujie-vue3-child copy/src/views/home.vue +0 -53
  152. package/app/wujie-wk/wujie-vue3-child copy/src/views/parent-to-child.vue +0 -225
  153. package/app/wujie-wk/wujie-vue3-child copy/src/views/phone-code.vue +0 -318
  154. package/app/wujie-wk/wujie-vue3-child copy/src/views/router-jump.vue +0 -115
  155. package/app/wujie-wk/wujie-vue3-child copy/src/views/test.vue +0 -192
  156. package/app/wujie-wk/wujie-vue3-child copy/vite.config.js +0 -10
  157. package/app/wujie-wk/wujie-vue3-main/.vscode/extensions.json +0 -3
  158. package/app/wujie-wk/wujie-vue3-main/README.md +0 -154
  159. package/app/wujie-wk/wujie-vue3-main/index.html +0 -13
  160. package/app/wujie-wk/wujie-vue3-main/package-lock.json +0 -4736
  161. package/app/wujie-wk/wujie-vue3-main/package.json +0 -25
  162. package/app/wujie-wk/wujie-vue3-main/public/vite.svg +0 -1
  163. package/app/wujie-wk/wujie-vue3-main/src/App.vue +0 -879
  164. package/app/wujie-wk/wujie-vue3-main/src/assets/vue.svg +0 -1
  165. package/app/wujie-wk/wujie-vue3-main/src/components/HelloWorld.vue +0 -43
  166. package/app/wujie-wk/wujie-vue3-main/src/components/WujieReact/index.vue +0 -20
  167. package/app/wujie-wk/wujie-vue3-main/src/components/WujieVue2/index.vue +0 -8
  168. package/app/wujie-wk/wujie-vue3-main/src/components/WujieVue3/index.vue +0 -8
  169. package/app/wujie-wk/wujie-vue3-main/src/components/WujieVue3Copy/index.vue +0 -8
  170. package/app/wujie-wk/wujie-vue3-main/src/main.js +0 -23
  171. package/app/wujie-wk/wujie-vue3-main/src/router/index.js +0 -88
  172. package/app/wujie-wk/wujie-vue3-main/src/store/useMicroAppStore.js +0 -66
  173. package/app/wujie-wk/wujie-vue3-main/src/style.css +0 -3
  174. package/app/wujie-wk/wujie-vue3-main/src/views/home.vue +0 -103
  175. package/app/wujie-wk/wujie-vue3-main/src/views/router-jump.vue +0 -159
  176. package/app/wujie-wk/wujie-vue3-main/src/views/test.vue +0 -125
  177. package/app/wujie-wk/wujie-vue3-main/src/views/vue3-child-msg.vue +0 -108
  178. package/app/wujie-wk/wujie-vue3-main/vite.config.js +0 -12
@@ -1,879 +0,0 @@
1
- <script setup>
2
- // 移除不需要的导入
3
- import { ref, watch, nextTick, onMounted, onUnmounted } from 'vue'
4
- import { ElNotification, ElDialog } from 'element-plus'
5
- import { useRouter } from 'vue-router'
6
- import WujieVue from 'wujie-vue3'
7
- import { useMicroAppStore } from './store/useMicroAppStore'
8
-
9
- const {bus} = WujieVue
10
- const microAppStore = useMicroAppStore()
11
-
12
- bus.$on('child-event', (data,from) => {
13
- // 先存储消息到 pinia
14
- microAppStore.receiveMessage({
15
- ...data,
16
- from: from || 'child-app' // 添加消息来源标识
17
- })
18
-
19
- // 然后显示通知
20
- ElNotification({
21
- message: data.message,
22
- type: data.type,
23
- duration: data.duration,
24
- title:'主应用接受:' + data.title
25
- })
26
- })
27
-
28
- const router = useRouter()
29
-
30
-
31
-
32
- const isMenuOpen = ref(false)
33
- const position = ref({
34
- x: window.innerWidth - 56, // 窗口宽度减去按钮宽度(36px)和右边距(20px)
35
- y: window.innerHeight - 56 // 窗口高度减去按钮高度(36px)和底部距离(20px)
36
- })
37
- const isDragging = ref(false)
38
- const startPosition = ref({ x: 0, y: 0 })
39
- // 添加一个变量来追踪是否发生了拖动
40
- const hasMoved = ref(false)
41
-
42
- // 计算菜单位置
43
- const menuPosition = ref({ direction: 'top', align: 'right' })
44
-
45
- const updateMenuPosition = () => {
46
- const buttonRect = document.querySelector('.menu-button').getBoundingClientRect()
47
- const menuEl = document.querySelector('.menu-content')
48
- if (!menuEl) return
49
-
50
- const menuRect = menuEl.getBoundingClientRect()
51
- const windowHeight = window.innerHeight
52
- const windowWidth = window.innerWidth
53
-
54
- // 计算垂直方向
55
- if (buttonRect.top < menuRect.height + 10) {
56
- menuPosition.value.direction = 'bottom'
57
- } else {
58
- menuPosition.value.direction = 'top'
59
- }
60
-
61
- // 计算水平方向
62
- if (buttonRect.right < menuRect.width) {
63
- menuPosition.value.align = 'right'
64
- } else if (windowWidth - buttonRect.left < menuRect.width) {
65
- menuPosition.value.align = 'left'
66
- } else {
67
- menuPosition.value.align = 'center'
68
- }
69
- }
70
-
71
- // 监听菜单打开状态
72
- watch(isMenuOpen, (newValue) => {
73
- if (newValue) {
74
- nextTick(() => {
75
- updateMenuPosition()
76
- })
77
- }
78
- })
79
-
80
- // 监听位置变化
81
- watch(position, () => {
82
- if (isMenuOpen.value) {
83
- updateMenuPosition()
84
- }
85
- checkStickToEdge()
86
- })
87
-
88
- // 监听窗口大小变化
89
- onMounted(() => {
90
- // 获取保存的位置
91
- const savedPosition = localStorage.getItem('menuPosition')
92
- if (savedPosition) {
93
- position.value = JSON.parse(savedPosition)
94
- } else {
95
- // 如果没有保存的位置,设置默认位置在右下角
96
- position.value = {
97
- x: window.innerWidth - 56,
98
- y: window.innerHeight - 56
99
- }
100
- }
101
-
102
- document.addEventListener('click', handleClickOutside)
103
- window.addEventListener('resize', () => {
104
- if (isMenuOpen.value) {
105
- updateMenuPosition()
106
- }
107
- })
108
- document.addEventListener('mousemove', onDialogDrag)
109
- document.addEventListener('mouseup', stopDialogDrag)
110
- })
111
-
112
- // 在组件卸载时移除事件监听
113
- onUnmounted(() => {
114
- document.removeEventListener('click', handleClickOutside)
115
- document.removeEventListener('mousemove', onDialogDrag)
116
- document.removeEventListener('mouseup', stopDialogDrag)
117
- })
118
-
119
- const isStickToEdge = ref(false)
120
- const stickDirection = ref(null) // 'left' or 'right'
121
- const STICK_THRESHOLD = 10 // 距离边缘多少像素时触发吸附
122
-
123
- // 获取滚动条宽度
124
- const getScrollbarWidth = () => {
125
- const outer = document.createElement('div')
126
- outer.style.visibility = 'hidden'
127
- outer.style.overflow = 'scroll'
128
- document.body.appendChild(outer)
129
-
130
- const inner = document.createElement('div')
131
- outer.appendChild(inner)
132
-
133
- const scrollbarWidth = outer.offsetWidth - inner.offsetWidth
134
- outer.parentNode.removeChild(outer)
135
-
136
- return scrollbarWidth
137
- }
138
-
139
- // 检查是否应该吸附到边缘
140
- const checkStickToEdge = () => {
141
- const windowWidth = window.innerWidth
142
- const buttonWidth = 36 // 按钮的正常宽度
143
-
144
- if (position.value.x < STICK_THRESHOLD) {
145
- stickDirection.value = 'left'
146
- isStickToEdge.value = true
147
- isMenuOpen.value = false
148
- position.value.x = 0 // 直接设置位置为0,完全贴边
149
- } else if (windowWidth - position.value.x - buttonWidth < STICK_THRESHOLD) {
150
- stickDirection.value = 'right'
151
- isStickToEdge.value = true
152
- isMenuOpen.value = false
153
- position.value.x = windowWidth - buttonWidth // 直接设置位置到右边缘
154
- } else {
155
- isStickToEdge.value = false
156
- }
157
- }
158
-
159
- // 修改 onDrag 函数
160
- const onDrag = (e) => {
161
- if (isDragging.value) {
162
- const buttonWidth = 36 // 按钮的正常宽度
163
- const maxX = window.innerWidth - buttonWidth // 修改最大 X 坐标
164
- const maxY = window.innerHeight - 40
165
-
166
- const newX = e.clientX - startPosition.value.x
167
- const newY = e.clientY - startPosition.value.y
168
-
169
- if (newX !== position.value.x || newY !== position.value.y) {
170
- hasMoved.value = true
171
- isStickToEdge.value = false
172
- }
173
-
174
- position.value = {
175
- x: Math.min(Math.max(0, newX), maxX),
176
- y: Math.min(Math.max(0, newY), maxY)
177
- }
178
- }
179
- }
180
-
181
- // 添加全局鼠标事件监听,优化拖拽体验
182
- const setupGlobalEvents = () => {
183
- window.addEventListener('mousemove', onDrag)
184
- window.addEventListener('mouseup', stopDrag)
185
- }
186
-
187
- const startDrag = (e) => {
188
- if (e.target.closest('.menu-button')) {
189
- isDragging.value = true
190
- hasMoved.value = false
191
- startPosition.value = {
192
- x: e.clientX - position.value.x,
193
- y: e.clientY - position.value.y
194
- }
195
- document.body.style.userSelect = 'none'
196
- document.body.style.cursor = 'move'
197
- setupGlobalEvents()
198
- }
199
- }
200
-
201
- const stopDrag = () => {
202
- isDragging.value = false
203
- document.body.style.userSelect = ''
204
- document.body.style.cursor = ''
205
- window.removeEventListener('mousemove', onDrag)
206
- window.removeEventListener('mouseup', stopDrag)
207
- localStorage.setItem('menuPosition', JSON.stringify(position.value))
208
- checkStickToEdge() // 停止拖动时检查是否需要吸附
209
- }
210
-
211
- // 添加点击外部关闭菜单的处理
212
- const handleClickOutside = (e) => {
213
- const floatingMenu = document.querySelector('.floating-menu')
214
- if (isMenuOpen.value && floatingMenu && !floatingMenu.contains(e.target)) {
215
- isMenuOpen.value = false
216
- checkStickToEdge()
217
- }
218
- }
219
-
220
- // 鼠标移入时展开
221
- const handleMouseEnter = () => {
222
- if (isStickToEdge.value) {
223
- isStickToEdge.value = false
224
- }
225
- }
226
-
227
- // 鼠标移出时检查是否需要吸附
228
- const handleMouseLeave = (e) => {
229
- // 检查鼠标是否移动到菜单内容区域
230
- const menuContent = document.querySelector('.menu-content')
231
- if (menuContent && menuContent.contains(e.relatedTarget)) {
232
- return
233
- }
234
-
235
- if (isMenuOpen.value) {
236
- isMenuOpen.value = false
237
- }
238
-
239
- // 立即检查吸附
240
- if (!isDragging.value) {
241
- checkStickToEdge()
242
- }
243
- }
244
-
245
- // 添加菜单内容区域的标移出处理
246
- const handleMenuContentLeave = (e) => {
247
- // 检查鼠标是否移动到按钮区域
248
- const button = document.querySelector('.menu-button')
249
- if (button && button.contains(e.relatedTarget)) {
250
- return
251
- }
252
-
253
- isMenuOpen.value = false
254
- // 重置状态并检查吸附
255
- isDragging.value = false
256
- hasMoved.value = false
257
- checkStickToEdge()
258
- }
259
-
260
- // 修改点击处理函数,阻止事件冒泡
261
- const handleClick = (e) => {
262
- e.stopPropagation() // 阻止事件冒泡
263
- if (!hasMoved.value) {
264
- isMenuOpen.value = !isMenuOpen.value
265
- }
266
- }
267
-
268
- // 添加对 isStickToEdge 的监听
269
- watch(isStickToEdge, (newValue) => {
270
- if (!newValue) {
271
- // 当取消吸附时,启动一个短暂延时,然后重新检查吸附
272
- setTimeout(() => {
273
- if (!isDragging.value && !isMenuOpen.value) {
274
- checkStickToEdge()
275
- }
276
- }, 300) // 300ms 延时,与 CSS 过渡时间匹配
277
- }
278
- })
279
-
280
- // 添加新的响应式变量
281
- const dialogVisible = ref(false)
282
- const messageText = ref('')
283
- const selectedTarget = ref('')
284
- const targets = ref([
285
- { label: 'vue3子应用', value: 'vue3-child-message' },
286
- { label: 'vue2子应用', value: 'vue2-child-message' },
287
- { label: 'react子应用', value: 'react-child-message' }
288
- ])
289
-
290
- // 修改 menuItems 数组
291
- const menuItems = [
292
- { name: '主应用首页', path: '/' },
293
- { name: 'Vue3Child', path: '/vue3-child' },
294
- { name: 'Vue3ChildCopy(保活)', path: '/vue3-child-copy' },
295
- { name: 'Vue2Child', path: '/vue2-child' },
296
- { name: 'ReactChild', path: '/react-child' },
297
- { name: '发送消息', action: 'openMessageDialog' } // 新增菜单项
298
- ]
299
-
300
- // 修改菜单点击处理函数
301
- const handleMenuItemClick = (path, action) => {
302
- if (action === 'openMessageDialog') {
303
- dialogVisible.value = true
304
- // 设置弹窗初始位置为居中
305
- nextTick(() => {
306
- const dialog = document.querySelector('.custom-dialog')
307
- if (dialog) {
308
- const windowWidth = window.innerWidth
309
- const windowHeight = window.innerHeight
310
- const dialogWidth = dialog.offsetWidth
311
- const dialogHeight = dialog.offsetHeight
312
-
313
- dialogPosition.value = {
314
- x: (windowWidth - dialogWidth) / 2,
315
- y: (windowHeight - dialogHeight) / 2
316
- }
317
- }
318
- })
319
- } else {
320
- router.push(path)
321
- }
322
- isMenuOpen.value = false
323
- }
324
-
325
- // 添加消息类型选项
326
- const messageTypes = ref([
327
- { label: '成功', value: 'success' },
328
- { label: '警告', value: 'warning' },
329
- { label: '信息', value: 'info' },
330
- { label: '错误', value: 'error' }
331
- ])
332
-
333
- // 添加选中的消息类型
334
- const selectedType = ref('success')
335
-
336
- // 修改发送消息的函数
337
- const sendGlobalMessage = () => {
338
- if (!messageText.value) return
339
- bus.$emit('global-message', {
340
- message: messageText.value,
341
- type: selectedType.value, // 使用选中的类型
342
- duration: 3000,
343
- title: '全局消息'
344
- })
345
- dialogVisible.value = false
346
- messageText.value = ''
347
- }
348
-
349
- const sendTargetMessage = () => {
350
- if (!messageText.value || !selectedTarget.value) return
351
- bus.$emit(selectedTarget.value, {
352
- message: messageText.value,
353
- type: selectedType.value, // 使用选中的类型
354
- duration: 3000,
355
- title: '定向消息'
356
- })
357
- dialogVisible.value = false
358
- messageText.value = ''
359
- }
360
-
361
- // 添加拖拽相关的变量
362
- const dialogDragging = ref(false)
363
- const dialogPosition = ref({ x: 0, y: 0 })
364
- const dialogStartPosition = ref({ x: 0, y: 0 })
365
-
366
- // 添加拖拽相关的方法
367
- const startDialogDrag = (e) => {
368
- if (e.target.classList.contains('dialog-header')) {
369
- dialogDragging.value = true
370
- const dialog = document.querySelector('.custom-dialog')
371
- const rect = dialog.getBoundingClientRect()
372
- dialogStartPosition.value = {
373
- x: e.clientX - rect.left,
374
- y: e.clientY - rect.top
375
- }
376
- document.body.style.userSelect = 'none'
377
- }
378
- }
379
-
380
- const onDialogDrag = (e) => {
381
- if (dialogDragging.value) {
382
- dialogPosition.value = {
383
- x: e.clientX - dialogStartPosition.value.x,
384
- y: e.clientY - dialogStartPosition.value.y
385
- }
386
- }
387
- }
388
-
389
- const stopDialogDrag = () => {
390
- dialogDragging.value = false
391
- document.body.style.userSelect = ''
392
- }
393
- bus.$on('router-jump-to-main', (data) => {
394
- if(data.app === 'main'){
395
- router.push({
396
- path: data.path,
397
- query: data.query
398
- })
399
- }else{
400
- router.push({
401
- path: `/${data.app}${data.path}`
402
- })
403
- jumpToChild(data)
404
- }
405
- })
406
- const isAlive = {
407
- 'vue3-child':false,
408
- 'vue3-child-copy':true
409
- }
410
-
411
- const jumpToChild = (data) => {
412
- router.push(data.app);
413
- // 判断子应用是否存在
414
- if ( isAlive[data.app] && window.document.querySelector(`iframe[name=${data.app}]`)) {
415
- bus.$emit("router-jump", {
416
- app: data.app,
417
- path: data.path,
418
- query: data.query,
419
- });
420
- } else {
421
- console.log("子应用不存在");
422
- // 监听子应用加载完成
423
- bus.$on("loaded", (app) => handleLoaded(app,data));
424
- }
425
- };
426
-
427
- // 定义一个具体的函数
428
- const handleLoaded = (app,data) => {
429
- if (app === data.app) {
430
- bus.$emit("router-jump", {
431
- app: data.app,
432
- path: data.path,
433
- query: data.query,
434
- });
435
- // 使用相同的函数引用来移除监听器
436
- bus.$off("loaded", handleLoaded);
437
- }
438
- };
439
- </script>
440
-
441
- <template>
442
- <div class="container">
443
- <router-view></router-view>
444
- <div class="floating-menu"
445
- :style="{
446
- left: `${position.x}px`,
447
- top: `${position.y}px`
448
- }"
449
- :class="{
450
- 'menu-expanded': isMenuOpen,
451
- 'stick-to-edge': isStickToEdge,
452
- 'stick-left': stickDirection === 'left',
453
- 'stick-right': stickDirection === 'right'
454
- }"
455
- @mouseenter="handleMouseEnter">
456
- <button class="menu-button"
457
- @mousedown="startDrag"
458
- @click="handleClick">
459
- <div class="menu-icon" @mousedown.stop>
460
- <span class="icon-line"></span>
461
- <span class="icon-line"></span>
462
- <span class="icon-line"></span>
463
- </div>
464
- </button>
465
- <div class="menu-content"
466
- :class="[
467
- `menu-${menuPosition.direction}`,
468
- `menu-align-${menuPosition.align}`
469
- ]">
470
- <ul>
471
- <li v-for="(item, index) in menuItems"
472
- :key="index"
473
- :style="{ '--i': index }"
474
- @click.stop="handleMenuItemClick(item.path, item.action)">
475
- {{ item.name }}
476
- </li>
477
- </ul>
478
- </div>
479
- </div>
480
-
481
-
482
- <!-- 自定义弹窗 -->
483
- <div v-if="dialogVisible"
484
- class="custom-dialog"
485
- :style="{
486
- left: `${dialogPosition.x}px`,
487
- top: `${dialogPosition.y}px`
488
- }">
489
- <div class="dialog-header" @mousedown="startDialogDrag">
490
- <span>发送消息</span>
491
- <button class="close-btn" @click="dialogVisible = false">×</button>
492
- </div>
493
- <div class="dialog-body">
494
- <div class="form-item">
495
- <label>消息内容</label>
496
- <textarea
497
- v-model="messageText"
498
- placeholder="请输入消息内容"
499
- rows="3"
500
- ></textarea>
501
- </div>
502
- <div class="form-item">
503
- <label>消息类型</label>
504
- <select v-model="selectedType">
505
- <option
506
- v-for="type in messageTypes"
507
- :key="type.value"
508
- :value="type.value"
509
- >
510
- {{ type.label }}
511
- </option>
512
- </select>
513
- </div>
514
- <div class="form-item">
515
- <label>接收方</label>
516
- <select v-model="selectedTarget">
517
- <option value="">请选择接收方</option>
518
- <option
519
- v-for="item in targets"
520
- :key="item.value"
521
- :value="item.value"
522
- >
523
- {{ item.label }}
524
- </option>
525
- </select>
526
- </div>
527
- </div>
528
- <div class="dialog-footer">
529
- <button class="btn btn-cancel" @click="dialogVisible = false">取消</button>
530
- <button class="btn btn-primary" @click="sendGlobalMessage">全局发送</button>
531
- <button class="btn btn-success" @click="sendTargetMessage">定向发送</button>
532
- </div>
533
- </div>
534
- </div>
535
- </template>
536
-
537
- <style scoped>
538
- .container {
539
- min-height: 100vh;
540
- position: relative;
541
- }
542
-
543
- .floating-menu {
544
- position: fixed;
545
- z-index: 1000;
546
- cursor: move;
547
- user-select: none;
548
- }
549
-
550
- .menu-button {
551
- width: 36px;
552
- height: 36px;
553
- border-radius: 50%;
554
- background: linear-gradient(145deg, #4cc592, #42b883);
555
- border: none;
556
- cursor: pointer;
557
- display: flex;
558
- align-items: center;
559
- justify-content: center;
560
- box-shadow: 0 3px 8px rgba(66, 184, 131, 0.2);
561
- transition: all 0.2s ease;
562
- outline: none;
563
- padding: 0;
564
- min-width: 36px;
565
- position: relative;
566
- z-index: 2;
567
- }
568
-
569
- /* 修改吸附状态下的按钮样式 */
570
- .stick-to-edge .menu-button {
571
- width: 10px !important; /* 强制置宽度为10px */
572
- min-width: 10px !important; /* 确保最小宽度也是10px */
573
- border-radius: 3px;
574
- height: 40px;
575
- background: #42b883;
576
- transform: none; /* 移除任何可能的transform */
577
- }
578
-
579
- /* 隐藏吸附状态下的图标 */
580
- .stick-to-edge .menu-icon {
581
- opacity: 0;
582
- }
583
-
584
- .menu-icon {
585
- width: 18px;
586
- height: 18px;
587
- position: relative;
588
- display: flex;
589
- flex-direction: column;
590
- justify-content: space-between;
591
- transform: translateY(0);
592
- pointer-events: none;
593
- }
594
-
595
- .icon-line {
596
- width: 100%;
597
- height: 2px;
598
- background-color: white;
599
- border-radius: 1px;
600
- transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
601
- transform-origin: center;
602
- }
603
-
604
- /* 间线的特殊处理 */
605
- .icon-line:nth-child(2) {
606
- transform-origin: center;
607
- transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
608
- }
609
-
610
- /* 菜单展开时图标动画 */
611
- .menu-expanded .icon-line:first-child {
612
- transform: translateY(8px) rotate(45deg);
613
- }
614
-
615
- .menu-expanded .icon-line:nth-child(2) {
616
- opacity: 0;
617
- transform: scaleX(0);
618
- }
619
-
620
- .menu-expanded .icon-line:last-child {
621
- transform: translateY(-8px) rotate(-45deg);
622
- }
623
-
624
- .menu-button:hover {
625
- transform: scale(1.05);
626
- background: linear-gradient(145deg, #42b883, #3aa876);
627
- box-shadow: 0 4px 12px rgba(66, 184, 131, 0.3);
628
- }
629
-
630
- .menu-button:active {
631
- transform: scale(0.95);
632
- }
633
-
634
- .menu-content {
635
- position: absolute;
636
- background-color: white;
637
- border-radius: 12px;
638
- box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
639
- padding: 8px 0;
640
- min-width: 120px;
641
- opacity: 0;
642
- visibility: hidden;
643
- transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
644
- }
645
-
646
- /* 垂直方向定位 */
647
- .menu-top {
648
- bottom: 45px;
649
- transform-origin: bottom;
650
- transform: scale(0.95) translateY(-10px);
651
- }
652
-
653
- .menu-bottom {
654
- top: 45px;
655
- transform-origin: top;
656
- transform: scale(0.95) translateY(10px);
657
- }
658
-
659
- /* 水平方向定位 */
660
- .menu-align-left {
661
- right: 0;
662
- transform-origin: bottom right;
663
- }
664
-
665
- .menu-align-right {
666
- left: 0;
667
- transform-origin: bottom left;
668
- }
669
-
670
- .menu-align-center {
671
- left: 50%;
672
- transform: translateX(-50%) scale(0.95) translateY(-10px);
673
- transform-origin: bottom center;
674
- }
675
-
676
- /* 展开状态 */
677
- .menu-expanded .menu-content {
678
- opacity: 1;
679
- visibility: visible;
680
- transform: scale(1) translateY(0);
681
- }
682
-
683
- .menu-expanded .menu-align-center {
684
- transform: translateX(-50%) scale(1) translateY(0);
685
- }
686
-
687
- .menu-content ul {
688
- list-style: none;
689
- margin: 0;
690
- padding: 0;
691
- }
692
-
693
- .menu-content li {
694
- padding: 8px 16px;
695
- cursor: pointer;
696
- transition: all 0.2s;
697
- color: #333;
698
- font-size: 14px;
699
- opacity: 0;
700
- transform: translateX(-10px);
701
- }
702
-
703
- /* 菜单项动画 */
704
- .menu-expanded .menu-content li {
705
- opacity: 1;
706
- transform: translateX(0);
707
- transition-delay: calc(0.05s * var(--i));
708
- }
709
-
710
- .menu-content li:hover {
711
- background-color: rgba(66, 184, 131, 0.1);
712
- color: #42b883;
713
- padding-left: 20px;
714
- }
715
-
716
- /* 修改吸附样式 */
717
- .stick-to-edge {
718
- transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
719
- }
720
-
721
- .stick-to-edge.stick-left {
722
- transform: translateX(-3px);
723
- }
724
-
725
- .stick-to-edge.stick-right {
726
- transform: translateX(26px);
727
- }
728
-
729
- /* 确保悬停时恢复原样 */
730
- .stick-to-edge:hover .menu-button {
731
- width: 36px !important;
732
- min-width: 36px !important;
733
- height: 36px;
734
- border-radius: 50%;
735
- background: linear-gradient(145deg, #4cc592, #42b883);
736
- }
737
-
738
- .stick-to-edge:hover .menu-icon {
739
- opacity: 1;
740
- }
741
-
742
- .stick-to-edge:hover {
743
- transform: translateX(0);
744
- transition-timing-function: cubic-bezier(0, 0, 0.2, 1);
745
- }
746
-
747
- /* 添加自定义弹窗样式 */
748
- .custom-dialog {
749
- position: fixed;
750
- background: white;
751
- border-radius: 8px;
752
- box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
753
- width: 400px;
754
- z-index: 2000;
755
- }
756
-
757
- .dialog-header {
758
- padding: 16px 20px;
759
- border-bottom: 1px solid #eee;
760
- display: flex;
761
- justify-content: space-between;
762
- align-items: center;
763
- cursor: move;
764
- background: #f8f9fa;
765
- border-radius: 8px 8px 0 0;
766
- }
767
-
768
- .dialog-header span {
769
- font-size: 16px;
770
- font-weight: 500;
771
- color: #333;
772
- }
773
-
774
- .close-btn {
775
- border: none;
776
- background: none;
777
- font-size: 20px;
778
- color: #999;
779
- cursor: pointer;
780
- padding: 0;
781
- width: 24px;
782
- height: 24px;
783
- display: flex;
784
- align-items: center;
785
- justify-content: center;
786
- border-radius: 4px;
787
- transition: all 0.2s;
788
- }
789
-
790
- .close-btn:hover {
791
- background: #eee;
792
- color: #666;
793
- }
794
-
795
- .dialog-body {
796
- padding: 20px;
797
- }
798
-
799
- .form-item {
800
- margin-bottom: 16px;
801
- }
802
-
803
- .form-item label {
804
- display: block;
805
- margin-bottom: 8px;
806
- color: #333;
807
- font-size: 14px;
808
- }
809
-
810
- .form-item textarea,
811
- .form-item select {
812
- width: 100%;
813
- padding: 8px 12px;
814
- border: 1px solid #dcdfe6;
815
- border-radius: 4px;
816
- font-size: 14px;
817
- transition: border-color 0.2s;
818
- outline: none;
819
- box-sizing: border-box;
820
- }
821
-
822
- .form-item textarea:focus,
823
- .form-item select:focus {
824
- border-color: #409eff;
825
- }
826
-
827
- .dialog-footer {
828
- padding: 10px 20px 20px;
829
- text-align: right;
830
- }
831
-
832
- .btn {
833
- padding: 8px 16px;
834
- border-radius: 4px;
835
- border: none;
836
- font-size: 14px;
837
- cursor: pointer;
838
- margin-left: 8px;
839
- transition: all 0.2s;
840
- }
841
-
842
- .btn-cancel {
843
- background: #f4f4f5;
844
- color: #606266;
845
- }
846
-
847
- .btn-cancel:hover {
848
- background: #e9e9eb;
849
- }
850
-
851
- .btn-primary {
852
- background: #409eff;
853
- color: white;
854
- }
855
-
856
- .btn-primary:hover {
857
- background: #66b1ff;
858
- }
859
-
860
- .btn-success {
861
- background: #67c23a;
862
- color: white;
863
- }
864
-
865
- .btn-success:hover {
866
- background: #85ce61;
867
- }
868
- </style>
869
-
870
- <script>
871
- // 添加响应式数据
872
- export default {
873
- data() {
874
- return {
875
- isMenuOpen: false
876
- }
877
- }
878
- }
879
- </script>