!233 优化登陆界面和用户界面

Merge pull request !233 from ZoeLeeFZ/optMainContent1
pull/233/MERGE
ChenX 6 years ago
parent 2d67f1786b
commit 806fe98887

@ -1,21 +1,22 @@
import { TopPanelStore } from "../UI/Store/TopPanelStore"; import { TopPanelStore } from "../UI/Store/TopPanelStore";
import { AppToaster } from "../UI/Components/Toaster"; import { AppToaster } from "../UI/Components/Toaster";
export const CURRENT_HOST = "http://www.ihome6.com";
export const SignUrl = { export const SignUrl = {
login: "http://www.ihome6.com/CAD-login", login: CURRENT_HOST + "/CAD-login",
loginOut: "http://www.ihome6.com/CAD-loginOut", loginOut: CURRENT_HOST + "/CAD-loginOut",
heart: "http://www.ihome6.com/CAD-heart", heart: CURRENT_HOST + "/CAD-heart",
} }
export const ImgsUrl = { export const ImgsUrl = {
get: "http://www.ihome6.com/CAD-imageList", get: CURRENT_HOST + "/CAD-imageList",
upload: "http://www.ihome6.com/CAD-imageUpload", upload: CURRENT_HOST + "/CAD-imageUpload",
delete: "http://www.ihome6.com/CAD-imageDelete", delete: CURRENT_HOST + "/CAD-imageDelete",
} }
export const DirUrl = { export const DirUrl = {
query: "http://www.ihome6.com/CAD-dirQuery", query: CURRENT_HOST + "/CAD-dirQuery",
create: "http://www.ihome6.com/CAD-dirCreate", create: CURRENT_HOST + "/CAD-dirCreate",
delete: "http://www.ihome6.com/CAD-dirDelete", delete: CURRENT_HOST + "/CAD-dirDelete",
update: "http://www.ihome6.com/CAD-dirUpdate", update: CURRENT_HOST + "/CAD-dirUpdate",
} }
export enum RequestStatus export enum RequestStatus

@ -0,0 +1,110 @@
import * as React from 'react';
import { observer, inject } from 'mobx-react';
import { observable } from 'mobx';
import { Classes } from '@blueprintjs/core';
import { TopPanelStore } from '../Store/TopPanelStore';
export interface CarouselProps
{
store?: TopPanelStore;
}
let banner = "http://t.qcad.cc/opzMainContent/fonts/2a81609f35de4df518a027bdf603d5f0.png";
/**
*
*/
@inject('store')
@observer
export class Carousel extends React.Component<CarouselProps, any> {
timeId = null;
@observable position = [0, 100, 200];
handleStart = () =>
{
this.handleClose();
this.timeId = setInterval(() =>
{
let newPos = this.position.map(n =>
{
n -= 100;
if (n < -100)
n = 100;
return n;
})
observable(this.position).replace(newPos);
}, 3000);
}
handleClose = () =>
{
clearInterval(this.timeId);
}
handleClick = (i: number) =>
{
let currentPos = this.position[i];
let newPos = this.position.map(n =>
{
n -= currentPos;
if (n < -100)
n = 100;
return n;
})
observable(this.position).replace(newPos);
}
componentWillUnmount()
{
this.handleClose();
}
componentDidMount()
{
//先不打开轮播,有数据在继续
// this.handleStart();
}
public render()
{
return (
<div className="carousel">
<div>
<div
style={{
left: this.position[0] + "%",
transition: this.position[0] === 100 && "none"
}}
onMouseEnter={this.handleClose}
onMouseLeave={this.handleStart}
>
<img src={banner} alt="" />
</div>
<div
style={{
left: this.position[1] + "%",
transition: this.position[1] === 100 && "none"
}}
onMouseEnter={this.handleClose}
onMouseLeave={this.handleStart}
><img src={banner} alt="" /></div>
<div style={{
left: this.position[2] + "%",
transition: this.position[2] === 100 && "none"
}}
onMouseEnter={this.handleClose}
onMouseLeave={this.handleStart}
><img src={banner} alt="" /></div>
</div>
<ul className={Classes.LIST_UNSTYLED}>
<li
className={this.position[0] === 0 && "active"}
onClick={() => this.handleClick(0)}
></li>
<li
className={this.position[1] === 0 && "active"}
onClick={() => this.handleClick(1)}
></li>
<li
className={this.position[2] === 0 && "active"}
onClick={() => this.handleClick(2)}
></li>
</ul>
</div>
);
}
}

@ -1,10 +1,10 @@
import { Alignment, Button, Card, H5, Intent, Navbar } from '@blueprintjs/core'; import { Button, Classes, H2, H3, H5, Intent, Icon } from '@blueprintjs/core';
import { observable } from 'mobx'; import { observable } from 'mobx';
import { inject, observer } from 'mobx-react'; import { inject, observer } from 'mobx-react';
import * as React from 'react'; import * as React from 'react';
import { request, SignUrl, RequestStatus } from '../../../Common/Request'; import { FileServer } from '../../../DatabaseServices/FileServer';
import { FileInfo, FileServer } from '../../../DatabaseServices/FileServer';
import { TopPanelStore } from '../../Store/TopPanelStore'; import { TopPanelStore } from '../../Store/TopPanelStore';
import { Carousel } from '../Carousel';
import './MainContent.less'; import './MainContent.less';
@inject('store') @inject('store')
@ -25,18 +25,6 @@ export class ContentComponent extends React.Component<{ store?: TopPanelStore }>
this.editoring = true; this.editoring = true;
FileServer.GetInstance().OpenFile(fid); FileServer.GetInstance().OpenFile(fid);
} }
handleLoginOut = async () =>
{
let data = await request(SignUrl.loginOut,
{
method: "POST",
});
if (data.err_code === RequestStatus.Ok)
{
this.props.store.isLogin = false;
sessionStorage.removeItem('isLogin');
}
}
async componentDidMount() async componentDidMount()
{ {
await this.props.store.UpdateFileList(); await this.props.store.UpdateFileList();
@ -45,61 +33,91 @@ export class ContentComponent extends React.Component<{ store?: TopPanelStore }>
render() render()
{ {
const store = this.props.store; const store = this.props.store;
let lastFile: FileInfo;
if (store.m_FileList.length > 0)
lastFile = store.m_FileList[0];
return ( return (
<Card <div
className="content" className="content"
> >
<Navbar> <div>
<Navbar.Group align={Alignment.LEFT}> <H2>
<Navbar.Heading></Navbar.Heading> <img src="http://t.qcad.cc/opzMainContent/fonts/03c1577dde7a97651283e2fde81928d2.png" alt="" />
</Navbar.Group>
<Navbar.Group align={Alignment.RIGHT}> </H2>
<Button <p>
text="注销"
intent={Intent.DANGER} </p>
onClick={this.handleLoginOut} <div>
/> <H5>
</Navbar.Group> <Icon icon="updated" />
</Navbar>
<Card> </H5>
<Card> <ul className={Classes.LIST_UNSTYLED}>
<li>
<span></span>
<span>
</span>
</li>
<li><span></span>
<span>
</span>
</li>
<li><span></span><span>3D线</span></li>
<li><span></span><span>
</span></li>
</ul>
</div>
<div>
<H5><Icon icon="help" /> </H5>
<ul className={Classes.LIST_UNSTYLED}>
<li>></li>
<li>></li>
<li>线></li>
</ul>
</div>
<div>
<Button <Button
text="开始绘制" text="开始设计>>"
intent={Intent.SUCCESS} intent={Intent.PRIMARY}
onClick={this.handleAddNewFile} onClick={this.handleAddNewFile}
/> />
</Card> </div>
<Card> </div>
<div style={{ textAlign: "right" }}> <div>
{ {
this.editoring && <Button this.editoring && <Button
text="继续编辑" icon="cross"
minimal
onClick={() => store.openMain = false} onClick={() => store.openMain = false}
/> />
} }
</div> <Carousel />
<H5></H5> <H3></H3>
<div className="grip-list"> <div className="grip-list">
{ {
store.m_FileList.length > 0 && store.m_FileList.slice(0, 4).map(file => <div
<Card onClick={() => this.handleOpenFile(file.fileId)}
onClick={() => this.handleOpenFile(lastFile.fileId)}
> >
<div> <div>
<img src={lastFile.pic} alt="" /> <img src={file.pic} alt="" />
</div> </div>
<div>{lastFile.title}</div> <div>{file.title}</div>
<div>{lastFile.modifyTime}</div> <div>{file.modifyTime}</div>
</Card> </div>)
} }
</div> </div>
</Card> <div>
</Card> <Button
</Card> text="查看更多>>"
intent={Intent.PRIMARY}
onClick={() =>
{
store.openMain = false;
store.m_FileManageOpen = true;
}}
/>
</div>
</div>
</div>
) )
} }
} }

@ -1,8 +1,8 @@
import { Button, Card, InputGroup } from '@blueprintjs/core'; import { Button, InputGroup, Intent } from '@blueprintjs/core';
import { inject } from 'mobx-react'; import { inject } from 'mobx-react';
import * as React from 'react'; import * as React from 'react';
import { KeyBoard } from '../../../Common/KeyEnum'; import { KeyBoard } from '../../../Common/KeyEnum';
import { request, SignUrl, RequestStatus } from '../../../Common/Request'; import { request, RequestStatus, SignUrl } from '../../../Common/Request';
import { TopPanelStore } from '../../Store/TopPanelStore'; import { TopPanelStore } from '../../Store/TopPanelStore';
interface ILoginState interface ILoginState
@ -31,16 +31,16 @@ export default class Login extends React.Component<{ store?: TopPanelStore }, IL
{ {
sessionStorage.setItem('isLogin', data); sessionStorage.setItem('isLogin', data);
this.props.store.isLogin = true; this.props.store.isLogin = true;
this.props.store.openMain = true;
} }
} }
render() render()
{ {
const inputStyle: React.CSSProperties = { const inputStyle: React.CSSProperties = {
width: "60%",
marginBottom: 20 marginBottom: 20
} }
return ( return (
<Card <div
className="login" className="login"
onKeyDown={e => onKeyDown={e =>
{ {
@ -52,10 +52,24 @@ export default class Login extends React.Component<{ store?: TopPanelStore }, IL
}} }}
> >
<div> <div>
<Button
text="查看更多"
intent={Intent.PRIMARY}
/>
</div>
<div>
<h2>
<img src="http://t.qcad.cc/opzMainContent/fonts/03c1577dde7a97651283e2fde81928d2.png" alt="" />
<span>
</span>
<span></span>
</h2>
<div className="login-input">
<InputGroup <InputGroup
style={inputStyle} style={inputStyle}
leftIcon="person" leftIcon="person"
placeholder="用户名" placeholder="请输入您的账号"
value={this.state.user_name} value={this.state.user_name}
onChange={e => this.setState({ user_name: e.target.value })} onChange={e => this.setState({ user_name: e.target.value })}
/> />
@ -63,28 +77,48 @@ export default class Login extends React.Component<{ store?: TopPanelStore }, IL
type="password" type="password"
style={inputStyle} style={inputStyle}
leftIcon="lock" leftIcon="lock"
placeholder="密码" placeholder="请输入您的密码"
value={this.state.pass_word} value={this.state.pass_word}
onChange={e => this.setState({ pass_word: e.target.value })} onChange={e => this.setState({ pass_word: e.target.value })}
/> />
</div> </div>
<div> <div>
<Button <Button
fill
text="登录" text="登录"
className="bp3-intent-success" className="bp3-intent-success"
onClick={this.handleLogin} onClick={this.handleLogin}
/> />
<Button > </div>
<div>
<div className="line"></div>
<span></span>
<div className="line"></div>
</div>
<div>
<a href="http://www.ihome6.cf/user-login-type-qq.html" target="_blank">
<img src='http://t.qcad.cc/opzMainContent/fonts/8c7f7cbfa672ffd0b7230aeb513b32b5.png' alt="" />
</a>
<a href="http://www.ihome6.cf/user-login-type-WeiXin.html" target="_blank">
<img src='http://t.qcad.cc/opzMainContent/fonts/9a823352c6dd540a4efe8f8e4c44f83f.png' alt="" />
</a>
</div>
<div>
<a
style={{
textDecoration: "none",
}}
target="_blank"
href="http://www.ihome6.cf/UserManager-findPsw"></a>
<a <a
style={{ style={{
textDecoration: "none", textDecoration: "none",
color: "#fff"
}} }}
target="_blank" target="_blank"
href="http://www.ihome6.cf/user-regCompany"></a> href="http://www.ihome6.cf/user-regCompany"></a>
</Button> </div>
</div>
</div> </div>
</Card>
); );
} }

@ -1,11 +1,21 @@
@color1:rgb(209, 209, 209);
@color2:rgb(160, 160, 160);
@color3:rgb(47, 124, 255);
#main{ #main{
h2,h3,h5,div{
color: #000;
}
&>div{ &>div{
position: fixed; position: fixed;
top:50px; top:0;
left:0; left:0;
width:100%; width:100%;
height:calc(100% - 50px); height: 100%;
padding: 0; padding: 0;
z-index:20;
background:url("http://t.qcad.cc/opzMainContent/fonts/0586209285aed644b1c66b4128bdee3f.jpg");
background-size: cover;
} }
.login{ .login{
position: absolute; position: absolute;
@ -13,41 +23,258 @@
right: 0; right: 0;
top: 0; top: 0;
bottom: 0; bottom: 0;
width: 60%; width: 997px;
height: 60%; height: 482px;
margin: auto; margin: auto;
padding: 100px; padding: 0;
box-shadow: none; box-shadow: none;
display: flex;
&>div:first-child{
width: 552px;
background: url("http://t.qcad.cc/opzMainContent/fonts/63c8e06d6ef9002ea9037d828dd38fec.png");
background-size:100% 100%;
background-repeat: no-repeat;
opacity: 0.9;
position: relative;
border-radius: 20px 0 0 20px;
button{
position: absolute;
right: 10%;
bottom: 8%;
background: linear-gradient(to right, rgb(102, 142, 180), rgb(65, 112, 180));
box-shadow: none;
width: 100px;
border-radius: 16px;
}
}
&>div:last-child{ &>div:last-child{
padding: 20px;
background: #fff;
width: 445px;
border-radius: 0 20px 20px 0;
h2{
text-align: center; text-align: center;
&>button{ font-size: 22px;
font-weight: 520;
color: #000;
height: 60px;
line-height: 60px;
img{
width: 60px;
height: auto;
vertical-align: middle;
margin-right: 10px; margin-right: 10px;
} }
span:last-child{
color:@color3;
} }
} }
.content{
.login-input{
padding: 0 40px;
.bp3-icon,{
top: 5px;
svg{
color: @color3;
}
}
.bp3-input-action{
top: 10px;
svg{
color: @color3;
}
}
input{
background: #fff;
color: #000;
line-height: 40px;
height: 40px;
}
}
&>div:nth-child(3){
padding: 0 40px;
button{
height: 40px;
background: linear-gradient(to right, rgb(110, 177, 255), rgb(11, 97, 255));
}
}
&>div:nth-child(4){
padding: 0 40px;
margin-top: 20px;
display: flex;
color: @color1;
align-items: center;
.line{
width: 30%;
height: 0;
border: 1px solid @color1;
}
}
&>div:nth-child(5){
margin-top: 20px;
text-align: center;
a{
display: inline-block;
width: 50px;
height: 50px;
margin-right: 20px;
img{
width: 100%;
height: 100%; height: 100%;
box-shadow: none; }
padding: 0; }
}
&>div:last-child{ &>div:last-child{
height: calc(~"100% - 50px"); padding: 0 40px;
padding: 0; margin-top: 20px;
a{
font-size: 14px;
color: @color2;
}
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
}
}
}
.content{
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
width: 1218px;
height: 589px;
margin: auto;
padding: 0;
box-shadow: none;
display: flex;
border-radius: 20px;
&>div:first-child{ &>div:first-child{
flex: 0 1 15%; width: 30%;
background: linear-gradient(to top, rgb(155, 185, 236), rgb(221, 235, 252));
border-radius: 10px 0 0 10px;
padding: 30px;
position: relative;
font-family: Source Han Sans CN,Arial, Helvetica, sans-serif;
h2{
text-align: center;
font-size: 31px;
font-weight: 600;
img{
width: 60px;
height: auto;
vertical-align: middle;
margin-right: 4px;
}
}
p{
font-size: 16px;
font-weight: 550;
text-align: center;
color: #000;
letter-spacing: 3px;
}
&>div{
margin-top: 30px;
}
&>div>div{
padding-left: 20px;
}
h5{
font-size: 16px;
.bp3-icon{
margin-right: 10px;
svg{
color: rgb(93, 164, 255);
}
}
}
ul{
padding-left: 20px;
li{
line-height: 25px;
display: flex;
font-size: 15px;
}
} }
&>div:last-child{ &>div:last-child{
flex: 0 1 85%; width: 80%;
text-align: center;
position: absolute;
bottom: 5%;
button{
width: 115px;
border-radius: 15px;
background: linear-gradient(to right,rgb(100, 169, 255),rgb(24, 107, 255));
}
} }
} }
&>div:last-child{
border-radius: 0 10px 10px 0;
width: 70%;
background: #fff;
padding: 30px;
position: relative;
&>button:first-child{
position: absolute;
right: 0;
top: 0;
}
.carousel{
width: 620px;
height: 200px;
margin: 30px auto;
position: relative;
overflow: hidden;
&>div>div{
position: absolute;
top: 0;
width: 100%;
height: 100%;
transition: all 0.5s;
cursor: pointer;
}
&>ul{
display: flex;
height: 10px;
position: absolute;
bottom: 10px;
width: 100%;
justify-content: center;
li{
width: 40px;
background: #fff;
margin-right: 10px;
cursor: pointer;
}
li.active{
background: @color3;
}
}
}
h3{
margin-top: 30px;
}
.grip-list{ .grip-list{
list-style: none;
display: flex; display: flex;
flex-wrap: wrap;
&>div{ &>div{
width: 20%;
cursor: pointer; cursor: pointer;
width: 20%;
margin-right: 5%;
}
}
&>div:last-child{
width: 90%;
text-align: center;
position: absolute;
bottom: 30px;
button{
width: 115px;
border-radius: 15px;
background: linear-gradient(to right,rgb(100, 169, 255),rgb(24, 107, 255));
}
} }
} }
} }

@ -15,18 +15,17 @@ export class MainContent extends React.Component<{ store?: TopPanelStore }>
render() render()
{ {
return ( return (
<Card <>
style={{ {
display: !this.props.store.isLogin || this.props.store.openMain (!this.props.store.isLogin || this.props.store.openMain) && <Card>
? "block" : "none",
zIndex: parseInt(ZINDEX.MainContent),
}}>
{ {
this.props.store.isLogin ? this.props.store.isLogin ?
<ContentComponent /> <ContentComponent />
: <Login /> : <Login />
} }
</Card> </Card>
}
</>
) )
} }
} }

@ -1,4 +1,4 @@
import { Alignment, Button, Classes, HTMLSelect, InputGroup, Navbar, Switch, Popover, Position } from '@blueprintjs/core'; import { Alignment, Button, Classes, HTMLSelect, InputGroup, Navbar, Switch, Popover, Position, Intent } from '@blueprintjs/core';
import { inject, observer } from 'mobx-react'; import { inject, observer } from 'mobx-react';
import * as React from 'react'; import * as React from 'react';
import { DownPanelStore } from '../Store/DownPanelStore'; import { DownPanelStore } from '../Store/DownPanelStore';
@ -8,6 +8,7 @@ import SoucePanel from './SourceManage/SoucePanel';
import { SnapMenuFixed } from '../../Editor/SnapMenuFixed'; import { SnapMenuFixed } from '../../Editor/SnapMenuFixed';
import { app } from '../../ApplicationServices/Application'; import { app } from '../../ApplicationServices/Application';
import { CommandState } from '../../Editor/CommandState'; import { CommandState } from '../../Editor/CommandState';
import { request, SignUrl, RequestStatus } from '../../Common/Request';
interface TopPanelState interface TopPanelState
{ {
@ -59,6 +60,18 @@ export class TopPanel extends React.Component<{ store?: TopPanelStore }, {}>
document.body.className = Classes.DARK + " dark-golden"; document.body.className = Classes.DARK + " dark-golden";
} }
} }
handleLoginOut = async () =>
{
let data = await request(SignUrl.loginOut,
{
method: "POST",
});
if (data.err_code === RequestStatus.Ok)
{
this.props.store.isLogin = false;
sessionStorage.removeItem('isLogin');
}
}
render() render()
{ {
return ( return (
@ -109,7 +122,7 @@ export class TopPanel extends React.Component<{ store?: TopPanelStore }, {}>
<Button icon="annotation" /> <Button icon="annotation" />
<span className="bp3-navbar-divider hidden" /> <span className="bp3-navbar-divider hidden" />
<Button icon="user" /> <Button icon="user" />
<Button icon="notifications" /> <Button text="注销" onClick={this.handleLoginOut} />
<Button icon="cog" onClick={() => this.handleClick('setting')} /> <Button icon="cog" onClick={() => this.handleClick('setting')} />
</div> </div>
); );

@ -1,5 +1,6 @@
import * as React from 'react'; import * as React from 'react';
import { Classes, Checkbox, Popover, Card, Button, Intent } from '@blueprintjs/core'; import { Classes, Checkbox, Popover, Card, Button, Intent } from '@blueprintjs/core';
import { CURRENT_HOST } from '../../../Common/Request';
export interface IImgListProps export interface IImgListProps
{ {
@ -31,7 +32,7 @@ export class ImgList extends React.Component<IImgListProps, any> {
className={Classes.CARD} className={Classes.CARD}
key={pic.image_id} key={pic.image_id}
> >
<img src={`http://www.ihome6.cf/${pic.thumbs ? pic.thumbs['100'].path : pic.path}`} alt="" /> <img src={`${CURRENT_HOST}/${pic.thumbs ? pic.thumbs['100'].path : pic.path}`} alt="" />
<p title={pic.name}>{pic.name}</p> <p title={pic.name}>{pic.name}</p>
<Checkbox <Checkbox
className={pic.isChecked && "selected"} className={pic.isChecked && "selected"}

@ -1,4 +1,4 @@
import { observable } from "mobx"; import { observable, autorun } from "mobx";
import { end } from "../../../node_modules/xaop"; import { end } from "../../../node_modules/xaop";
import { arrayRemoveIf } from "../../Common/ArrayExt"; import { arrayRemoveIf } from "../../Common/ArrayExt";
import { Singleton } from "../../Common/Singleton"; import { Singleton } from "../../Common/Singleton";
@ -15,6 +15,15 @@ export class TopPanelStore extends Singleton
{ {
super(); super();
this.isLogin = Boolean(sessionStorage.getItem('isLogin')); this.isLogin = Boolean(sessionStorage.getItem('isLogin'));
autorun(() =>
{
//有前面层视图的时候隐藏绘图区域
[document.getElementById("app"), document.getElementById("TopPanel"), document.getElementById("DownPanel")]
.forEach(el =>
el.style.display = this.isLogin && !this.openMain ? "block" : "none"
)
})
} }
async UpdateFileList() async UpdateFileList()

Loading…
Cancel
Save