|
|
@ -1,25 +1,28 @@
|
|
|
|
import { Outlet, Link, useHref, NavLink } from 'react-router-dom'
|
|
|
|
import { Outlet, Link, useHref, NavLink } from 'react-router-dom';
|
|
|
|
import { useRef, useEffect, useState } from 'react'
|
|
|
|
import { Layout, Menu, ConfigProvider, theme, Empty, Row, Col, Dropdown, Space, Typography, App as AntApp } from 'antd';
|
|
|
|
import { Layout, Menu, ConfigProvider, theme, Empty, Row, Col, Dropdown, Space, Typography, Result, Select, App as AntApp } from 'antd'
|
|
|
|
import { DownOutlined } from '@ant-design/icons';
|
|
|
|
import { DownOutlined } from "@ant-design/icons";
|
|
|
|
|
|
|
|
import ErrorBoundary from '@/components/ErrorBoundary';
|
|
|
|
import ErrorBoundary from '@/components/ErrorBoundary';
|
|
|
|
import zhLocale from 'antd/locale/zh_CN';
|
|
|
|
import zhLocale from 'antd/locale/zh_CN';
|
|
|
|
import { useThemeContext } from '@/stores/ThemeContext'
|
|
|
|
import { useThemeContext } from '@/stores/ThemeContext';
|
|
|
|
|
|
|
|
import { useAuthContext } from '@/stores/AuthContext'
|
|
|
|
import 'dayjs/locale/zh-cn';
|
|
|
|
import 'dayjs/locale/zh-cn';
|
|
|
|
|
|
|
|
|
|
|
|
import 'react-chat-elements/dist/main.css'
|
|
|
|
import 'react-chat-elements/dist/main.css'
|
|
|
|
import '@/assets/App.css'
|
|
|
|
import '@/assets/App.css';
|
|
|
|
import AppLogo from '@/assets/logo-gh.png'
|
|
|
|
import AppLogo from '@/assets/logo-gh.png';
|
|
|
|
import { isEmpty } from '@/utils/commons'
|
|
|
|
import { isEmpty } from '@/utils/commons';
|
|
|
|
|
|
|
|
|
|
|
|
const { Header, Footer, Content } = Layout
|
|
|
|
const { Header, Footer, Content } = Layout
|
|
|
|
const { Title } = Typography
|
|
|
|
const { Title } = Typography
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// SecurityApp
|
|
|
|
function App() {
|
|
|
|
function App() {
|
|
|
|
|
|
|
|
|
|
|
|
const {colorPrimary, borderRadius} = useThemeContext()
|
|
|
|
const { colorPrimary, borderRadius } = useThemeContext()
|
|
|
|
|
|
|
|
const { loginUser, permissionList } = useAuthContext()
|
|
|
|
const href = useHref()
|
|
|
|
const href = useHref()
|
|
|
|
//const shouldBeLogin = (isEmpty(userId) || isEmpty(website)) && (href.indexOf('/authorise/') == -1)
|
|
|
|
// 除了路由 /p...以外都需要登陆系统
|
|
|
|
|
|
|
|
const shouldBeLogin = isEmpty(loginUser) && (href.indexOf('/p/') == -1)
|
|
|
|
let defaultPath = 'follow'
|
|
|
|
let defaultPath = 'follow'
|
|
|
|
|
|
|
|
|
|
|
|
if (href !== '/') {
|
|
|
|
if (href !== '/') {
|
|
|
@ -30,28 +33,24 @@ function App() {
|
|
|
|
token: { colorBgContainer },
|
|
|
|
token: { colorBgContainer },
|
|
|
|
} = theme.useToken()
|
|
|
|
} = theme.useToken()
|
|
|
|
|
|
|
|
|
|
|
|
function globalEmpty() {
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
|
|
<Empty description={false} />
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function renderLogin() {
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
|
|
<Result
|
|
|
|
|
|
|
|
status='403'
|
|
|
|
|
|
|
|
title='授权失败'
|
|
|
|
|
|
|
|
subTitle='请登陆信息平台,通过指定链接打开。'
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function renderLayout() {
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
|
|
|
|
<ConfigProvider
|
|
|
|
|
|
|
|
theme={{
|
|
|
|
|
|
|
|
token: {
|
|
|
|
|
|
|
|
colorPrimary: colorPrimary,
|
|
|
|
|
|
|
|
borderRadius: borderRadius
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
algorithm: theme.defaultAlgorithm,
|
|
|
|
|
|
|
|
}}
|
|
|
|
|
|
|
|
locale={zhLocale}
|
|
|
|
|
|
|
|
renderEmpty={() => <Empty description={false} />}
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<AntApp>
|
|
|
|
|
|
|
|
<ErrorBoundary>
|
|
|
|
<Layout>
|
|
|
|
<Layout>
|
|
|
|
<Header className='header' style={{ position: 'sticky', top: 0, zIndex: 2, width: '100%', background: 'white' }}>
|
|
|
|
<Header className='header' style={{ position: 'sticky', top: 0, zIndex: 2, width: '100%', background: 'white' }}>
|
|
|
|
<Row gutter={{ md: 24 }} align='middle'>
|
|
|
|
<Row gutter={{ md: 24 }} align='middle'>
|
|
|
|
<Col flex="300px">
|
|
|
|
<Col flex='300px'>
|
|
|
|
<NavLink to='/'>
|
|
|
|
<NavLink to='/'>
|
|
|
|
<img src={AppLogo} className='logo' alt='App logo' />
|
|
|
|
<img src={AppLogo} className='logo' alt='App logo' />
|
|
|
|
</NavLink>
|
|
|
|
</NavLink>
|
|
|
@ -64,33 +63,33 @@ function App() {
|
|
|
|
mode='horizontal'
|
|
|
|
mode='horizontal'
|
|
|
|
selectedKeys={[defaultPath]}
|
|
|
|
selectedKeys={[defaultPath]}
|
|
|
|
items={[
|
|
|
|
items={[
|
|
|
|
{ key: '/s/order/follow', label: <Link to='/s/order/follow'>订单跟踪</Link> },
|
|
|
|
{ key: '/order/follow', label: <Link to='/order/follow'>订单跟踪</Link> },
|
|
|
|
{ key: '/s/order/chat', label: <Link to='/s/order/chat'>销售聊天</Link> },
|
|
|
|
{ key: '/order/chat', label: <Link to='/order/chat'>销售聊天</Link> },
|
|
|
|
{ key: '/s/chat/history', label: <Link to='/s/chat/history'>聊天历史</Link> },
|
|
|
|
{ key: '/chat/history', label: <Link to='/chat/history'>聊天历史</Link> },
|
|
|
|
{ key: '/s/sales/management', label: <Link to='/s/sales/management'>销售管理</Link> }
|
|
|
|
{ key: '/sales/management', label: <Link to='/sales/management'>销售管理</Link> }
|
|
|
|
]}
|
|
|
|
]}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</Col>
|
|
|
|
</Col>
|
|
|
|
<Col flex="auto" style={{ color: "white", marginBottom: "0", display: "flex", justifyContent: "end" }}>
|
|
|
|
<Col flex='auto' style={{ color: 'white', marginBottom: '0', display: 'flex', justifyContent: 'end' }}>
|
|
|
|
<Dropdown
|
|
|
|
<Dropdown
|
|
|
|
menu={{
|
|
|
|
menu={{
|
|
|
|
items: [
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
{
|
|
|
|
label: <Link to="/s/account/profile">个人资料</Link>,
|
|
|
|
label: <Link to='/account/profile'>个人资料</Link>,
|
|
|
|
key: "1",
|
|
|
|
key: '1',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
type: "divider",
|
|
|
|
type: 'divider',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
label: <Link to="/login?out">退出</Link>,
|
|
|
|
label: <Link to='/login?out'>退出</Link>,
|
|
|
|
key: "3",
|
|
|
|
key: '3',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
]
|
|
|
|
]
|
|
|
|
}}
|
|
|
|
}}
|
|
|
|
trigger={['click']}
|
|
|
|
trigger={['click']}
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<a onClick={(e) => e.preventDefault()}>
|
|
|
|
<a onClick={(e) => e.preventDefault()} style={{ color: colorPrimary }}>
|
|
|
|
<Space>
|
|
|
|
<Space>
|
|
|
|
廖一军
|
|
|
|
廖一军
|
|
|
|
<DownOutlined />
|
|
|
|
<DownOutlined />
|
|
|
@ -114,24 +113,6 @@ function App() {
|
|
|
|
</Layout>
|
|
|
|
</Layout>
|
|
|
|
<Footer>桂林海纳国际旅行社有限公司</Footer>
|
|
|
|
<Footer>桂林海纳国际旅行社有限公司</Footer>
|
|
|
|
</Layout>
|
|
|
|
</Layout>
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
|
|
<ConfigProvider
|
|
|
|
|
|
|
|
theme={{
|
|
|
|
|
|
|
|
token: {
|
|
|
|
|
|
|
|
colorPrimary: colorPrimary,
|
|
|
|
|
|
|
|
borderRadius: borderRadius
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
algorithm: theme.defaultAlgorithm,
|
|
|
|
|
|
|
|
}}
|
|
|
|
|
|
|
|
locale={zhLocale}
|
|
|
|
|
|
|
|
renderEmpty={globalEmpty}
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<AntApp>
|
|
|
|
|
|
|
|
<ErrorBoundary>
|
|
|
|
|
|
|
|
{renderLayout()}
|
|
|
|
|
|
|
|
</ErrorBoundary>
|
|
|
|
</ErrorBoundary>
|
|
|
|
</AntApp>
|
|
|
|
</AntApp>
|
|
|
|
</ConfigProvider>
|
|
|
|
</ConfigProvider>
|
|
|
|