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

24478 团委h5-活动管理,点击签到记录显示请求错误admin

上级 b1c1b8e4
import React from 'react'; import React, { useEffect } from 'react';
import styles from './index.css'; import styles from './index.css';
import { router, connect, } from 'dva'; import { router, connect } from 'dva';
import { getToken, setToken, } from '@/H5Public/utils/authority' import { getToken, setToken } from '@/H5Public/utils/authority';
import { setLoginToUrl } from '../utils/authority'; import { setLoginToUrl } from '../utils/authority';
import { Base16Encode } from '../utils/Base16';
const routerWhiteList = [ const routerWhiteList = [
"/login", '/login',
'/webActivtiDetali', '/webActivtiDetali',
// 来访登记者填写表单 // 来访登记者填写表单
"/visitorRegister/visitorFormPage", '/visitorRegister/visitorFormPage',
]; ];
const { Redirect } = router; const { Redirect } = router;
let BasicLayout = ({ children, dispatch, location: { pathname }, }) => { let BasicLayout = ({ children, dispatch, location: { pathname } }) => {
if (pathname === '/login') { if (pathname === '/login') {
return <div>{children}</div>; return <div>{children}</div>;
} }
return <div className={styles.normal}>{children}</div>; return <div className={styles.normal}>{children}</div>;
} };
BasicLayout = connect()(BasicLayout); BasicLayout = connect()(BasicLayout);
export default (props) => { export default (props) => {
const { location: { pathname, query: { token, returnUrl } }, children, } = props; const { location: { pathname, query: { token, returnUrl } }, children } = props;
if (routerWhiteList.includes(pathname)) return children; if (routerWhiteList.includes(pathname)) return children;
if (!!token || getToken()) { if (!!token || getToken()) {
...@@ -31,18 +31,18 @@ export default (props) => { ...@@ -31,18 +31,18 @@ export default (props) => {
setToken(token); setToken(token);
} }
if (!!returnUrl) { if (!!returnUrl) {
return <Redirect to={returnUrl}/>; return <Redirect to={returnUrl} />;
} }
return <BasicLayout {...props}/>; return <BasicLayout {...props} />;
} }
let loginPathname = '/login'; let loginPathname = '/login';
if (!!returnUrl) { if (!!returnUrl) {
loginPathname = `${loginPathname}?returnUrl=${returnUrl}`; loginPathname = `${loginPathname}?returnUrl=${returnUrl}`;
} }
if(window.location.href.indexOf('/CollegeYongthLeague/Student') > -1){ // 团委签到, 团委签退 if (window.location.href.indexOf('/CollegeYongthLeague/Student') > -1) { // 团委签到, 团委签退
setLoginToUrl(window.location.href); setLoginToUrl(window.location.href);
} }
return <Redirect to={loginPathname}/>; return <Redirect to={loginPathname} />;
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论