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

debug

parent 3fedbcb5
This diff is collapsed.
import React from 'react';
import './index.less'
const Index = (props) => {
const data = props.data;
return (
<div className="address-box">
{data.map((item, index) => item.title && (
<div key={index}>
<div className="address-item">
1111111111
</div>
{item.children.map((child, index2) => (
<div className="address-item" key={index2}>
<div>
<img alt="" src="" className=""/>
{child.title || '11'}
</div>
<div>
<img alt="" className='smallIco mr-5' src='/img/tel.png' />13488876526
</div>
</div>
))}
</div>
))}
</div>
);
};
export default Index;
import React from 'react'; import React from 'react';
import './index.less' import './index.less'
const Index = (props) => {
const data = [{}, {}, {}, {}] const data = props.data;
const Index = () => {
return ( return (
<div className="address-box"> <div className="address-box">
{data.map((item, index) => ( {data.map((item, index) => item.title && (
<div className="address-item"> <div className="address-item">
cccc {item.title || '11'}
<img src="/img/rarrow.png" alt="" className='icon18'/> <img src="/img/rarrow.png" alt="" className='icon18'/>
</div> </div>
))} ))}
......
...@@ -10,7 +10,7 @@ const Index = (props) => { ...@@ -10,7 +10,7 @@ const Index = (props) => {
const input = document.getElementsByClassName("top-single-search"); const input = document.getElementsByClassName("top-single-search");
props.onSearch(input[0].value); props.onSearch(input[0].value);
let inputValue = input[0].value; let inputValue = input[0].value;
setStatus(inputValue != null && inputValue != undefined && inputValue != '') setStatus(inputValue != null && inputValue !== '')
}; };
const clear = () => { const clear = () => {
setStatus(false) setStatus(false)
......
...@@ -3,7 +3,7 @@ import './index.less' ...@@ -3,7 +3,7 @@ import './index.less'
const CardItem = (props) => { const CardItem = (props) => {
const {data, addStatus, type, addCommon, iconAction} = props; const {data, addStatus, type, addCommon, iconAction, workUrl} = props;
const [status, setStatus] = useState(false); const [status, setStatus] = useState(false);
useEffect(() => { useEffect(() => {
...@@ -11,7 +11,7 @@ const CardItem = (props) => { ...@@ -11,7 +11,7 @@ const CardItem = (props) => {
}, [addStatus]) }, [addStatus])
const contentCLick = () => { const contentCLick = () => {
!status && !data.iconAdd && console.log(data.text); !status && !data.iconAdd && workUrl('/blank/work/1')
data.iconAdd && addCommon() data.iconAdd && addCommon()
}; };
const iconClick = () => { const iconClick = () => {
......
...@@ -3,7 +3,7 @@ import './index.less' ...@@ -3,7 +3,7 @@ import './index.less'
import CardItem from './CardItem' import CardItem from './CardItem'
const Index = (props) => { const Index = (props) => {
const {title, type, addStatus, addCommon, data, iconAction} = props; const {title, type, addStatus, addCommon, data, iconAction, workUrl} = props;
const emptyIcon = type === 'edit' ? { const emptyIcon = type === 'edit' ? {
text: addStatus ? '完成添加' :'添加常用', icon: addStatus ? '/img/finish-work.png' : '/img/add-work.png', iconAdd: true text: addStatus ? '完成添加' :'添加常用', icon: addStatus ? '/img/finish-work.png' : '/img/add-work.png', iconAdd: true
} : {}; } : {};
...@@ -23,6 +23,7 @@ const Index = (props) => { ...@@ -23,6 +23,7 @@ const Index = (props) => {
type={type} type={type}
key={index} key={index}
data={item} data={item}
workUrl={workUrl}
addStatus={addStatus} addStatus={addStatus}
addCommon={addCommon} addCommon={addCommon}
iconAction={iconAction} iconAction={iconAction}
......
import React, {useEffect, useState} from 'react'; 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 React, {useState, useEffect} from 'react'; import React, {useState, useEffect} from 'react';
import {WhiteSpace, WingBlank, ActivityIndicator} from 'antd-mobile' import {WhiteSpace, WingBlank, ActivityIndicator} from 'antd-mobile'
import TodoCard from '../../components/LogCard' import TodoCard from '../../components/LogCard'
import TopSearch from '../../components/TopSearch' import TopSearch from '../../components/TopSearch';
import axiosRequest from '../../utils/request';
const Backlog = (props) => { const Backlog = (props) => {
const [current, setCurrent] = useState(1); const [current, setCurrent] = useState(1);
...@@ -15,11 +16,18 @@ const Backlog = (props) => { ...@@ -15,11 +16,18 @@ const Backlog = (props) => {
props.history.push(`/blank/info/example/1`) props.history.push(`/blank/info/example/1`)
}; };
const getData = () => { const getData = () => {
setLoading(false) const pageMap ={searchWord, nowPage: current, pageSize: 10};
const pageMap ={searchWord, nowPage: current, pageSize: 10} console.log(pageMap)
let result = data.concat([{}, {}, {}, {}, {}, {}]) setLoading(true)
setData(result) axiosRequest({
setCurrent(current + 1) method: 'post',
url: '/dgbg/mobileGetOperates.view?userName=2012012099&clientFlag=123456',
}).then(res => {
setLoading(false);
let result = data.concat([{}, {}, {}, {}, {}, {}])
setData(result)
setCurrent(current + 1)
});
}; };
//下拉加载 //下拉加载
...@@ -29,7 +37,6 @@ const Backlog = (props) => { ...@@ -29,7 +37,6 @@ const Backlog = (props) => {
const scrollHeight = event.scrollHeight; const scrollHeight = event.scrollHeight;
const clientHeight = event.clientHeight; const clientHeight = event.clientHeight;
if (top + clientHeight === scrollHeight) { if (top + clientHeight === scrollHeight) {
setLoading(true);
getData() getData()
} }
}; };
...@@ -38,6 +45,7 @@ const Backlog = (props) => { ...@@ -38,6 +45,7 @@ const Backlog = (props) => {
return () => window.removeEventListener('scroll', handleScroll, true); return () => window.removeEventListener('scroll', handleScroll, true);
}, [data]); }, [data]);
//回到顶部
useEffect(() => { useEffect(() => {
const element = document.getElementById('common-content') const element = document.getElementById('common-content')
element.scrollTo(0, 0) element.scrollTo(0, 0)
...@@ -61,7 +69,6 @@ const Backlog = (props) => { ...@@ -61,7 +69,6 @@ const Backlog = (props) => {
)) ))
} }
</WingBlank> </WingBlank>
); );
}; };
......
import React, {useState, useEffect} from 'react';
import AddressList from '../../components/AddressList';
import AddressUser from '../../components/AddressList/AddressUser';
const AddressBook = (props) => {
return (
<div>
<div className='breadBox'>
<span className='currentLink'>科技创新委员会</span>
<span className='symbol'>&gt;</span>
<span>组织架构</span>
<span className='symbol'>&gt;</span>
<span>办公厅</span>
</div>
<div className='adMainBox'>
<AddressList data={[{title: '1'}, {title: 2}, {title: 3}]}/>
<AddressUser data={[{title: '1', children: [{}, {}, {}]}, {title: 2, children: [{}, {}, {}]}, {title: 3, children: [{}, {}, {}]}]}/>
</div>
</div>
);
};
export default AddressBook;
import React, {Component} from 'react'; // import React, {Component} from 'react';
import './index.less' // import './index.less'
//
// class Communicate extends Component {
//
// render() {
// return (
// <div>
// <div className='breadBox'>
// <span className='currentLink'>科技创新委员会</span><span className='symbol'>&gt;</span><span>组织架构</span><span className='symbol'>&gt;</span><span>办公厅</span>
// </div>
// <div className='adMainBox'>
// <ul className='adListBox'>
// <li>
// <div className='itemBox'>
// <h4 className='titleBar'>市委办公厅审核员</h4>
// <div className='adContent'>
// <div className='peopleList'>
// <p className='subItem'>
// <span className='cicrleHead mr-5'>
// <img src='/img/head.png' className='imgRes' />
// </span>
// 王磊
// </p>
// <p className='subItem'>
// <img className='smallIco mr-5' src='/img/tel.png' />13488876526
// </p>
// </div>
// <div className='peopleList'>
// <p className='subItem'>
// <span className='cicrleHead mr-5 centerFont'>
// 王
// </span>
// 王磊
// </p>
// <p className='subItem'>
// <img className='smallIco mr-5' src='/img/tel.png' />13488876526
// </p>
// </div>
// </div>
// </div>
// </li>
// <li>
// <div className='itemBox'>
// <h4 className='titleBar'>市委办公厅审核员</h4>
// <div className='adContent'>
// <div className='peopleList'>
// <p className='subItem'>
// <span className='cicrleHead mr-5'>
// <img src='/img/head.png' className='imgRes' />
// </span>
// 王磊
// </p>
// <p className='subItem'>
// <img className='smallIco mr-5' src='/img/tel.png' />13488876526
// </p>
// </div>
// <div className='peopleList'>
// <p className='subItem'>
// <span className='cicrleHead mr-5 centerFont'>
// 王
// </span>
// 王磊
// </p>
// <p className='subItem'>
// <img className='smallIco mr-5' src='/img/tel.png' />13488876526
// </p>
// </div>
// </div>
// </div>
// </li>
// </ul>
// </div>
// </div>
// );
// }
// }
//
// export default Communicate;
class Communicate extends Component {
render() {
return ( import React from 'react';
<div> import AddressList from '../../components/AddressList';
<div className='breadBox'> import AddressUser from '../../components/AddressList/AddressUser';
<span className='currentLink'>科技创新委员会</span><span className='symbol'>&gt;</span><span>组织架构</span><span className='symbol'>&gt;</span><span>办公厅</span>
</div>
<div className='adMainBox'> const AddressBook = (props) => {
<ul className='adListBox'> return (
<li> <div>
<div className='itemBox'> <div className='breadBox'>
<h4 className='titleBar'>市委办公厅审核员</h4> <span className='currentLink'>科技创新委员会</span>
<div className='adContent'> <span className='symbol'>&gt;</span>
<div className='peopleList'> <span>组织架构</span>
<p className='subItem'> <span className='symbol'>&gt;</span>
<span className='cicrleHead mr-5'> <span>办公厅</span>
<img src='/img/head.png' className='imgRes' />
</span>
王磊
</p>
<p className='subItem'>
<img className='smallIco mr-5' src='/img/tel.png' />13488876526
</p>
</div>
<div className='peopleList'>
<p className='subItem'>
<span className='cicrleHead mr-5 centerFont'>
</span>
王磊
</p>
<p className='subItem'>
<img className='smallIco mr-5' src='/img/tel.png' />13488876526
</p>
</div>
</div>
</div>
</li>
<li>
<div className='itemBox'>
<h4 className='titleBar'>市委办公厅审核员</h4>
<div className='adContent'>
<div className='peopleList'>
<p className='subItem'>
<span className='cicrleHead mr-5'>
<img src='/img/head.png' className='imgRes' />
</span>
王磊
</p>
<p className='subItem'>
<img className='smallIco mr-5' src='/img/tel.png' />13488876526
</p>
</div>
<div className='peopleList'>
<p className='subItem'>
<span className='cicrleHead mr-5 centerFont'>
</span>
王磊
</p>
<p className='subItem'>
<img className='smallIco mr-5' src='/img/tel.png' />13488876526
</p>
</div>
</div>
</div>
</li>
</ul>
</div>
</div> </div>
); <div className='adMainBox'>
} <AddressList data={[{title: '1'}, {title: 2}, {title: 3}]}/>
}
<AddressUser data={[{title: '1', children: [{}, {}, {}]}, {title: 2, children: [{}, {}, {}]}, {title: 3, children: [{}, {}, {}]}]}/>
</div>
</div>
);
};
export default AddressBook;
export default Communicate;
...@@ -20,13 +20,15 @@ const Pro = (props) => { ...@@ -20,13 +20,15 @@ const Pro = (props) => {
setFootStatus(true) setFootStatus(true)
}; };
useEffect(() => { useEffect(() => {
setLoading(false);
const option = document.getElementsByClassName("option-text")[0] const option = document.getElementsByClassName("option-text")[0]
option.addEventListener('focus', optionBlur, true); option.addEventListener('focus', optionBlur, true);
return () => option.removeEventListener('focus', optionBlur, true); return () => option.removeEventListener('focus', optionBlur, true);
}, []); }, []);
const optionChange = val => { const optionChange = val => {
setDisabled(!(val != null && val != undefined && val != '')) setDisabled(!(val != null && val !== ''))
}; };
const [current, setCurrent] = useState('basic'); const [current, setCurrent] = useState('basic');
......
import React, { useEffect } from 'react'; import React from 'react';
import { useRequest } from "@umijs/hooks"; // import { useRequest } from "@umijs/hooks";
import axios from 'axios'; // import axios from 'axios';
import {withRouter} from 'react-router-dom' import {withRouter} from 'react-router-dom'
import axiosRequest, { loading } from '../../utils/request'; import axiosRequest from '../../utils/request';
// import { postRequest } from '../../utils/request'; // import { postRequest } from '../../utils/request';
// import './index.less' // import './index.less'
...@@ -12,6 +12,7 @@ const Login = (props) => { ...@@ -12,6 +12,7 @@ const Login = (props) => {
method: 'post', method: 'post',
url: '/dgbg/mobileLogin.view?userName=2012012099&clientFlag=123456&password=1', url: '/dgbg/mobileLogin.view?userName=2012012099&clientFlag=123456&password=1',
}).then(res => { }).then(res => {
!res.errorMessage && props.history.push(`/bord/backlog`)
// setOperates(res.operate || []); // setOperates(res.operate || []);
}); });
......
...@@ -2,7 +2,7 @@ import React, {useEffect, useState} from 'react'; ...@@ -2,7 +2,7 @@ import React, {useEffect, useState} from 'react';
import {ActivityIndicator, WhiteSpace, WingBlank} from 'antd-mobile' import {ActivityIndicator, WhiteSpace, WingBlank} from 'antd-mobile'
import TodoCard from '../../components/LogCard' import TodoCard from '../../components/LogCard'
import TopNotice from '../../components/NoticeTab' import TopNotice from '../../components/NoticeTab'
import axiosRequest from '../../utils/request';
const Notice = (props) => { const Notice = (props) => {
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
...@@ -11,11 +11,18 @@ const Notice = (props) => { ...@@ -11,11 +11,18 @@ const Notice = (props) => {
const [data, setData] = useState([{},{},{},{},{},{}]); const [data, setData] = useState([{},{},{},{},{},{}]);
const getData = () => { const getData = () => {
setLoading(false) const pageMap ={searchWord, nowPage: current, pageSize: 10};
const pageMap ={searchWord, nowPage: current, pageSize: 10} console.log(pageMap)
let result = data.concat([{}, {}, {}, {}, {}, {}]) setLoading(true)
setData(result) axiosRequest({
setCurrent(current + 1) method: 'post',
url: '/dgbg/mobileGetOperates.view?userName=2012012099&clientFlag=123456',
}).then(res => {
setLoading(false);
let result = data.concat([{}, {}, {}, {}, {}, {}])
setData(result)
setCurrent(current + 1)
});
}; };
//下拉加载 //下拉加载
...@@ -25,7 +32,6 @@ const Notice = (props) => { ...@@ -25,7 +32,6 @@ const Notice = (props) => {
const scrollHeight = event.scrollHeight; const scrollHeight = event.scrollHeight;
const clientHeight = event.clientHeight; const clientHeight = event.clientHeight;
if (top + clientHeight === scrollHeight) { if (top + clientHeight === scrollHeight) {
setLoading(true);
getData() getData()
} }
}; };
...@@ -37,6 +43,12 @@ const Notice = (props) => { ...@@ -37,6 +43,12 @@ const Notice = (props) => {
const checkLog = () => { const checkLog = () => {
props.history.push(`/blank/info/example/1`) props.history.push(`/blank/info/example/1`)
}; };
//回到顶部
useEffect(() => {
const element = document.getElementById('common-content')
element.scrollTo(0, 0)
}, [])
return ( return (
<WingBlank> <WingBlank>
<ActivityIndicator <ActivityIndicator
...@@ -45,7 +57,7 @@ const Notice = (props) => { ...@@ -45,7 +57,7 @@ const Notice = (props) => {
animating={loading} animating={loading}
/> />
<WhiteSpace/> <WhiteSpace/>
<TopNotice/> <TopNotice onSearch={setSearchWord}/>
{ {
data.map((item, index) => ( data.map((item, index) => (
<div key={index}> <div key={index}>
......
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import {ActivityIndicator, WhiteSpace, WingBlank} from "antd-mobile"; import {ActivityIndicator, WhiteSpace, WingBlank} from "antd-mobile";
import axiosRequest, { loading } from '../../utils/request'; import axiosRequest from '../../utils/request';
import TopSearch from '../../components/TopSearch' import TopSearch from '../../components/TopSearch'
import WorkCard from '../../components/WorkCard' import WorkCard from '../../components/WorkCard';
const Work = () => {
const Work = (props) => {
const [loading, setLoading] = useState(false)
const [addStatus, setAddStatus] = useState(false); const [addStatus, setAddStatus] = useState(false);
const [operates, setOperates] = useState([]); const [operates, setOperates] = useState([]);
...@@ -14,10 +14,12 @@ const Work = () => { ...@@ -14,10 +14,12 @@ const Work = () => {
}, []); }, []);
const loadOperates = () => { const loadOperates = () => {
setLoading(true)
axiosRequest({ axiosRequest({
method: 'post', method: 'post',
url: '/dgbg/mobileGetOperates.view?userName=2012012099&clientFlag=123456', url: '/dgbg/mobileGetOperates.view?userName=2012012099&clientFlag=123456',
}).then(res => { }).then(res => {
setLoading(false)
setOperates(res.operate || []); setOperates(res.operate || []);
}); });
} }
...@@ -35,10 +37,15 @@ const Work = () => { ...@@ -35,10 +37,15 @@ const Work = () => {
// arr.splice(arr.length - 1, 0, item[0]); // arr.splice(arr.length - 1, 0, item[0]);
}; };
const itemSlice = (id, arr, arr2) => { // const itemSlice = (id, arr, arr2) => {
// const index = arr.findIndex(item => item.id == id); // // const index = arr.findIndex(item => item.id == id);
// index > -1 && arr.splice(index, 1); // // index > -1 && arr.splice(index, 1);
}; // };
const workUrl = (url) => {
props.history.push(url)
}
return ( return (
<WingBlank> <WingBlank>
<ActivityIndicator <ActivityIndicator
...@@ -50,10 +57,11 @@ const Work = () => { ...@@ -50,10 +57,11 @@ const Work = () => {
<TopSearch onSearch={ workSearch }/> <TopSearch onSearch={ workSearch }/>
<WhiteSpace/> <WhiteSpace/>
<WorkCard <WorkCard
title="事物管理" title="工作详情"
addCommon={ commonEdit } addCommon={ commonEdit }
addStatus={addStatus} addStatus={addStatus}
data={ operates.map(item => ({ icon: '', text: item.NODENAME }))} data={ operates.map(item => ({ icon: '', text: item.NODENAME }))}
workUrl={workUrl}
iconAction={ itemAdd } iconAction={ itemAdd }
/> />
</WingBlank> </WingBlank>
......
import React, {useEffect, useState} from 'react';
import {ActivityIndicator, WhiteSpace, WingBlank} from 'antd-mobile'
import TodoCard from '../../components/LogCard'
import TopNotice from '../../components/NoticeTab'
import axiosRequest from '../../utils/request';
import './index.less'
const WorkDetail = (props) => {
const [loading, setLoading] = useState(false);
const [current, setCurrent] = useState(1);
const [searchWord, setSearchWord] = useState()
const [data, setData] = useState([{},{},{},{},{},{}]);
const getData = () => {
const pageMap ={searchWord, nowPage: current, pageSize: 10};
console.log(pageMap)
setLoading(true)
axiosRequest({
method: 'post',
url: '/dgbg/mobileGetOperates.view?userName=2012012099&clientFlag=123456',
}).then(res => {
setLoading(false);
let result = data.concat([{}, {}, {}, {}, {}, {}])
setData(result)
setCurrent(current + 1)
});
};
//下拉加载
const handleScroll = () => {
const event = document.getElementById("work-content")
const top = event.scrollTop;
const scrollHeight = event.scrollHeight;
const clientHeight = event.clientHeight;
if (top + clientHeight === scrollHeight) {
getData()
}
};
useEffect(() => {
window.addEventListener('scroll', handleScroll, true);
return () => window.removeEventListener('scroll', handleScroll, true);
}, [data]);
const checkLog = () => {
props.history.push(`/blank/info/example/1`)
};
//回到顶部
useEffect(() => {
const element = document.getElementById('work-content')
element.scrollTo(0, 0)
}, [])
return (
<div id="work-content" className="work-content">
<WingBlank>
<ActivityIndicator
toast
text="加载中..."
animating={loading}
/>
<WhiteSpace/>
<TopNotice onSearch={setSearchWord}/>
{
data.map((item, index) => (
<div key={index}>
<WhiteSpace/>
<TodoCard data={item} onClick={checkLog}/>
</div>
))
}
</WingBlank>
</div>
);
};
export default WorkDetail;
.work-content{
position: fixed;
top: 0;left: 0;right: 0;bottom: 0;
overflow: auto;
padding-bottom: 10px
}
...@@ -5,6 +5,7 @@ import BlankLayout from './layout/BlankLayout'; ...@@ -5,6 +5,7 @@ import BlankLayout from './layout/BlankLayout';
import CommonLayout from './layout/CommonLayout'; import CommonLayout from './layout/CommonLayout';
import Backlog from './pages/Backlog/Backlog' import Backlog from './pages/Backlog/Backlog'
import Work from './pages/Work/Work' import Work from './pages/Work/Work'
import WorkDetail from './pages/Work/WorkDetail'
import Notice from './pages/Notice/Notice' import Notice from './pages/Notice/Notice'
import Communicate from './pages/Communicate/Communicate'; import Communicate from './pages/Communicate/Communicate';
import AddressList from './pages/AddressList/AddressList'; import AddressList from './pages/AddressList/AddressList';
...@@ -21,8 +22,8 @@ const ReactRouter = () => { ...@@ -21,8 +22,8 @@ const ReactRouter = () => {
return ( return (
<Router> <Router>
<Switch> <Switch>
<Route exact path="/" render={() => <Redirect to="/login" />} />
<Route path="/login" component={Login} /> <Route path="/login" component={Login} />
<Route exact path="/" render={() => <Redirect to="/bord/backlog" />} />
<Route path="/bord" render={ () => <Route path="/bord" render={ () =>
<CommonLayout> <CommonLayout>
<Route path="/bord/backlog" component={Backlog} /> <Route path="/bord/backlog" component={Backlog} />
...@@ -34,6 +35,7 @@ const ReactRouter = () => { ...@@ -34,6 +35,7 @@ const ReactRouter = () => {
}/> }/>
<Route path="/blank" component={() => <Route path="/blank" component={() =>
<BlankLayout> <BlankLayout>
<Route path="/blank/work/:id" component={WorkDetail}/>
<Route path="/blank/submit/:id" component={SubmitDetail}/> <Route path="/blank/submit/:id" component={SubmitDetail}/>
<Route path="/blank/info/:name/:id" component={Process}/> <Route path="/blank/info/:name/:id" component={Process}/>
</BlankLayout> </BlankLayout>
......
import axios from 'axios'; import axios from 'axios';
import { parse, stringify } from 'qs'; import { stringify } from 'qs';
import { Toast } from 'antd-mobile'; import { Toast } from 'antd-mobile';
const instance = axios.create(); const instance = axios.create();
...@@ -8,7 +8,7 @@ const token = 'bearer ' + localStorage.getItem("token"); ...@@ -8,7 +8,7 @@ const token = 'bearer ' + localStorage.getItem("token");
let defaultHeaders = { let defaultHeaders = {
token, token,
}; };
const codeMessage = { const codeMessage = {
200: '服务器成功返回请求的数据。', 200: '服务器成功返回请求的数据。',
201: '新建或修改数据成功。', 201: '新建或修改数据成功。',
...@@ -51,9 +51,9 @@ export const createAPI = (baseURL) => { ...@@ -51,9 +51,9 @@ export const createAPI = (baseURL) => {
if (!response || !response.data) { console.log('response出错, 无返回数据!', response); return false; }; if (!response || !response.data) { console.log('response出错, 无返回数据!', response); return false; };
if (response.data && response.data.errorMessage) { if (response.data && response.data.errorMessage) {
Toast.fail(response.data.errorMessage); Toast.fail(response.data.errorMessage);
return false; return false;
} }
// 保存到本地 // 保存到本地
if (response && response.data && response.data.access_token) { if (response && response.data && response.data.access_token) {
defaultHeaders = { defaultHeaders = {
token: 'bearer ' + response.data.access_token, token: 'bearer ' + response.data.access_token,
...@@ -69,9 +69,9 @@ export const createAPI = (baseURL) => { ...@@ -69,9 +69,9 @@ export const createAPI = (baseURL) => {
}) })
.catch(error => { .catch(error => {
if (error.response) { if (error.response) {
const { status, statusText, url } = error.response; const { status, statusText } = error.response;
const errortext = codeMessage[status] || statusText; const errortext = codeMessage[status] || statusText;
if (status === 401) { if (status === 401) {
// TODO 重新登录 // TODO 重新登录
// history.push('/user/login'); // history.push('/user/login');
......
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