Commit 8d387ab5 authored by 熊成伟's avatar 熊成伟

first-submit

parent a1ad9165
Pipeline #16454 passed with stages
in 1 minute and 5 seconds
import React from 'react'; import React, {useEffect} from 'react';
import {withRouter} from 'react-router-dom' import {withRouter} from 'react-router-dom'
import './index.less' import './index.less'
import queryString from "query-string";
const BlankLayout = (props) => { const BlankLayout = (props) => {
useEffect(() => {
const query = queryString.parse(props.location.search);
const keys = Object.keys(query);
keys.length > 0 && query.token && localStorage.setItem('token', query.token);
}, [])
return ( return (
<div> <div>
{props.children} {props.children}
......
...@@ -2,6 +2,7 @@ import React, {useEffect} from 'react'; ...@@ -2,6 +2,7 @@ import React, {useEffect} from 'react';
import Footer from './Footer' import Footer from './Footer'
import {withRouter} from 'react-router-dom' import {withRouter} from 'react-router-dom'
import './index.less' import './index.less'
import queryString from "query-string";
const CommonLayout = (props) => { const CommonLayout = (props) => {
...@@ -35,7 +36,12 @@ const CommonLayout = (props) => { ...@@ -35,7 +36,12 @@ const CommonLayout = (props) => {
const defaultH = window.innerHeight; const defaultH = window.innerHeight;
window.addEventListener('resize', () => resize(defaultH)); window.addEventListener('resize', () => resize(defaultH));
return () => window.removeEventListener('resize', resize); return () => window.removeEventListener('resize', resize);
}, []) }, []);
useEffect(() => {
const query = queryString.parse(props.location.search);
const keys = Object.keys(query);
keys.length > 0 && query.token && localStorage.setItem('token', query.token);
}, []);
return ( return (
<div> <div>
<div id="common-content" className="common-layout-content" > <div id="common-content" className="common-layout-content" >
......
...@@ -2,15 +2,11 @@ import React, {useState, useEffect} from 'react'; ...@@ -2,15 +2,11 @@ import React, {useState, useEffect} from 'react';
import {TabBar} from 'antd-mobile' import {TabBar} from 'antd-mobile'
import './index.less' import './index.less'
import axiosRequest from '../utils/request'; import axiosRequest from '../utils/request';
import queryString from "query-string";
const Footer = (props) => { const Footer = (props) => {
const [current, setCurrent] = useState(); const [current, setCurrent] = useState();
const [badge, setBadge] = useState() const [badge, setBadge] = useState();
useEffect(() => {
const keysArray = props.location.pathname.replace(`${props.match.path}/`, '').split("/");
keysArray.length > 0 && setCurrent(keysArray[0]);
getData()
}, []);
const getData = () => { const getData = () => {
axiosRequest({ axiosRequest({
method: 'post', method: 'post',
...@@ -29,6 +25,18 @@ const Footer = (props) => { ...@@ -29,6 +25,18 @@ const Footer = (props) => {
{title: '通讯录', key: 'addressList', icon: '/img/footer-communicate.png', selectedIcon: '/img/footer-communicate-s.png', badge: '', onPress: '/bord/addressList'}, {title: '通讯录', key: 'addressList', icon: '/img/footer-communicate.png', selectedIcon: '/img/footer-communicate-s.png', badge: '', onPress: '/bord/addressList'},
{title: '通知', key: 'notice', icon: '/img/footer-notice.png', selectedIcon: '/img/footer-notice-s.png', badge: badge, onPress: '/bord/notice'} {title: '通知', key: 'notice', icon: '/img/footer-notice.png', selectedIcon: '/img/footer-notice-s.png', badge: badge, onPress: '/bord/notice'}
]; ];
useEffect(() => {
new Promise((resolve => {
const query = queryString.parse(props.location.search);
const keys = Object.keys(query);
keys.length > 0 && query.token && localStorage.setItem('token', query.token);
resolve()
})).then(() => {
const keysArray = props.location.pathname.replace(`${props.match.path}/`, '').split("/");
keysArray.length > 0 && setCurrent(keysArray[0]);
getData()
})
}, []);
return ( return (
<div id="footer" className="footer"> <div id="footer" className="footer">
<TabBar <TabBar
......
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 to comment