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 './index.less'
import queryString from "query-string";
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 (
<div>
{props.children}
......
......@@ -2,6 +2,7 @@ import React, {useEffect} from 'react';
import Footer from './Footer'
import {withRouter} from 'react-router-dom'
import './index.less'
import queryString from "query-string";
const CommonLayout = (props) => {
......@@ -35,7 +36,12 @@ const CommonLayout = (props) => {
const defaultH = window.innerHeight;
window.addEventListener('resize', () => resize(defaultH));
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 (
<div>
<div id="common-content" className="common-layout-content" >
......
......@@ -2,15 +2,11 @@ import React, {useState, useEffect} from 'react';
import {TabBar} from 'antd-mobile'
import './index.less'
import axiosRequest from '../utils/request';
import queryString from "query-string";
const Footer = (props) => {
const [current, setCurrent] = useState();
const [badge, setBadge] = useState()
useEffect(() => {
const keysArray = props.location.pathname.replace(`${props.match.path}/`, '').split("/");
keysArray.length > 0 && setCurrent(keysArray[0]);
getData()
}, []);
const [badge, setBadge] = useState();
const getData = () => {
axiosRequest({
method: 'post',
......@@ -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: '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 (
<div id="footer" className="footer">
<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