提交 9336a7c6 authored 作者: zengBB96's avatar zengBB96

首页,导航栏

上级 f7122329
/* eslint-disable react/destructuring-assignment */
import React from 'react'; import React from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { bindActionCreators } from 'redux'; import { bindActionCreators } from 'redux';
import Route from 'react-router-dom/Route'; import Route from 'react-router-dom/Route';
import Router from 'react-router-dom/Router'; import Router from 'react-router-dom/Router';
import createHistory from 'history/createHashHistory'; import createHistory from 'history/createHashHistory';
import { Tab, TabBarItem, TabBar } from 'react-weui';
const history = createHistory(); const history = createHistory();
// import { BrowserRouter } from 'react-router-dom';
/* /*
全局导入less 全局导入less
*/ */
import './app.less'; import './app.less';
import * as global from 'actions/global'; import * as global from 'actions/global';
import routes from './routes'; import routes from './routes';
@connect( @connect(
...@@ -21,6 +21,11 @@ import routes from './routes'; ...@@ -21,6 +21,11 @@ import routes from './routes';
) )
export default class App extends React.Component { export default class App extends React.Component {
state={
// eslint-disable-next-line react/no-unused-state
tab: 0
}
componentDidMount() { componentDidMount() {
window.addEventListener('hashchange', () => { window.addEventListener('hashchange', () => {
}); });
...@@ -51,24 +56,54 @@ export default class App extends React.Component { ...@@ -51,24 +56,54 @@ export default class App extends React.Component {
component={route.component} component={route.component}
/> />
)); ));
} }
} }
} }
/> />
</Router> </Router>
<Tab type="tabbar">
{/* <Tab>
<TabBody>
<Article style={{ display: this.state.tab === 0 ? null : 'none' }}>
<h1>Page 1</h1>
<section>
<h2 className="title">Heading</h2>
<section>
<h3>1.1 Title</h3>
<p>Lorem ipsum dolor sit amet,</p>
</section>
</section>
</Article>
<Article style={{ display: this.state.tab === 1 ? null : 'none' }}>
<h1>Page 2</h1>
<section>
<h2 className="title">Heading</h2>
<section>
<h3>1.2 Title</h3>
<p>Lorem ipsum dolor sit amet,</p>
</section>
</section>
</Article>
</TabBody>
<TabBar> <TabBar>
<TabBarItem label="会议"> <TabBarItem
{i18n.t('home:meeting')} active={this.state.tab === 0}
</TabBarItem> onClick={e=>this.setState({ tab: 0 })}
<TabBarItem label="预定"> icon={<img src={TabBarlist} alt="" />}
预定 label="Tab1"
</TabBarItem> />
<TabBarItem label="我的"> <TabBarItem active={this.state.tab === 1} onClick={e=>this.setState({ tab: 1 })}>
我的 <TabBarIcon>
</TabBarItem> <img src={TabBarroom} alt="" />
</TabBar> </TabBarIcon>
</Tab> <TabBarLabel>Tab2</TabBarLabel>
</TabBarItem>
</TabBar>
</Tab> */}
</div> </div>
); );
} }
......
import React from 'react';
import './index.less';
import { Tab, TabBarItem, TabBar } from 'react-weui';
import { Link } from 'react-router-dom';
import i18n from 'i18n';
// import { meetingIcon } from '../../../build/apps/20190226111443945/1.0.0/images';
export default class MyTab extends React.Component {
componentWillMount() {
}
componentDidMount() {
}
render() {
return (
<Tab type="tabbar">
<TabBar>
<TabBarItem label="会议">
<Link to="/meeting">{i18n.t('home:meeting')}</Link>
</TabBarItem>
<TabBarItem label="预定">
<Link to="/meeting">预定</Link>
</TabBarItem>
<TabBarItem label="我的">
<Link to="/meeting">我的</Link>
</TabBarItem>
</TabBar>
</Tab>
);
}
};
{
"name": "index",
"version": "1.0.0",
"private": true,
"main": "./index.js"
}
/* eslint-disable react/destructuring-assignment */
/* eslint-disable no-undef */
import React from 'react'; import React from 'react';
import { bindActionCreators } from 'redux'; import { bindActionCreators } from 'redux';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
// import { SearchBar } from 'react-weui';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import i18n from 'i18n';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import * as home from '../../actions/home'; import * as home from '../../actions/home';
import * as global from '../../actions/global'; import * as global from '../../actions/global';
import { Tab, TabBarItem, TabBar } from 'react-weui';
import './index.less'; import './index.less';
import MyTab from '../../components/MyTab';
// import { MyTab } from '../../components/MyTab'; import Footer from '../../components/Footer';
import seach from '../../../public/images/search.png';
import Indeximg from '../../../public/images/index.png';
// import Banner from '../../../public/images/banner.png';
@connect( @connect(
state => ({ ...state.home }), state => ({ ...state.home }),
dispatch => bindActionCreators({ ...home, ...global }, dispatch) dispatch => bindActionCreators({ ...home, ...global }, dispatch)
) )
export default class Home extends React.Component { export default class Home extends React.Component {
async componentWillMount() { async componentWillMount() {
window.HWH5.navTitle({ title: 'Hello World' }); // window.HWH5.navTitle({ title: 'Hello World' });
HWH5.navTitle({ title: 'UBAINS会议' }).catch(error => {
console.log('设置标题异常', error);
});
const { const {
homeInfo, dataList, getHomeInfo, getFetchDemo homeInfo, dataList, getHomeInfo, getFetchDemo
} = this.props; } = this.props;
...@@ -40,13 +47,23 @@ export default class Home extends React.Component { ...@@ -40,13 +47,23 @@ export default class Home extends React.Component {
} }
render() { render() {
return ( return (
<div className="container">
<div className="App"> <div className="banner">
helloworld <div className="seach">
<Link to="/desc">
<img src={seach} alt="" />
<input type="text" placeholder="请输入会议室名称、状态…" disabled="disabled" />
</Link>
</div>
</div>
{/* <Seach>123</Seach> */}
<div className="indeximg">
<img src={Indeximg} alt="" />
</div>
<Footer />
</div> </div>
); );
} }
} }
......
.App { .banner{
padding: 10px; width: 100%;
height: 137px;
.App-logo { background: url(../../../public/images/banner.png) no-repeat;
margin: 20px 0; background-size: cover;
text-align: center; }
} .seach{
width: 60%;
.App-header { height: 40px;
height: 90px; background:rgba(0, 0, 0, .5);
text-align: center; border-radius: 20px;
} text-align: center;
position: relative;
.App-title { top: 28%;
margin-bottom: 30px; left: 18%;
font-size: 1.5em; }
text-align: center; .seach img{
} display: inline-block;
width: 20px;
.App-intro { height: 20px;
margin-bottom: 10px; margin: 10px 12px;
font-size: large; }
} .seach input{
border: none;
.desc-link { background: none;
display: block; color: #fff;
width: 100px; margin: 12px 0;
height: 50px; }
margin: 0 auto; .indeximg img{
margin-top: 30px; width: 100%;
color: #2b88e6; height: auto;
font-size: 14px; margin-bottom: 50px;
text-align: center;
}
.develop-doc {
h3 {
margin-bottom: 5px;
}
ul {
list-style: circle;
padding-left: 30px;
}
li {
margin-bottom: 5px;
color: #2b88e6;
cursor: pointer;
}
}
} }
...@@ -9,6 +9,7 @@ import Meeting from './Meeting'; ...@@ -9,6 +9,7 @@ import Meeting from './Meeting';
// webpackChunkName 可指定模块名称,访问路由按需加载 // webpackChunkName 可指定模块名称,访问路由按需加载
const routes = [ const routes = [
{ path: '/', component: Home, exact: true }, { path: '/', component: Home, exact: true },
{ path: '/home', component: Home, exact: true },
{ path: '/meeting', component: Meeting, exact: true }, { path: '/meeting', component: Meeting, exact: true },
{ path: '/desc', component: AsyncComponent(() => import('./Desc')) } { path: '/desc', component: AsyncComponent(() => import('./Desc')) }
]; ];
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论