提交 58c127e8 authored 作者: 钟是志's avatar 钟是志

活动签到 签退 二维码功能开发

上级 15dd0e12
......@@ -3,6 +3,7 @@ import React from 'react';
import styles from './index.css';
import { router, connect, } from 'dva';
import { getToken, setToken, } from '@/H5Public/utils/authority'
import { setLoginToUrl } from '../utils/authority';
const routerWhiteList = [
"/login",
......@@ -22,6 +23,8 @@ BasicLayout = connect()(BasicLayout);
export default (props) => {
const { location: { pathname, query: { token, returnUrl } }, children, } = props;
if (routerWhiteList.includes(pathname)) return children;
if (!!token || getToken()) {
if (!!token) {
......@@ -36,6 +39,10 @@ export default (props) => {
if (!!returnUrl) {
loginPathname = `${loginPathname}?returnUrl=${returnUrl}`;
}
if(window.location.href.indexOf('/CollegeYongthLeague/Student') > -1){ // 团委签到, 团委签退
setLoginToUrl(window.location.href);
}
return <Redirect to={loginPathname}/>;
}
......@@ -6,6 +6,15 @@ export function getAuthority() {
export function setAuthority(authority) {
return localStorage.setItem('antd-pro-authority', authority);
}
export function getLoginToUrl() {
return localStorage.getItem('antd-pro-login-url');
}
export function setLoginToUrl(url) {
return localStorage.setItem('antd-pro-login-url', url);
}
export function clearToken() {
localStorage.removeItem('antd-username');
localStorage.removeItem('antd-pro-token-onestop');
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论