From f745492a1248f3d92e8dbaca4e75e58e21aa41a8 Mon Sep 17 00:00:00 2001 From: YCC Date: Thu, 18 May 2023 16:13:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=AC=E5=91=8A=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.jsx | 2 + src/stores/Feedback.js | 2 +- src/stores/Notice.js | 71 ++++++++++++++++++++++++++++++++++++ src/stores/Root.js | 2 + src/views/App.jsx | 24 ++++++++---- src/views/feedback/Index.jsx | 6 +-- src/views/notice/Detail.jsx | 40 ++++++++++++++++++++ src/views/notice/Index.jsx | 45 +++++++---------------- 8 files changed, 148 insertions(+), 44 deletions(-) create mode 100644 src/stores/Notice.js create mode 100644 src/views/notice/Detail.jsx diff --git a/src/main.jsx b/src/main.jsx index 8931bb9..5b4cdf7 100644 --- a/src/main.jsx +++ b/src/main.jsx @@ -23,6 +23,7 @@ import AccountProfile from "@/views/account/Profile"; import FeedbackIndex from "@/views/feedback/Index"; import FeedbackDetail from "@/views/feedback/Detail"; import NoticeIndex from "@/views/notice/Index"; +import NoticeDetail from "@/views/notice/Detail"; import InvoiceIndex from "@/views/invoice/Index"; import InvoiceDetail from "@/views/invoice/Detail"; @@ -52,6 +53,7 @@ const router = createBrowserRouter([ { path: "feedback", element: }, { path: "feedback/:GRI_SN", element: }, { path: "notice", element: }, + { path: "notice/:CCP_BLID", element: }, { path: "invoice",element:}, { path: "invoice/detail/:GMDSN/:GSN",element:}, ] diff --git a/src/stores/Feedback.js b/src/stores/Feedback.js index 1a8b2c3..cafe688 100644 --- a/src/stores/Feedback.js +++ b/src/stores/Feedback.js @@ -128,7 +128,7 @@ class Feedback { //提交供应商反馈信息 postFeedbackInfo(VEI_SN, GRI_SN, EOI_SN, info_content) { - let url = `/service-fileServer/FeedbackInfo`; + let url = `/service-CooperateSOA/FeedbackInfo`; let formData = new FormData(); formData.append("VEI_SN", VEI_SN); formData.append("GRI_SN", GRI_SN); diff --git a/src/stores/Notice.js b/src/stores/Notice.js new file mode 100644 index 0000000..6f57d5c --- /dev/null +++ b/src/stores/Notice.js @@ -0,0 +1,71 @@ +import { makeAutoObservable, runInAction } from "mobx"; +import * as config from "@/config"; + +class Notice { + constructor(root) { + makeAutoObservable(this, { rootStore: false }); + this.root = root; + } + + noticeList = []; //公告列表 + noticeUnRead = 0; //未读公告数量 + noticeInfo = { CCP_BLID: 0, CCP_BLTitle: "", CCP_BLContent: "", CCP_LastEditTime: "" }; //公告详情 + + /* 查询公告列表 + LMI_SN 登录用户SN,用户sn用来判断是否已读公告 + */ + getBulletinList(LMI_SN) { + let url = `/service-Cooperate/Cooperate/GetBulletinList`; + url += `?LMI_SN=${LMI_SN}`; + fetch(config.HT_HOST + url) + .then(response => response.json()) + .then(json => { + console.log(json); + runInAction(() => { + this.noticeList = json.Result; + }); + }) + .catch(error => { + console.log("fetch data failed", error); + }); + } + + /* 查询反馈表信息 + LMI_SN 登录用户sn 用户sn用来设置已读公告,请求过一次详情页表示已读 + CCP_BLID 公告sn + */ + getNoticeDetail(LMI_SN, CCP_BLID) { + let url = `/service-Cooperate/Cooperate/GetBulletinDetail`; + url += `?LMI_SN=${LMI_SN}&CCP_BLID=${CCP_BLID}`; + fetch(config.HT_HOST + url) + .then(response => response.json()) + .then(json => { + console.log(json); + runInAction(() => { + this.noticeUnRead = json.Result.CCP_BulletinCount; + }); + }) + .catch(error => { + console.log("fetch data failed", error); + }); + } + + //检查是否有未读公告 + getBulletinUnReadCount(LMI_SN) { + let url = `/service-Cooperate/Cooperate/GetBulletinUnReadCount`; + url += `?LMI_SN=${LMI_SN}`; + fetch(config.HT_HOST + url) + .then(response => response.json()) + .then(json => { + console.log(json); + runInAction(() => { + this.noticeInfo = json.Result; + }); + }) + .catch(error => { + console.log("fetch data failed", error); + }); + } +} + +export default Notice; diff --git a/src/stores/Root.js b/src/stores/Root.js index 59704d9..0907e7b 100644 --- a/src/stores/Root.js +++ b/src/stores/Root.js @@ -1,6 +1,7 @@ import { makeAutoObservable } from "mobx"; import Reservation from "./Reservation"; import Feedback from "./Feedback"; +import Notice from "./Notice"; import Auth from "./Auth"; import Invoice from "./Invoice"; @@ -8,6 +9,7 @@ class Root { constructor() { this.reservationStore = new Reservation(this); this.feedbackStore = new Feedback(this); + this.noticeStore = new Notice(this); this.authStore = new Auth(this); this.invoiceStore = new Invoice(this); makeAutoObservable(this); diff --git a/src/views/App.jsx b/src/views/App.jsx index e85bd06..9f18497 100644 --- a/src/views/App.jsx +++ b/src/views/App.jsx @@ -1,7 +1,7 @@ import { Outlet, Link, useHref, useLocation, NavLink } from "react-router-dom"; import { useEffect } from "react"; import { observer } from "mobx-react"; -import { Layout, Menu, ConfigProvider, theme, Dropdown, Space, Row, Col, Alert, Typography, Divider, App as AntApp } from "antd"; +import { Layout, Menu, ConfigProvider, theme, Dropdown, Space, Row, Col, Badge, Typography, Divider, App as AntApp } from "antd"; import { DownOutlined } from "@ant-design/icons"; import "antd/dist/reset.css"; import AppLogo from "@/assets/logo-gh.png"; @@ -28,8 +28,8 @@ const items = [ }, ]; function App() { - const { authStore } = useStore(); - + const { authStore, noticeStore } = useStore(); + const { noticeUnRead } = noticeStore; const href = useHref(); useEffect(() => { // Check location @@ -61,7 +61,7 @@ function App() { minHeight: "100vh", }}>
- + App logo @@ -74,12 +74,22 @@ function App() { { key: "reservation", label: Reservation }, { key: "invoice", label: Invoice }, { key: "feedback", label: Feedback }, - { key: "notice", label: Notice }, + { + key: "notice", + label: ( + + Notice + {noticeUnRead ? : ""} + + ), + }, ]} /> - {authStore.login.travelAgencyName} + + {authStore.login.travelAgencyName} +
- 公告 查看后不再显示,或者一直显示,或者放到页面底部} description="" type="info" banner closable /> - `Total ${feedbackList.length} items`; + const showTotal = total => `Total ${feedbackList.length} items`; useEffect(() => { - console.info("feedback.useEffect"); + feedbackStore.searchFeedbackList(authStore.login.travelAgencyId, referenceNo, search_date_start.format(config.DATE_FORMAT), search_date_end.format(config.DATE_FORMAT) + " 23:59"); }, []); return ( diff --git a/src/views/notice/Detail.jsx b/src/views/notice/Detail.jsx new file mode 100644 index 0000000..5c98f8c --- /dev/null +++ b/src/views/notice/Detail.jsx @@ -0,0 +1,40 @@ +import { NavLink, useParams } from "react-router-dom"; +import { useEffect, useState } from "react"; +import { observer } from "mobx-react"; +import { toJS } from "mobx"; +import { Row, Col, Space, Button, Table, Input, Typography, Badge, Divider } from "antd"; +import { useStore } from "@/stores/StoreContext.js"; +import * as config from "@/config"; +import * as comm from "@/utils/commons"; +import dayjs from "dayjs"; + +const { Title, Paragraph, Text } = Typography; + +function Detail() { + const { noticeStore, authStore } = useStore(); + const { noticeInfo } = noticeStore; + const { CCP_BLID } = useParams(); + + useEffect(() => { + console.info("notice detail .useEffect " + CCP_BLID); + noticeStore.getNoticeDetail(authStore.login.userId, CCP_BLID); + }, []); + + return ( + + + + + {noticeInfo.CCP_BLTitle} + {noticeInfo.CCP_LastEditTime} + {noticeInfo.CCP_BLContent} + + + Back + + + + ); +} + +export default observer(Detail); diff --git a/src/views/notice/Index.jsx b/src/views/notice/Index.jsx index 16876e4..21d0bfa 100644 --- a/src/views/notice/Index.jsx +++ b/src/views/notice/Index.jsx @@ -2,7 +2,7 @@ import { NavLink } from "react-router-dom"; import { useEffect, useState } from "react"; import { observer } from "mobx-react"; import { toJS } from "mobx"; -import { Row, Col, Space, Button, Table, Input, Typography, DatePicker, Radio } from "antd"; +import { Row, Col, Space, Button, Table, Input, Typography, Badge, List } from "antd"; import { useStore } from "@/stores/StoreContext.js"; import * as config from "@/config"; import * as comm from "@/utils/commons"; @@ -11,44 +11,27 @@ import dayjs from "dayjs"; const { Title, Paragraph, Text } = Typography; function Index() { - const { feedbackStore } = useStore(); + const { noticeStore, authStore } = useStore(); + const { noticeList } = noticeStore; useEffect(() => { - console.info("feedback.useEffect"); + console.info("notice.useEffect"); + noticeStore.getBulletinList(authStore.login.userId); }, []); - const [ellipsis, setEllipsis] = useState(true); - return ( - - Guidelines and Resources - - We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure), to help people create their product prototypes beautifully and We - supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure), to help people create their product prototypes beautifully and We - supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure), to help people create their product prototypes beautifully and We - supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure), to help people create their product prototypes beautifully and - efficiently. efficiently. We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure), to help people create their product - prototypes beautifully and We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure), to help people create their product - prototypes beautifully and efficiently. efficiently. We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure), to help - people create their product prototypes beautifully and We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure), to help - people create their product prototypes beautifully and efficiently. efficiently. efficiently. efficiently. - - - 第二个公告 - - We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure), to help people create their product prototypes beautifully and We - supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure), to help people create their product prototypes beautifully and We - supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure), to help people create their product prototypes beautifully and We - supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure), to help people create their product prototypes beautifully and - efficiently. efficiently. We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure), to help people create their product - prototypes beautifully and We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure), to help people create their product - prototypes beautifully and efficiently. efficiently. We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure), to help - people create their product prototypes beautifully and We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure), to help - people create their product prototypes beautifully and efficiently. efficiently. efficiently. efficiently. - + + ( + + [{item.CCP_LastEditTime}] + {item.CCP_BLTitle} {item.IsRead ? "" : } + + )}>