|
|
|
@ -1,15 +1,11 @@
|
|
|
|
|
import { Outlet, Link, useHref, useNavigate, useLocation, NavLink } from "react-router-dom";
|
|
|
|
|
import { Outlet, Link, useHref, useNavigate, useLocation, NavLink } from 'react-router-dom';
|
|
|
|
|
import { useEffect, useState } from 'react';
|
|
|
|
|
import { observer } from "mobx-react";
|
|
|
|
|
import { toJS } from "mobx";
|
|
|
|
|
import { Layout, Menu, ConfigProvider, theme, Dropdown, Space, Row, Col, Badge, Typography, Modal, Input, Button, App as AntApp } from "antd";
|
|
|
|
|
import { DownOutlined } from "@ant-design/icons";
|
|
|
|
|
import "antd/dist/reset.css";
|
|
|
|
|
import AppLogo from "@/assets/logo-gh.png";
|
|
|
|
|
import { isEmpty } from "@/utils/commons";
|
|
|
|
|
import { useStore } from "@/stores/StoreContext.js";
|
|
|
|
|
import * as config from "@/config";
|
|
|
|
|
import Language from "../i18n/LanguageSwitcher";
|
|
|
|
|
import { Layout, Menu, ConfigProvider, theme, Dropdown, Space, Row, Col, Badge, Typography, Modal, Input, Button, App as AntApp } from 'antd';
|
|
|
|
|
import { DownOutlined } from '@ant-design/icons';
|
|
|
|
|
import 'antd/dist/reset.css';
|
|
|
|
|
import AppLogo from '@/assets/logo-gh.png';
|
|
|
|
|
import { isEmpty } from '@/utils/commons';
|
|
|
|
|
import Language from '../i18n/LanguageSwitcher';
|
|
|
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
|
import zhLocale from 'antd/locale/zh_CN';
|
|
|
|
|
import enLocale from 'antd/locale/en_US';
|
|
|
|
@ -25,12 +21,10 @@ function App() {
|
|
|
|
|
const { t, i18n } = useTranslation();
|
|
|
|
|
|
|
|
|
|
const [password, setPassword] = useState('');
|
|
|
|
|
const { authStore } = useStore();
|
|
|
|
|
const { notification } = AntApp.useApp();
|
|
|
|
|
|
|
|
|
|
const loginUser = useAuthStore((state) => state.loginUser)
|
|
|
|
|
|
|
|
|
|
// const login = toJS(authStore.login);
|
|
|
|
|
const noticeUnRead = useNoticeStore((state) => state.noticeUnRead);
|
|
|
|
|
const href = useHref();
|
|
|
|
|
const loginToken = loginUser.token;
|
|
|
|
@ -71,8 +65,8 @@ function App() {
|
|
|
|
|
setPassword('');
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const splitPath = href.split("/");
|
|
|
|
|
let defaultPath = "reservation";
|
|
|
|
|
const splitPath = href.split('/');
|
|
|
|
|
let defaultPath = 'reservation';
|
|
|
|
|
|
|
|
|
|
if (splitPath.length > 1) {
|
|
|
|
|
defaultPath = splitPath[1];
|
|
|
|
@ -90,7 +84,7 @@ function App() {
|
|
|
|
|
<ConfigProvider locale={antdLng}
|
|
|
|
|
theme={{
|
|
|
|
|
token: {
|
|
|
|
|
colorPrimary: "#00b96b",
|
|
|
|
|
colorPrimary: '#00b96b',
|
|
|
|
|
},
|
|
|
|
|
algorithm: theme.defaultAlgorithm,
|
|
|
|
|
}}>
|
|
|
|
@ -104,7 +98,7 @@ function App() {
|
|
|
|
|
>
|
|
|
|
|
<Title level={3}>{t('LoginTimeout')}</Title>
|
|
|
|
|
<div>{t('LoginTimeoutTip')}</div>
|
|
|
|
|
<Space direction="horizontal">
|
|
|
|
|
<Space direction='horizontal'>
|
|
|
|
|
<Input.Password value={password}
|
|
|
|
|
onChange={(e) => setPassword(e.target.value)}
|
|
|
|
|
onPressEnter={() => onSubmit()}
|
|
|
|
@ -116,29 +110,29 @@ function App() {
|
|
|
|
|
</Modal>
|
|
|
|
|
<Layout
|
|
|
|
|
style={{
|
|
|
|
|
minHeight: "100vh",
|
|
|
|
|
minHeight: '100vh',
|
|
|
|
|
}}>
|
|
|
|
|
<Header className="header" style={{ position: "sticky", top: 0, zIndex: 1, width: "100%" }}>
|
|
|
|
|
<Row gutter={{ md: 24 }} justify="end" align="middle">
|
|
|
|
|
<Header className='header' style={{ position: 'sticky', top: 0, zIndex: 1, width: '100%' }}>
|
|
|
|
|
<Row gutter={{ md: 24 }} justify='end' align='middle'>
|
|
|
|
|
<Col span={16}>
|
|
|
|
|
<NavLink to="/">
|
|
|
|
|
<img src={AppLogo} className="logo" alt="App logo" />
|
|
|
|
|
<NavLink to='/'>
|
|
|
|
|
<img src={AppLogo} className='logo' alt='App logo' />
|
|
|
|
|
</NavLink>
|
|
|
|
|
<Menu
|
|
|
|
|
theme="dark"
|
|
|
|
|
mode="horizontal"
|
|
|
|
|
theme='dark'
|
|
|
|
|
mode='horizontal'
|
|
|
|
|
selectedKeys={[defaultPath]}
|
|
|
|
|
items={[
|
|
|
|
|
{ key: "reservation", label: <Link to="/reservation/newest">{t('menu.Reservation')}</Link> },
|
|
|
|
|
{ key: "invoice", label: <Link to="/invoice">{t('menu.Invoice')}</Link> },
|
|
|
|
|
{ key: "feedback", label: <Link to="/feedback">{t('menu.Feedback')}</Link> },
|
|
|
|
|
{ key: "report", label: <Link to="/report">{t('menu.Report')}</Link> },
|
|
|
|
|
{ key: 'reservation', label: <Link to='/reservation/newest'>{t('menu.Reservation')}</Link> },
|
|
|
|
|
{ key: 'invoice', label: <Link to='/invoice'>{t('menu.Invoice')}</Link> },
|
|
|
|
|
{ key: 'feedback', label: <Link to='/feedback'>{t('menu.Feedback')}</Link> },
|
|
|
|
|
{ key: 'report', label: <Link to='/report'>{t('menu.Report')}</Link> },
|
|
|
|
|
{
|
|
|
|
|
key: "notice",
|
|
|
|
|
key: 'notice',
|
|
|
|
|
label: (
|
|
|
|
|
<Link to="/notice">
|
|
|
|
|
<Link to='/notice'>
|
|
|
|
|
{t('menu.Notice')}
|
|
|
|
|
{noticeUnRead ? <Badge dot /> : ""}
|
|
|
|
|
{noticeUnRead ? <Badge dot /> : ''}
|
|
|
|
|
</Link>
|
|
|
|
|
),
|
|
|
|
|
},
|
|
|
|
@ -146,7 +140,7 @@ function App() {
|
|
|
|
|
/>
|
|
|
|
|
</Col>
|
|
|
|
|
<Col span={4}>
|
|
|
|
|
<Title level={3} style={{ color: "white", marginBottom: "0", display: "flex", justifyContent: "end" }}>
|
|
|
|
|
<Title level={3} style={{ color: 'white', marginBottom: '0', display: 'flex', justifyContent: 'end' }}>
|
|
|
|
|
{loginUser.travelAgencyName}
|
|
|
|
|
</Title>
|
|
|
|
|
</Col>
|
|
|
|
@ -194,4 +188,4 @@ function App() {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default observer(App);
|
|
|
|
|
export default App
|
|
|
|
|