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 @@
<link rel="icon" href="./favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>静安智慧房管</title>
<script type="module" crossorigin src="./assets/index.473707ed.js"></script>
<link rel="modulepreload" href="./assets/vendor.8dcd84ff.js">
<script type="module" crossorigin src="./assets/index.b4772bee.js"></script>
<link rel="modulepreload" href="./assets/vendor.630e6fa8.js">
<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>
<body>
......
......@@ -29,16 +29,24 @@ const props = defineProps({
type: Boolean as PropType<boolean>,
default: false,
},
onlyOneView: {
type: Boolean as PropType<boolean>,
default: false,
},
})
const emit = defineEmits(['touch'])
const btns = computed(() => [
{ key: 'home', icon: btn7, hidden: props.isDefaultScreen },
{
key: 'home',
icon: btn7,
hidden: props.isDefaultScreen || props.onlyOneView,
},
{ key: 'btn1', icon: btn1 },
{ key: 'full', icon: btn2 },
{ key: 'in', icon: btn3 },
{ key: 'out', icon: btn4 },
{ key: 'list', icon: btn5 },
{ key: 'list', icon: btn5, hidden: props.onlyOneView },
{ key: 'btn6', icon: btn6 },
])
const onClick = (key: string) => {
......
......@@ -34,14 +34,14 @@
>
<TrashBin />
</n-icon>
<n-icon
<!-- <n-icon
v-show="!!components[index]"
class="btn config"
size=".16rem"
@click="onSetComponent(componentList[components[index]])"
>
<Settings />
</n-icon>
</n-icon> -->
</div>
</m-grid>
</div>
......@@ -51,7 +51,7 @@
:rows="isTake2rows ? 2 : 1"
@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-form
ref="formRef"
......
......@@ -48,6 +48,7 @@
<MapBtns
:full-screen="fullScreen"
:is-default-screen="isDefaultScreen"
:only-one-view="onlyOneView"
@touch="handleMapBtnsEvents"
/>
</template>
......@@ -80,7 +81,22 @@ const defaultConfig = {
'4': 'A019',
},
}
const onlyOneView = ref(false) // 目前是否为特定id的url大屏
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
components.value = defaultConfig.components
isDefaultScreen.value = true
......@@ -88,12 +104,13 @@ function initConfig() {
onMounted(initConfig)
const isDefaultScreen = ref(true)
function check({ configJson }) {
function check({ id, configJson }) {
const config = JSON.parse(configJson)
config?.layout && (layout.value = config.layout)
config?.components && (components.value = config.components)
showModal.value = false
isDefaultScreen.value = false
window.location.hash = `#/${id}`
}
const fullScreen = ref(false)
......@@ -111,6 +128,11 @@ function handleMapBtnsEvents(key: string) {
})
break
case 'home':
window.history.replaceState(
null,
'',
window.location.pathname + window.location.search,
) // 移除hash
initConfig()
break
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