Browse Source

TDK页面参数

yangc 8 years ago
parent
commit
1b694bfbbc
3 changed files with 159 additions and 4 deletions
  1. 95 0
      layouts/main.vue
  2. 62 0
      layouts/shop.vue
  3. 2 4
      nuxt.config.js

+ 95 - 0
layouts/main.vue

@@ -19,6 +19,101 @@
       RightBar,
       MainHeader,
       MainNav
+    },
+    head () {
+      return {
+        title: this.title,
+        meta: [
+          {hid: 'description', name: 'description', content: this.description},
+          {hid: 'keywords', name: 'keywords', content: this.keywords}
+        ]
+      }
+    },
+    computed: {
+      title () {
+        let path = this.$route.path
+        if (path === '/product/kind/home') {
+          return '电子元器件器件选型参数型号查询器件类别分类大全'
+        } else if (path.startsWith('/product/kind/')) {
+          return this.kinds[this.kinds.length - 1].nameCn + '产品品牌型号大全'
+        } else if (path.startsWith('/product/component/')) {
+          return this.componentDetail.brand.nameCn + this.componentDetail.code + '参数|供应商|数据手册中文资料|规格书'
+        } else if (path.startsWith('/product/brand/brandList/')) {
+          return 'IC电子元器件品牌中心品牌大全'
+        } else if (path.startsWith('/product/brand/')) {
+          return this.brandDetail.nameEn + '(' + this.brandDetail.nameCn + ')产品分类及产品型号大全'
+        } else if (path === '/provider/factories') {
+          return 'IC电子元器件厂家原厂直销原厂专卖店大全'
+        } else if (path === '/provider/home') {
+          return 'IC电子元器件代理商经销商专营店大全'
+        } else if (path === '/news') {
+          return 'IC电子元器件行业市场资讯新闻'
+        } else if (path.startsWith('/news/')) {
+          return this.newsDetail.title
+        } else {
+          return '【优软商城】IC电子元器件现货采购交易平台商城'
+        }
+      },
+      description () {
+        let path = this.$route.path
+        if (path === '/product/kind/home') {
+          return '优软商城电子元器件器件型号查询器件类别分类大全,优软商城提供元器件智能选型服务,能让您完美的找到热门型号的替代型号产品,一键搜索功能让您快速找到您想要的型号。'
+        } else if (path.startsWith('/product/kind/')) {
+          return '优软商城' + this.kinds[this.kinds.length - 1].nameCn + '产品品牌型号大全,能让您快速的找到' + this.kinds[this.kinds.length - 1].nameCn + '产品品牌型号。'
+        } else if (path.startsWith('/product/component/')) {
+          return '优软商城提供' + this.componentDetail.brand.nameCn + this.componentDetail.code + '数据手册中文资料规格书下载,' + this.componentDetail.code + '供应商及参数报价。'
+        } else if (path.startsWith('/product/brand/brandList/')) {
+          return 'IC电子元器件品牌中心品牌大全,优软商城品牌中心汇聚国内国际电子元器件品牌,全力打造国家级元器件电商品台。'
+        } else if (path.startsWith('/product/brand/')) {
+          return this.brandDetail.brief
+        } else if (path === '/provider/factories') {
+          return 'IC电子元器件厂家原厂直销原厂专卖店大全,优软商城原厂专区提供IC电子元器件厂家原厂直销原厂专卖店大全。'
+        } else if (path === '/provider/home') {
+          return 'IC电子元器件代理商经销商专营店大全,优软商城代理经销专区提供IC电子元器件代理商经销商专卖店大全。'
+        } else if (path === '/news') {
+          return '优软商城电子元器件采购网提供精准的电子快讯,电子资讯,电子元器件资讯。'
+        } else if (path.startsWith('/news/')) {
+          return this.newsDetail.summary
+        } else {
+          return '优软商城(usoftmall.com)是中国领先的IC电子元器件现货采购交易网上商城,提供上千万种电子元器件现货采购交易,采购电子元器件就上优软商城!'
+        }
+      },
+      keywords () {
+        let path = this.$route.path
+        if (path === '/product/kind/home') {
+          return '电子元器件分类,电子元器件参数,电子元器件型号,电子元器件类别'
+        } else if (path.startsWith('/product/kind/')) {
+          return this.kinds[this.kinds.length - 1].nameCn
+        } else if (path.startsWith('/product/component/')) {
+          return this.componentDetail.code + '供应商,' + this.componentDetail.code + '数据手册,' + this.componentDetail.code + '规格书'
+        } else if (path.startsWith('/product/brand/brandList/')) {
+          return 'ic,元器件,品牌'
+        } else if (path.startsWith('/product/brand/')) {
+          return this.brandDetail.nameEn + '(' + this.brandDetail.nameCn
+        } else if (path === '/provider/factories') {
+          return '电子元器件原厂,电子元器件厂家'
+        } else if (path === '/provider/home') {
+          return 'ic代理商,ic经销商,电子元器件代理商 , 电子元器件经销商'
+        } else if (path === '/news') {
+          return '元器件新闻,电子资讯,电子元器件资讯'
+        } else if (path.startsWith('/news/')) {
+          return ''
+        } else {
+          return '优软商城'
+        }
+      },
+      kinds () {
+        return this.$store.state.product.kind.kindsParentWithBother.data
+      },
+      componentDetail () {
+        return this.$store.state.componentDetail.detail.data
+      },
+      brandDetail () {
+        return this.$store.state.brandDetail.detail.data
+      },
+      newsDetail () {
+        return this.$store.state.newsData.detailNews.detailNews.data
+      }
     }
   }
 </script>

+ 62 - 0
layouts/shop.vue

@@ -12,6 +12,9 @@
   import { Header, Footer, RightBar } from '~components/default'
   import { StoreHeader, StoreTitle } from '~components/store'
 
+  function getCount (str, char) {
+    return str.split(char).length - 1
+  }
   export default {
     name: 'shop',
     components: {
@@ -20,6 +23,65 @@
       RightBar,
       StoreHeader,
       StoreTitle
+    },
+    head () {
+      return {
+        title: this.title,
+        meta: [
+          {hid: 'description', name: 'description', content: this.description},
+          {hid: 'keywords', name: 'keywords', content: this.keywords}
+        ]
+      }
+    },
+    computed: {
+      title () {
+        let path = this.$route.path
+        if (path.startsWith('/store/') && getCount(path, '/') === 2) {
+          if (path.indexOf('33069557578d44e69bd91ad12d28a8d4') === -1) {
+            return this.storeInfo.storeName + '原厂专卖店'
+          } else {
+            return 'IC电子元器件库存寄售优软商城自营现货寄售'
+          }
+        } else if (path.startsWith('/store/') && getCount(path, '/') === 3) {
+          return this.commodity.brandNameEn + this.commodity.code + '价格|现货库存|报价|产品参数'
+        } else {
+          return '【优软商城】IC电子元器件现货采购交易平台商城'
+        }
+      },
+      description () {
+        let path = this.$route.path
+        if (path.startsWith('/store/') && getCount(path, '/') === 2) {
+          if (path.indexOf('33069557578d44e69bd91ad12d28a8d4') === -1) {
+            return this.storeInfo.storeName + '官方原厂专卖店,提供最新IC电子元器件现货在线销售。'
+          } else {
+            return '优软商城为您提供IC电子元器件库存寄售,商城自营现货寄售让您更放心更省心。'
+          }
+        } else if (path.startsWith('/store/') && getCount(path, '/') === 3) {
+          return this.commodity.enterpriseName + '提供' + this.commodity.brandNameEn + this.commodity.code + '价格和' + this.commodity.code + '现货库存,并且内容还包含' + this.commodity.code + '产品参数、' + this.commodity.code + '规格书数据手册等。'
+        } else {
+          return '优软商城(usoftmall.com)是中国领先的IC电子元器件现货采购交易网上商城,提供上千万种电子元器件现货采购交易,采购电子元器件就上优软商城!'
+        }
+      },
+      keywords () {
+        let path = this.$route.path
+        if (path.startsWith('/store/') && getCount(path, '/') === 2) {
+          if (path.indexOf('33069557578d44e69bd91ad12d28a8d4') === -1) {
+            return '电子元器件原厂专卖店'
+          } else {
+            return '优软商城,ic芯片库存寄售,电子元器件寄售'
+          }
+        } else if (path.startsWith('/store/') && getCount(path, '/') === 3) {
+          return this.commodity.code + '价格,' + this.commodity.code + '现货,' + this.commodity.code + '报价,' + this.commodity.code + '产品参数'
+        } else {
+          return '优软商城'
+        }
+      },
+      storeInfo () {
+        return this.$store.state.shop.storeInfo.store.data
+      },
+      commodity () {
+        return this.$store.state.shop.storeInfo.commodity.data
+      }
     }
   }
 </script>

+ 2 - 4
nuxt.config.js

@@ -10,13 +10,11 @@ module.exports = {
   ** Headers of the page
   */
   head: {
-    title: '【优软商城】IC电子元器件现货采购交易平台商城',
     meta: [
       { charset: 'utf-8' },
       { 'http-equiv': 'X-UA-Compatible', content: 'IE=edge,chrome=1' },
       { name: 'render', content: 'webkit' },
-      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
-      { hid: 'description', name: 'description', content: '优软商城(usoftmall.com)是中国领先的IC电子元器件现货采购交易网上商城,提供上千万种电子元器件现货采购交易,采购电子元器件就上优软商城!' }
+      { name: 'viewport', content: 'width=device-width, initial-scale=1' }
     ],
     link: [
       { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
@@ -98,7 +96,7 @@ module.exports = {
     ssr: false
   }, {
     src: '~plugins/element-ui.js',
-    ssr: true
+    ssr: false
   }, {
     src: '~plugins/filters.js',
     ssr: false