mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-27 09:33:55 +08:00
fix: 修复webUI刷新跳转登录页面的问题
This commit is contained in:
@@ -1,64 +1,19 @@
|
||||
<template>
|
||||
<div id="app">
|
||||
<div class="app-content" :class="{ 'auth-layout': !isLoggedIn }">
|
||||
<div v-if="!isLoggedIn">
|
||||
<Login v-if="!showRegistration" @show-registration="showRegistration = true" @login-success="handleLoginSuccess" />
|
||||
<Registration v-else @show-login="showRegistration = false" />
|
||||
</div>
|
||||
<div v-else class="main-layout">
|
||||
<role-setting v-if="currentView === 'RoleSetting'"
|
||||
:device-id="selectedDeviceId"
|
||||
@back-to-panel="switchView('panel')"/>
|
||||
<panel v-else-if="currentView === 'panel'"
|
||||
@go-home="switchView('main')"
|
||||
@show-role="handleShowRole"
|
||||
/>
|
||||
<main-page v-else @enter-panel="switchView('panel')"/>
|
||||
</div>
|
||||
<div class="app-content">
|
||||
<router-view></router-view>
|
||||
</div>
|
||||
<Footer />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Login from './components/Login.vue';
|
||||
import Registration from './components/Registration.vue';
|
||||
import panel from './components/panel.vue';
|
||||
import MainPage from './components/Main.vue';
|
||||
import RoleSetting from './components/RoleSetting.vue';
|
||||
import Footer from './components/Footer.vue';
|
||||
|
||||
export default {
|
||||
name: 'App',
|
||||
components: {
|
||||
Login,
|
||||
Registration,
|
||||
panel,
|
||||
MainPage,
|
||||
RoleSetting,
|
||||
Footer
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
showRegistration: false,
|
||||
isLoggedIn: false,
|
||||
currentView: 'main',
|
||||
selectedDeviceId: null // 添加selectedDeviceId状态
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
handleLoginSuccess() {
|
||||
this.isLoggedIn = true;
|
||||
this.currentView = 'panel';
|
||||
},
|
||||
switchView(view) {
|
||||
console.log('Switching to view:', view); // 添加调试日志
|
||||
this.currentView = view;
|
||||
},
|
||||
handleShowRole(deviceId) {
|
||||
this.selectedDeviceId = deviceId;
|
||||
this.switchView('RoleSetting');
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user