Merge branch 'master' of codeup.aliyun.com:5f9118049cffa29cfdd3be1c/marketing/frontend

This commit is contained in:
姜棚 2021-11-28 18:38:16 +08:00
commit 6ea0a1f400
7 changed files with 56 additions and 47 deletions

View File

@ -87,18 +87,19 @@ const req = (method, url, params, responseType) => {
let http = fetch(url, obj).then(res =>{
window.timeshow=res.headers.get('Date-Time');
console.log(res);
if(res.status==200){
return res.json()
}else{
console.log(res);
switch (res.status) {
// 401: 未登录
case 401:
Notify.clear();
Notify.error( "当前信息过期请重新登录");
Notify.error( "没有权限,用户登录已失效");
sessionStorage.clear();
setTimeout(() => {
window.location.href='./login';
}, 3000)
window.location.href='/login';
}, 2000)
break;
}
}

View File

@ -262,8 +262,7 @@ export default class acclist extends React.Component{
const reseller_data=response.data;
const {total}=response;
_self.setState({resellerList:reseller_data,total});
Notify.clear();
Notify.success(msg);
},err=>{
});
}).catch(err=>{

View File

@ -303,8 +303,7 @@ export default class acclist extends React.Component{
const codeList_data=response.data;
const {total}=response;
_self.setState({codeList:codeList_data,total});
Notify.clear();
Notify.success(msg);
},(err)=>{
})

View File

@ -127,12 +127,26 @@ componentWillMount(){
}
this.getTableList(data);
}
//limit
countChange(e){
this.setState({page:1,limit:e});
let data = {
page:e,
limit:this.state.limit
}
this.getTableList(data);
}
pageChange(e){
this.setState({page:e})
let data = {
page:e,
limit:this.state.limit
}
if(this.state.key_word){
data.title=this.state.key_word;
}
this.getTableList(data);
}

View File

@ -181,7 +181,7 @@ export default class App extends Component {
Notify.clear();
Notify.success('退出成功!');
sessionStorage.clear();
},2000);
},100);
}
}).catch(err=>{
@ -203,20 +203,20 @@ export default class App extends Component {
window.document.addEventListener('mouseover',function(){
window["mydata"].setState({lastTime:new Date().getTime()}); //更新操作时间
});
timerstop=window.setInterval( window["mydata"].testTime, 1000);
}
testTime(){
window["mydata"].setState({'currentTime':new Date().getTime()});//更新当前时间
if( window["mydata"].state.currentTime - window["mydata"].state.lastTime > window["mydata"].state.timeOut){ //判断是否超时
window.clearInterval(timerstop)
Notify.clear()
Notify.warn('登录失效,请重新登录!')
sessionStorage.clear();
setTimeout(()=>{
window["mydata"].props.history.push('/login');
},5000);
}
// timerstop=window.setInterval( window["mydata"].testTime, 1000);
}
// testTime(){
// window["mydata"].setState({'currentTime':new Date().getTime()});//更新当前时间
// if( window["mydata"].state.currentTime - window["mydata"].state.lastTime > window["mydata"].state.timeOut){ //判断是否超时
// window.clearInterval(timerstop)
// Notify.clear()
// Notify.warn('登录失效,请重新登录!')
// sessionStorage.clear();
// setTimeout(()=>{
// window["mydata"].props.history.push('/login');
// },5000);
// }
// }
componentWillReceiveProps(nextProps) {
if (this.state.noShowSubMenu.indexOf(nextProps.location.pathname) > -1 ) {
console.log("不展示")

View File

@ -98,24 +98,9 @@ export default class acclistDom extends React.Component{
}
]}]
sessionStorage.setItem('breaknav',JSON.stringify(activerou));
this.getCompanyFn();
}
//获取公司
getCompanyFn(){
let _self=this;
getCompany().then(res=>{
handelResponse(res,(response,msg)=>{
let companyList=response.map(item=>{
return {key:item.id,text:item.company_name}
});
sessionStorage.setItem('company',JSON.stringify(companyList));
},(err)=>{
})
}).catch(err=>{
});
}
onChange = options => {
this.setState(options);
};
@ -188,7 +173,19 @@ export default class acclistDom extends React.Component{
});
}
editFn(e,row){
let _self=this;
getCompany().then(res=>{
handelResponse(res,(response,msg)=>{
let companyList=response.map(item=>{
return {key:item.id,text:item.company_name}
});
sessionStorage.setItem('company',JSON.stringify(companyList));
this.props.history.push('/home/system/account-add');
},(err)=>{
})
}).catch(err=>{
});
sessionStorage.setItem('pathname2','/home/system/account-add')
let activerou=[{'pagetitle':'编辑',items:[
{
@ -200,9 +197,10 @@ export default class acclistDom extends React.Component{
"name": "编辑账号"
}
]}]
sessionStorage.setItem('breaknav',JSON.stringify(activerou));
sessionStorage.setItem('dataInfo',JSON.stringify(row));
this.props.history.push('/home/system/account-add');
}
//重置密码
resetpwd(e,row){
@ -221,8 +219,7 @@ export default class acclistDom extends React.Component{
const accList_data=response.data;
const {total}=response;
_self.setState({accList:accList_data,total});
Notify.clear();
Notify.success(msg);
},(err)=>{
})
@ -284,7 +281,7 @@ componentDidUpdate(prevProps,prevState){
<p className="accountable dflexj">
<Button type="primary" icon="plus" onClick={this.clickFn.bind(this)}>新建账号</Button>
{/* <Button type="info">批量操作</Button> */}
<Ipt onChange={(e)=>this.setState({search:e})} value={this.state.search} wordSearch={this.iptsureFn.bind(this)} icon="search" placeholder={"请输入手机号、账号查询"} countShow={false} height={'36px'} width={'260px'} onClearItem={(e)=>{this.setState({search:''})}} alignment={'left'}/>
<Ipt onChange={(e)=>this.setState({search:e})} value={this.state.search} wordSearch={this.iptsureFn.bind(this)} icon="search" placeholder={"请输入姓名、手机号、账号查询"} countShow={false} height={'36px'} width={'260px'} onClearItem={(e)=>{this.setState({search:''})}} alignment={'left'}/>
</p>
<div className="table-container">
<Grid

View File

@ -53,8 +53,7 @@ export default class acclist extends React.Component{
const roleList_data=response.data;
const {total}=response;
_self.setState({roleList:roleList_data,total});
Notify.clear();
Notify.success(msg);
})
})
}