routes.js 2.36 KB
const pages = {
  crowdfunding: [
    {
      name: 'index/index',
      meta: {
        keepAlive: true,
        // noAuth: true,
        backgroundColor: '#F7F7F7',
        showAction: true
      }
    },
    {
      name: 'success',
      meta: {
        keepAlive: true,
        backgroundColor: '#FFF',
        noAuth: true,
        title: '参团成功'
      }
    },
    {
      name: 'agreement',
      meta: {
        // keepAlive: true,
        backgroundColor: '#FFF',
        noAuth: true,
        title: '隐私协议'
      }
    },
    {
      name: 'carBrands',
      meta: {
        keepAlive: true,
        backgroundColor: '#FFF',
        title: '品牌'
      }
    },
    {
      name: 'carSeries',
      meta: {
        keepAlive: true,
        backgroundColor: '#F7F8FA',
        title: '选择车系'
      }
    },
    {
      name: 'orderList',
      meta: {
        keepAlive: true,
        backgroundColor: '#FFF',
        title: '订单'
      }
    },
    {
      name: 'evaluate',
      meta: {
        keepAlive: true,
        backgroundColor: '#F7F8FA',
        title: '服务评价',
        showAction: true
      }
    },
    {
      name: 'faq',
      meta: {
        keepAlive: true,
        backgroundColor: '#F7F8FA',
        title: '商品答疑'
      }
    },
    {
      name: 'imagePreview',
      meta: {
        keepAlive: true,
        backgroundColor: '#101010'
      }
    }
  ],
  common:[
    {
      name: 'auth',
      meta: {
        keepAlive: true,
        backgroundColor: '#F7F7F7'
      }
    },
  ],
  testPayMerchant: [
    {
      name: 'index',
      meta: {
        keepAlive: true,
        // noAuth: true,
        backgroundColor: '#F7F7F7',
        showAction: true
      }
    },
  ]
}
let routes = [
  {
    path: '/',
    redirect: '/crowdfunding'
  }
]
const keepAlives = []
Object.keys(pages).map(parent => {
  pages[parent].map(val => {
    let childrenPath = `${parent}/${val.name}`
    let { meta } = val
    const path = `/${val.name == 'index/index' ? parent : childrenPath}`
    const name = val.name == 'index/index' ? parent : childrenPath.replace(/\//g, '.')
    if (meta && meta.keepAlive) keepAlives.push(name)
    let route = {
      component: resolve => require([`views/${childrenPath}.vue`], resolve),
      path,
      name,
      meta
    }
    routes.push(route)
  })
})
export const keeps = keepAlives
export default routes