Merge branch 'main' of github.com:hainatravel/GHHub

release
赵鹏 2 years ago
commit b9938d2c19

@ -9,6 +9,7 @@ import RootStore from "@/stores/Root";
import { StoreContext } from '@/stores/StoreContext'; import { StoreContext } from '@/stores/StoreContext';
import "@/assets/global.css"; import "@/assets/global.css";
import App from "@/views/App"; import App from "@/views/App";
import Standlone from "@/views/Standlone";
import Login from "@/views/Login"; import Login from "@/views/Login";
import SignOut from "@/views/SignOut"; import SignOut from "@/views/SignOut";
import Index from "@/views/index"; import Index from "@/views/index";
@ -52,7 +53,7 @@ const router = createBrowserRouter([
] ]
}, },
{ {
element: <App />, element: <Standlone />,
children: [ children: [
{ path: "/login", element: <Login /> }, { path: "/login", element: <Login /> },
{ path: "/sign-out", element: <SignOut /> } { path: "/sign-out", element: <SignOut /> }

@ -1,4 +1,7 @@
import { makeAutoObservable } from "mobx"; import { makeAutoObservable, runInAction } from "mobx";
import { fetchJSON } from '@/utils/request';
import { HT_HOST } from "@/config";
import { prepareUrl } from '@/utils/commons';
class Auth { class Auth {
@ -7,10 +10,56 @@ class Auth {
this.root = root; this.root = root;
} }
valdateUserPassword(usr, pwd) {
const fetchUrl = prepareUrl(HT_HOST + '/service-Cooperate/Cooperate/Login')
.append('username', usr)
.append('password', pwd)
.build();
return fetchJSON(fetchUrl)
.then(json => {
if (json.errcode == 0) {
runInAction(() => {
this.login = {
userId: json.Result.WU_LMI_SN,
username: json.Result.WU_UserName,
}
});
} else {
throw new Error(json.errmsg + ': ' + json.errcode);
}
});
}
fetchUserDetail(userId) {
const fetchUrl = prepareUrl(HT_HOST + '/service-Cooperate/Cooperate/GetLinkManInfo')
.append('LMI_SN', userId)
.build();
return fetchJSON(fetchUrl)
.then(json => {
if (json.errcode == 0) {
runInAction(() => {
this.login = {
userId: json.Result.LMI_SN,
username: json.Result.LoginName,
travelAgencyId: json.Result.LMI_VEI_SN,
travelAgencyName: json.Result.VName,
cityId: json.Result.citysn
}
});
} else {
throw new Error(json.errmsg + ': ' + json.errcode);
}
});
}
login = { login = {
userId: 1, userId: 1,
username: 'Vu Xuan Giang(ANP)', username: 'Vu Xuan Giang',
travelAgencyId: 32531 //30008供应商id对应HT的VEI_SN travelAgencyId: 32531, //30008供应商id对应HT的VEI_SN
travelAgencyName: 'ANP',
cityId: 0
} }
} }

@ -1,5 +1,5 @@
import { makeAutoObservable, runInAction } from "mobx"; import { makeAutoObservable, runInAction } from "mobx";
import { fetchJSON } from '@/utils/request'; import { fetchJSON, postForm } from '@/utils/request';
import { HT_HOST } from "@/config"; import { HT_HOST } from "@/config";
import { prepareUrl } from '@/utils/commons'; import { prepareUrl } from '@/utils/commons';
@ -31,7 +31,7 @@ class Reservation {
this.reservationList = json.Result.map((data, index) => { this.reservationList = json.Result.map((data, index) => {
return { return {
key: data.vas_gri_sn, key: data.vas_gri_sn,
referenceId: data.vas_gri_sn, reservationId: data.vas_gri_sn,
referenceNumber: data.GriName, referenceNumber: data.GriName,
arrivalDate: data.GetGDate, arrivalDate: data.GetGDate,
pax: data.PersonNum, pax: data.PersonNum,
@ -96,11 +96,10 @@ class Reservation {
this.cityList = json.Result.map((data, index) => { this.cityList = json.Result.map((data, index) => {
return { return {
key: data.CII_SN, key: data.CII_SN,
cityId: data.CII_SN,
cityName: data.CityName, cityName: data.CityName,
tourGuideId: data.TGI_SN, tourGuideId: data.TGI_SN,
tourGuide: data.GuideName, tourGuide: data.GuideName
reservationId: reservationId,
travelAgencyId: this.root.authStore.login.travelAgencyId,
} }
}); });
} else { } else {
@ -110,17 +109,17 @@ class Reservation {
}); });
} }
setupCityGuide() { setupCityGuide(cityId, guideId) {
let formData = new FormData(); let formData = new FormData();
formData.append('GRI_SN', 1); formData.append('GRI_SN', this.selectedReservation.reservationId);
formData.append('VEI_SN', 1); formData.append('VEI_SN', this.root.authStore.login.travelAgencyId);
formData.append('TGI_SN', 1); formData.append('TGI_SN', cityId);
formData.append('CII_SN', 1); formData.append('CII_SN', guideId);
formData.append('GetDate', '2023-06-01'); formData.append('GetDate', this.selectedReservation.reservationDate);
formData.append('LMI_SN', 1); formData.append('LMI_SN', this.root.authStore.login.userId);
const postUrl = HT_HOST + '/service-cusservice/PTAddGuide'; const postUrl = HT_HOST + '/service-cusservice/PTAddGuide';
return req.postForm(postUrl, formData) return postForm(postUrl, formData)
.then(json => { .then(json => {
console.info(json); console.info(json);
}); });
@ -149,9 +148,15 @@ class Reservation {
}); });
} }
editReservation(reservation) {
this.selectedReservation = reservation;
}
guideList = []; guideList = [];
cityList = []; cityList = [];
selectedReservation = null;
reservationList = []; reservationList = [];
reservationDetail = { reservationDetail = {

@ -1,39 +1,22 @@
import { Button, Checkbox, Form, Input, Row, Typography, Layout } from 'antd'; import { Button, Checkbox, Form, Input, Row, App } from 'antd';
const { Header, Footer, Sider, Content } = Layout; import { useStore } from '@/stores/StoreContext.js';
const { Title } = Typography;
const headerStyle = {
textAlign: 'center', function Login() {
// color: '#fff', const { authStore } = useStore();
height: 64, const { notification } = App.useApp();
paddingInline: 50,
lineHeight: '64px', const onFinish = (values) => {
backgroundColor: '#f5f5f5',
};
const contentStyle = {
textAlign: 'center',
minHeight: 600,
lineHeight: '120px',
// color: '#fff',
// backgroundColor: '#108ee9',
};
const footerStyle = {
textAlign: 'center',
// color: '#fff',
// backgroundColor: '#7dbcea',
};
const onFinish = (values) => {
console.log('Success:', values); console.log('Success:', values);
}; authStore.valdateUserPassword(values.username, values.password);
const onFinishFailed = (errorInfo) => { };
const onFinishFailed = (errorInfo) => {
console.log('Failed:', errorInfo); console.log('Failed:', errorInfo);
}; };
const Login = () => (
<Layout> return (
<Header style={headerStyle}> <Row justify="center" align="middle" style={{ minHeight: 500 }}>
<Title>Global Highlights Hub</Title>
</Header>
<Content style={contentStyle}>
<Row justify="center" align="middle" style={{minHeight: 600}}>
<Form <Form
name="basic" name="basic"
labelCol={{ labelCol={{
@ -101,9 +84,7 @@ const Login = () => (
</Form.Item> </Form.Item>
</Form> </Form>
</Row> </Row>
</Content> );
<Footer style={footerStyle}>Footer</Footer> }
</Layout>
);
export default Login; export default Login;

@ -0,0 +1,57 @@
import { Outlet, Link, useHref, useLocation } from "react-router-dom";
import { useEffect } from "react";
import { observer } from "mobx-react";
import { Layout, Menu, ConfigProvider, theme, Typography, Space, Row, Col, Alert, App as AntApp } from "antd";
import { DownOutlined } from "@ant-design/icons";
import "antd/dist/reset.css";
import AppLogo from "@/assets/logo-gh.png";
import { useStore } from "@/stores/StoreContext.js";
const { Title } = Typography;
const { Header, Content, Footer } = Layout;
function Standlone() {
const { authStore } = useStore();
const {
token: { colorBgContainer },
} = theme.useToken();
return (
<ConfigProvider
theme={{
token: {
colorPrimary: "#00b96b",
},
algorithm: theme.defaultAlgorithm,
}}>
<AntApp>
<Layout
style={{
minHeight: "100vh",
}}>
<Header className="header" style={{ position: "sticky", top: 0, zIndex: 1, width: "100%" }}>
<Row gutter={{ md: 24 }} justify="center">
<Col span={4}>
<img src={AppLogo} className="logo" alt="App logo" />
</Col>
<Col span={20}><Title style={{ color: "white", marginTop: "3.5px" }}>Global Highlights Hub</Title></Col>
</Row>
</Header>
<Content
style={{
padding: 24,
margin: 0,
minHeight: 280,
background: colorBgContainer,
}}>
<Outlet />
</Content>
<Footer></Footer>
</Layout>
</AntApp>
</ConfigProvider>
);
}
export default observer(Standlone);

@ -13,7 +13,7 @@ function Newest() {
title: 'Reference number', title: 'Reference number',
dataIndex: 'referenceNumber', dataIndex: 'referenceNumber',
key: 'Reference number', key: 'Reference number',
render: (text, record) => <NavLink to={`/reservation/${record.referenceId}`}>{text}</NavLink>, render: (text, record) => <NavLink to={`/reservation/${record.reservationId}`}>{text}</NavLink>,
}, },
{ {
title: 'Arrival date', title: 'Arrival date',
@ -71,11 +71,12 @@ function Newest() {
allowClear allowClear
placeholder="Select a guide" placeholder="Select a guide"
optionFilterProp="children" optionFilterProp="children"
onChange={(value) => { onChange={(guideId) => {
console.log(`selected:`); console.log(`selected:`);
console.log(value); console.log(guideId);
console.log(`city:`); console.log(`city:`);
console.log(city); console.log(city);
reservationStore.setupCityGuide(city.cityId, guideId);
}} }}
onSearch={(value) => { onSearch={(value) => {
console.log('search:', value); console.log('search:', value);
@ -105,8 +106,9 @@ function Newest() {
const showCityGuideModal = (reservation) => { const showCityGuideModal = (reservation) => {
setDataLoading(true); setDataLoading(true);
setIsModalOpen(true); setIsModalOpen(true);
reservationStore.editReservation(reservation);
reservationStore.fetchGuideList(); reservationStore.fetchGuideList();
reservationStore.fetchCityList(reservation.referenceId) reservationStore.fetchCityList(reservation.reservationId)
.catch(ex => { .catch(ex => {
notification.error({ notification.error({
message: `Notification`, message: `Notification`,

Loading…
Cancel
Save