Commit 2f880304 by zhanghaozhe

Merge branch 'master' into search

# Conflicts:
#	src/router.js
parents 39501fcf 39412987
import React from 'react';
import { BrowserRouter as Router, Switch, Route } from 'react-router-dom';
import Index from './components/Index';
import Classify from './components/classify';
import Study from './components/study';
import My from './components/my';
import CourseList from './components/classify/courselist';
import Order from './components/order/index';
import Preferential from './components/preferential/index';
import Search from './components/search/index'
import Detail from './components/detail/index'
import Examination from './components/examination'
import ExchangeCoupons from './components/coupons/exchange-coupons'
import UseCoupon from './components/coupons/use-coupons'
// import OrderInfo from './components/order/orderinfo';
import ShopCard from './components/shopCard/index';
import BargainMiddlePage from './components/bargainMiddlePage';
import Passport from './components/passport'
const router = () => (
<Router>
<Switch>
<Route exact path="/" component={Index}/>
<Route path="/index" component={Index}/>
<Route path='/classify' component={Classify}/>
<Route path='/study' component={Study}/>
<Route path='/my' component={My}/>
<Route path='/courselist' component={CourseList}/>
<Route path='/preferential' component={Preferential}/>
<Route path='/looking' component={Search}/>
<Route path='/order' component={Order}/>
<Route path='/detail' component={Detail}/>
<Route path='/examination' component={Examination}/>
<Route path='/exchange-coupons' component={ExchangeCoupons}/>
<Route path='/use-coupon' component={UseCoupon}/>
{/*<Route path='/orderinfo' component={OrderInfo}></Route>*/}
<Route path='/shopcard' component={ShopCard}/>
<Route path='/bargain-middle-page' component={BargainMiddlePage}/>
<Route path='/passport' component={Passport}/>
</Switch>
</Router>
)
export default router;
\ No newline at end of file
import React from 'react'
import { BrowserRouter as Router, Switch, Route } from 'react-router-dom'
import RouterConfig from './router-config'
export default function () {
return (
<Router>
<Switch>
{RouterConfig.map((item, index) => {
let {CustomRoute, ...rest} = item
if (CustomRoute) {
return <CustomRoute {...rest}/>
} else {
return (
<Route {...rest} key={index}/>
)
}
})}
</Switch>
</Router>
)
}
\ No newline at end of file
import Index from '@/components/Index';
import Classify from '@/components/classify';
import Study from '@/components/study';
import My from '@/components/my';
import CourseList from '@/components/classify/courselist';
import Order from '@/components/order/index';
import Preferential from '@/components/preferential/index';
import Search from '@/components/search/index'
import Detail from '@/components/detail/index'
import Examination from '@/components/examination'
import ExchangeCoupons from '@/components/coupons/exchange-coupons'
import UseCoupon from '@/components/coupons/use-coupons'
import ShopCard from '@/components/shopCard/index';
import BargainMiddlePage from '@/components/bargainMiddlePage';
import Passport from '@/components/passport'
export default [
{
path: '/',
exact: true,
component: Index
},
{
path: '/classify',
component: Classify
},
{
path: '/study',
component: Study
},
{
path: '/my',
component: My
},
{
path: '/courselist',
component: CourseList
},
{
path: '/preferential',
component: Preferential
},
{
path: '/search',
component: Search
},
{
path: '/order',
component: Order
},
{
path: '/detail',
component: Detail
},
{
path: '/examination',
component: Examination
},
{
path: '/exchange-coupons',
component: ExchangeCoupons
},
{
path: '/use-coupon',
component: UseCoupon
},
{
path: '/shopcard',
component: ShopCard
},
{
path: '/bargain-middle-page',
component: BargainMiddlePage
},
{
path: '/passport',
component: Passport
},
]
\ No newline at end of file
......@@ -50,4 +50,11 @@ export const isPhone = ($poneInput) => {
} else {
return false;
}
}
\ No newline at end of file
}
export const getParam = (key, str) => {
const _s = str ? str : location.href;
const re = new RegExp(`(?:\\?|#|&)(${key})=([^=&#\\?]+)`, 'ig');
let found;
return (found = re.exec(_s)) ? found[2] : null;
}
\ No newline at end of file
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