main.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <div id="main">
  3. <header-view v-if="!isInFrame"></header-view>
  4. <main-header></main-header>
  5. <main-nav></main-nav>
  6. <nuxt/>
  7. <footer-view></footer-view>
  8. <right-bar></right-bar>
  9. </div>
  10. </template>
  11. <script>
  12. import { Header, Footer, RightBar } from '~components/default'
  13. import { MainHeader, MainNav } from '~components/main'
  14. export default {
  15. name: 'main',
  16. components: {
  17. HeaderView: Header,
  18. FooterView: Footer,
  19. RightBar,
  20. MainHeader,
  21. MainNav
  22. },
  23. head () {
  24. return {
  25. title: this.title,
  26. meta: [
  27. {hid: 'description', name: 'description', content: this.description},
  28. {hid: 'keywords', name: 'keywords', content: this.keywords}
  29. ]
  30. }
  31. },
  32. computed: {
  33. isMobile: function () {
  34. return this.$store.state.option.isMobile
  35. },
  36. isInFrame () {
  37. if (this.$route.query.type === 'erp') {
  38. this.$store.commit('option/ADD_COOKIES', 'type=erp;')
  39. return true
  40. } else {
  41. let cookies = this.$store.state.option.cookies
  42. let cookieArr = cookies.split(';')
  43. let cookieObj = {}
  44. for (let i = 0; i < cookieArr.length; i++) {
  45. let tmpArr = cookieArr[i].split('=') || []
  46. if (tmpArr.length === 2) {
  47. cookieObj[tmpArr[0].trim()] = tmpArr[1].trim()
  48. }
  49. }
  50. return cookieObj.type === 'erp'
  51. }
  52. },
  53. title () {
  54. let path = this.$route.path
  55. if (path === '/product/kind/home') {
  56. return '电子元器件器件选型参数型号查询器件类别分类大全-优软商城'
  57. } else if (path.startsWith('/product/kind/')) {
  58. return this.kinds[this.kinds.length - 1].nameCn + '产品品牌型号大全-优软商城'
  59. } else if (path.startsWith('/product/component/')) {
  60. return this.componentDetail.brand.nameCn + this.componentDetail.code + '参数|供应商|数据手册中文资料|规格书-优软商城'
  61. } else if (path.startsWith('/product/brand/brandList/')) {
  62. return 'IC电子元器件品牌中心品牌大全-优软商城'
  63. } else if (path.startsWith('/product/brand/')) {
  64. return this.brandDetail.nameEn + '(' + this.brandDetail.nameCn + ')产品分类及产品型号大全-优软商城'
  65. } else if (path === '/provider/factories') {
  66. return 'IC电子元器件厂家原厂直销原厂专卖店大全-优软商城'
  67. } else if (path === '/provider/home') {
  68. return 'IC电子元器件代理商经销商专营店大全-优软商城'
  69. } else if (path === '/news') {
  70. return 'IC电子元器件行业市场资讯新闻-优软商城'
  71. } else if (path.startsWith('/news/')) {
  72. return this.newsDetail.title + '-电子元器件行业资讯-优软商城' || 'IC电子元器件行业市场资讯新闻-优软商城'
  73. } else if (path === '/search') {
  74. return this.$route.query.w + '-产品搜索-优软商城'
  75. } else if (path === '/searchStore') {
  76. return this.$route.query.w + '-店铺搜索-优软商城'
  77. } else {
  78. return '【优软商城】IC电子元器件现货采购交易平台商城'
  79. }
  80. },
  81. description () {
  82. let path = this.$route.path
  83. if (path === '/product/kind/home') {
  84. return '优软商城电子元器件器件型号查询器件类别分类大全,优软商城提供元器件智能选型服务,能让您完美的找到热门型号的替代型号产品,一键搜索功能让您快速找到您想要的型号。'
  85. } else if (path.startsWith('/product/kind/')) {
  86. return '优软商城' + this.kinds[this.kinds.length - 1].nameCn + '产品品牌型号大全,能让您快速的找到' + this.kinds[this.kinds.length - 1].nameCn + '产品品牌型号。'
  87. } else if (path.startsWith('/product/component/')) {
  88. return '优软商城提供' + this.componentDetail.brand.nameCn + this.componentDetail.code + '数据手册中文资料规格书下载,' + this.componentDetail.code + '供应商及参数报价。'
  89. } else if (path.startsWith('/product/brand/brandList/')) {
  90. return 'IC电子元器件品牌中心品牌大全,优软商城品牌中心汇聚国内国际电子元器件品牌,全力打造国家级元器件电商品台。'
  91. } else if (path.startsWith('/product/brand/')) {
  92. return this.brandDetail.brief
  93. } else if (path === '/provider/factories') {
  94. return 'IC电子元器件厂家原厂直销原厂专卖店大全,优软商城原厂专区提供IC电子元器件厂家原厂直销原厂专卖店大全。'
  95. } else if (path === '/provider/home') {
  96. return 'IC电子元器件代理商经销商专营店大全,优软商城代理经销专区提供IC电子元器件代理商经销商专卖店大全。'
  97. } else if (path === '/news') {
  98. return '优软商城电子元器件采购网提供精准的电子快讯,电子资讯,电子元器件资讯。'
  99. } else if (path.startsWith('/news/')) {
  100. return this.newsDetail.summary
  101. } else {
  102. return '优软商城(usoftmall.com)是中国领先的IC电子元器件现货采购交易网上商城,提供上千万种电子元器件现货采购交易,采购电子元器件就上优软商城!'
  103. }
  104. },
  105. keywords () {
  106. let path = this.$route.path
  107. if (path === '/product/kind/home') {
  108. return '电子元器件分类,电子元器件参数,电子元器件型号,电子元器件类别'
  109. } else if (path.startsWith('/product/kind/')) {
  110. return this.kinds[this.kinds.length - 1].nameCn
  111. } else if (path.startsWith('/product/component/')) {
  112. return this.componentDetail.code + '供应商,' + this.componentDetail.code + '数据手册,' + this.componentDetail.code + '规格书'
  113. } else if (path.startsWith('/product/brand/brandList/')) {
  114. return 'ic,元器件,品牌'
  115. } else if (path.startsWith('/product/brand/')) {
  116. return this.brandDetail.nameEn + '(' + this.brandDetail.nameCn
  117. } else if (path === '/provider/factories') {
  118. return '电子元器件原厂,电子元器件厂家'
  119. } else if (path === '/provider/home') {
  120. return 'ic代理商,ic经销商,电子元器件代理商 , 电子元器件经销商'
  121. } else if (path === '/news') {
  122. return '元器件新闻,电子资讯,电子元器件资讯'
  123. } else if (path.startsWith('/news/')) {
  124. return ''
  125. } else {
  126. return '优软商城'
  127. }
  128. },
  129. kinds () {
  130. return this.$store.state.product.kind.kindsParentWithBother.data
  131. },
  132. componentDetail () {
  133. return this.$store.state.componentDetail.detail.data
  134. },
  135. brandDetail () {
  136. return this.$store.state.brandDetail.detail.data
  137. },
  138. newsDetail () {
  139. return this.$store.state.newsData.detailNews.detailNews.data
  140. }
  141. }
  142. }
  143. </script>