web-component-gallery 1.3.12 → 2.0.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 (218) hide show
  1. package/dist/923.umd.js +1 -0
  2. package/dist/index.umd.js +1 -12252
  3. package/dist/js.umd.js +1 -0
  4. package/dist/style.css +17 -0
  5. package/dist/style.umd.js +1 -0
  6. package/{method → extensions}/AMap.js +1 -5
  7. package/{plugins/method → extensions}/Dialog.js +2 -2
  8. package/{lib/lazy_use.js → extensions/index.js} +16 -2
  9. package/lib/{amap/components/AmapSearch/index.jsx → amap-comp/AmapSearch.jsx} +3 -5
  10. package/lib/amap-comp/index.js +18 -0
  11. package/{plugins/lib/amap/components/AmapSearch/index.less → lib/amap-comp/style/AmapSearch.less} +5 -3
  12. package/lib/amap-comp/style/index.js +1 -0
  13. package/lib/amap-comp/style/index.less +1 -0
  14. package/lib/{amap/AmapDraw.jsx → amap-draw/index.jsx} +2 -4
  15. package/lib/amap-draw/style/index.js +1 -0
  16. package/lib/{amap/AmapDraw.less → amap-draw/style/index.less} +6 -3
  17. package/lib/browse/index.jsx +0 -2
  18. package/lib/browse/style/index.js +1 -0
  19. package/lib/button/Button.js +1 -3
  20. package/lib/button/style/index.js +1 -0
  21. package/{plugins/lib/dateTime → lib/date-time}/index.vue +3 -13
  22. package/lib/date-time/style/index.js +1 -0
  23. package/lib/date-time/style/index.less +7 -0
  24. package/lib/{descriptions → descriptions-list}/index.jsx +1 -3
  25. package/lib/descriptions-list/style/index.js +1 -0
  26. package/{plugins/lib/tree → lib/directory}/Directory.js +4 -21
  27. package/lib/directory/index.js +8 -0
  28. package/lib/directory/style/index.js +1 -0
  29. package/lib/{tree/style/Directory.less → directory/style/index.less} +3 -4
  30. package/{plugins/lib/form/components → lib/form-comp}/ACascaderMultiple.vue +1 -106
  31. package/lib/form-comp/ARadio.vue +70 -0
  32. package/lib/{form/components → form-comp}/ARangePicker.vue +9 -20
  33. package/lib/{form/components → form-comp}/ASelectCustom.vue +1 -8
  34. package/lib/form-comp/ATagsInput.vue +88 -0
  35. package/lib/form-comp/ATimePicker.vue +127 -0
  36. package/lib/{form/components → form-comp}/AUpload.vue +2 -17
  37. package/lib/form-comp/index.js +37 -0
  38. package/lib/form-comp/style/ACascaderMultiple.less +117 -0
  39. package/lib/form-comp/style/ARadio.less +0 -0
  40. package/lib/form-comp/style/ARangePicker.less +11 -0
  41. package/lib/form-comp/style/ASelectCustom.less +4 -0
  42. package/lib/form-comp/style/ATagsInput.less +24 -0
  43. package/lib/form-comp/style/ATimePicker.less +8 -0
  44. package/lib/form-comp/style/AUpload.less +15 -0
  45. package/lib/form-comp/style/index.js +1 -0
  46. package/lib/form-comp/style/index.less +7 -0
  47. package/lib/index.js +60 -45
  48. package/lib/modal/index.jsx +4 -6
  49. package/lib/modal/style/index.js +1 -0
  50. package/lib/modal/{index.less → style/index.less} +6 -7
  51. package/{plugins/lib/form → lib/model}/Model.js +1 -3
  52. package/lib/model/index.js +7 -0
  53. package/lib/model/style/index.js +1 -0
  54. package/lib/{form/style/Model.less → model/style/index.less} +10 -10
  55. package/{plugins/lib/form → lib/model}/utils/render.js +1 -1
  56. package/lib/{form → model}/utils/resetFields.js +1 -1
  57. package/lib/no-data/directive.js +65 -0
  58. package/lib/no-data/index.js +21 -0
  59. package/lib/no-data/index.vue +35 -0
  60. package/lib/no-data/style/index.js +1 -0
  61. package/lib/no-data/style/index.less +15 -0
  62. package/lib/search/index.js +7 -0
  63. package/{plugins/lib/form/Search.vue → lib/search/index.vue} +3 -6
  64. package/lib/search/style/index.js +1 -0
  65. package/{plugins/lib/form/style/Search.less → lib/search/style/index.less} +7 -8
  66. package/lib/style/mixins.less +1 -1
  67. package/lib/{svgIcon → svg-icon}/index.vue +1 -17
  68. package/lib/svg-icon/style/index.js +1 -0
  69. package/lib/svg-icon/style/index.less +15 -0
  70. package/lib/table/index.vue +4 -8
  71. package/lib/table/style/index.js +1 -0
  72. package/lib/table/style/index.less +12 -13
  73. package/lib/tree/index.js +2 -11
  74. package/{plugins/lib/tree/Tree.vue → lib/tree/index.vue} +2 -5
  75. package/lib/tree/style/index.js +1 -0
  76. package/{plugins/lib/tree/style/Tree.less → lib/tree/style/index.less} +4 -4
  77. package/lib/weather/index.vue +1 -9
  78. package/lib/weather/style/index.js +1 -0
  79. package/lib/weather/style/index.less +7 -0
  80. package/package.json +16 -34
  81. package/utils/Axios.js +91 -82
  82. package/utils/Postcss.js +12 -8
  83. package/README.md +0 -24
  84. package/dist/amap.umd.js +0 -12252
  85. package/dist/avatar.umd.js +0 -5337
  86. package/dist/button.umd.js +0 -5845
  87. package/dist/dateTime.umd.js +0 -1287
  88. package/dist/form.umd.js +0 -9981
  89. package/dist/multiTab.umd.js +0 -5556
  90. package/dist/svgIcon.umd.js +0 -1167
  91. package/dist/table.umd.js +0 -6306
  92. package/dist/tree.umd.js +0 -5393
  93. package/dist/weather.umd.js +0 -1167
  94. package/lib/amap/components/AmapSearch/index.less +0 -16
  95. package/lib/amap/index.js +0 -13
  96. package/lib/avatar/index.js +0 -7
  97. package/lib/avatar/index.vue +0 -47
  98. package/lib/basic/404.vue +0 -24
  99. package/lib/dateTime/index.vue +0 -43
  100. package/lib/form/Model.js +0 -153
  101. package/lib/form/Search.vue +0 -159
  102. package/lib/form/components/ACascaderMultiple.vue +0 -766
  103. package/lib/form/components/ARadio.vue +0 -74
  104. package/lib/form/components/ATagsInput.vue +0 -93
  105. package/lib/form/components/ATimePicker.vue +0 -73
  106. package/lib/form/index.js +0 -55
  107. package/lib/form/style/Search.less +0 -34
  108. package/lib/form/utils/render.js +0 -85
  109. package/lib/iframe/events.js +0 -2
  110. package/lib/iframe/index.jsx +0 -234
  111. package/lib/iframe/index.less +0 -19
  112. package/lib/multiTab/APIEnums.js +0 -17
  113. package/lib/multiTab/MultiTab.jsx +0 -237
  114. package/lib/multiTab/RouteAPI.js +0 -71
  115. package/lib/multiTab/RouteContent.jsx +0 -90
  116. package/lib/multiTab/RouteKeepAlive.js +0 -183
  117. package/lib/multiTab/events.js +0 -2
  118. package/lib/multiTab/index.js +0 -15
  119. package/lib/multiTab/index.less +0 -73
  120. package/lib/style/index.less +0 -2
  121. package/lib/tree/Directory.js +0 -428
  122. package/lib/tree/Tree.vue +0 -181
  123. package/lib/tree/style/Tree.less +0 -52
  124. package/method/Dialog.js +0 -134
  125. package/method/index.js +0 -12
  126. package/plugins/lib/amap/AmapDraw.jsx +0 -349
  127. package/plugins/lib/amap/AmapDraw.less +0 -45
  128. package/plugins/lib/amap/components/AmapSearch/index.jsx +0 -73
  129. package/plugins/lib/amap/index.js +0 -13
  130. package/plugins/lib/avatar/index.js +0 -7
  131. package/plugins/lib/avatar/index.vue +0 -47
  132. package/plugins/lib/basic/404.vue +0 -24
  133. package/plugins/lib/browse/index.jsx +0 -76
  134. package/plugins/lib/browse/index.less +0 -4
  135. package/plugins/lib/button/Button.js +0 -89
  136. package/plugins/lib/button/index.js +0 -7
  137. package/plugins/lib/dateTime/index.js +0 -7
  138. package/plugins/lib/descriptions/index.jsx +0 -108
  139. package/plugins/lib/descriptions/index.less +0 -15
  140. package/plugins/lib/form/components/ARadio.vue +0 -74
  141. package/plugins/lib/form/components/ARangePicker.vue +0 -129
  142. package/plugins/lib/form/components/ASelectCustom.vue +0 -226
  143. package/plugins/lib/form/components/ATagsInput.vue +0 -93
  144. package/plugins/lib/form/components/ATimePicker.vue +0 -73
  145. package/plugins/lib/form/components/AUpload.vue +0 -183
  146. package/plugins/lib/form/components/RenderComp.vue +0 -69
  147. package/plugins/lib/form/index.js +0 -55
  148. package/plugins/lib/form/style/Model.less +0 -53
  149. package/plugins/lib/form/utils/resetFields.js +0 -16
  150. package/plugins/lib/iframe/events.js +0 -2
  151. package/plugins/lib/iframe/index.jsx +0 -234
  152. package/plugins/lib/iframe/index.less +0 -19
  153. package/plugins/lib/index.js +0 -72
  154. package/plugins/lib/lazy_use.js +0 -40
  155. package/plugins/lib/modal/index.jsx +0 -53
  156. package/plugins/lib/modal/index.less +0 -50
  157. package/plugins/lib/multiTab/APIEnums.js +0 -17
  158. package/plugins/lib/multiTab/MultiTab.jsx +0 -237
  159. package/plugins/lib/multiTab/RouteAPI.js +0 -71
  160. package/plugins/lib/multiTab/RouteContent.jsx +0 -90
  161. package/plugins/lib/multiTab/RouteKeepAlive.js +0 -183
  162. package/plugins/lib/multiTab/events.js +0 -2
  163. package/plugins/lib/multiTab/index.js +0 -15
  164. package/plugins/lib/multiTab/index.less +0 -73
  165. package/plugins/lib/style/index.less +0 -2
  166. package/plugins/lib/style/mixins.less +0 -79
  167. package/plugins/lib/svgIcon/index.js +0 -7
  168. package/plugins/lib/svgIcon/index.vue +0 -77
  169. package/plugins/lib/table/index.js +0 -7
  170. package/plugins/lib/table/index.vue +0 -217
  171. package/plugins/lib/table/style/index.less +0 -50
  172. package/plugins/lib/tree/index.js +0 -17
  173. package/plugins/lib/tree/style/Directory.less +0 -119
  174. package/plugins/lib/weather/index.js +0 -7
  175. package/plugins/lib/weather/index.vue +0 -58
  176. package/plugins/method/AMap.js +0 -368
  177. package/plugins/method/PageLoading.jsx +0 -106
  178. package/plugins/method/Theme.js +0 -88
  179. package/plugins/method/index.js +0 -12
  180. package/plugins/store/auth.js +0 -31
  181. package/plugins/store/cache.js +0 -56
  182. package/plugins/store/chat.js +0 -74
  183. package/plugins/store/project.js +0 -46
  184. package/plugins/utils/Axios.js +0 -105
  185. package/plugins/utils/Base64.js +0 -314
  186. package/plugins/utils/Filter.js +0 -249
  187. package/plugins/utils/PostMessage.js +0 -16
  188. package/plugins/utils/Postcss.js +0 -9
  189. package/plugins/utils/Rem.js +0 -24
  190. package/plugins/utils/Request.js +0 -38
  191. package/plugins/utils/Storage.js +0 -73
  192. package/plugins/utils/Tree.js +0 -169
  193. package/plugins/utils/Utils.js +0 -51
  194. package/plugins/utils/Validate.js +0 -33
  195. package/plugins/utils/Websocket.js +0 -186
  196. package/utils/PostMessage.js +0 -16
  197. package/utils/Request.js +0 -38
  198. /package/{method → extensions}/PageLoading.jsx +0 -0
  199. /package/{method → extensions}/Theme.js +0 -0
  200. /package/{plugins/font → font}/DS-DIGI-1.ttf +0 -0
  201. /package/{plugins/font → font}/DS-DIGIB-2.ttf +0 -0
  202. /package/{plugins/font → font}/DS-DIGII-3.ttf +0 -0
  203. /package/{plugins/font → font}/DS-DIGIT-4.ttf +0 -0
  204. /package/{plugins/font → font}/Orbitron-Black.ttf +0 -0
  205. /package/{plugins/font → font}/Orbitron-Bold.ttf +0 -0
  206. /package/{plugins/font → font}/Orbitron-Medium.ttf +0 -0
  207. /package/{plugins/font → font}/Orbitron-Regular.ttf +0 -0
  208. /package/{plugins/font → font}/PANGMENZHENGDAOBIAOTITI-1.TTF +0 -0
  209. /package/{plugins/font → font}/PingFang SC.ttf +0 -0
  210. /package/{plugins/font → font}/YouSheBiaoTiHei.ttf +0 -0
  211. /package/{plugins/font → font}/font.css +0 -0
  212. /package/{plugins/font → font}//345/255/227/351/255/20235/345/217/267-/347/273/217/345/205/270/351/233/205/351/273/221.ttf" +0 -0
  213. /package/lib/browse/{index.less → style/index.less} +0 -0
  214. /package/{dist/css/index.css → lib/button/style/index.less} +0 -0
  215. /package/lib/{dateTime → date-time}/index.js +0 -0
  216. /package/lib/{descriptions → descriptions-list/style}/index.less +0 -0
  217. /package/lib/{form/components → form-comp}/RenderComp.vue +0 -0
  218. /package/lib/{svgIcon → svg-icon}/index.js +0 -0
@@ -1,368 +0,0 @@
1
- // amap-plugin.js
2
- // import AMapLoader from '@amap/amap-jsapi-loader'
3
-
4
- /** 入口文件不同 作用域不同 */
5
- let AMapKey = null
6
- let AMapStyle = null
7
- let AMapInstance = null
8
- /** 默认地图key、样式及安全解码 */
9
- let AMapConfig = {
10
- key: '722d07dd44d442d72a25a1304bac7743',
11
- style: 'amap://styles/ff26c7ed32880397f692f5b69b1c1f9f',
12
- securityJsCode: '90366326a87f1d0e3ddb43e05cc021b1'
13
- }
14
-
15
- // 安全配置 / 地图样式配置
16
- export const setAMapSecurity = (config = AMapConfig) => {
17
- const { key, style, securityJsCode } = config
18
- AMapKey = key
19
- AMapStyle = style
20
- /** 设置高德地图密钥 */
21
- window.forceWebGL = true
22
- window._AMapSecurityConfig = { securityJsCode }
23
- }
24
-
25
-
26
- // 核心地图服务类
27
- class AMapService {
28
- constructor(AMap) {
29
- this.AMap = AMap
30
- this._iconCache = new Map() // 图标缓存
31
-
32
- /** 常用覆盖物 */
33
- this.layers = {
34
- setIcon: this.setIcon.bind(this),
35
- setMarker: this.setMarker.bind(this),
36
- setInfoWindow: this._createInfoWindowHandler()
37
- }
38
-
39
- /** 抛出地图常用方法 */
40
- this.methods = {
41
- getMapAddress: this.getMapAddress.bind(this),
42
- getMapSearch: this.getMapSearch.bind(this),
43
- setMapDriving: this.setMapDriving.bind(this),
44
- drawMapAnimation,
45
- parseRouteToPath,
46
- getOverlayPos
47
- }
48
-
49
- }
50
-
51
- /** 初始化地图 */
52
- initMap(container, options = {}) {
53
- const map = new this.AMap.Map(container, {
54
- zoom: 13,
55
- zooms: [3, 20],
56
- pitch: 30,
57
- rotation: -15,
58
- viewMode: '3D',
59
- center: [118.868228, 28.892844],
60
- mapStyle: AMapStyle,
61
- ...options
62
- })
63
-
64
- options.zoomTool && map.addControl(new this.AMap.ToolBar())
65
- options.directionTool && map.addControl(new this.AMap.ControlBar())
66
-
67
- return map
68
- }
69
-
70
- /** 格式化地图经纬度 */
71
- setLngLat(position) {
72
- return new this.AMap.LngLat(position[0], position[1])
73
- }
74
-
75
- /** 创建信息窗口处理器(柯里化函数) */
76
- _createInfoWindowHandler() {
77
- return (Vue) => {
78
- if (!Vue || !Vue.extend) {
79
- throw new Error('必须传入有效的Vue构造函数')
80
- }
81
-
82
- return ({component, props, options = {}}) => {
83
- if (!component) throw new Error('component参数必填')
84
-
85
- const InfoWindowComponent = Vue.extend(component)
86
- const instance = new InfoWindowComponent({
87
- propsData: props
88
- }).$mount(document.createElement('div'))
89
-
90
- return new this.AMap.InfoWindow({
91
- isCustom: true,
92
- content: instance.$el,
93
- ...options
94
- })
95
- }
96
- }
97
- }
98
-
99
- /** 带缓存的图标创建方法 */
100
- async setIcon(iconUrl) {
101
- if (this._iconCache.has(iconUrl)) {
102
- return this._iconCache.get(iconUrl)
103
- }
104
-
105
- return new Promise((resolve, reject) => {
106
- const icon = new this.AMap.Icon({
107
- image: iconUrl,
108
- imageOffset: new this.AMap.Pixel(0, 0)
109
- })
110
-
111
- const img = new Image()
112
- img.onload = () => {
113
- const size = new this.AMap.Size(img.width, img.height)
114
- icon.setSize(size)
115
- icon.setImageSize(size)
116
- this._iconCache.set(iconUrl, icon)
117
- resolve(icon)
118
- }
119
- img.onerror = () => reject(new Error(`图标加载失败: ${iconUrl}`))
120
- img.src = iconUrl
121
- })
122
- }
123
-
124
- /** 增强的标记点创建方法 */
125
- async setMarker(iconUrl, options = {}) {
126
- try {
127
- const icon = await this.setIcon(iconUrl)
128
- const marker = new this.AMap.Marker({
129
- anchor: 'bottom-center',
130
- ...options,
131
- icon
132
- })
133
- return marker
134
- } catch (error) {
135
- console.error('创建标记点失败:', error)
136
- throw error
137
- }
138
- }
139
-
140
- /** 地图逆地理编码 */
141
- getMapAddress({longitude, latitude}, callBack) {
142
- return new Promise((resolve, reject) => {
143
- const geocoder = new this.AMap.Geocoder({
144
- city: '全国',
145
- extensions: 'all'
146
- })
147
-
148
- geocoder.getAddress([longitude, latitude], (status, result) => {
149
- if (status === 'complete' && result.info === 'OK') {
150
- const { formattedAddress, pois } = result.regeocode
151
- const { district, township } = result.regeocode.addressComponent
152
- const division = township && formattedAddress.includes(township)
153
- ? formattedAddress.indexOf(township) + township.length
154
- : formattedAddress.indexOf(district) + district.length
155
-
156
- const addressMsg = {
157
- address: formattedAddress.slice(0, division) + (pois[0]?.address || ''),
158
- addressInfo: result.regeocode.addressComponent
159
- }
160
-
161
- callBack?.(addressMsg)
162
- resolve(addressMsg)
163
- } else {
164
- reject(new Error('转换失败'))
165
- }
166
- })
167
- })
168
- }
169
-
170
- /** 根据地址搜索地图poi点及其他信息 */
171
- /**
172
- *
173
- * @param {*} keywords 根据关键字搜索
174
- * @param {*} callBack 查询成功后过滤信息及转换格式 传递回调函数 兼容老版本代码
175
- */
176
- getMapSearch(keywords, callBack) {
177
- return new Promise((resolve) => {
178
- const placeSearch = new this.AMap.PlaceSearch()
179
- placeSearch.search(keywords, (status, searchList) => {
180
- const options = searchList?.poiList?.pois?.map(node => ({
181
- ...node,
182
- label: `${node.name}(${node.address})`
183
- })) || []
184
- callBack?.(options)
185
- resolve(options)
186
- })
187
- })
188
- }
189
-
190
- /** 道路规划 */
191
- /**
192
- *
193
- * @param {*} AMapInit 当前地图实例
194
- * @param {*} paths 需查询的路径起始点及途径点集合
195
- * @param {*} roadOptions 路线规划的其他参数
196
- * { paths: 需查询的路径起始点及途径点集合, options: 为查询路线配置项 }
197
- * @param {*} callBack 查询成功后回调函数 兼容老版本代码
198
- */
199
- async setMapDriving(mapInstance, roadOptions, callBack) {
200
- const { paths, options = {} } = roadOptions
201
- return new Promise((resolve) => {
202
- mapInstance.plugin("AMap.Driving", () => {
203
- const driving = new this.AMap.Driving({
204
- map: mapInstance,
205
- ...options
206
- })
207
-
208
- driving.search(
209
- this.setLngLat(paths[0]),
210
- this.setLngLat(paths[paths.length - 1]),
211
- {
212
- waypoints: paths.slice(1, -1).map(path => this.setLngLat(path))
213
- },
214
- (status, {routes}) => status === 'complete' && (
215
- callBack?.(roadDriving, routes),
216
- resolve({ driving, routes })
217
- )
218
- )
219
- })
220
- })
221
- }
222
-
223
- // 其他方法保持类似改造...
224
- }
225
-
226
- // 获取AMap实例(组件内使用)
227
- export const getAMapInstance = async (options = {}) => {
228
- if (AMapInstance) return AMapInstance
229
-
230
- // 确保key存在
231
- if (!AMapKey) {
232
- try {
233
- setAMapSecurity()
234
- } catch (e) {
235
- throw new Error('请先设置地图Key!')
236
- }
237
- }
238
-
239
- const AMapLoader = (await import('@amap/amap-jsapi-loader')).default
240
-
241
- try {
242
- const AMap = await AMapLoader.load({
243
- key: AMapKey,
244
- version: '2.0',
245
- plugins: [
246
- 'AMap.Geocoder',
247
- 'AMap.PlaceSearch', // 搜索
248
- 'AMap.MouseTool', // 鼠标
249
- 'AMap.ControlBar', // 方向盘
250
- 'AMap.ToolBar', // 缩放
251
- ...(options.plugins || [])
252
- ]
253
- })
254
- AMapInstance = new AMapService(AMap)
255
- return AMapInstance
256
- } catch (e) {
257
- throw new Error(`高德地图加载失败: ${e.message}`)
258
- }
259
- }
260
-
261
- // 在 Vue 插件中封装高德地图的初始化和常用方法
262
- export default {
263
- async install(Vue, options = {}) {
264
-
265
- const amap = await getAMapInstance(options)
266
-
267
- const { AMap, methods, layers } = amap
268
-
269
- Vue.prototype.$amap = AMap
270
-
271
- /** 初始化地图 */
272
- Vue.prototype.$initAMap = (mapOptions, callBack) => {
273
- const amapInit = amap.initMap(
274
- mapOptions.el,
275
- mapOptions.options || {}
276
- )
277
- /** 兼容之前版本代码 */
278
- callBack?.(amapInit)
279
- return amapInit
280
- }
281
-
282
- /** 地图加载完成 */
283
- Vue.prototype.$amapBus.$emit('onAMapMounted')
284
-
285
- /** 常用覆盖物 */
286
- Vue.prototype.$amapLayers = {
287
- ...layers,
288
- setInfoWindow: layers.setInfoWindow(Vue)
289
- }
290
-
291
- /** 抛出地图常用方法 */
292
- Vue.prototype.$amapMethods = methods || {}
293
-
294
- }
295
- }
296
-
297
- /**
298
- * 安全获取覆盖物坐标信息
299
- * @param {AMap.Overlay} overlay 地图覆盖物实例
300
- * @returns {Array<Array<number>>} 坐标点数组
301
- */
302
- function getOverlayPos(overlay) {
303
- if (!overlay) throw new Error('覆盖物实例不存在')
304
-
305
- try {
306
- return overlay.type === 'AMap.Marker'
307
- ? [overlay.getPosition().lng, overlay.getPosition().lat]
308
- : overlay.getPath().map(({lng, lat}) => [lng, lat])
309
- } catch (e) {
310
- console.error('转换失败', e)
311
- return []
312
- }
313
- }
314
-
315
- /**
316
- * 轨迹动画执行器
317
- * @param {AMap.Map} AMapInit 地图实例
318
- * @param {AMap.Marker} animationMarker 动画标记物
319
- * @param {Array<Array<number>>} paths 路径坐标数组
320
- * @param {Object} [options] 动画配置
321
- * @param {Function} [callBack] 动画完成回调
322
- */
323
- function drawMapAnimation(AMapInit, animationMarker, paths, options = {}, callBack) {
324
- if (!AMapInit || !animationMarker || !paths?.length) {
325
- return console.error('缺少参数信息')
326
- }
327
-
328
- AMapInit.plugin('AMap.MoveAnimation', () => {
329
- const defaultOptions = {
330
- duration: 500,
331
- autoRotation: true,
332
- ...options
333
- }
334
-
335
- animationMarker.moveAlong(paths, defaultOptions)
336
- callBack?.(animationMarker)
337
- })
338
- }
339
-
340
- /**
341
- * 转换导航路线为可绘制路径
342
- * @param {AMap.DrivingRoute} route 导航路线对象
343
- * @returns {{
344
- * path: Array<Array<number>>,
345
- * approachPoints: Array<number>
346
- * }}
347
- */
348
- function parseRouteToPath(route) {
349
- if (!route?.steps) return { path: [], approachPoints: [] }
350
-
351
- const result = {
352
- path: [],
353
- approachPoints: []
354
- }
355
-
356
- route.steps.forEach((step, stepIndex) => {
357
- step.path.forEach((point, pointIndex) => {
358
- result.path.push([point.lng, point.lat])
359
-
360
- if (step.assistant_action === "到达途经地" &&
361
- pointIndex === step.path.length - 1) {
362
- result.approachPoints.push(result.path.length - 1)
363
- }
364
- })
365
- })
366
-
367
- return result
368
- }
@@ -1,106 +0,0 @@
1
- import { Spin } from 'ant-design-vue'
2
-
3
- export const PageLoading = {
4
- name: 'PageLoading',
5
- props: {
6
- tip: {
7
- type: String,
8
- default: 'Loading..'
9
- },
10
- size: {
11
- type: String,
12
- default: 'large'
13
- }
14
- },
15
- render () {
16
- const style = {
17
- textAlign: 'center',
18
- background: 'rgba(0,0,0,0.6)',
19
- position: 'fixed',
20
- top: 0,
21
- bottom: 0,
22
- left: 0,
23
- right: 0,
24
- zIndex: 1100
25
- }
26
- const spinStyle = {
27
- position: 'absolute',
28
- left: '50%',
29
- top: '40%',
30
- transform: 'translate(-50%, -50%)'
31
- }
32
- return (<div style={style}>
33
- <Spin size={this.size} style={spinStyle} tip={this.tip} />
34
- </div>)
35
- }
36
- }
37
-
38
- const version = '0.0.1'
39
- const loading = {}
40
-
41
- loading.newInstance = (Vue, options) => {
42
- let loadingElement = document.querySelector('body>div[type=loading]')
43
- if (!loadingElement) {
44
- loadingElement = document.createElement('div')
45
- loadingElement.setAttribute('type', 'loading')
46
- loadingElement.setAttribute('class', 'ant-loading-wrapper')
47
- document.body.appendChild(loadingElement)
48
- }
49
-
50
- const cdProps = Object.assign({ visible: false, size: 'large', tip: 'Loading...' }, options)
51
-
52
- const instance = new Vue({
53
- data () {
54
- return {
55
- ...cdProps
56
- }
57
- },
58
- render () {
59
- const { tip } = this
60
- const props = {}
61
- this.tip && (props.tip = tip)
62
- if (this.visible) {
63
- return <PageLoading { ...{ props } } />
64
- }
65
- return null
66
- }
67
- }).$mount(loadingElement)
68
-
69
- function update (config) {
70
- const { visible, size, tip } = { ...cdProps, ...config }
71
- instance.$set(instance, 'visible', visible)
72
- if (tip) {
73
- instance.$set(instance, 'tip', tip)
74
- }
75
- if (size) {
76
- instance.$set(instance, 'size', size)
77
- }
78
- }
79
-
80
- return {
81
- instance,
82
- update
83
- }
84
- }
85
-
86
- const api = {
87
- show: function (options) {
88
- this.instance.update({ ...options, visible: true })
89
- },
90
- hide: function () {
91
- this.instance.update({ visible: false })
92
- }
93
- }
94
-
95
- const install = function (Vue, options) {
96
- if (Vue.prototype.$loading) {
97
- return
98
- }
99
- api.instance = loading.newInstance(Vue, options)
100
- Vue.prototype.$loading = api
101
- }
102
-
103
- export default {
104
- version,
105
- install
106
- }
@@ -1,88 +0,0 @@
1
- import {toggleTheme} from "@zougt/theme-css-extract-webpack-plugin/dist/toggleTheme"
2
-
3
- import message from 'ant-design-vue/es/message'
4
-
5
- const watchTheme = {
6
- created() {
7
- /** 全局添加标志变量来控制是否已经添加过监听器 */
8
- if (!window._storageListenerAdded) {
9
- /** 监听storage变化 */
10
- window.addEventListener('storage', this.handleStorageChange)
11
- window._storageListenerAdded = true
12
- }
13
- },
14
- methods: {
15
- handleStorageChange(event) {
16
- // console.log('Storage changed:', event.newValue)
17
- /** 判断是否为主题key更改并执行资源切换 */
18
- event.key === 'projectTheme' && this.$setTheme(event.newValue)
19
- }
20
- },
21
- beforeDestroy() {
22
- /** 销毁标志变量及监听器 */
23
- if (window._storageListenerAdded) {
24
- window.removeEventListener('storage', this.handleStorageChange)
25
- window._storageListenerAdded = false
26
- }
27
- }
28
- }
29
-
30
- export default {
31
- install(Vue) {
32
- /** 判断是否属于内嵌项目 */
33
- const isHas = window.parent !== window
34
-
35
- Vue.prototype.$setTheme = function(theme) {
36
- /** 子项目则只需切换主题资源 */
37
- if(isHas) {
38
- return ToggleThemeSource(theme)
39
- }
40
- ToggleTheme(theme)
41
- }
42
- /** 子项目需挂载监听主题变化自动执行切换 */
43
- isHas && Vue.mixin(watchTheme)
44
-
45
- /** 切换当前主题 */
46
- function ToggleTheme(scopeName) {
47
- /** 切换主题loading */
48
- const hideMessage = message.loading('正在切换主题!', 0)
49
-
50
- ToggleThemeSource(scopeName)
51
-
52
- const loadingTimer=setTimeout(() => {
53
- hideMessage()
54
- clearTimeout(loadingTimer)
55
- }, 10)
56
-
57
- Vue.prototype.$store.commit('SET_THEME',scopeName)
58
- }
59
-
60
- /** 切换主题资源 */
61
- function ToggleThemeSource(scopeName) {
62
- /** 获取初始配置项 */
63
- // env.themeConfig 来源 vue.config.js define (webpack的DefinePlugin)
64
- const themeConfig = env.themeConfig
65
- /** 主题配置
66
- * @scopeName 名称
67
- * @multipleScopeVars 主题项
68
- * @extract 是否提取
69
- * @publicPath 资源输出路径
70
- * @outputDir 提取的 css 文件存放目录
71
- */
72
- toggleTheme({
73
- scopeName: `theme-${scopeName}`,
74
- multipleScopeVars: themeConfig.multipleScopeVars,
75
- extract: themeConfig.extract,
76
- publicPath: themeConfig.publicPath,
77
- outputDir: themeConfig.extractCssOutputDir
78
- })
79
-
80
- /** 加载主题对应样式文件 */
81
- // const requireLess = require.context('@/theme/styles', false, /\.less$/)
82
- // requireLess(`./${scopeName}.less`)
83
- let themeLink = document.getElementById('theme-stylesheet')
84
- themeLink.href = `${process.env.BASE_URL}static/style/${scopeName}.css`
85
- }
86
-
87
- }
88
- }
@@ -1,12 +0,0 @@
1
- /** 全局便捷弹出框 */
2
- import Dialog from "./Dialog"
3
- /** 全局页面加载框 */
4
- import PageLoading from "./PageLoading"
5
-
6
- /** 加载便捷弹窗等 */
7
- export default {
8
- install(Vue) {
9
- Vue.use(Dialog)
10
- Vue.use(PageLoading)
11
- }
12
- }
@@ -1,31 +0,0 @@
1
- import storage from '../utils/Storage.js'
2
- /** 存储方式 */
3
- const storageMode = process.env.NODE_ENV === 'development' ? 'cookies' : 'local'
4
-
5
- const state = {
6
- /** 登录token存储 */
7
- token: storage[storageMode].get('token'),
8
- /** 登录用户信息 */
9
- userInfo: storage[storageMode].getJson('userInfo')
10
- }
11
-
12
- const mutations = {
13
- SET_USER_INFO(state, userInfo) {
14
- state.userInfo = userInfo
15
- storage[storageMode].setJson('userInfo', userInfo)
16
- },
17
- SET_TOKEN(state, token) {
18
- state.token = token
19
- storage[storageMode].set('token', token)
20
- },
21
- REMOVE_TOKEN(state, token) {
22
- state.token = null
23
- storage[storageMode].remove('token')
24
- storage[storageMode].remove('userInfo')
25
- }
26
- }
27
-
28
- export default {
29
- state,
30
- mutations
31
- }
@@ -1,56 +0,0 @@
1
- // import Vue from 'vue'
2
-
3
- const state = {
4
- menuRouteTime: {},
5
- // 缓存时长,单位为分钟
6
- menuCacheDuration: 5,
7
- menuCacheLength: 20
8
- }
9
-
10
- const mutations = {
11
- SET_MENU_ROUTE_TIME(state, route) {
12
- state.menuRouteTime = {
13
- ...state.menuRouteTime,
14
- [route]: new Date().getTime()
15
- }
16
- // Vue.set(state.menuRouteTime, route, new Date().getTime())
17
- },
18
- SET_MENU_ROUTE(state, key) {
19
- state.menuRouteTime[key] && delete state.menuRouteTime[key]
20
- }
21
- }
22
-
23
- const actions = {
24
- // 当缓存超出限制数量,将自动根据时间比对出最早入栈菜单并移除
25
- RemoveFirstMenu({commit,state}, length) {
26
- let menuKeys = Object.keys(state.menuRouteTime)
27
- let menuLength = length ?? state.menuCacheLength
28
- if(menuKeys.length > menuLength) {
29
- const key = menuKeys.reduce((last, next) => {
30
- return state.menuRouteTime[next] < state.menuRouteTime[last] ?
31
- next : last
32
- }, menuKeys[0])
33
- commit('SET_MENU_ROUTE', key)
34
- }
35
- },
36
- JudgeMenuCache({commit,state}, duration) {
37
- let menuKeys = Object.keys(state.menuRouteTime)
38
- let menuDuration = duration ?? state.menuCacheDuration
39
- menuKeys.forEach(key => {
40
- let targetTimestamp = state.menuRouteTime[key]
41
- let currentTimestamp = Date.now()
42
- let fiveMinutesAgo = currentTimestamp - menuDuration * 60 * 1000
43
- if (targetTimestamp >= fiveMinutesAgo && targetTimestamp <= currentTimestamp) {
44
- console.log(`目标时间戳在过去${menuDuration}分钟内`)
45
- } else {
46
- commit('SET_MENU_ROUTE', key)
47
- }
48
- } )
49
- }
50
- }
51
-
52
- export default {
53
- state,
54
- mutations,
55
- actions
56
- }