|
@@ -1,27 +1,18 @@
|
|
<template>
|
|
<template>
|
|
- <n-config-provider data-cy="app" :theme="theme" :theme-overrides="themeOverrides" :class="{ dark: mode }">
|
|
|
|
|
|
+ <n-config-provider
|
|
|
|
+ data-cy="app"
|
|
|
|
+ :theme="theme"
|
|
|
|
+ :theme-overrides="themeOverrides"
|
|
|
|
+ :class="{ dark: mode }"
|
|
|
|
+ >
|
|
<n-layout position="absolute" style="height: 100vh">
|
|
<n-layout position="absolute" style="height: 100vh">
|
|
<n-layout-header style="padding: 24px" bordered>
|
|
<n-layout-header style="padding: 24px" bordered>
|
|
<div class="flex justify-between items-center">
|
|
<div class="flex justify-between items-center">
|
|
- <div class="back" style="position: relative; top: 4px">
|
|
|
|
|
|
+ <div class="back" style="position: relative; top: 4px; color: #fff">
|
|
<n-icon size="24" :component="ChevronBackOutline" />
|
|
<n-icon size="24" :component="ChevronBackOutline" />
|
|
<span style="position: relative; top: -6px">返回我的场景</span>
|
|
<span style="position: relative; top: -6px">返回我的场景</span>
|
|
</div>
|
|
</div>
|
|
<n-button type="primary"> 保存 </n-button>
|
|
<n-button type="primary"> 保存 </n-button>
|
|
- <!-- <n-switch data-cy="dark-mode" v-model:value="mode">
|
|
|
|
- <template #checked> Dark </template>
|
|
|
|
- <template #unchecked> Light </template>
|
|
|
|
- <template #checked-icon>
|
|
|
|
- <n-icon>
|
|
|
|
- <moon />
|
|
|
|
- </n-icon>
|
|
|
|
- </template>
|
|
|
|
- <template #unchecked-icon>
|
|
|
|
- <n-icon>
|
|
|
|
- <sun />
|
|
|
|
- </n-icon>
|
|
|
|
- </template>
|
|
|
|
- </n-switch> -->
|
|
|
|
</div>
|
|
</div>
|
|
</n-layout-header>
|
|
</n-layout-header>
|
|
<n-layout
|
|
<n-layout
|
|
@@ -40,17 +31,25 @@
|
|
:native-scrollbar="false"
|
|
:native-scrollbar="false"
|
|
bordered
|
|
bordered
|
|
>
|
|
>
|
|
- <n-menu :options="menuOptions" @update:value="handleUpdateValue" />
|
|
|
|
|
|
+ <n-menu v-model:value="activeKey" :options="menuOptions" @update:value="handleUpdateValue" />
|
|
</n-layout-sider>
|
|
</n-layout-sider>
|
|
<n-layout-content
|
|
<n-layout-content
|
|
content-class="layoutContent"
|
|
content-class="layoutContent"
|
|
:native-scrollbar="false"
|
|
:native-scrollbar="false"
|
|
>
|
|
>
|
|
<div class="app-wrap">
|
|
<div class="app-wrap">
|
|
- <div class="app-scene" ref="sceneRef"></div>
|
|
|
|
|
|
+ <div
|
|
|
|
+ class="app-scene"
|
|
|
|
+ ref="sceneRef"
|
|
|
|
+ :style="{ width: sceneRefWidth, opacity: showScene ? 0 : 1 }"
|
|
|
|
+ ></div>
|
|
</div>
|
|
</div>
|
|
- <div class="app-view">
|
|
|
|
- <router-view />
|
|
|
|
|
|
+ <div class="app-view pointer-events-none" id="drawer-target">
|
|
|
|
+ <n-message-provider>
|
|
|
|
+ <n-dialog-provider>
|
|
|
|
+ <router-view />
|
|
|
|
+ </n-dialog-provider>
|
|
|
|
+ </n-message-provider>
|
|
</div>
|
|
</div>
|
|
</n-layout-content>
|
|
</n-layout-content>
|
|
</n-layout>
|
|
</n-layout>
|
|
@@ -60,10 +59,17 @@
|
|
|
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
import { useSDK } from '@/sdk'
|
|
import { useSDK } from '@/sdk'
|
|
-import { darkTheme, lightTheme } from 'naive-ui'
|
|
|
|
-import { computed, ref, watchEffect, h, onMounted } from 'vue'
|
|
|
|
|
|
+import {
|
|
|
|
+ darkTheme,
|
|
|
|
+ lightTheme,
|
|
|
|
+ NDialogProvider,
|
|
|
|
+ NMessageProvider
|
|
|
|
+} from 'naive-ui'
|
|
|
|
+import { computed, ref, toRaw , watchEffect, h, onMounted, watch } from 'vue'
|
|
import type { Component } from 'vue'
|
|
import type { Component } from 'vue'
|
|
|
|
+import { useMainStore } from '@/store'
|
|
import themeOverrides from '@/styles/theme.js'
|
|
import themeOverrides from '@/styles/theme.js'
|
|
|
|
+import { useRouter, useRoute } from 'vue-router'
|
|
import {
|
|
import {
|
|
ChevronBackOutline,
|
|
ChevronBackOutline,
|
|
Layers,
|
|
Layers,
|
|
@@ -76,14 +82,40 @@ import {
|
|
const darkStore = localStorage.getItem('dark')
|
|
const darkStore = localStorage.getItem('dark')
|
|
import { RouterLink } from 'vue-router'
|
|
import { RouterLink } from 'vue-router'
|
|
import { NIcon, useMessage } from 'naive-ui'
|
|
import { NIcon, useMessage } from 'naive-ui'
|
|
|
|
+const route = useRoute()
|
|
|
|
+const activeKey = ref(route.name)
|
|
|
|
+
|
|
|
|
+const showScene = ref(false)
|
|
|
|
+watch(
|
|
|
|
+ () => route.name,
|
|
|
|
+ () => {
|
|
|
|
+ console.log('activeKeys', route.name)
|
|
|
|
+ activeKey.value = route.name
|
|
|
|
+ if (route.name === 'textToaudio') {
|
|
|
|
+ showScene.value = true
|
|
|
|
+ } else {
|
|
|
|
+ showScene.value = false
|
|
|
|
+ }
|
|
|
|
+ console.log('watch', route.name)
|
|
|
|
+ }
|
|
|
|
+)
|
|
const prefersDark: boolean = darkStore
|
|
const prefersDark: boolean = darkStore
|
|
? darkStore === 'true'
|
|
? darkStore === 'true'
|
|
: window.matchMedia('(prefers-color-scheme: dark)').matches
|
|
: window.matchMedia('(prefers-color-scheme: dark)').matches
|
|
|
|
|
|
const mode = ref<boolean>(prefersDark)
|
|
const mode = ref<boolean>(prefersDark)
|
|
const theme = computed(() => (mode.value ? darkTheme : lightTheme))
|
|
const theme = computed(() => (mode.value ? darkTheme : lightTheme))
|
|
-const sceneRef = ref()
|
|
|
|
|
|
+const sceneRefWidth = computed(() => {
|
|
|
|
+ console.log('route', route, route.name === 'basicSettings')
|
|
|
|
+ if (route.name === 'basicSettings' || route.name === 'topicNavigation')
|
|
|
|
+ return `calc(100% - ${240}px)`
|
|
|
|
+ if (route.name === 'message') return `calc(100% - ${0}px)`
|
|
|
|
+ return `calc(100% - ${mode.sceneRefWidth}px)`
|
|
|
|
+})
|
|
|
|
|
|
|
|
+const sceneRef = ref()
|
|
|
|
+const main = useMainStore()
|
|
|
|
+const { setSceneRef } = main
|
|
watchEffect(() => {
|
|
watchEffect(() => {
|
|
localStorage.setItem('dark', `${mode.value}`)
|
|
localStorage.setItem('dark', `${mode.value}`)
|
|
})
|
|
})
|
|
@@ -185,11 +217,11 @@ const handleUpdateValue = (value: string) => {
|
|
const sdk = useSDK()
|
|
const sdk = useSDK()
|
|
sdk.use('MinMap')
|
|
sdk.use('MinMap')
|
|
|
|
|
|
-onMounted(()=>{
|
|
|
|
|
|
+onMounted(() => {
|
|
sdk.mount(sceneRef.value)
|
|
sdk.mount(sceneRef.value)
|
|
sdk.render()
|
|
sdk.render()
|
|
|
|
+ setSceneRef(sceneRef.value)
|
|
})
|
|
})
|
|
-
|
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style lang="sass">
|
|
<style lang="sass">
|
|
@@ -209,7 +241,7 @@ onMounted(()=>{
|
|
width: 100%
|
|
width: 100%
|
|
height: 100%
|
|
height: 100%
|
|
z-index: 10
|
|
z-index: 10
|
|
-.app-view
|
|
|
|
|
|
+.app-view
|
|
z-index: 100
|
|
z-index: 100
|
|
pointer-events: none
|
|
pointer-events: none
|
|
|
|
|
|
@@ -218,6 +250,14 @@ onMounted(()=>{
|
|
height: 100%
|
|
height: 100%
|
|
|
|
|
|
[xui_min_map]
|
|
[xui_min_map]
|
|
- right:10px
|
|
|
|
- top:10px
|
|
|
|
|
|
+ right: 10px
|
|
|
|
+ top: 10px
|
|
|
|
+.required
|
|
|
|
+ padding-left: 10px
|
|
|
|
+ position: relative
|
|
|
|
+ &:after
|
|
|
|
+ content: " *"
|
|
|
|
+ color: red
|
|
|
|
+ position: absolute
|
|
|
|
+ left: 0
|
|
</style>
|
|
</style>
|