feat(app): 添加全局加载组件和CAS单点登录功能
- 在App.vue中引入GlobalLoading组件并挂载到全局 - 新增src/components/GlobalLoading/index.vue组件文件 - 在auth.js中添加AccessUserKey常量和相关存储方法 - 在login.js中添加logincas和outlogcas接口函数 - 在main.js中注册GlobalLoading全局组件 - 修改Navbar.vue实现CAS登出逻辑和跳转处理 - 增加sessionStorage和localStorage清理机制 Signed-off-by: NewName <1048783178@qq.com>
This commit is contained in:
10
src/App.vue
10
src/App.vue
@@ -1,19 +1,22 @@
|
||||
<template>
|
||||
<div id="app" style="background-color:#0e2e87" v-if="$route.meta.bigScreen">
|
||||
<router-view />
|
||||
<global-loading ref="globalLoading" />
|
||||
</div>
|
||||
<div id="app" v-else>
|
||||
<router-view :key="language"/>
|
||||
<theme-picker />
|
||||
<global-loading ref="globalLoading" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ThemePicker from "@/components/ThemePicker";
|
||||
import GlobalLoading from '@/components/GlobalLoading'
|
||||
|
||||
export default {
|
||||
name: "App",
|
||||
components: { ThemePicker },
|
||||
components: { ThemePicker, GlobalLoading },
|
||||
metaInfo() {
|
||||
return {
|
||||
title: this.$store.state.settings.dynamicTitle && this.$store.state.settings.title,
|
||||
@@ -26,9 +29,14 @@ export default {
|
||||
language(){
|
||||
return this.$store.state.settings.language
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// 将loading方法挂载到全局,方便在任何组件中调用
|
||||
this.$root.$loading = this.$refs.globalLoading
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
#app .theme-picker {
|
||||
display: none;
|
||||
|
||||
Reference in New Issue
Block a user