|
@@ -1,9 +1,9 @@
|
|
|
-import React, { Component , Suspense } from 'react';
|
|
|
+import React, { Component, Suspense } from 'react';
|
|
|
import ReactDOM from 'react-dom';
|
|
|
import './App.css';
|
|
|
-import { Menu, Button } from 'antd';
|
|
|
+import { Menu, Button,Result } from 'antd';
|
|
|
import { $Axios } from './common/publish';
|
|
|
-import { SettingOutlined, DollarCircleOutlined, } from '@ant-design/icons';
|
|
|
+import { SettingOutlined, DollarCircleOutlined, } from '@ant-design/icons';
|
|
|
import * as Icons from "@ant-design/icons";
|
|
|
import {
|
|
|
MenuUnfoldOutlined,
|
|
@@ -15,174 +15,236 @@ export default class App extends React.Component {
|
|
|
super(props)
|
|
|
this.state = {
|
|
|
isLogin: true,
|
|
|
- current: 'one',
|
|
|
- arr1 : [
|
|
|
- { txt : '商户入网' , icon : 'GlobalOutlined' , assembly:'Layout' },
|
|
|
- { txt : '商户入网列表' , icon : 'SlidersOutlined', assembly:'center-tab'}
|
|
|
+ current: 1,
|
|
|
+ arr1: [
|
|
|
+ { txt: '商户入网', icon: 'GlobalOutlined', assembly: 'Layout' }, // no 1-0
|
|
|
+ { txt: '商户入网列表', icon: 'SlidersOutlined', assembly: 'center-tab' } // ok 1-1
|
|
|
],
|
|
|
- arr2 : [
|
|
|
- { txt : '订单查询' , icon : '', assembly:'Finance-orderQuery'},//ok
|
|
|
- { txt : '退款查询' , icon : '', assembly:'Refund-inquiry'}, //ok
|
|
|
- { txt : '账户概览' , icon : '', assembly:'Account-overview'}, //ok
|
|
|
- { txt : '发起提现' , icon : '', assembly:'Cash-initiated'}, //ok
|
|
|
- { txt : '提现记录' , icon : '', assembly:'Withdrawal-record'}, //ok
|
|
|
- { txt : '分账收益记录' , icon : '', assembly:'Income-record'}, //ok
|
|
|
+ arr2: [
|
|
|
+ { txt: '订单查询', icon: '', assembly: 'Finance-orderQuery' },//ok 2-0
|
|
|
+ { txt: '退款查询', icon: '', assembly: 'Refund-inquiry' }, //ok 2-1
|
|
|
+ { txt: '账户概览', icon: '', assembly: 'Account-overview' }, //ok 2-2
|
|
|
+ { txt: '发起提现', icon: '', assembly: 'Cash-initiated' }, //ok 2-3
|
|
|
+ { txt: '提现记录', icon: '', assembly: 'Withdrawal-record' }, //ok 2-4
|
|
|
+ { txt: '分账收益记录', icon: '', assembly: 'Income-record' }, //ok 2-5
|
|
|
// { txt : 'demo' , icon : '', assembly:'homePage'},
|
|
|
],
|
|
|
- assembly : 'Layout',
|
|
|
- defaultSelectedKeys : 'Layout',
|
|
|
- defaultSelectedKeys1 : 'Finance-orderQuery',
|
|
|
- assembly_cw : 'Finance-orderQuery',
|
|
|
- user_txt : {
|
|
|
- userName : 'xxx', //名字
|
|
|
- userJur : 'Y1', //权限
|
|
|
- userInternet : null, // 用户权限为Y3时 才会出现是否入网字段
|
|
|
- }
|
|
|
+ assembly: 'Layout',
|
|
|
+ defaultSelectedKeys: 'Layout',
|
|
|
+ assembly_cw: 'Finance-orderQuery',
|
|
|
+ user_txt: {},
|
|
|
+ signout: false,
|
|
|
+ isSignout : 'no'
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
- this.initJurisdiction()
|
|
|
+ let isSignout = localStorage.getItem('isSignout');
|
|
|
+ let userData = localStorage.getItem('userInformation');
|
|
|
+ // if(isSignout == 'yes' && userData == null){ //拦截是否为刷新页面
|
|
|
+ // this.setState({
|
|
|
+ // signout : true
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ this.initJurisdiction();
|
|
|
+ // console.log(userData)
|
|
|
}
|
|
|
- initJurisdiction(){//初始化用户权限
|
|
|
+ initJurisdiction() {//初始化用户权限
|
|
|
console.log('----------初始化用户权限---------');
|
|
|
console.log(process.env.NODE_ENV == 'development' ? '----------开发测试环境----------' : '----------线上生产环境----------')
|
|
|
- this.autoLogin() //登录查询用户信息
|
|
|
- let Jur = ['Y1','Y2','Y3'] //Y1为云悦平台权限最高权限 //Y2为商城权限二级权限 // Y3为商户权限属于个人权限
|
|
|
- let obj = {
|
|
|
- appName : 'com.smrongshengtianxia',
|
|
|
- merchantId : '896582034',
|
|
|
- id : 2,
|
|
|
- pfAppName : 'com.chuangyetong' //包名
|
|
|
+ // this.autoLogin() //登录查询用户信息
|
|
|
+ let userData = JSON.parse(localStorage.getItem('userInformation '));
|
|
|
+ let obj = { //默认信息
|
|
|
+ userName: '测试用户',
|
|
|
+ appName: 'com.smrongshengtianxia',
|
|
|
+ merchantId: '896582034',
|
|
|
+ id: 2,
|
|
|
+ pfAppName: 'com.chuangyetong', //包名
|
|
|
+ Jur : 1,//用户权限
|
|
|
+ pages : '2-0'
|
|
|
+ }
|
|
|
+ if (userData !== null) { //能获取用户信息 改变存储信息
|
|
|
+ obj = {
|
|
|
+ userName: userData.userName, //用户名
|
|
|
+ appName: userData.appName, //appName
|
|
|
+ merchantId: userData.merchantId, //merchantId
|
|
|
+ id: userData.id, //id
|
|
|
+ userId: userData.userId,
|
|
|
+ pfAppName: userData.pfAppName, //包名
|
|
|
+ Jur : userData.Jur, //用户权限 1为云悦平台权限最高权限 //2为商城权限二级权限 // 3为商户权限属于个人权限;
|
|
|
+ pages : userData.pages //支持页面跳转
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let page = obj.pages.split('-');
|
|
|
+ if(page[0] == 1){
|
|
|
+ let arr = this.state.arr1;
|
|
|
+ this.setState({
|
|
|
+ user_txt: obj,
|
|
|
+ current : page[0],
|
|
|
+ assembly : arr.find((item,index) => { return index == page[1]}).assembly
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ let arr = this.state.arr2;
|
|
|
+ this.setState({
|
|
|
+ user_txt: obj,
|
|
|
+ current : page[0],
|
|
|
+ assembly_cw : arr.find((item,index) => { return index == page[1]}).assembly
|
|
|
+ })
|
|
|
}
|
|
|
- localStorage.setItem('userData',JSON.stringify(obj))
|
|
|
+
|
|
|
+ localStorage.setItem('userData', JSON.stringify(obj))
|
|
|
|
|
|
}
|
|
|
|
|
|
- handleClick(e){
|
|
|
- this.setState({
|
|
|
- current : e.key,
|
|
|
+ handleClick(e) {
|
|
|
+ this.setState({
|
|
|
+ current: e.key,
|
|
|
});
|
|
|
this.initassembly()
|
|
|
}
|
|
|
|
|
|
- toggleCollapsed(e){
|
|
|
+ toggleCollapsed(e) {
|
|
|
this.setState({
|
|
|
collapsed: !this.state.collapsed,
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- toggleNavs(e){
|
|
|
+ toggleNavs(e) {
|
|
|
let current = this.state.current;
|
|
|
- if(current == 'one'){
|
|
|
+ if (current == 'one') {
|
|
|
this.setState({
|
|
|
assembly: e.key,
|
|
|
});
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
this.setState({
|
|
|
- assembly_cw : e.key
|
|
|
+ assembly_cw: e.key
|
|
|
});
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
- initassembly(){
|
|
|
+ initassembly() {
|
|
|
let current = this.state.current;
|
|
|
let Assembly = null;
|
|
|
- if(current == 'one'){
|
|
|
+ if (current == 'one') {
|
|
|
Assembly = React.lazy(() => import(`./component/${this.state.assembly}/${this.state.assembly}.jsx`));
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
Assembly = React.lazy(() => import(`./component/${this.state.assembly_cw}/${this.state.assembly_cw}.jsx`));
|
|
|
}
|
|
|
-
|
|
|
- return <Suspense fallback="" key="dialog"><Assembly refModal={this.state.current} /></Suspense>
|
|
|
+
|
|
|
+ return <Suspense fallback="" key="dialog"><Assembly refModal={this.state.current} /></Suspense>
|
|
|
}
|
|
|
- initIcon(item){
|
|
|
+ initIcon(item) {
|
|
|
let Icon = item.icon;
|
|
|
return React.createElement(Icons[Icon])
|
|
|
}
|
|
|
|
|
|
- autoLogin = () => {
|
|
|
- let url = '/payment/merchant.query.groovy'
|
|
|
- let param = {
|
|
|
- appName : '吕卓',
|
|
|
- action : "queryInfo"
|
|
|
-
|
|
|
- }
|
|
|
- $Axios('post',url,param,(res) => {
|
|
|
- // console.log(res)
|
|
|
- })
|
|
|
+ // autoLogin = () => {
|
|
|
+ // let url = '/payment/merchant.query.groovy'
|
|
|
+ // let param = {
|
|
|
+ // appName : '吕卓',
|
|
|
+ // action : "queryInfo"
|
|
|
+
|
|
|
+ // }
|
|
|
+ // $Axios('post',url,param,(res) => {
|
|
|
+ // // console.log(res)
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+
|
|
|
+ signout() {
|
|
|
+ localStorage.setItem('isSignout', 'yes')
|
|
|
+ localStorage.removeItem('userInformation') //退出清除用户本地数据
|
|
|
+ localStorage.removeItem('userData') //退出清除用户本地数据
|
|
|
+ this.setState({
|
|
|
+ signout: true
|
|
|
+ });
|
|
|
+
|
|
|
}
|
|
|
|
|
|
render() {
|
|
|
- const { current, arr1, arr2 , user_txt } = this.state;
|
|
|
+ const { current, arr1, arr2, user_txt, signout,assembly,assembly_cw } = this.state;
|
|
|
const { SubMenu } = Menu;
|
|
|
return (
|
|
|
<React.Fragment>
|
|
|
- {/* {this.state.isLogin ? <Layout></Layout>} */}
|
|
|
- <div className='wrap'>
|
|
|
- <div className='header_nav'>
|
|
|
- <div className='header_title'>商户入网信息管理平台</div>
|
|
|
- <div className='header_menu'>
|
|
|
- <div className='head-sj'>
|
|
|
- <Button type="primary" onClick={this.toggleCollapsed.bind(this)} style={{ marginBottom: 16 }} style={{height:'100%'}}>
|
|
|
- {React.createElement(this.state.collapsed ? MenuUnfoldOutlined : MenuFoldOutlined)}
|
|
|
- </Button>
|
|
|
- </div>
|
|
|
- <Menu onClick={this.handleClick.bind(this)} selectedKeys={[current]} mode="horizontal" className='header_navs'>
|
|
|
- <Menu.Item key="one" icon={<SettingOutlined />}>
|
|
|
- 高级设置
|
|
|
- </Menu.Item>
|
|
|
- <Menu.Item key="tow" icon={<DollarCircleOutlined />}>
|
|
|
- 财务管理
|
|
|
- </Menu.Item>
|
|
|
- </Menu>
|
|
|
- </div>
|
|
|
- <div className='header_user' style={{lineHeight:'60px'}}>
|
|
|
- <div style={{width:'50%',lineHeight:'60px',display:'inline-block'}}>用户名 : {user_txt.userName}</div>
|
|
|
- <div style={{width:'50%',lineHeight:'60px',display:'inline-block'}}>
|
|
|
- <a>修改密码</a>
|
|
|
- <a style={{marginLeft:'10px'}}>退出</a>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ {
|
|
|
+ signout == true && <div style={{ width: '100%', height: '100%' }}>
|
|
|
+ <Result
|
|
|
+ status="success"
|
|
|
+ title="您已退出登录!"
|
|
|
+ subTitle="You have logged out."
|
|
|
+ // extra={}
|
|
|
+ />
|
|
|
</div>
|
|
|
- <div className='main_centers'>
|
|
|
- {current === 'one' && <Menu
|
|
|
- className='main_left_nav'
|
|
|
- defaultSelectedKeys={[this.state.assembly]}
|
|
|
- mode="inline"
|
|
|
- theme="dark"
|
|
|
- inlineCollapsed={this.state.collapsed}
|
|
|
- onClick={this.toggleNavs.bind(this)}
|
|
|
- >
|
|
|
- {current === 'one' && (arr1.map((item,index) =>(
|
|
|
- <Menu.Item key={item.assembly} data={item.txt} icon={this.initIcon(item)}>
|
|
|
- {item.txt}
|
|
|
- </Menu.Item>
|
|
|
- )))}
|
|
|
- </Menu>}
|
|
|
- {current === 'tow' && <Menu
|
|
|
- className='main_left_nav'
|
|
|
- defaultSelectedKeys={[this.state.assembly_cw]}
|
|
|
- mode="inline"
|
|
|
- theme="dark"
|
|
|
- inlineCollapsed={this.state.collapsed}
|
|
|
- onClick={this.toggleNavs.bind(this)}
|
|
|
- >
|
|
|
- {current === 'tow' && (arr2.map((item,index) =>(
|
|
|
- <Menu.Item key={item.assembly} data={item.txt} icon={<DollarCircleOutlined />}>
|
|
|
- {item.txt}
|
|
|
- </Menu.Item>
|
|
|
- )))}
|
|
|
- </Menu>}
|
|
|
-
|
|
|
- <div className='main_right_center'>
|
|
|
- {
|
|
|
+ }
|
|
|
+ {
|
|
|
+ signout == false && <div style={{ width: '100%', height: '100%' }}>
|
|
|
+ <div className='wrap'>
|
|
|
+ <div className='header_nav'>
|
|
|
+ <div className='header_title'>商户入网信息管理平台</div>
|
|
|
+ <div className='header_menu'>
|
|
|
+ <div className='head-sj'>
|
|
|
+ <Button type="primary" onClick={this.toggleCollapsed.bind(this)} style={{ marginBottom: 16 }} style={{ height: '100%' }}>
|
|
|
+ {React.createElement(this.state.collapsed ? MenuUnfoldOutlined : MenuFoldOutlined)}
|
|
|
+ </Button>
|
|
|
+ </div>
|
|
|
+ <Menu onClick={this.handleClick.bind(this)} selectedKeys={[current]} mode="horizontal" className='header_navs'>
|
|
|
+ <Menu.Item key={1} icon={<SettingOutlined />}>
|
|
|
+ 高级设置
|
|
|
+ </Menu.Item>
|
|
|
+ <Menu.Item key={2} icon={<DollarCircleOutlined />}>
|
|
|
+ 财务管理
|
|
|
+ </Menu.Item>
|
|
|
+ </Menu>
|
|
|
+ </div>
|
|
|
+ <div className='header_user' style={{ lineHeight: '60px' }}>
|
|
|
+ <div style={{ width: '50%', lineHeight: '60px', display: 'inline-block' }}>用户名 : {user_txt.userName}</div>
|
|
|
+ <div style={{ width: '50%', lineHeight: '60px', display: 'inline-block' }}>
|
|
|
+ {/* <a>修改密码</a> */}
|
|
|
+ <a style={{ marginLeft: '10px' }} onClick={this.signout.bind(this)}>退出</a>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div className='main_centers'>
|
|
|
+ {current == 1 && <Menu
|
|
|
+ className='main_left_nav'
|
|
|
+ defaultSelectedKeys={[this.state.assembly]}
|
|
|
+ mode="inline"
|
|
|
+ theme="dark"
|
|
|
+ key={assembly}
|
|
|
+ inlineCollapsed={this.state.collapsed}
|
|
|
+ onClick={this.toggleNavs.bind(this)}
|
|
|
+ >
|
|
|
+ {current == 1 && (arr1.map((item, index) => (
|
|
|
+ <Menu.Item key={item.assembly} data={item.txt} icon={this.initIcon(item)}>
|
|
|
+ {item.txt}
|
|
|
+ </Menu.Item>
|
|
|
+ )))}
|
|
|
+ </Menu>}
|
|
|
+ {current == 2 && <Menu
|
|
|
+ className='main_left_nav'
|
|
|
+ defaultSelectedKeys={[this.state.assembly_cw]}
|
|
|
+ mode="inline"
|
|
|
+ theme="dark"
|
|
|
+ key={assembly_cw}
|
|
|
+ inlineCollapsed={this.state.collapsed}
|
|
|
+ onClick={this.toggleNavs.bind(this)}
|
|
|
+ >
|
|
|
+ {current == 2 && (arr2.map((item, index) => (
|
|
|
+ <Menu.Item key={item.assembly} data={item.txt} icon={<DollarCircleOutlined />}>
|
|
|
+ {item.txt}
|
|
|
+ </Menu.Item>
|
|
|
+ )))}
|
|
|
+ </Menu>}
|
|
|
+
|
|
|
+ <div className='main_right_center'>
|
|
|
+ {
|
|
|
this.initassembly()
|
|
|
- }
|
|
|
+ }
|
|
|
+ </div>
|
|
|
</div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
+ }
|
|
|
</React.Fragment>
|
|
|
)
|
|
|
}
|