Skip to content

Commit 9f76733

Browse files
committed
同步最新代码
1 parent 1483541 commit 9f76733

File tree

18 files changed

+229
-187
lines changed

18 files changed

+229
-187
lines changed

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,20 @@
1212
"lint": "eslint ./src/**/*.{js,jsx,vue,ts,tsx} --fix && vue-tsc --noEmit"
1313
},
1414
"dependencies": {
15-
"@iconify/vue": "^3.1.3",
15+
"@icon-park/vue-next": "^1.3.6",
1616
"@turf/turf": "^6.5.0",
1717
"ant-design-vue": "3.0.0-beta.13",
1818
"axios": "^0.25.0",
1919
"core-js": "^3.20.3",
2020
"echarts": "^5.2.2",
2121
"echarts-gl": "^2.0.8",
2222
"kml-geojson": "^1.2.0",
23-
"leaflet": "^1.7.1",
23+
"leaflet": "^1.8.0",
2424
"localforage": "^1.10.0",
25-
"mars2d": "^3.1.0",
25+
"mapv": "^2.0.62",
26+
"mars2d-echarts": "^3.1.0",
2627
"mars2d-esri": "^3.1.0",
28+
"mars2d-mapv": "^3.1.0",
2729
"nprogress": "^0.2.0",
2830
"uuid": "^8.3.2",
2931
"vue": "^3.2.31",

public/config/config.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@
3030
"name": "底图",
3131
"type": "tdt",
3232
"layer": "vec_d",
33-
"key": ["ad5bee3fe473a639887fa9d57a670c6e"]
33+
"key": ["789e558be762ff832392a0393fd8a4f1"]
3434
},
3535
{
3636
"name": "注记",
3737
"type": "tdt",
3838
"layer": "vec_z",
39-
"key": ["ad5bee3fe473a639887fa9d57a670c6e"]
39+
"key": ["789e558be762ff832392a0393fd8a4f1"]
4040
}
4141
],
4242
"show": true
@@ -51,13 +51,13 @@
5151
"name": "底图",
5252
"type": "tdt",
5353
"layer": "img_d",
54-
"key": ["ad5bee3fe473a639887fa9d57a670c6e"]
54+
"key": ["789e558be762ff832392a0393fd8a4f1"]
5555
},
5656
{
5757
"name": "注记",
5858
"type": "tdt",
5959
"layer": "img_z",
60-
"key": ["ad5bee3fe473a639887fa9d57a670c6e"]
60+
"key": ["789e558be762ff832392a0393fd8a4f1"]
6161
}
6262
]
6363
},
@@ -67,7 +67,7 @@
6767
"icon": "img/basemaps/tianditudem.png",
6868
"type": "tdt",
6969
"layer": "ter",
70-
"key": ["ad5bee3fe473a639887fa9d57a670c6e"],
70+
"key": ["789e558be762ff832392a0393fd8a4f1"],
7171
"maxNativeZoom": 14,
7272
"errorTileUrl": "img/tile/errortile.png"
7373
},

src/common/store/widget.d.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ declare module "@mars/common/store/widget" {
3737

3838
export const injectState: (options: StoreOptions<WidgetState>) => Store<WidgetState>
3939

40+
export const useWidgetStore: any
41+
4042
export const useWidget: () => {
43+
currentWidget:any
4144
// 本页面widget配置数组
4245
widgets: ComputedRef<Widget[]>
4346
// 默认开启的widget
@@ -49,9 +52,9 @@ declare module "@mars/common/store/widget" {
4952
// 获取widget的当前激活状态
5053
isActivate: (name: string) => boolean
5154
// 激活指定 widget模块
52-
activate: (widget: string | Widget, reload?:boolean) => void
55+
activate: (widget: string | Widget| (string | Widget)[], reload?:boolean) => void
5356
// 释放指定的widget
54-
disable: (name: string) => void
57+
disable: (name: string| string[]) => void
5558
// 关闭释放所有widget ,hasAll传true值强制释放所有widget(默认autoDisable为false的widet不会释放)
5659
disableAll: (hasAll?: boolean) => void
5760
}

src/common/store/widget.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/mars-ui/mars-dialog/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<slot name="icon"></slot>
77
</span>
88
<span class="title">{{ mergeProps.title }}</span>
9-
<mars-icon icon="ph:x-light" :width="20" @click="closeModel" class="close-btn"></mars-icon>
9+
<mars-icon icon="close" :width="20" @click="closeModel" class="close-btn"></mars-icon>
1010
</div>
1111
<div class="pannel-model__body">
1212
<div class="content" :class="{ 'full-content': !$slots.footer }">
Lines changed: 39 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,39 @@
1-
<template>
2-
<Icon class="mars-icon" v-bind="attrs"></Icon>
3-
</template>
4-
<script lang="ts">
5-
import { useAttrs, defineComponent } from "vue"
6-
import { Icon } from "@iconify/vue"
7-
export default defineComponent({
8-
name: "mars-icon",
9-
inheritAttrs: false,
10-
components: {
11-
Icon
12-
},
13-
setup() {
14-
const attrs = useAttrs()
15-
return {
16-
attrs
17-
}
18-
}
19-
})
20-
</script>
21-
<style lang="less" scoped>
22-
.mars-icon{
23-
vertical-align: sub;
24-
}
25-
</style>
1+
<template>
2+
<component class="mars-icon" :is="iconComponent" theme="outline" :fill="color" :size="width" v-bind="attrs" />
3+
</template>
4+
<script lang="ts">
5+
import { computed, useAttrs, defineComponent } from "vue"
6+
import * as iconModules from "@icon-park/vue-next"
7+
import _ from "lodash"
8+
export default defineComponent({
9+
name: "mars-icon",
10+
// inheritAttrs: false,
11+
props: {
12+
icon: {
13+
type: String
14+
},
15+
color: {
16+
type: String,
17+
default: "#fff"
18+
},
19+
width: {
20+
type: [String, Number],
21+
default: "14"
22+
}
23+
},
24+
setup(props) {
25+
const attrs = useAttrs()
26+
const iconName = computed(() => _.upperFirst(_.camelCase(props.icon)))
27+
const iconComponent = iconModules[iconName.value] || iconModules.Logout
28+
return {
29+
attrs,
30+
iconComponent
31+
}
32+
}
33+
})
34+
</script>
35+
<style lang="less" scoped>
36+
.mars-icon{
37+
vertical-align: sub;
38+
}
39+
</style>

src/components/mars-ui/mars-pannel/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</div>
77

88
<div v-if="mergeProps.closeable" class="pannel-close-icon" @click="closeModel">
9-
<mars-icon icon="icon-park-outline:close-one" width="20"></mars-icon>
9+
<mars-icon icon="close-one" width="20"></mars-icon>
1010
</div>
1111
</div>
1212
</teleport>

src/components/mars-ui/mars-tree/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Tree } from "ant-design-vue"
22
import { App, defineComponent, h } from "vue"
3-
import { Icon } from "@iconify/vue"
3+
import Icon from "../mars-icon/index.vue"
44
import "./tree.less"
55

66
/**
@@ -14,11 +14,11 @@ const MarsTree = defineComponent({
1414
setup(props, context) {
1515
const icon = (isLeaf: boolean, expanded: boolean, group: boolean) => {
1616
if (isLeaf && !group) {
17-
return [h(Icon, { icon: "ph:browsers-fill", width: "14", color: "#79C1F8" })]
17+
return [h(Icon, { icon: "folder-close", width: "14", color: "#79C1F8" })]
1818
} else if (!expanded) {
19-
return [h(Icon, { icon: "ph:folder-fill", width: "14", color: "#db9829" })]
19+
return [h(Icon, { icon: "folder-close", width: "14", color: "#db9829" })]
2020
} else if (expanded) {
21-
return [h(Icon, { icon: "ph:folders-fill", width: "14", color: "#db9829" })]
21+
return [h(Icon, { icon: "folder-close", width: "14", color: "#db9829" })]
2222
}
2323
}
2424
return () =>

src/components/mars-work/main-view.vue

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,7 @@
66
</div>
77
<template v-if="loaded">
88
<template v-for="comp in widgets" :key="comp.key">
9-
<component
10-
v-if="openAtStart.includes(comp.name) && comp.visible"
11-
:is="comp.component"
12-
v-model:visible="comp.visible"
13-
v-bind="getWidgetAttr(comp)"
14-
/>
9+
<mars-widget v-if="openAtStart.includes(comp.name) && comp.visible" v-model:visible="comp.visible" :widget="comp" />
1510
</template>
1611
</template>
1712
</div>
@@ -25,14 +20,18 @@
2520
* @author 火星吴彦祖 2022-02-19
2621
*/
2722
import zhCN from "ant-design-vue/es/locale/zh_CN"
28-
import { provide, ref } from "vue"
23+
import { computed, provide, ref } from "vue"
2924
import { ConfigProvider } from "ant-design-vue"
30-
import { useWidget, Widget } from "@mars/common/store/widget"
25+
import { useWidgetStore } from "@mars/common/store/widget"
3126
import Mars2dMap from "@mars/components/mars-work/mars2d-map.vue"
27+
import MarsWidget from "./widget.vue"
3228
3329
const locale = zhCN
3430
35-
const { widgets, openAtStart } = useWidget()
31+
const widgetStore = useWidgetStore()
32+
33+
const widgets = computed(() => widgetStore.state.widgets)
34+
const openAtStart = computed(() => widgetStore.state.openAtStart)
3635
3736
const configUrl = `${process.env.BASE_URL}config/config.json`
3837
@@ -51,23 +50,6 @@ const marsOnload = (map: any) => {
5150
loaded.value = true
5251
}
5352
54-
const getWidgetAttr = (widget: Widget) => {
55-
let attr = {}
56-
if (widget.meta && widget.meta.props) {
57-
attr = {
58-
// ...widget.defaultOption.meta.props,
59-
...attr,
60-
...widget.meta.props
61-
}
62-
}
63-
if (widget.data && widget.data.props) {
64-
attr = {
65-
...attr,
66-
...widget.data.props
67-
}
68-
}
69-
return attr
70-
}
7153
</script>
7254

7355
<style lang="less" scoped>

src/components/mars-work/widget.vue

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<template>
2+
<component :is="widget.component" v-bind="getWidgetAttr(widget)" />
3+
</template>
4+
<script lang="ts">
5+
import { useAttrs, defineComponent, provide } from "vue"
6+
import type { Widget } from "@mars/common/store/widget"
7+
8+
export default defineComponent({
9+
name: "mars-widget",
10+
props: ["widget"],
11+
setup(props) {
12+
const attrs = useAttrs()
13+
14+
provide("getCurrentWidget", () => {
15+
return props.widget.name
16+
})
17+
18+
const getWidgetAttr = (widget: Widget) => {
19+
let attr = {}
20+
if (widget.meta && widget.meta.props) {
21+
attr = {
22+
...attr,
23+
...widget.meta.props
24+
}
25+
}
26+
if (widget.data && widget.data.props) {
27+
attr = {
28+
...attr,
29+
...widget.data.props
30+
}
31+
}
32+
return attr
33+
}
34+
35+
return {
36+
attrs,
37+
getWidgetAttr
38+
}
39+
}
40+
})
41+
</script>

0 commit comments

Comments
 (0)