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/hooks/userFetch.js b/src/hooks/userFetch.js
index d1a195d..c58ae03 100644
--- a/src/hooks/userFetch.js
+++ b/src/hooks/userFetch.js
@@ -13,7 +13,7 @@ function checkStatus(response) {
}
}
-export function useJson(url) {
+export function useGetJson(url) {
const [data, setData] = useState(null)
useEffect(() => {
if (url) {
@@ -26,9 +26,34 @@ export function useJson(url) {
setData(json)
}
})
- return () => {
- ignore = true
- }
+
+ return () => { ignore = true }
+ }
+ }, [url])
+
+ return data
+}
+
+export function usePostForm(url, formData) {
+ const [data, setData] = useState(null)
+ useEffect(() => {
+ if (url) {
+ let ignore = false
+ fetch(url, {
+ method: 'POST',
+ body: formData
+ }).then(checkStatus)
+ .then(response => response.json())
+ .then(json => {
+ if (!ignore) {
+ setData(json)
+ }
+ })
+ .catch(error => {
+ throw error
+ })
+
+ return () => { ignore = true }
}
}, [url])
diff --git a/src/main.jsx b/src/main.jsx
index da78adc..926b30b 100644
--- a/src/main.jsx
+++ b/src/main.jsx
@@ -35,14 +35,7 @@ const router = createBrowserRouter([
path: '/',
element: ,
errorElement: ,
- children: [
- { index: true, element: },
- ]
- },
- {
- path: '/s',
- element: ,
- children: [
+ children: [
{ index: true, element: },
{ path: 'order/follow', element: },
{ path: 'chat/history', element: },
@@ -52,10 +45,11 @@ const router = createBrowserRouter([
]
},
{
+ path: '/p',
element: ,
children: [
- { path: '/dingding/qrcode', element: },
- { path: '/dingding/callback', element: },
+ { path: 'dingding/qrcode', element: },
+ { path: 'dingding/callback', element: },
]
}
])
@@ -64,7 +58,7 @@ ReactDOM.createRoot(document.getElementById('root')).render(
//
-
+
Loading...
}
diff --git a/src/views/App.jsx b/src/views/App.jsx
index 458cbbf..e0086ff 100644
--- a/src/views/App.jsx
+++ b/src/views/App.jsx
@@ -1,25 +1,28 @@
-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 { DownOutlined } from "@ant-design/icons";
+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 'react-chat-elements/dist/main.css'
-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 !== '/') {
@@ -30,93 +33,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/OrderFollow.jsx b/src/views/OrderFollow.jsx
index 5794dac..152ac03 100644
--- a/src/views/OrderFollow.jsx
+++ b/src/views/OrderFollow.jsx
@@ -1,9 +1,8 @@
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, Segmented, Radio, Select, AutoComplete, Spin, Typography, Flex, DatePicker, List, Avatar
+ Space, Segmented, Radio, Select, AutoComplete, Spin, Typography, Switch, DatePicker, List, Avatar
} from 'antd'
import {
StarFilled, ZoomInOutlined, StarOutlined, BarsOutlined, AppstoreOutlined, SearchOutlined
@@ -184,93 +183,16 @@ const columns = [
function OrderFollow() {
const [taskCategory, setTaskCategory] = useState('today')
+ const [advanceChecked, toggleAdvance] = useState(false)
useEffect(() => {
}, [])
- function AdvanceCriteria() {
- return (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- } onClick={() => {
- search()
- }}>搜索
-
-
-
- )
- }
-
return (
-
+
{
@@ -289,8 +210,13 @@ function OrderFollow() {
buttonStyle='solid'
/>
+
+ {toggleAdvance(!advanceChecked)}} />
+
- } />
+ } />
-
+
)
+
+ function OrderList({ taskCategory }) {
+ console.info('taskCategory: ' + taskCategory)
+ return (
+ <>
+
+ >
+ )
+ }
+
+ function AdvanceCriteria() {
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ } onClick={() => {
+ search()
+ }}>搜索
+
+
+
+ )
+ }
}
-export default observer(OrderFollow)
+export default OrderFollow
diff --git a/src/views/SalesManagement.jsx b/src/views/SalesManagement.jsx
index 5f8d186..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'
@@ -9,7 +8,7 @@ import {
} from '@ant-design/icons'
import {useFormInput} from '@/hooks/useFormInput'
-import {useJson} from '@/hooks/userFetch'
+import {useGetJson} from '@/hooks/userFetch'
const { Search } = Input;
const { RangePicker } = DatePicker;
@@ -104,7 +103,7 @@ const columns = [
function SalesManagement() {
const keywordProps = useFormInput('')
- const countryList = useJson(`https://p9axztuwd7x8a7.mycht.cn/service-InfoSys/InfoSys/GetCountryList`)
+ const countryList = useGetJson(`https://p9axztuwd7x8a7.mycht.cn/service-InfoSys/InfoSys/GetCountryList`)
console.info(countryList)
useEffect(() => {
@@ -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()}