Parcourir la source

fix: kaifain routes redirect

Acathur il y a 5 ans
Parent
commit
a86cc80bbb
1 fichiers modifiés avec 22 ajouts et 3 suppressions
  1. 22 3
      plugins/router.js

+ 22 - 3
plugins/router.js

@@ -8,7 +8,8 @@ export default ({ app, context, req, store}) => {
     console.log("app.router.options.routes", app.router.options.routes)
     if (isKaifain) {
       window.__NUXT__.routePath = app.context.route.path.replace(/^\/kaifain/, '/')
-      let kaifainIndex = app.router.options.routes.filter(v => v.name === 'kaifain')[ 0 ]
+      let kaifainIndex = app.router.options.routes.filter(v => v.name === 'kaifain')[0]
+      let kaifainSearch = app.router.options.routes.filter(v => v.name === 'kaifainSearch')[0]
       let kaifainDetail = app.router.options.routes.filter(v => v.name === 'kaifain-detail-tid')[ 0 ]
       let kaifainCaseDetail = app.router.options.routes.filter(v => v.name === 'kaifain-case-tid')[ 0 ]
       let kaifainAdd = app.router.options.routes.filter(v => v.name === 'kaifain-add')[ 0 ]
@@ -19,6 +20,21 @@ export default ({ app, context, req, store}) => {
         path: '/*',
         component: kaifainIndex.component
       }
+      let kaifainPageNow = {
+        name: 'kaifainPage_$',
+        path: '/page/:page',
+        component: kaifainIndex.component
+      }
+      let kaifainCategoryNow = {
+        name: 'kaifainCategory_$',
+        path: '/c/:cat_id',
+        component: kaifainIndex.component
+      }
+      let kaifainSearchNow = {
+        name: 'kaifainSearch_$',
+        path: '/search',
+        component: kaifainSearch.component
+      }
       let kaifainDetailNow = {
         name: 'kaifainSeoDetails_$',
         path: '/s/:tid',
@@ -49,6 +65,9 @@ export default ({ app, context, req, store}) => {
         kaifainAddNow,
         kaifainCaseDetailNow,
         kaifainDetailNow,
+        kaifainSearchNow,
+        kaifainCategoryNow,
+        kaifainPageNow,
         kaifainIndexNow
       ]
       try {
@@ -58,7 +77,7 @@ export default ({ app, context, req, store}) => {
         console.log(e)
       }
     }
-    
+
     if (isJishuin) {
       window.__NUXT__.routePath = app.context.route.path.replace(/^\/jishuin/, '/')
       let jishuinCIndex = app.router.options.routes.filter(v => v.name === "user-collect_article-id-type")[ 0 ]
@@ -95,7 +114,7 @@ export default ({ app, context, req, store}) => {
         console.log(e)
       }
     }
-    
+
     if (isJob) {
       window.__NUXT__.routePath = app.context.route.path.replace(/^\/job/, '/')
       let jobIndex = app.router.options.routes.filter(v => v.name === 'job')[ 0 ]