Ver código fonte

SEO解析问题

xinfeng 5 anos atrás
pai
commit
08ded38b5e
1 arquivos alterados com 3 adições e 5 exclusões
  1. 3 5
      plugins/router.js

+ 3 - 5
plugins/router.js

@@ -5,7 +5,6 @@ export default ({ app, context,req, store }) => {
     const isKaifain = host.indexOf('kaifain') !== -1
     const isKaifain = host.indexOf('kaifain') !== -1
     const isJishuin = host.indexOf('jishuin') !== -1
     const isJishuin = host.indexOf('jishuin') !== -1
     const isJob = host.indexOf('job') !== -1
     const isJob = host.indexOf('job') !== -1
-    console.log("222222", app.context.route.path)
     return
     return
   }
   }
   
   
@@ -14,10 +13,9 @@ export default ({ app, context,req, store }) => {
     const isKaifain = host.indexOf('kaifain') !== -1
     const isKaifain = host.indexOf('kaifain') !== -1
     const isJishuin = host.indexOf('jishuin') !== -1
     const isJishuin = host.indexOf('jishuin') !== -1
     const isJob = host.indexOf('job') !== -1
     const isJob = host.indexOf('job') !== -1
-    
     console.log("app.router.options.routes", app.router.options.routes)
     console.log("app.router.options.routes", app.router.options.routes)
     if (isKaifain) {
     if (isKaifain) {
-      window.__NUXT__.routePath = '/kaifain' + app.context.route.path
+      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 kaifainDetail = app.router.options.routes.filter(v => v.name === 'kaifain-detail-tid')[ 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 kaifainCaseDetail = app.router.options.routes.filter(v => v.name === 'kaifain-case-tid')[ 0 ]
@@ -47,7 +45,7 @@ export default ({ app, context,req, store }) => {
     }
     }
     
     
     if (isJishuin) {
     if (isJishuin) {
-      window.__NUXT__.routePath =  '/jishuin' + app.context.route.path
+      window.__NUXT__.routePath = app.context.route.path.replace(/^\/jishuin/, '')
       let jishuinCIndex = app.router.options.routes.filter(v => v.name === "jishuinCollectedC1")[ 0 ]
       let jishuinCIndex = app.router.options.routes.filter(v => v.name === "jishuinCollectedC1")[ 0 ]
       let jishuinCType = app.router.options.routes.filter(v => v.name === "jishuinCollectedCID1")[ 0 ]
       let jishuinCType = app.router.options.routes.filter(v => v.name === "jishuinCollectedCID1")[ 0 ]
       let jishuinUIndex = app.router.options.routes.filter(v => v.name === "jishuinUserU1")[ 0 ]
       let jishuinUIndex = app.router.options.routes.filter(v => v.name === "jishuinUserU1")[ 0 ]
@@ -84,7 +82,7 @@ export default ({ app, context,req, store }) => {
     }
     }
     
     
     if (isJob) {
     if (isJob) {
-      window.__NUXT__.routePath = '/job' + + app.context.route.path
+      window.__NUXT__.routePath = app.context.route.path.replace(/^\/job/, '')
       let jobIndex = app.router.options.routes.filter(v => v.name === 'JobListSeoIndex')[ 0 ]
       let jobIndex = app.router.options.routes.filter(v => v.name === 'JobListSeoIndex')[ 0 ]
       let jobDetail = app.router.options.routes.filter(v => v.name === 'job-detail-id')[ 0 ]
       let jobDetail = app.router.options.routes.filter(v => v.name === 'job-detail-id')[ 0 ]
       let jobIndexNow = {
       let jobIndexNow = {