From 6da633261311f616dd5925ae352614db87a9eec8 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Tue, 19 Mar 2024 20:33:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E8=AE=BE=E5=A4=87=E6=9D=A5?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC=E8=B7=AF=E7=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.jsx | 55 +++++++++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/src/main.jsx b/src/main.jsx index 3bbeae8..cd56e30 100644 --- a/src/main.jsx +++ b/src/main.jsx @@ -23,34 +23,41 @@ import '@/assets/index.css' useAuthStore.getState().loadUserSession() +const isMobileApp = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i) !== null; + const router = createBrowserRouter([ { path: '/', element: , errorElement: , - children: [ - { - element: , - children: [ - { index: true, element: }, - { path: 'order/follow', element: }, - { path: 'chat/history', element: }, - { path: 'sales/management', element: }, - { path: 'order/chat/:order_sn', element: }, - { path: 'order/chat', element: }, - { path: 'account/profile', element: }, + children: isMobileApp + ? [ + { + path: 'm', + element: , + children: [ + { path: 'conversation', element: }, + // { path: 'chat/:order_sn', element: }, + // { path: 'chat', element: }, + ], + }, + { path: 'm/chat/:order_sn', element: }, + { path: 'm/chat', element: }, ] - }, - { - path: 'm', - element: , - children: [ - { path: 'conversation', element: }, - { path: 'chat/:order_sn', element: }, - { path: 'chat', element: }, - ] - }, - ], + : [ + { + element: , + children: [ + { index: true, element: }, + { path: 'order/follow', element: }, + { path: 'chat/history', element: }, + { path: 'sales/management', element: }, + { path: 'order/chat/:order_sn', element: }, + { path: 'order/chat', element: }, + { path: 'account/profile', element: }, + ], + }, + ], }, { path: '/p', @@ -59,10 +66,10 @@ const router = createBrowserRouter([ { path: 'dingding/qrcode', element: }, { path: 'dingding/callback', element: }, { path: 'dingding/logout', element: }, - { path: 'mobile-login', element: }, + { path: 'mobile-login', element: }, ], }, -]) +]); ReactDOM.createRoot(document.getElementById('root')).render( //