Преглед изворни кода

fix: add footer to kaifain search page

Acathur пре 5 година
родитељ
комит
7ca46989bf

+ 2 - 2
components/kaifain/dealSeoFooter.js

@@ -51,7 +51,7 @@ export default class DealSeoData {
     //设置底部link列表
     const typeList = this.typeList
     const { city, industry, techType, cityName = "", industryName = "", techTypeName = "", proviceName } = this.selected
-    const { headers: { host } } = this.req || {}
+    const { headers: { host = '' } } = this.req || { headers: {}}
     const kaifainUrl = this.store.state.domainConfig.kaifainUrl
 
     let footer = {
@@ -62,7 +62,7 @@ export default class DealSeoData {
     //设置baseLink
     if (host.indexOf('local') !== -1) {
       footer.baseLink = 'http://' + host
-    } else {
+    } else if (host) {
       footer.baseLink = 'https://' + host
     }
     if (city && !industry && !techType) {

+ 1 - 1
components/kaifain/dealSeoIndex.js

@@ -218,7 +218,7 @@ export default class DealSeoData {
           host
         },
         url
-      } = this.req || {}
+      } = this.req
 
       //拼接canonical
       if (host.indexOf('local') !== -1) {

+ 13 - 3
kaifain_v2/pages/search.vue

@@ -26,6 +26,8 @@
         :page="page || 1"
         :total="solutionTotal"
         )
+
+    KaifainFooter(:data="footer")
     ConnectUs(
       source="开发屋-搜索"
       :isShowToast="connectPopupVisible"
@@ -49,6 +51,8 @@ import { SolutionListMixin } from '../mixins/solution'
 import { scrollToElement } from '../utils/misc'
 
 import ConnectUs from '@/components/common/connectUs.vue'
+import KaifainFooter from '@/components/SeoFooter.vue'
+import DealSeoFooter from '@/components/kaifain/dealSeoFooter'
 
 export default SolutionListMixin.extend({
   name: 'Search',
@@ -60,7 +64,8 @@ export default SolutionListMixin.extend({
     Toolbar,
     SolutionCell,
     Pagination,
-    ConnectUs
+    ConnectUs,
+    KaifainFooter
   },
 
   layout: 'kaifain_v2',
@@ -92,7 +97,8 @@ export default SolutionListMixin.extend({
     }
   },
 
-  async asyncData({ query, error }) {
+  async asyncData(ctx: any) {
+    const { query, error } = ctx
     const {
       q = '',
       page = 0,
@@ -115,6 +121,9 @@ export default SolutionListMixin.extend({
       throw error({ statusCode: 404, message: 'Post not found (no data)' })
     }
 
+    let dealSeoFooterObj = new DealSeoFooter(ctx)
+    let footer = await dealSeoFooterObj.dealData()
+
     return {
       q,
       page: ~~page,
@@ -125,7 +134,8 @@ export default SolutionListMixin.extend({
       classes,
       serviceTypes,
       solutionList: solutionRes.list || [],
-      solutionTotal: ~~solutionRes.total
+      solutionTotal: ~~solutionRes.total,
+      ...footer
     }
   },