ソースを参照

Merge branch 'master' into feature/yc-mobile-1020

# Conflicts:
#	layouts/main.vue
yangc 8 年 前
コミット
98633c0730

+ 1 - 1
components/default/Header.vue

@@ -79,7 +79,7 @@
       logout () {
         this.$http.get('/logout/crossBefore').then(response => {
           if (response.data) {
-            window.location.href = response.data.logoutUrl + encodeURIComponent(window.location.protocol + '//' + window.location.host + response.data.baseUrl)
+            window.location.href = response.data.logoutUrl + '&baseUrl=' + encodeURIComponent(window.location.protocol + '//' + window.location.host + response.data.baseUrl)
           }
         })
       },

+ 13 - 14
components/main/count/Box.vue

@@ -32,21 +32,20 @@
       counts () {
         return this.$store.state.product.common.counts
       }
+    },
+    mounted () {
+      this.$nextTick(() => {
+        // 刷新统计信息
+        setInterval(() => {
+          this.loadCounts()
+        }, 30000)
+      })
+    },
+    methods: {
+      loadCounts () {
+        this.$store.dispatch('loadProductCounts', { _status: 'actived' })
+      }
     }
-//    mounted () {
-//      this.$nextTick(() => {
-//        this.loadCounts()
-//        // 刷新统计信息
-//        setInterval(() => {
-//          this.loadCounts()
-//        }, 30000)
-//      })
-//    },
-//    methods: {
-//      loadCounts () {
-//        this.$store.dispatch('loadProductCounts', { _status: 'actived' })
-//      }
-//    }
   }
 </script>
 <style lang="scss" scoped>

+ 1 - 4
components/searchStore/StoreContent.vue

@@ -1,5 +1,5 @@
 <template>
-  <div>
+  <div id="search-store-content">
   <ul class="store-list" v-if="storeData.content && storeData.content.length > 0">
     <li v-for="(store, index) in storeData.content">
       <div class="store-content-left">
@@ -308,9 +308,6 @@
     color: #008B00;
     margin-top: 0;
   }
-  .el-dialog__body{
-    padding: 20px !important;
-  }
   .focus button.focus-btn a{
     color: #fff;
   }

+ 26 - 0
layouts/default.vue

@@ -15,6 +15,32 @@
       HeaderView: Header,
       FooterView: Footer,
       RightBar
+    },
+    head () {
+      return {
+        title: this.title
+      }
+    },
+    computed: {
+      title () {
+        let path = this.$route.path
+        console.log(path)
+        if (path.startsWith('/help/helpList/')) {
+          return this.helpTitle.item + '-优软商城'
+        } else if (path.startsWith('/help/helpDetail')) {
+          return this.helpDetail.title + '-优软商城'
+        } else if (path.startsWith('/help')) {
+          return '帮助中心-优软商城'
+        } else {
+          return '【优软商城】IC电子元器件现货采购交易平台商城'
+        }
+      },
+      helpTitle () {
+        return this.$store.state.help.title.data
+      },
+      helpDetail () {
+        return this.$store.state.help.detail.data
+      }
     }
   }
 </script>

+ 45 - 0
layouts/errorPage.vue

@@ -0,0 +1,45 @@
+<template>
+  <div class="error">
+    <div class="section">
+      <div class="container">
+        <div class="btn-click">
+          <a href="/"><i class="fa fa-home" style="margin-right:5px;"></i>返回首页</a>
+          <a href="javascript:history.go(-1)"><i class="fa fa-reply" style="margin-right:5px;"></i>返回上一页</a>
+        </div>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+  export default {
+    props: ['error']
+  }
+</script>
+
+<style scoped lang="scss">
+  .section{
+    background: #ebfdff url('/images/404.png')no-repeat center center;
+    height:900px;
+    position:relative;
+  }
+  .section .btn-click{
+    position:absolute;
+    top:54%;
+    left:50%;
+    margin-left:-150px;
+  }
+  .section .btn-click a{
+    display:inline-block;
+    width:130px;
+    height:33px;
+    font-size: 16px;
+    line-height: 33px;
+    color:#fff;
+    background: #f87c29;
+    text-align: center;
+    margin:0 10px;
+    border-radius: 2px;
+    text-decoration: none;
+  }
+</style>

+ 98 - 0
layouts/main.vue

@@ -25,9 +25,107 @@
       MobileHeader,
       MobileFooter
     },
+    head () {
+      return {
+        title: this.title,
+        meta: [
+          {hid: 'description', name: 'description', content: this.description},
+          {hid: 'keywords', name: 'keywords', content: this.keywords}
+        ]
+      }
+    },
     computed: {
       isMobile: function () {
         return this.$store.state.option.isMobile
+      },
+      title () {
+        let path = this.$route.path
+        console.log(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 + '-电子元器件行业资讯-优软商城' || 'IC电子元器件行业市场资讯新闻-优软商城'
+        } else if (path === '/search') {
+          return this.$route.query.w + '-产品搜索-优软商城'
+        } else if (path === '/searchStore') {
+          return this.$route.query.w + '-店铺搜索-优软商城'
+        } 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
       }
     }
   }

+ 76 - 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,79 @@
       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 + this.getStoreType(this.storeInfo.type) + '专卖店-优软商城'
+          } 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 + '官方' + this.getStoreType(this.storeInfo.type) + '专卖店,提供最新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 '电子元器件' + this.getStoreType(this.storeInfo.type) + '专卖店'
+          } 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
+      }
+    },
+    methods: {
+      getStoreType: function (type) {
+        if (type === 'ORIGINAL_FACTORY') {
+          return '原厂'
+        } else if (type === 'AGENCY') {
+          return '代理'
+        } else if (type === 'DISTRIBUTION') {
+          return '经销'
+        } else if (type === 'CONSIGNMENT') {
+          return '寄售'
+        }
+        return ''
+      }
     }
   }
 </script>

+ 1 - 1
nuxt.config.js

@@ -108,5 +108,5 @@ module.exports = {
     ssr: false
   }],
   /* TODO 暂时代理到商城测试版,之后再做出调整 */
-  proxyTable: ['/api/**', '/search/**', '/user/**', '/login/**', '/register/**', '/logout/**', '/static/**', '/vendor**', '/user**', '/trade/**', '/recommendation/**', '/store-service/**', '/basic/**', '/logout**', '/operation/**', '/help**', '/product**', '/store**', '/order/proxy**', '/report/**', '/store/**#/**', '/kdn/**', '/product/**Submit', '/admin**', '/product/**Submit/**', '/release/**', '/auth/store/**', '/produce/**', '/file**', '/rate/**']
+  proxyTable: ['/api/**', '/search/**', '/user/**', '/login/**', '/register/**', '/logout/**', '/static/**', '/vendor**', '/user**', '/trade/**', '/recommendation/**', '/store-service/**', '/basic/**', '/logout**', '/operation/**', '/help**', '/product**', '/store**', '/order/proxy**', '/report/**', '/store/**#/**', '/kdn/**', '/product/**Submit', '/admin**', '/product/**Submit/**', '/release/**', '/auth/store/**', '/produce/**', '/file**', '/rate/**', '/log/**', '/help-service/**', '/keyword/**']
 }

+ 9 - 0
pages/error/index.vue

@@ -0,0 +1,9 @@
+<template>
+  <div id="error">404</div>
+</template>
+<script>
+  export default {
+    name: 'error',
+    layout: 'errorPage'
+  }
+</script>

+ 8 - 1
pages/searchStore/_keyword.vue

@@ -37,4 +37,11 @@
     }
   }
 </script>
-
+<style>
+  #search-store-content .el-dialog--tiny{
+    width: 320px !important;
+  }
+  #search-store-content .el-dialog__body{
+    padding: 12px !important;
+  }
+</style>

+ 4 - 1
pages/store/_uuid/index.vue

@@ -15,7 +15,10 @@ export default {
       uuid: this.$route.params.uuid
     }
   },
-  fetch ({ store, params }) {
+  fetch ({ store, params, redirect }) {
+    if (!params.uuid) {
+      return redirect('/error')
+    }
     return Promise.all([
       store.dispatch('shop/findStoreInfoFromUuid', params),
       store.dispatch('shop/findRecommendProducts', params),