123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
-
- // 客户页面
- const mainPages = [
- {
- title: '首页',
- page: 'pages/index/index',
- isIndex: true,
- },
- {
- title: '搜索',
- page: 'pages/search/search',
- },
- {
- title: '搜索结果',
- page: 'pages/searchResult/searchResult',
- },
- {
- title: '商铺详情',
- page: 'pages/details/foodDetails/foodDetails',
- },
- {
- title: '景点详情',
- page: 'pages/details/mjDetails/sceneryDetails',
- },
- {
- title: '笔记详情',
- page: 'pages/details/NoteDetails/index',
-
- },
- {
- title: '订单',
- page: 'pages/PayOrder/index',
- },
- {
- title: '联系我们',
- page: 'pages/MineUserAll/ContactMe/index',
- },
- {
- title: '我的收藏',
- page: 'pages/MineUserAll/Collect/index',
- },
- {
- title: '协议声明',
- page: 'pages/MineUserAll/Rules/index',
- },
- {
- title: '退款申请',
- page: 'pages/MineUserAll/RefundMoney/index',
- },
- {
- title: '确认退款',
- page: 'pages/MineUserAll/RefundMoney/CheckRefund/index',
- },
- {
- title: '我的订单',
- page: 'pages/MineUserAll/AllOrder/index',
- },
- {
- title: '我的行程',
- page: 'pages/MineUserAll/MyTravel/index',
- },
- {
- title: '套餐核销',
- page: 'pages/TobeShop/index',
- },
- {
- title: '入住指引跳转表单',
- page: 'pages/RoomOrder/index'
- }
- ];
-
- // 商户管理页面shop/pages/spread/spreadIndex
- const shopPages = [
- {
- title: '商铺管理',
- page: 'pages/spread/spreadIndex',
- isIndex: true,
- },
- ];
-
- // 民宿管理页面hotel/pages/landlord/landlord
- const hotelPages = [
- {
- title: '民宿管理',
- page: 'pages/landlord/landlord',
- isIndex: true,
- },
- {
- title: '新增房源',
- page: 'pages/landlord/addRoom/addRoom',
- },
- {
- title: '查看入住人',
- page: 'pages/landlord/roomOrder/roomOrder',
- },
- ];
-
- // 所有的页面
- const routes = mainPages.concat(shopPages.map(x => ({ ...x, root: 'shop' })))
- .concat(hotelPages.map(x => ({ ...x, root: 'hotel' })))
-
- // 主包
- const pages = mainPages.map(x => x.page);
-
- // 分包
- const subPages = routes.reduce((acc, route) => {
- if (!route.root) return acc;
-
- const pgs = acc[route.root] || []
-
- return {
- ...acc,
- [route.root]: pgs.concat(route.page)
- }
- }, {})
-
- const subPackages = Object.keys(subPages).map((key) => {
- return {
- root: key,
- pages: subPages[key]
- }
- })
-
- // 获取路径对应页面
- function getPageBy(path) {
- return routes.filter(x => path.indexOf(x.page) > -1)[0]
- }
-
- // 获取角色首页
- function getIndexPageOf(role) {
- if (role === 'person') {
- return routes.filter(x => !x.root && x.isIndex)[0]
- }
-
- return routes.filter(x => x.root === role && x.isIndex)[0]
- }
-
- // eslint-disable-next-line import/no-commonjs
- module.exports = {
- routes,
- pages,
- subPackages,
- getPageBy,
- getIndexPageOf
- }
|