| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- export default ({ app, store }) => {
- if (process.client) {
- const { host } = location || {}
- const isKaifain = host.indexOf('kaifain') !== -1
- const isJishuin = host.indexOf('jishuin') !== -1
- const isJob = host.indexOf('job') !== -1
- console.log("app.router.options.routes", app.router.options.routes)
- if (isKaifain) {
- let kaifainIndex = app.router.options.routes.filter(v => v.name === 'kaifainSeoIndex')[0]
- let kaifainDetail = app.router.options.routes.filter(v => v.name === 'kaifainSeoDetail')[0]
- let kaifainCaseDetail = app.router.options.routes.filter(v => v.name === 'kaifainCaseSeoDetail')[0]
- app.router.options.routes.unshift({
- name: 'kaifain_$',
- path: '/*',
- component: kaifainIndex.component
- })
- app.router.options.routes.unshift({
- name: 'kaifainSeoDetails_$',
- path: '/s/:tid',
- component: kaifainDetail.component
- })
- app.router.options.routes.unshift({
- name: 'kaifainCaseSeoDetails_$',
- path: '/d/:tid',
- component: kaifainCaseDetail.component
- })
- app.router.matcher.addRoutes([{
- name: 'kaifainSeoDetails_$',
- path: '/s/:tid',
- component: () => import('@/pages/kaifain/detail/_tid/index.vue')
- }, {
- name: 'kaifainCaseSeoDetails_$',
- path: '/d/:tid',
- component: () => import('@/pages/kaifain/case/_tid.vue')
- }])
- }
- if (isJishuin) {
- //合集
- app.router.options.routes.unshift({
- name: 'jishuinCollectedC',
- path: '/c/:id',
- component: import('@/pages/user/collect_article/_id/_type.vue')
- })
- app.router.options.routes.unshift({
- name: 'jishuinCollectedCID',
- path: '/c/:id/:type',
- component: import('@/pages/user/collect_article/_id/_type.vue')
- })
- app.router.options.routes.unshift({
- name: 'jishuinUserU',
- path: '/u/:id',
- component: import('@/pages/user/_id/_type.vue')
- })
- app.router.options.routes.unshift({
- name: 'jishuinUserUID',
- path: '/u/:id/:type',
- component: import('@/pages/user/_id/_type.vue')
- })
- app.router.matcher.addRoutes([{
- name: 'jishuinCollectedC',
- path: '/c/:id',
- component: import('@/pages/user/collect_article/_id/_type.vue')
- }])
- app.router.matcher.addRoutes([{
- name: 'jishuinCollectedCID',
- path: '/c/:id/:type',
- component: import('@/pages/user/collect_article/_id/_type.vue')
- }])
- app.router.matcher.addRoutes([{
- name: 'jishuinUserU',
- path: '/u/:id',
- component: import('@/pages/user/_id/_type.vue')
- }])
- app.router.matcher.addRoutes([{
- name: 'jishuinUserUID',
- path: '/u/:id/:type',
- component: import('@/pages/user/_id/_type.vue')
- }])
- }
- if (isJob) {
- app.router.options.routes.unshift({
- name: 'jobSeoDetails_$',
- path: '/d/:id',
- component: () => import('@/pages/job/detail/_id.vue')
- })
- app.router.options.routes.unshift({
- name: 'JobListSeoIndex_$',
- path: '/',
- component: () => import('@/pages/job/index.vue')
- })
- app.router.matcher.addRoutes([{
- name: 'jobSeoDetails_$',
- path: '/d/:id',
- component: () => import('@/pages/job/detail/_id.vue')
- }, {
- name: 'JobListSeoIndex_$',
- path: '/',
- component: () => import('@/pages/job/index.vue')
- }])
- }
- console.log('router', app.router)
-
- app.router.beforeEach((to, from, next)=> {
- console.log("location.href", to, from)
- next()
- })
-
- }
- }
|