diff --git a/src/components/ErrorBoundary.jsx b/src/components/ErrorBoundary.jsx
index 8c9164c..845839d 100644
--- a/src/components/ErrorBoundary.jsx
+++ b/src/components/ErrorBoundary.jsx
@@ -9,13 +9,13 @@ import { Result } from 'antd'
class ErrorBoundary extends PureComponent {
constructor(props) {
super(props);
- this.state = { hasError: false }
+ this.state = { hasError: false, info: '' }
}
componentDidCatch(error, info) {
console.error('Sorry, Something went wrong.')
console.error(error)
- this.setState({ hasError: true })
+ this.setState({ hasError: true, info: error.message })
}
render() {
@@ -23,7 +23,7 @@ class ErrorBoundary extends PureComponent {
return
}
return this.props.children
diff --git a/src/main.jsx b/src/main.jsx
index 24e43f8..6f5f87f 100644
--- a/src/main.jsx
+++ b/src/main.jsx
@@ -32,13 +32,6 @@ const router = createBrowserRouter([
path: '/',
element: ,
errorElement: ,
- children: [
- { index: true, element: },
- ]
- },
- {
- path: '/s',
- element: ,
children: [
{ index: true, element: },
{ path: 'order/follow', element: },
@@ -48,10 +41,11 @@ const router = createBrowserRouter([
]
},
{
+ path: '/p',
element: ,
children: [
- { path: '/dingding/qrcode', element: },
- { path: '/dingding/callback', element: },
+ { path: 'dingding/qrcode', element: },
+ { path: 'dingding/callback', element: },
]
}
])
diff --git a/src/views/App.jsx b/src/views/App.jsx
index 827d5cc..68db2bb 100644
--- a/src/views/App.jsx
+++ b/src/views/App.jsx
@@ -1,24 +1,27 @@
-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, Result, Select, App as AntApp } from 'antd'
+import { Outlet, Link, useHref, NavLink } from 'react-router-dom';
+import { Layout, Menu, ConfigProvider, theme, Empty, Row, Col, Dropdown, Space, Typography, App as AntApp } from 'antd';
import { DownOutlined } from '@ant-design/icons';
import ErrorBoundary from '@/components/ErrorBoundary';
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 '@/assets/App.css'
-import AppLogo from '@/assets/logo-gh.png'
-import { isEmpty } from '@/utils/commons'
+import '@/assets/App.css';
+import AppLogo from '@/assets/logo-gh.png';
+import { isEmpty } from '@/utils/commons';
const { Header, Footer, Content } = Layout
const { Title } = Typography
+// SecurityApp
function App() {
- const {colorPrimary, borderRadius} = useThemeContext()
+ const { colorPrimary, borderRadius } = useThemeContext()
+ const { loginUser, permissionList } = useAuthContext()
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'
if (href !== '/') {
@@ -29,93 +32,6 @@ function App() {
token: { colorBgContainer },
} = theme.useToken()
- function globalEmpty() {
- return (
-
- )
- }
-
- function renderLogin() {
- return (
-
- )
- }
-
- function renderLayout() {
- return (
-
-
-
-
-
-
-
-
- 聊天式销售平台
-
-
-
-
-
-
-
-
-
-
-
-
- )
- }
-
return (
}
>
-
- {renderLayout()}
-
+
+
+
+
+
+
+
+
+
+ 聊天式销售平台
+
+
+
+
+
+
+
+
+
+
+
+
+
)
diff --git a/src/views/ChatHistory.jsx b/src/views/ChatHistory.jsx
index c38fff9..dff0147 100644
--- a/src/views/ChatHistory.jsx
+++ b/src/views/ChatHistory.jsx
@@ -1,6 +1,5 @@
import { useNavigate } from 'react-router-dom'
import { useRef, useEffect, useState } from 'react'
-import { observer } from 'mobx-react'
import { Row, Col, Divider, Table , Card, Button, Input,
Space, Empty, Radio, AutoComplete, DatePicker, Spin, List, Avatar
} from 'antd'
@@ -92,4 +91,4 @@ function ChatHistory() {
)
}
-export default observer(ChatHistory)
+export default ChatHistory
diff --git a/src/views/DingdingCallbak.jsx b/src/views/DingdingCallbak.jsx
index 8ce1ce8..7ca7491 100644
--- a/src/views/DingdingCallbak.jsx
+++ b/src/views/DingdingCallbak.jsx
@@ -6,7 +6,7 @@ import { useRequest } from 'ahooks'
const { Title } = Typography
const { Meta } = Card
-import { useAuthContext } from '@/stores/AuthContext.js'
+import { useAuthContext } from '@/stores/AuthContext'
function DingdingCallbak() {
diff --git a/src/views/SalesManagement.jsx b/src/views/SalesManagement.jsx
index 28f585e..430e50a 100644
--- a/src/views/SalesManagement.jsx
+++ b/src/views/SalesManagement.jsx
@@ -1,6 +1,5 @@
import { useNavigate } from 'react-router-dom'
import { useRef, useEffect, useState } from 'react'
-import { observer } from 'mobx-react'
import { Row, Col, Divider, Table , Card, Button, Input,
Space, Empty, Radio, Select, DatePicker, Spin, List, Avatar
} from 'antd'
@@ -140,4 +139,4 @@ function SalesManagement() {
)
}
-export default observer(SalesManagement)
+export default SalesManagement
diff --git a/src/views/Standlone.jsx b/src/views/Standlone.jsx
index 1edd6f6..4efac98 100644
--- a/src/views/Standlone.jsx
+++ b/src/views/Standlone.jsx
@@ -10,23 +10,6 @@ import { isEmpty } from '@/utils/commons'
const { Header, Footer, Content } = Layout
const { Title } = Typography
-const items = [
- {
- label: Change password,
- key: "0",
- },
- {
- label: Profile,
- key: "1",
- },
- {
- type: "divider",
- },
- {
- label: Logout,
- key: "3",
- },
-];
function Standlone() {
const {colorPrimary, borderRadius} = useThemeContext()
@@ -35,22 +18,6 @@ function Standlone() {
token: { colorBgContainer },
} = theme.useToken()
- function globalEmpty() {
- return (
-
- )
- }
-
- function renderLogin() {
- return (
-
- )
- }
-
function renderLayout() {
return (
@@ -91,7 +58,7 @@ function Standlone() {
},
algorithm: theme.defaultAlgorithm,
}}
- renderEmpty={globalEmpty}
+ renderEmpty={() => }
>
{renderLayout()}