pcb.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <template>
  2. <div id="main">
  3. <header-view v-if="!isInFrame"></header-view>
  4. <main-header :isPcb="true" :isFixed="isFixed"></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: 'pcb',
  16. data () {
  17. return {
  18. isFixed: false
  19. }
  20. },
  21. components: {
  22. HeaderView: Header,
  23. FooterView: Footer,
  24. RightBar,
  25. MainHeader,
  26. MainNav
  27. },
  28. mounted () {
  29. this.$nextTick(() => {
  30. window.addEventListener('scroll', () => {
  31. let obj = document.querySelector('#headerWrapperContent')
  32. let scrolled = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop
  33. // 写死是因为获取不到
  34. if (obj) {
  35. this.isFixed = scrolled >= obj.offsetTop
  36. }
  37. }, false)
  38. })
  39. },
  40. head () {
  41. return {
  42. title: this.title || '【优软商城】IC电子元器件现货采购交易平台商城',
  43. meta: [
  44. {hid: 'description', name: 'description', content: this.description || '优软商城(mall.usoftchina.com)是中国领先的IC电子元器件现货采购交易网上商城,提供上千万种电子元器件现货采购交易,采购电子元器件就上优软商城!'},
  45. {hid: 'keywords', name: 'keywords', content: this.keywords || '优软商城'}
  46. ]
  47. }
  48. },
  49. computed: {
  50. isMobile: function () {
  51. return this.$store.state.option.isMobile
  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. if (this.kinds[this.kinds.length - 1]) {
  59. return this.kinds[this.kinds.length - 1].nameCn + '产品品牌型号大全-优软商城'
  60. }
  61. return ''
  62. } else if (path.startsWith('/product/component/')) {
  63. if (this.componentDetail) {
  64. return this.componentDetail.brand.nameCn + this.componentDetail.code + '参数|供应商|数据手册中文资料|规格书-优软商城'
  65. } else {
  66. return ''
  67. }
  68. } else if (path.startsWith('/product/brand/brandList/')) {
  69. return 'IC电子元器件品牌中心品牌大全-优软商城'
  70. } else if (path.startsWith('/product/brand/')) {
  71. if (this.brandDetail.nameEn) {
  72. return this.brandDetail.nameEn + '(' + this.brandDetail.nameCn + ')产品分类及产品型号大全-优软商城'
  73. }
  74. return '【优软商城】IC电子元器件现货采购交易平台商城'
  75. } else if (path === '/provider/factories') {
  76. return 'IC电子元器件厂家原厂直销原厂专卖店大全-优软商城'
  77. } else if (path === '/provider/home') {
  78. return 'IC电子元器件代理商经销商专营店大全-优软商城'
  79. } else if (path === '/news') {
  80. return 'IC电子元器件行业市场资讯新闻-优软商城'
  81. } else if (path.startsWith('/news/')) {
  82. return this.newsDetail.title + '-电子元器件行业资讯-优软商城' || 'IC电子元器件行业市场资讯新闻-优软商城'
  83. } else if (path === '/search') {
  84. return this.$route.query.w + '-产品搜索-优软商城'
  85. } else if (path === '/searchStore') {
  86. return this.$route.query.w + '-店铺搜索-优软商城'
  87. } else {
  88. return '【优软商城】IC电子元器件现货采购交易平台商城'
  89. }
  90. },
  91. description () {
  92. let path = this.$route.path
  93. if (path === '/product/kind/home') {
  94. return '优软商城电子元器件器件型号查询器件类别分类大全,优软商城提供元器件智能选型服务,能让您完美的找到热门型号的替代型号产品,一键搜索功能让您快速找到您想要的型号。'
  95. } else if (path.startsWith('/product/kind/')) {
  96. if (this.kinds[this.kinds.length - 1]) {
  97. return '优软商城' + this.kinds[this.kinds.length - 1].nameCn + '产品品牌型号大全,能让您快速的找到' + this.kinds[this.kinds.length - 1].nameCn + '产品品牌型号。'
  98. }
  99. return ''
  100. } else if (path.startsWith('/product/component/')) {
  101. if (this.componentDetail) {
  102. return '优软商城提供' + this.componentDetail.brand.nameCn + this.componentDetail.code + '数据手册中文资料规格书下载,' + this.componentDetail.code + '供应商及参数报价。'
  103. } else {
  104. return ''
  105. }
  106. } else if (path.startsWith('/product/brand/brandList/')) {
  107. return 'IC电子元器件品牌中心品牌大全,优软商城品牌中心汇聚国内国际电子元器件品牌,全力打造国家级元器件电商品台。'
  108. } else if (path.startsWith('/product/brand/')) {
  109. if (this.brandDetail.brief) {
  110. return this.brandDetail.brief || '优软商城(mall.usoftchina.com)是中国领先的IC电子元器件现货采购交易网上商城,提供上千万种电子元器件现货采购交易,采购电子元器件就上优软商城!'
  111. }
  112. return ''
  113. } else if (path === '/provider/factories') {
  114. return 'IC电子元器件厂家原厂直销原厂专卖店大全,优软商城原厂专区提供IC电子元器件厂家原厂直销原厂专卖店大全。'
  115. } else if (path === '/provider/home') {
  116. return 'IC电子元器件代理商经销商专营店大全,优软商城代理经销专区提供IC电子元器件代理商经销商专卖店大全。'
  117. } else if (path === '/news') {
  118. return '优软商城电子元器件采购网提供精准的电子快讯,电子资讯,电子元器件资讯。'
  119. } else if (path.startsWith('/news/')) {
  120. return this.newsDetail.summary
  121. } else {
  122. return '优软商城(mall.usoftchina.com)是中国领先的IC电子元器件现货采购交易网上商城,提供上千万种电子元器件现货采购交易,采购电子元器件就上优软商城!'
  123. }
  124. },
  125. keywords () {
  126. let path = this.$route.path
  127. if (path === '/product/kind/home') {
  128. return '电子元器件分类,电子元器件参数,电子元器件型号,电子元器件类别'
  129. } else if (path.startsWith('/product/kind/')) {
  130. if (this.kinds[this.kinds.length - 1]) {
  131. return this.kinds[this.kinds.length - 1].nameCn
  132. }
  133. return ''
  134. } else if (path.startsWith('/product/component/')) {
  135. if (this.componentDetail) {
  136. return this.componentDetail.code + '供应商,' + this.componentDetail.code + '数据手册,' + this.componentDetail.code + '规格书'
  137. } else {
  138. return ''
  139. }
  140. } else if (path.startsWith('/product/brand/brandList/')) {
  141. return 'ic,元器件,品牌'
  142. } else if (path.startsWith('/product/brand/')) {
  143. if (this.brandDetail.nameEn) {
  144. return this.brandDetail.nameEn + '(' + this.brandDetail.nameCn
  145. }
  146. return '优软商城'
  147. } else if (path === '/provider/factories') {
  148. return '电子元器件原厂,电子元器件厂家'
  149. } else if (path === '/provider/home') {
  150. return 'ic代理商,ic经销商,电子元器件代理商 , 电子元器件经销商'
  151. } else if (path === '/news') {
  152. return '元器件新闻,电子资讯,电子元器件资讯'
  153. } else if (path.startsWith('/news/')) {
  154. return ''
  155. } else {
  156. return '优软商城'
  157. }
  158. },
  159. kinds () {
  160. return this.$store.state.product.kind.kindsParentWithBother.data
  161. },
  162. componentDetail () {
  163. return this.$store.state.componentDetail.detail.data
  164. },
  165. brandDetail () {
  166. return this.$store.state.brandDetail.detail.data
  167. },
  168. newsDetail () {
  169. return this.$store.state.newsData.detailNews.detailNews.data
  170. }
  171. }
  172. }
  173. </script>