Commit ebce654f by 姜雷

添加部分接口请求

parent e5457ee5
...@@ -6,22 +6,9 @@ ...@@ -6,22 +6,9 @@
<meta name="viewport" content="width=device-width, initial-scale=1,user-scalable=no, viewport-fit=cover, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1,user-scalable=no, viewport-fit=cover, shrink-to-fit=no">
<meta name="theme-color" content="#000000"> <meta name="theme-color" content="#000000">
<script src="//g.alicdn.com/fdilab/lib3rd/viewport-units-buggyfill/0.6.2/??viewport-units-buggyfill.hacks.min.js,viewport-units-buggyfill.min.js"></script> <script src="//g.alicdn.com/fdilab/lib3rd/viewport-units-buggyfill/0.6.2/??viewport-units-buggyfill.hacks.min.js,viewport-units-buggyfill.min.js"></script>
<!--
manifest.json provides metadata used when your web app is added to the
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json"> <link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico"> <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<!-- <title>成都师范后勤管理</title>
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
</head> </head>
<body> <body>
...@@ -29,18 +16,7 @@ ...@@ -29,18 +16,7 @@
You need to enable JavaScript to run this app. You need to enable JavaScript to run this app.
</noscript> </noscript>
<div id="root"> <div id="root">
载入中。。。
</div> </div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
<script> window.onload = function () { window.viewportUnitsBuggyfill.init({ hacks: window.viewportUnitsBuggyfillHacks }); } </script> <script> window.onload = function () { window.viewportUnitsBuggyfill.init({ hacks: window.viewportUnitsBuggyfillHacks }); } </script>
</body> </body>
......
...@@ -2,12 +2,46 @@ import fetch from './fetch'; ...@@ -2,12 +2,46 @@ import fetch from './fetch';
export const fetchPublicCarList = entity => export const fetchPublicCarList = entity =>
fetch({ fetch({
url: '/app/publicCarController/pageList', url: '/publicCar/app/pageList4PublicCar',
params: entity, params: entity,
}); });
export const applyPublicCar = entity => export const applyPublicCar = entity =>
fetch({ fetch({
url: '/app/publicCarController/addPublicCar', url: '/publicCar/app/addPublicCar',
params: entity,
});
export const fetchApplyPublicCarList = entity =>
fetch({
url: '/publicCar/app/pageListAdmin4PublicCar',
params: entity,
});
export const dealPublicCar = entity =>
fetch({
url: '/publicCar/app/deal4PublicCar',
params: entity,
});
export const fetchRepairList = entity =>
fetch({
url: '/repair/app/pageList4Repair',
params: entity,
});
export const reportRepair = entity =>
fetch({
url: '/repair/app/addRepair',
params: entity,
});
export const fetchReportRepairList = entity =>
fetch({
url: '/repair/app/pageListAdmin4Repair',
params: entity,
});
export const dealRepair = entity =>
fetch({
url: '/repair/app/deal4Repair',
params: entity, params: entity,
}); });
import React, { Component } from 'react'; import React, { Component } from 'react';
import '../styles/App.css';
import { is_weixn } from '../utils'; import { is_weixn } from '../utils';
import { APP_ID } from '../config'; import { APP_ID } from '../config';
import UserInfoContext, { defaultUserinfo } from '../context/userinfo-context'; import UserInfoContext, { defaultUserinfo } from '../context/userinfo-context';
import { Route, Switch } from 'react-router-dom'; import { Route, Switch } from 'react-router-dom';
import Home from './Home/Index';
import Report from './report/report'; import Report from './report/report';
import Login from './Login/Login'; import Login from './Login/Login';
import PublicCarList from './PublicCar/PublicCarList'; import PublicCarList from './PublicCar/PublicCarList';
import PublicCarApply from './PublicCar/PublicCarApply'; import PublicCarApply from './PublicCar/PublicCarApply';
import NoMatch from './NoMatch';
class App extends Component { class App extends Component {
constructor(props) { constructor(props) {
...@@ -35,20 +36,40 @@ class App extends Component { ...@@ -35,20 +36,40 @@ class App extends Component {
const { search } = props.location; const { search } = props.location;
const paramsString = search.substring(1); const paramsString = search.substring(1);
const searchParams = new URLSearchParams(paramsString); const searchParams = new URLSearchParams(paramsString);
const openid = searchParams.get('openid'); const code = searchParams.get('code');
// const state = searchParams.get('state'); const state = searchParams.get('state');
console.log(isWx, openid); console.log(isWx, code, state);
if (!isWx) { if (!isWx) {
return <div>请在微信客户端打开链接</div>; return <div>请在微信客户端打开链接</div>;
} else if (!openid) { } else if (!code) {
let rUrl = encodeURIComponent(''); let rUrl = encodeURIComponent('');
window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${APP_ID}&redirect_uri=${rUrl}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`; window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${APP_ID}&redirect_uri=${rUrl}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`;
return <div>授权中。。。</div>; return <div>授权中。。。</div>;
} else { } else {
return <Login {...props} openid={openid} />; return <Login {...props} code={code} />;
} }
}; };
getParams = str => {
let obj = {};
const searchParams = new URLSearchParams(str);
let keys = searchParams.keys();
for (const key of keys) {
obj[key] = searchParams.get(key);
}
return obj;
};
validateUserinfo = props => {
console.log(props);
setTimeout(() => {
const { history, location } = props;
let params = this.getParams(location.search);
// history.push('/login');
console.log('redirect', params, history);
}, 1000);
return <Home />;
};
updateUserInfo = data => { updateUserInfo = data => {
this.setState({ this.setState({
userContext: { userContext: {
...@@ -64,10 +85,12 @@ class App extends Component { ...@@ -64,10 +85,12 @@ class App extends Component {
<div className="App"> <div className="App">
<UserInfoContext.Provider value={userContext}> <UserInfoContext.Provider value={userContext}>
<Switch> <Switch>
<Route exact path="/" render={this.renderLogin} /> <Route exact path="/" render={this.validateUserinfo} />
<Route path="/report" component={Report} /> <Route path="/report" component={Report} />
<Route path="/login" component={Login} />
<Route path="/PublicCarList" component={PublicCarList} /> <Route path="/PublicCarList" component={PublicCarList} />
<Route path="/PublicCarApply" component={PublicCarApply} /> <Route path="/PublicCarApply" component={PublicCarApply} />
<Route component={NoMatch} />
</Switch> </Switch>
</UserInfoContext.Provider> </UserInfoContext.Provider>
</div> </div>
......
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { Link } from 'react-router-dom'; import styles from './style.css';
export class Index extends React.Component { export class Index extends React.Component {
static propTypes = { static propTypes = {
name: PropTypes.string, name: PropTypes.string,
}; };
render() { render() {
return ( return <div className={styles.LoadPage}>加载中。。。</div>;
<div>
Home
<br />
<Link to="/report">report</Link>
<br />
<Link to="/report">report</Link>
<br />
<Link to="/report">report</Link>
</div>
);
} }
} }
......
.LoadPage {
margin: 60px 24px 0;
}
import React from 'react';
class Index extends React.Component {
render() {
return <div>404 NoMatch</div>;
}
}
export default Index;
.App {
text-align: center;
}
.App-logo {
animation: App-logo-spin infinite 20s linear;
height: 80px;
}
.App-header {
background-color: #222;
height: 150px;
padding: 20px;
color: white;
}
.App-title {
font-size: 1.5em;
}
.App-intro {
font-size: large;
}
@keyframes App-logo-spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
.box {
display: flex;
justify-content: center;
}
\ No newline at end of file
...@@ -5,6 +5,7 @@ html { ...@@ -5,6 +5,7 @@ html {
margin: 0; margin: 0;
padding: 0; padding: 0;
font-family: sans-serif; font-family: sans-serif;
overflow: hidden;
} }
figure, figure,
p { p {
...@@ -46,10 +47,10 @@ img { ...@@ -46,10 +47,10 @@ img {
[w-750-190] { [w-750-190] {
aspect-ratio: '750:190'; aspect-ratio: '750:190';
} }
.bb1px { :global(.bb1px) {
position: relative; position: relative;
} }
.bb1px::after { :global(.bb1px::after) {
content: ''; content: '';
display: block; display: block;
position: absolute; position: absolute;
...@@ -62,10 +63,10 @@ img { ...@@ -62,10 +63,10 @@ img {
background: #dcdcdc; background: #dcdcdc;
transform: scaleY(0.5); transform: scaleY(0.5);
} }
.bt1px { :global(.bt1px) {
position: relative; position: relative;
} }
.bt1px::after { :global(.bt1px::after) {
content: ''; content: '';
display: block; display: block;
position: absolute; position: absolute;
...@@ -78,20 +79,20 @@ img { ...@@ -78,20 +79,20 @@ img {
background: #dcdcdc; background: #dcdcdc;
transform: scaleY(0.5); transform: scaleY(0.5);
} }
.ellipsis { :global(.ellipsis) {
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.ellipsis-2lines { :global(.ellipsis-2lines) {
overflow: hidden; overflow: hidden;
-webkit-line-clamp: 2; -webkit-line-clamp: 2;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
display: -webkit-box; display: -webkit-box;
} }
#root, :global(#root),
.App { :global(.App) {
width: 100%; width: 100%;
height: 100%; height: 100%;
position: relative; position: relative;
......
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