!2636 开发:公告发布改进-WebCAD部分

zc/read_code_daa
彭泽 5 months ago committed by ChenX
parent 96c97794f9
commit 15f6934200

@ -124,12 +124,16 @@
"react-dnd": "^16.0.1",
"react-dnd-html5-backend": "^16.0.1",
"react-dom": "^17.0.2",
"react-markdown": "^9.0.1",
"react-rnd": "^10.4.1",
"react-split": "^2.0.14",
"react-virtualized-auto-sizer": "^1.0.20",
"react-window": "^1.8.9",
"react-zmage": "0.7.0",
"remark-gfm": "^4.0.0",
"stats.js": "^0.17.0",
"three": "npm:three-cf@0.122.6",
"swiper": "6.8.4",
"xaop": "^2.1.0"
},
"resolutions": {

@ -206,3 +206,6 @@ export const PrivateModule = {
};
export const FBXURL = CURRENT_HOST + "/CAD-ossUploadSign";
//通知
export const NOTICE = CURRENT_HOST + "/CAD-notices";

@ -0,0 +1,8 @@
import { Position, Toaster } from "@blueprintjs/core";
export const NoticeToaster = Toaster.create({
className: "noticeToaster",
canEscapeKeyClear: true,
usePortal: true,
autoFocus: false,
position: Position.TOP,
});

@ -0,0 +1,123 @@
import { Tab, TabId, Tabs } from "@blueprintjs/core";
import { observer } from "mobx-react";
import React, { FC } from "react";
import ReactMarkdown from 'react-markdown';
import Zmage from 'react-zmage';
import gfm from 'remark-gfm';
import SwiperCore, { Autoplay, Navigation, Pagination } from 'swiper/core';
import { Swiper, SwiperSlide } from 'swiper/react';
import 'swiper/swiper-bundle.min.css';
import 'swiper/swiper.min.css';
import { CURRENT_HOST } from "../Common/HostUrl";
import { NoticeGroup, TabsExampleState } from "./NoticeGroup";
SwiperCore.use([Autoplay, Pagination, Navigation]);
export class NoticeBody extends React.Component<NoticeGroup, TabsExampleState, {}>
{
public state: TabsExampleState = {
activePanelOnly: false,
animate: true,
navbarTabId: 1,
};
render()
{
return (
<div>
{
<div id="Notice">
<div><h3 style={{ margin: "0 0 5px 0", textAlign: "center" }}></h3></div>
<div style={{ width: "650px", height: "400px" }}>
<Tabs id="TabsExample" selectedTabId={this.state.navbarTabId} animate
key="vertical"
renderActiveTabPanelOnly
vertical
onChange={this.handleNavbarTabChange}>
{
this.props.data.map((data, i) =>
{
return <Tab id={i + 1} title={`公告${i + 1}`} panel={<Message data={[data]} />} />;
})
}
</Tabs>
</div>
</div>
}
</div>
);
}
private handleNavbarTabChange = (navbarTabId: TabId) => this.setState({ navbarTabId });
}
// 通知
const Notice: FC<NoticeGroup> = observer(({ data }) =>
<div>
</div>
);
const Message: FC<NoticeGroup> = observer(({ data }) =>
<div style={{ height: "100%" }}>
<div >
{
data.map((data) =>
{
// 纯文字
if (Number(data.notice_type) == 1)
{
return Number(data.notice_type) == 1 && <div style={{ marginTop: "10px", whiteSpace: "pre-wrap" }}>{data.notice_content}</div>;
}
// 纯图片
if (Number(data.notice_type) == 2)
{
let Img = JSON.parse(data.notice_content);
let imgstr = [];
for (let Imginfo of Object.keys(Img))
{
imgstr.push(<Zmage src={`${CURRENT_HOST}/${Img[Imginfo]}`} alt="" />);
}
return imgstr;
}
// 图文模式
if (Number(data.notice_type) == 3)
{
return <div className="Markdown"><ReactMarkdown remarkPlugins={[gfm]}>{data.notice_content}</ReactMarkdown></div>;
}
// 轮播图
if (Number(data.notice_type) == 4)
{
let Swipers = JSON.parse(data.notice_content);
let swiper = [];
for (let Swiperinfo of Object.keys(Swipers))
{
swiper.push(<SwiperSlide className="NoticeImg">
<Zmage zoomOptions={{ maxZoom: 5, minZoom: 1 }} style={{ maxWidth: '100%', minWidth: '0' }} src={`${CURRENT_HOST}/${Swipers[Swiperinfo]}`} alt="" />
</SwiperSlide>);
}
return <Swiper
spaceBetween={50}
slidesPerView={1}
pagination={{
"clickable": true
}}
loop autoplay={{ delay: 3000, disableOnInteraction: false }}
scrollbar={{ draggable: true }}
>
{swiper}
</Swiper>;
}
//视频
if (Number(data.notice_type) == 5)
{
let Video = JSON.parse(data.notice_content);
let video = [];
for (let VideoInfo of Object.keys(Video))
{
video.push(<video style={{ width: "100%" }} controls src={`${Video[VideoInfo]}`}></video>);
}
return video;
}
})
}
</div>
</div>
);

@ -0,0 +1,25 @@
import { TabId } from "@blueprintjs/core";
export interface NoticeGroup
{
data: NoticeProp[];
}
interface NoticeProp
{
data: string[]; //列表节点
notice_id: string; //通知标识
product_type: string; //产品类型
notice_type: string; //通知类型
component_type: string; //组件类型
notice_group_type: string; //通知群组类型
notice_group: string; //通知群组
notice_content: string; //通知内容
}
export interface TabsExampleState
{
activePanelOnly: boolean;
animate: boolean;
navbarTabId: TabId;
}

@ -4,13 +4,15 @@ import { inject, observer } from 'mobx-react';
import * as React from 'react';
import { app } from '../../../ApplicationServices/Application';
import { appCache } from '../../../Common/AppCache';
import { CURRENT_HOST, ResourcesCDN_HOST, SignUrl } from '../../../Common/HostUrl';
import { CURRENT_HOST, NOTICE, ResourcesCDN_HOST, SignUrl } from '../../../Common/HostUrl';
import { KeyBoard } from '../../../Common/KeyEnum';
import { IResponseData, PostJson, RequestStatus } from '../../../Common/Request';
import { Sleep } from '../../../Common/Sleep';
import { StoreageKeys } from "../../../Common/StoreageKeys";
import { FileServer } from '../../../DatabaseServices/FileServer';
import { userConfig } from '../../../Editor/UserConfig';
import { NoticeToaster } from '../../../Notice/Notice';
import { NoticeBody } from '../../../Notice/NoticeBody';
import { TopPanelStore } from '../../Store/TopPanelStore';
import { userConfigStore } from '../../Store/UserConfigStore';
import { ChatButton } from '../ChatButton';
@ -18,6 +20,7 @@ import { AppConfirm } from '../Common/Confirm';
import GalleryStore from '../Gallery/GalleryStore';
import { AppToaster } from '../Toaster';
interface ILoginState
{
user_name: string;
@ -169,6 +172,23 @@ export default class Login extends React.Component<{ store?: TopPanelStore; }, I
});
}
this.isLoginIng = false;
// 通知
let info = null;
let NoticeData = await PostJson(NOTICE, info);
if (NoticeData.err_code === RequestStatus.Ok)
{
info = NoticeData.data;
if (info.length)
{
NoticeToaster.show({
timeout: 0,
message:
<NoticeBody
data={info}
/>,
});
}
}
};
render()

@ -54,7 +54,7 @@ export class MainContent extends React.Component<{ store?: TopPanelStore; }>
else GalleryStore.GetInstance().isAdmin = 0;
//关闭文件显示界面,直接开始画图
const StartEditor = () =>
const StartEditor = async () =>
{
this.props.store.openMain = false;
this.props.store.editoring = true;

@ -1104,6 +1104,77 @@ img {
//-----文件编辑记录结束--------
//-------通知样式开始----------
.bp3-toast {
max-width: 700px;
max-height: 350px;
overflow: hidden;
#Notice {
min-height: 200px;
max-height: 640px;
width: 650px;
.bp3-button-group.bp3-minimal {
float: left;
}
.bp3-running-text table th,
table.bp3-html-table th,
.bp3-running-text table td,
table.bp3-html-table td {
vertical-align: middle;
padding: 10px;
height: 30px;
position: relative;
}
.bp3-tab-list {
height: 350px;
overflow: scroll;
}
.bp3-tabs {
width: 650px;
height: 250px;
position: relative;
.Markdown a {
color: #106ba3;
text-decoration: none;
}
.bp3-tab-panel {
height: 300px !important;
overflow: scroll;
width: 100%;
padding-left: 0px !important;
}
.bp3-tab {
width: 100px;
}
}
.swiper-container-pointer-events {
height: 300px;
}
.NoticeImg {
max-width: 100%;
min-width: 0;
img {
width: auto;
height: auto;
}
}
}
}
//-------通知样式结束----------
#TemplateList {
.imglist {
width: 136px;
@ -1527,51 +1598,52 @@ img {
}
}
#GoodsListDiv{
#GoodsListDiv {
.search-shop {
position : absolute;
z-index : 35;
padding : 10px;
position: absolute;
z-index: 35;
padding: 10px;
font-size: 16px;
min-width: 1100px;
outline : 1px solid #ccc;
outline: 1px solid #ccc;
input {
width: 100%;
}
th{
padding : auto;
text-align : center;
min-width : 55px;
th {
padding: auto;
text-align: center;
min-width: 55px;
vertical-align: middle;
.th_goods_thick{
.th_goods_thick {
display: flex;
align-items: center;
width : 44px;
width: 44px;
margin: auto;
}
}
.bp3-html-table.bp3-html-table-condensed td {
padding-top : 1.5px;
padding-top: 1.5px;
padding-bottom: 1.5px;
padding-right : 1.5px;
padding-right: 1.5px;
}
table {
margin-top: 5px;
width : 100%;
border : 1px #dbdcdd solid;
width: 100%;
border: 1px #dbdcdd solid;
}
.bp3-input-action {
top: 3px !important;
right: 3px;
}
.pagination li {
padding-left: 11px;
}
}
}
}

Loading…
Cancel
Save