Commit 17608af4 by 姜雷

Merge branch 'test' into 'master'

Test See merge request !3
parents b48daa1f ca0df557
import React, { useState } from 'react';
import { Switch, Route } from 'react-router-dom';
import UserInfoContext, { initUserinfo } from '../context/userinfo-context';
import { UserProvider } from '../context/userinfo-context';
import NavBar from '../components/NavBar';
import Index from './Index/Index';
......@@ -11,19 +11,10 @@ import BindEquipment from './BindEquipment';
import NoMatch from './NoMatch';
function App() {
const [userinfo, setUserinfo] = useState(initUserinfo);
const [title, setTitle] = useState('多彩运维');
return (
<div className='App'>
<UserInfoContext.Provider
value={{
userinfo: userinfo,
updateUserInfo: val =>
setUserinfo({
...userinfo,
...val,
}),
}}>
<UserProvider>
<Route render={props => <NavBar {...props} title={title} />} />
<Switch>
<Route
......@@ -49,7 +40,7 @@ function App() {
/>
<Route component={NoMatch} />
</Switch>
</UserInfoContext.Provider>
</UserProvider>
</div>
);
}
......
.BindEquipment {
flex: 1;
background: #ebebeb url('../../images/Login/login_bg@2x.png') no-repeat;
background-size: contain;
background-position-y: -624px;
background-color: #fff;
......
......@@ -105,7 +105,7 @@ class EquipmentTest extends Component {
<i className='linkIcon'>
<img src={testIcon} alt='' />
</i>
<span>测试放水</span>
<span>测试吹风</span>
</div>
</div>
</div>
......
......@@ -48,7 +48,7 @@ export class Index extends React.Component {
<i className='linkIcon'>
<img src={testIcon} alt='' />
</i>
<span>测试放水</span>
<span>测试吹风</span>
</Link>
<Link
className='linkItem'
......
......@@ -21,7 +21,6 @@ export class Index extends React.Component {
}
componentWillMount() {
console.log(this.props);
const { setTitle, updateUserInfo } = this.props;
setTitle('登陆');
const { code } = this.props;
......
......@@ -20,7 +20,7 @@ export class Index extends React.Component {
componentWillMount() {
const { setTitle } = this.props;
setTitle('测试放水');
setTitle('测试吹风');
}
componentDidMount() {
this.createBarcode();
......
import React from 'react';
import React, { createContext, useState } from 'react';
function is_weixn() {
var ua = navigator.userAgent.toLowerCase();
......@@ -21,9 +21,24 @@ export const initUserinfo = {
},
};
export const UserContext = React.createContext({
userinfo: initUserinfo,
updateUserInfo: () => {},
});
export const UserContext = createContext();
export const UserProvider = props => {
const [userinfo, setUserinfo] = useState(initUserinfo);
return (
<UserContext.Provider
value={{
userinfo: userinfo,
updateUserInfo: val =>
setUserinfo({
...userinfo,
...val,
}),
}}>
{props.children}
</UserContext.Provider>
);
};
export default UserContext;
import React from 'react';
import ReactDOM from 'react-dom';
import './styles/index.css';
import App from './containers/App';
import * as serviceWorker from './serviceWorker';
import { BrowserRouter } from 'react-router-dom';
import packageConfig from '../package.json';
import './styles/index.css';
ReactDOM.render(
<BrowserRouter basename={packageConfig.homepage}>
......
......@@ -5,6 +5,7 @@ html {
margin: 0;
padding: 0;
font-family: sans-serif;
font-size: 28px;
}
figure,
p {
......@@ -147,3 +148,6 @@ img {
flex: 1;
line-height: 80px;
}
.am-button {
font-size: 28px;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment