sk_fems_ui commit

This commit is contained in:
unknown
2025-07-12 15:13:46 +09:00
commit ffdf5ccb66
380 changed files with 137913 additions and 0 deletions

8
middleware/README.md Normal file
View File

@ -0,0 +1,8 @@
# MIDDLEWARE
**This directory is not required, you can delete it if you don't want to use it.**
This directory contains your application middleware.
Middleware let you define custom functions that can be run before rendering either a page or a group of pages.
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/routing#middleware).

View File

@ -0,0 +1,28 @@
import $cookie from 'vue-cookie';
export default async function({ store, route, redirect }) {
// const menuId = route.query.menuId;
const FEMS_SESSION = $cookie.get('FEMS_SESSION');
if (!FEMS_SESSION) {
if (route.name !== 'login') redirect('/login');
} else {
const userInfo = parseJwt(FEMS_SESSION);
if (store.state.userInfo && !store.state.userInfo.comId) {
store.commit('setUserInfo', userInfo);
}
}
}
function parseJwt(token) {
var base64Url = token.split('.')[1];
var base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');
var jsonPayload = decodeURIComponent(
atob(base64)
.split('')
.map(function(c) {
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
})
.join(''),
);
return JSON.parse(jsonPayload);
}