Commit bc6b4440 authored by 郭铭瑶's avatar 郭铭瑶 🤘

选择大屏配置地址增加id参数

parent 0e5e0818
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -6,10 +6,10 @@ ...@@ -6,10 +6,10 @@
<link rel="icon" href="./favicon.ico" /> <link rel="icon" href="./favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>静安智慧房管</title> <title>静安智慧房管</title>
<script type="module" crossorigin src="./assets/index.473707ed.js"></script> <script type="module" crossorigin src="./assets/index.b4772bee.js"></script>
<link rel="modulepreload" href="./assets/vendor.8dcd84ff.js"> <link rel="modulepreload" href="./assets/vendor.630e6fa8.js">
<link rel="stylesheet" href="./assets/vendor.db35e2cd.css"> <link rel="stylesheet" href="./assets/vendor.db35e2cd.css">
<link rel="stylesheet" href="./assets/index.19e21daa.css"> <link rel="stylesheet" href="./assets/index.9ef128c6.css">
</head> </head>
<body> <body>
......
...@@ -29,16 +29,24 @@ const props = defineProps({ ...@@ -29,16 +29,24 @@ const props = defineProps({
type: Boolean as PropType<boolean>, type: Boolean as PropType<boolean>,
default: false, default: false,
}, },
onlyOneView: {
type: Boolean as PropType<boolean>,
default: false,
},
}) })
const emit = defineEmits(['touch']) const emit = defineEmits(['touch'])
const btns = computed(() => [ const btns = computed(() => [
{ key: 'home', icon: btn7, hidden: props.isDefaultScreen }, {
key: 'home',
icon: btn7,
hidden: props.isDefaultScreen || props.onlyOneView,
},
{ key: 'btn1', icon: btn1 }, { key: 'btn1', icon: btn1 },
{ key: 'full', icon: btn2 }, { key: 'full', icon: btn2 },
{ key: 'in', icon: btn3 }, { key: 'in', icon: btn3 },
{ key: 'out', icon: btn4 }, { key: 'out', icon: btn4 },
{ key: 'list', icon: btn5 }, { key: 'list', icon: btn5, hidden: props.onlyOneView },
{ key: 'btn6', icon: btn6 }, { key: 'btn6', icon: btn6 },
]) ])
const onClick = (key: string) => { const onClick = (key: string) => {
......
...@@ -34,14 +34,14 @@ ...@@ -34,14 +34,14 @@
> >
<TrashBin /> <TrashBin />
</n-icon> </n-icon>
<n-icon <!-- <n-icon
v-show="!!components[index]" v-show="!!components[index]"
class="btn config" class="btn config"
size=".16rem" size=".16rem"
@click="onSetComponent(componentList[components[index]])" @click="onSetComponent(componentList[components[index]])"
> >
<Settings /> <Settings />
</n-icon> </n-icon> -->
</div> </div>
</m-grid> </m-grid>
</div> </div>
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
:rows="isTake2rows ? 2 : 1" :rows="isTake2rows ? 2 : 1"
@select="onSelectComponent" @select="onSelectComponent"
/> />
<n-drawer id="setting-drawer" v-model:show="showSettingDrawer" :width="502"> <n-drawer id="setting-drawer" v-model:show="showSettingDrawer" :width="400">
<n-drawer-content title="组件设置"> <n-drawer-content title="组件设置">
<n-form <n-form
ref="formRef" ref="formRef"
......
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
<MapBtns <MapBtns
:full-screen="fullScreen" :full-screen="fullScreen"
:is-default-screen="isDefaultScreen" :is-default-screen="isDefaultScreen"
:only-one-view="onlyOneView"
@touch="handleMapBtnsEvents" @touch="handleMapBtnsEvents"
/> />
</template> </template>
...@@ -80,7 +81,22 @@ const defaultConfig = { ...@@ -80,7 +81,22 @@ const defaultConfig = {
'4': 'A019', '4': 'A019',
}, },
} }
const onlyOneView = ref(false) // 目前是否为特定id的url大屏
function initConfig() { function initConfig() {
if (window.location.hash) {
const id = window.location.hash.split('/')?.[1]
ajax
.get({
url: api.CONFIGS,
params: { id },
})
.then((res) => {
const config = res?.data?.content?.[0] || {}
check(config)
})
onlyOneView.value = true
return
}
layout.value = defaultConfig.layout layout.value = defaultConfig.layout
components.value = defaultConfig.components components.value = defaultConfig.components
isDefaultScreen.value = true isDefaultScreen.value = true
...@@ -88,12 +104,13 @@ function initConfig() { ...@@ -88,12 +104,13 @@ function initConfig() {
onMounted(initConfig) onMounted(initConfig)
const isDefaultScreen = ref(true) const isDefaultScreen = ref(true)
function check({ configJson }) { function check({ id, configJson }) {
const config = JSON.parse(configJson) const config = JSON.parse(configJson)
config?.layout && (layout.value = config.layout) config?.layout && (layout.value = config.layout)
config?.components && (components.value = config.components) config?.components && (components.value = config.components)
showModal.value = false showModal.value = false
isDefaultScreen.value = false isDefaultScreen.value = false
window.location.hash = `#/${id}`
} }
const fullScreen = ref(false) const fullScreen = ref(false)
...@@ -111,6 +128,11 @@ function handleMapBtnsEvents(key: string) { ...@@ -111,6 +128,11 @@ function handleMapBtnsEvents(key: string) {
}) })
break break
case 'home': case 'home':
window.history.replaceState(
null,
'',
window.location.pathname + window.location.search,
) // 移除hash
initConfig() initConfig()
break break
case 'full': case 'full':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment