|
|
|
import React from 'react'
|
|
|
|
import ReactDOM from 'react-dom/client'
|
|
|
|
import { createBrowserRouter, RouterProvider } from 'react-router-dom'
|
|
|
|
import { ThemeContext } from '@/stores/ThemeContext'
|
|
|
|
import AuthApp from '@/views/AuthApp'
|
|
|
|
import DesktopApp from '@/views/DesktopApp'
|
|
|
|
import MobileApp from '@/views/MobileApp'
|
|
|
|
import Standlone from '@/views/Standlone'
|
|
|
|
import OrderFollow from '@/views/OrderFollow'
|
|
|
|
import ChatHistory from '@/views/ChatHistory'
|
|
|
|
import SalesManagement from '@/views/SalesManagement'
|
|
|
|
import DingdingQRCode from '@/views/dingding/QRCode'
|
|
|
|
import DingdingCallback from '@/views/dingding/Callback'
|
|
|
|
import DingdingLogout from '@/views/dingding/Logout'
|
|
|
|
import AccountProfile from '@/views/AccountProfile'
|
|
|
|
import ErrorPage from '@/components/ErrorPage'
|
|
|
|
import Conversations from '@/views/Conversations/ChatWindow'
|
|
|
|
import MobileConversation from '@/views/mobile/Conversation'
|
|
|
|
import MobileChat from '@/views/mobile/Chat'
|
|
|
|
import MobileLogin from '@/views/mobile/Login'
|
|
|
|
import useAuthStore from '@/stores/AuthStore'
|
|
|
|
import '@/assets/index.css'
|
|
|
|
|
|
|
|
useAuthStore.getState().loadUserSession()
|
|
|
|
|
|
|
|
const router = createBrowserRouter([
|
|
|
|
{
|
|
|
|
path: '/',
|
|
|
|
element: <AuthApp />,
|
|
|
|
errorElement: <ErrorPage />,
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
element: <DesktopApp />,
|
|
|
|
children: [
|
|
|
|
{ index: true, element: <OrderFollow /> },
|
|
|
|
{ path: 'order/follow', element: <OrderFollow /> },
|
|
|
|
{ path: 'chat/history', element: <ChatHistory /> },
|
|
|
|
{ path: 'sales/management', element: <SalesManagement /> },
|
|
|
|
{ path: 'order/chat/:order_sn', element: <Conversations /> },
|
|
|
|
{ path: 'order/chat', element: <Conversations /> },
|
|
|
|
{ path: 'account/profile', element: <AccountProfile /> },
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: 'm',
|
|
|
|
element: <MobileApp />,
|
|
|
|
children: [
|
|
|
|
{ path: 'conversation', element: <MobileConversation /> },
|
|
|
|
{ path: 'chat', element: <MobileChat /> },
|
|
|
|
]
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/p',
|
|
|
|
element: <Standlone />,
|
|
|
|
children: [
|
|
|
|
{ path: 'dingding/qrcode', element: <DingdingQRCode /> },
|
|
|
|
{ path: 'dingding/callback', element: <DingdingCallback /> },
|
|
|
|
{ path: 'dingding/logout', element: <DingdingLogout /> },
|
|
|
|
{ path: 'mobile-login', element: <MobileLogin />},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
])
|
|
|
|
|
|
|
|
ReactDOM.createRoot(document.getElementById('root')).render(
|
|
|
|
// <React.StrictMode>
|
|
|
|
<ThemeContext.Provider value={{ colorPrimary: '#1ba784', borderRadius: 4 }}>
|
|
|
|
<RouterProvider router={router} fallbackElement={() => <div>Loading...</div>} />
|
|
|
|
</ThemeContext.Provider>
|
|
|
|
// </React.StrictMode>
|
|
|
|
);
|