mirror of
https://github.com/YMFE/yapi.git
synced 2025-03-01 14:05:44 +08:00
opti: 首页添加动画,修改header
This commit is contained in:
parent
97a67b9b39
commit
50aa0d1bec
@ -5,6 +5,7 @@ import { Route, HashRouter } from 'react-router-dom'
|
|||||||
import { Home, ProjectGroups, Interface, News, AddInterface } from './containers/index'
|
import { Home, ProjectGroups, Interface, News, AddInterface } from './containers/index'
|
||||||
import User from './containers/User/User.js'
|
import User from './containers/User/User.js'
|
||||||
import Header from './components/Header/Header'
|
import Header from './components/Header/Header'
|
||||||
|
import Loading from './components/Loading/Loading'
|
||||||
import { checkLoginState } from './actions/login'
|
import { checkLoginState } from './actions/login'
|
||||||
import { requireAuthentication } from './components/AuthenticatedComponent';
|
import { requireAuthentication } from './components/AuthenticatedComponent';
|
||||||
|
|
||||||
@ -38,7 +39,7 @@ export default class App extends Component {
|
|||||||
route = (status) => {
|
route = (status) => {
|
||||||
let r;
|
let r;
|
||||||
if (status === LOADING_STATUS) {
|
if (status === LOADING_STATUS) {
|
||||||
return <span>loading...</span>
|
return <Loading visible/>
|
||||||
} else {
|
} else {
|
||||||
r = (
|
r = (
|
||||||
<HashRouter>
|
<HashRouter>
|
||||||
|
@ -129,7 +129,7 @@ class HeaderCom extends Component {
|
|||||||
<Header>
|
<Header>
|
||||||
<div className="content">
|
<div className="content">
|
||||||
<div className="logo">
|
<div className="logo">
|
||||||
YAPI
|
<Link to="/" onClick={this.relieveLink}>YAPI</Link>
|
||||||
</div>
|
</div>
|
||||||
<Menu
|
<Menu
|
||||||
mode="horizontal"
|
mode="horizontal"
|
||||||
@ -139,17 +139,8 @@ class HeaderCom extends Component {
|
|||||||
onClick={this.linkTo}
|
onClick={this.linkTo}
|
||||||
selectedKeys={[curKey]}
|
selectedKeys={[curKey]}
|
||||||
>
|
>
|
||||||
<Menu.Item key="/">
|
|
||||||
<Link to="/">首页</Link>
|
|
||||||
</Menu.Item>
|
|
||||||
<Menu.Item key="/ProjectGroups">
|
<Menu.Item key="/ProjectGroups">
|
||||||
<Link to="/ProjectGroups">分组</Link>
|
<Link to="/ProjectGroups">项目广场</Link>
|
||||||
</Menu.Item>
|
|
||||||
<Menu.Item key="/Interface">
|
|
||||||
<Link to="/Interface">接口</Link>
|
|
||||||
</Menu.Item>
|
|
||||||
<Menu.Item key="/doc">
|
|
||||||
<a>文档</a>
|
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
</Menu>
|
</Menu>
|
||||||
<div className="user-toolbar">
|
<div className="user-toolbar">
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import { Row, Col, Icon } from 'antd'
|
import { Col, Icon } from 'antd'
|
||||||
import "./Intro.scss"
|
import "./Intro.scss"
|
||||||
|
import { OverPack } from 'rc-scroll-anim'
|
||||||
|
import TweenOne from 'rc-tween-one'
|
||||||
|
import QueueAnim from 'rc-queue-anim';
|
||||||
|
|
||||||
const IntroPart = (props) =>(
|
const IntroPart = (props) =>(
|
||||||
<Col span={12} className="switch-content">
|
<Col span={12} className="switch-content">
|
||||||
@ -33,22 +36,42 @@ class Intro extends React.Component{
|
|||||||
title:PropTypes.string,
|
title:PropTypes.string,
|
||||||
des:PropTypes.string
|
des:PropTypes.string
|
||||||
}))
|
}))
|
||||||
})
|
}),
|
||||||
|
className : PropTypes.string
|
||||||
}
|
}
|
||||||
render(){
|
render(){
|
||||||
const { intro } = this.props;
|
const { intro } = this.props;
|
||||||
|
const id = "motion";
|
||||||
|
const animType = {
|
||||||
|
queue: 'right',
|
||||||
|
one: { x: '-=30', opacity: 0, type: 'from' }
|
||||||
|
};
|
||||||
return(
|
return(
|
||||||
<div className="intro-container">
|
<div className="intro-container">
|
||||||
<Row>
|
<OverPack
|
||||||
<Col span={12}>
|
playScale="0.3"
|
||||||
<div>
|
>
|
||||||
<div className="img-container">
|
<TweenOne
|
||||||
<img src={intro.img}/>
|
animation={animType.one}
|
||||||
</div>
|
key={`${id}-img`}
|
||||||
|
resetStyleBool
|
||||||
|
id={`${id}-imgWrapper`}
|
||||||
|
className="imgWrapper"
|
||||||
|
>
|
||||||
|
<div className="img-container" id={`${id}-img-container`}>
|
||||||
|
<img src={intro.img}/>
|
||||||
</div>
|
</div>
|
||||||
</Col>
|
</TweenOne>
|
||||||
<Col span={12} className="des-container">
|
|
||||||
<div>
|
<QueueAnim
|
||||||
|
type={animType.queue}
|
||||||
|
key={`${id}-text`}
|
||||||
|
leaveReverse
|
||||||
|
ease={['easeOutCubic', 'easeInCubic']}
|
||||||
|
id={`${id}-textWrapper`}
|
||||||
|
className={`${id}-text des-container textWrapper`}
|
||||||
|
>
|
||||||
|
<div key={`${id}-des-content`}>
|
||||||
<div className="des-title">
|
<div className="des-title">
|
||||||
{intro.title}
|
{intro.title}
|
||||||
</div>
|
</div>
|
||||||
@ -56,13 +79,13 @@ class Intro extends React.Component{
|
|||||||
{intro.des}
|
{intro.des}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="des-switch">
|
<div className="des-switch" key={`${id}-des-switch`}>
|
||||||
{intro.detail.map(function(item,i){
|
{intro.detail.map(function(item,i){
|
||||||
return(<IntroPart key={i} title={item.title} des={item.des}/>)
|
return(<IntroPart key={i} title={item.title} des={item.des}/>)
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
</Col>
|
</QueueAnim>
|
||||||
</Row>
|
</OverPack>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,22 @@ $color-blue : #108ee9;
|
|||||||
$color-white: #fff;
|
$color-white: #fff;
|
||||||
|
|
||||||
.intro-container{
|
.intro-container{
|
||||||
|
.imgWrapper{
|
||||||
|
height: 100%;
|
||||||
|
width: 50%;
|
||||||
|
overflow: hidden;
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
.textWrapper{
|
||||||
|
display: block;
|
||||||
|
width: 50%;
|
||||||
|
height: 150px;
|
||||||
|
vertical-align: top;
|
||||||
|
position: absolute;
|
||||||
|
margin: auto;
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
.des-container{
|
.des-container{
|
||||||
padding-left: .15rem;
|
padding-left: .15rem;
|
||||||
.des-title{
|
.des-title{
|
||||||
|
@ -2,13 +2,17 @@ import './Home.scss'
|
|||||||
import React, { Component } from 'react'
|
import React, { Component } from 'react'
|
||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import { Link } from 'react-router-dom'
|
import { Link } from 'react-router-dom'
|
||||||
import { Row, Col, Button } from 'antd'
|
import { Row, Col, Button, Icon } from 'antd'
|
||||||
import PropTypes from "prop-types"
|
import PropTypes from "prop-types"
|
||||||
import Login from '../Login/LoginWrap'
|
import Login from '../Login/LoginWrap'
|
||||||
import Intro from '../../components/Intro/Intro'
|
import Intro from '../../components/Intro/Intro'
|
||||||
import Footer from "../../components/Footer/Footer";
|
|
||||||
import { changeMenuItem } from '../../actions/menu'
|
import { changeMenuItem } from '../../actions/menu'
|
||||||
|
import { OverPack } from 'rc-scroll-anim'
|
||||||
|
import TweenOne from 'rc-tween-one'
|
||||||
|
|
||||||
|
|
||||||
|
const oneAnim = { y: '+=30', opacity: 0, type: 'from', ease: 'easeOutQuad' };
|
||||||
|
const queueAnim = { y: '+=30', opacity: 0, type: 'from', ease: 'easeOutQuad','delay':200 };
|
||||||
const HomeGuest = (props) => (
|
const HomeGuest = (props) => (
|
||||||
<div>
|
<div>
|
||||||
<div className="main-one">
|
<div className="main-one">
|
||||||
@ -17,7 +21,7 @@ const HomeGuest = (props) => (
|
|||||||
<Col span={24}>
|
<Col span={24}>
|
||||||
<div className="home-des">
|
<div className="home-des">
|
||||||
<p className="title">YAPI</p>
|
<p className="title">YAPI</p>
|
||||||
<div className="detail">一个高效,易用,功能强大的api管理系统</div>
|
<div className="detail">一个高效,易用,可部署的Api管理系统</div>
|
||||||
</div>
|
</div>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
@ -33,9 +37,55 @@ const HomeGuest = (props) => (
|
|||||||
</Row>
|
</Row>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="feat-part">
|
||||||
|
<div className="container">
|
||||||
|
<OverPack
|
||||||
|
playScale="0.3"
|
||||||
|
>
|
||||||
|
<TweenOne
|
||||||
|
key="h3"
|
||||||
|
animation={oneAnim}
|
||||||
|
component="h3"
|
||||||
|
>
|
||||||
|
<span>特性</span>
|
||||||
|
</TweenOne>
|
||||||
|
<TweenOne
|
||||||
|
animation={queueAnim}
|
||||||
|
reverseDelay={200}
|
||||||
|
>
|
||||||
|
<Row>
|
||||||
|
<Col span={8} className="feat-wrapper">
|
||||||
|
<div className="feat-img">
|
||||||
|
<Icon type="api" />
|
||||||
|
</div>
|
||||||
|
<p className="feat-title">
|
||||||
|
接口管理
|
||||||
|
</p>
|
||||||
|
</Col>
|
||||||
|
<Col span={8} className="feat-wrapper">
|
||||||
|
<div className="feat-img">
|
||||||
|
<Icon type="link" />
|
||||||
|
</div>
|
||||||
|
<p className="feat-title">
|
||||||
|
支持Mock
|
||||||
|
</p>
|
||||||
|
</Col>
|
||||||
|
<Col span={8} className="feat-wrapper">
|
||||||
|
<div className="feat-img">
|
||||||
|
<Icon type="team" />
|
||||||
|
</div>
|
||||||
|
<p className="feat-title">
|
||||||
|
团队协作
|
||||||
|
</p>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</TweenOne>
|
||||||
|
</OverPack>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{ props.introList.map(function(intro,i){
|
{ props.introList.map(function(intro,i){
|
||||||
return (
|
return (
|
||||||
<div className="main-part" key={i}>
|
<div className="main-part" key={i} id={`main-part-${i}`}>
|
||||||
<div className="container">
|
<div className="container">
|
||||||
<Intro intro={intro}/>
|
<Intro intro={intro}/>
|
||||||
</div>
|
</div>
|
||||||
@ -88,7 +138,6 @@ class Home extends Component {
|
|||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
: <HomeGuest introList={this.props.introList}/>}
|
: <HomeGuest introList={this.props.introList}/>}
|
||||||
<Footer/>
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -2,18 +2,20 @@
|
|||||||
|
|
||||||
$color-white : #fff;
|
$color-white : #fff;
|
||||||
$color-blue-lighter : #f1f5ff;
|
$color-blue-lighter : #f1f5ff;
|
||||||
|
$color-blue-grey-lighter : #f7fafc;
|
||||||
$color-grey-lighter : #F7F7F7;
|
$color-grey-lighter : #F7F7F7;
|
||||||
$color-blue-light: #5dade2;
|
$color-blue-light: #5dade2;
|
||||||
$color-black-lighter: #404040;
|
$color-black-lighter: #404040;
|
||||||
|
|
||||||
|
|
||||||
.home-main {
|
.home-main {
|
||||||
height:calc(100% - .64rem);
|
min-height:calc(100% - 2.23rem);
|
||||||
display: -webkit-box;
|
display: -webkit-box;
|
||||||
-webkit-box-orient: vertical;
|
-webkit-box-orient: vertical;
|
||||||
background: $color-grey-lighter;
|
background: $color-blue-grey-lighter;
|
||||||
.main-one{
|
.main-one{
|
||||||
padding: .5rem .5rem 0 .5rem;
|
padding: .5rem .5rem 0 .5rem;
|
||||||
|
//height: 7.16rem;
|
||||||
//background: radial-gradient(ellipse at center,#45484d 0%,#000 100%);
|
//background: radial-gradient(ellipse at center,#45484d 0%,#000 100%);
|
||||||
.home-des{
|
.home-des{
|
||||||
padding: 0 .3rem .3rem 0;
|
padding: 0 .3rem .3rem 0;
|
||||||
@ -45,9 +47,9 @@ $color-black-lighter: #404040;
|
|||||||
.user-home{
|
.user-home{
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
height:calc(100% - 2rem);
|
height: 100%;
|
||||||
max-width: 11rem;
|
max-width: 11rem;
|
||||||
margin: 0 auto;
|
margin: 1rem auto 0;
|
||||||
.user-des{
|
.user-des{
|
||||||
max-width: 11rem;
|
max-width: 11rem;
|
||||||
margin: 0 auto .5rem;
|
margin: 0 auto .5rem;
|
||||||
@ -72,6 +74,7 @@ $color-black-lighter: #404040;
|
|||||||
}
|
}
|
||||||
.main-part{
|
.main-part{
|
||||||
padding: .9rem .5rem;
|
padding: .9rem .5rem;
|
||||||
|
height: 5.8rem;
|
||||||
&:nth-child(odd){
|
&:nth-child(odd){
|
||||||
background-color: $color-blue-lighter;
|
background-color: $color-blue-lighter;
|
||||||
}
|
}
|
||||||
@ -79,9 +82,73 @@ $color-black-lighter: #404040;
|
|||||||
background-color: $color-white;
|
background-color: $color-white;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.feat-part{
|
||||||
|
padding: .9rem .5rem;
|
||||||
|
background-color: $color-white;
|
||||||
|
h3{
|
||||||
|
display: flex;
|
||||||
|
height: .3rem;
|
||||||
|
align-items: center;
|
||||||
|
padding: 0 .1rem;
|
||||||
|
margin-bottom: .2rem;
|
||||||
|
color: #333;
|
||||||
|
&:before, &:after{
|
||||||
|
content: "";
|
||||||
|
display: inline-block;
|
||||||
|
height: .02rem;
|
||||||
|
flex: 1;
|
||||||
|
border-top: .01rem solid #e6e6e6;
|
||||||
|
}
|
||||||
|
span{
|
||||||
|
font-size: .24rem;
|
||||||
|
padding: 0 .1rem;
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
.container{
|
.container{
|
||||||
max-width: 11rem;
|
max-width: 11rem;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
|
height:100%;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.feat-wrapper{
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
text-align: center;
|
||||||
|
.feat-img{
|
||||||
|
height: 1.2rem;
|
||||||
|
width: 1.2rem;
|
||||||
|
border-radius: 100%;
|
||||||
|
margin-bottom: .2rem;
|
||||||
|
color: $color-white;
|
||||||
|
i{
|
||||||
|
line-height: 1.2rem;
|
||||||
|
font-size: .6rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.feat-title{
|
||||||
|
font-size: .16rem;
|
||||||
|
line-height: .3rem;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
&:first-child{
|
||||||
|
.feat-img{
|
||||||
|
background-color: rgb(248, 88, 96);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&:nth-child(2){
|
||||||
|
.feat-img{
|
||||||
|
background-color: #f9bb13;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&:nth-child(3){
|
||||||
|
.feat-img{
|
||||||
|
background-color: #20ab8e;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ import {
|
|||||||
} from '../../constants/action-types.js'
|
} from '../../constants/action-types.js'
|
||||||
|
|
||||||
const initialState = {
|
const initialState = {
|
||||||
curKey: window.location.hash.split("#")[1] || '/'
|
curKey: window.location.hash.split("#")[1] || ''
|
||||||
}
|
}
|
||||||
|
|
||||||
export default (state = initialState, action) => {
|
export default (state = initialState, action) => {
|
||||||
|
@ -37,6 +37,8 @@
|
|||||||
"node-sass-china": "^4.5.0",
|
"node-sass-china": "^4.5.0",
|
||||||
"nodemailer": "^4.0.1",
|
"nodemailer": "^4.0.1",
|
||||||
"prop-types": "^15.5.10",
|
"prop-types": "^15.5.10",
|
||||||
|
"rc-queue-anim": "^1.2.0",
|
||||||
|
"rc-scroll-anim": "^1.0.7",
|
||||||
"redux": "^3.7.1",
|
"redux": "^3.7.1",
|
||||||
"redux-promise": "^0.5.3",
|
"redux-promise": "^0.5.3",
|
||||||
"redux-thunk": "^2.2.0",
|
"redux-thunk": "^2.2.0",
|
||||||
|
Loading…
Reference in New Issue
Block a user