Commit b10c24ce by 张建朝

tj

parent b31a1b67
Showing with 37 additions and 1 deletions
...@@ -17,7 +17,12 @@ const router = new VueRouter({ ...@@ -17,7 +17,12 @@ const router = new VueRouter({
path: '/callback.html', path: '/callback.html',
name: "oidcCallback", name: "oidcCallback",
component: () => import("@/views/OidcCallback.vue") component: () => import("@/views/OidcCallback.vue")
} },{
path: "/test",
name: "test",
component: () => import("@/views/test.vue")
}
], ],
scrollBehavior(to, from, savedPosition) { scrollBehavior(to, from, savedPosition) {
return { x: 0, y: 0 } return { x: 0, y: 0 }
......
<template> <template>
<div class="b-container"> <div class="b-container">
<tab-header :title="title" /> <tab-header :title="title" />
<div v-if="oidcIsAuthenticated"> 已登录,{{oidcUser}} <a @click="signOutOidc">退出</a></div>
<div v-else>
</div>
</div> </div>
</template> </template>
<script> <script>
import { TabHeader } from "@/components"; import { TabHeader } from "@/components";
import { mapGetters, mapActions } from 'vuex'
export default { export default {
components:{ components:{
TabHeader, TabHeader,
}, },
computed: {
...mapGetters([
'oidcIsAuthenticated',
'oidcUser',
'oidcAccessToken',
'oidcAccessTokenExp',
'oidcIdToken',
'oidcIdTokenExp',
'oidcAuthenticationIsChecked',
'oidcError'
]),
hasAccess: function() {
return this.oidcIsAuthenticated || this.$route.meta.isPublic
}
},
methods: {
...mapActions([
'authenticateOidc', // Authenticates with redirect to sign in if not signed in
'oidcSignInCallback', // Handles callback from authentication redirect. Has an optional url parameter
'authenticateOidcSilent', // Authenticates if signed in. No redirect is made if not signed in
'getOidcUser', // Get user from oidc-client storage and update it in vuex store. Returns a promise
'signOutOidc', // Signs out user in open id provider
'removeOidcUser' // Signs out user in vuex and browser storage, but not in open id provider
])
},
data() { data() {
return { return {
title: "TAB页面" title: "TAB页面"
......
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 sign in to comment