|
|
@@ -17,7 +17,7 @@ export default class DealSeoData {
|
|
|
this.cateNameOne = ''
|
|
|
this.cateNameTwo = ''
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
async dealData() {
|
|
|
const self = this
|
|
|
let {
|
|
|
@@ -32,6 +32,7 @@ export default class DealSeoData {
|
|
|
// 目前仅将二级 id 拼接到 url 上
|
|
|
let match = params.pathMatch || ''
|
|
|
let matchList = match.split('/').map(item => item.toLocaleLowerCase())
|
|
|
+ matchList.pop()
|
|
|
let lastMatch = matchList.pop()
|
|
|
// console.log(`match: ${match}, matchList: ${matchList}, lastMatch: ${lastMatch}`)
|
|
|
|
|
|
@@ -50,19 +51,19 @@ export default class DealSeoData {
|
|
|
}
|
|
|
})
|
|
|
|
|
|
- if (Number(lastMatch) > 0) {
|
|
|
+ if (lastMatch) {
|
|
|
// 遍历分类数组
|
|
|
let selectedCateIdOne = ''
|
|
|
skillCate.forEach(cateOne => {
|
|
|
cateOne.children.forEach(cateTwo => {
|
|
|
- if (Number(cateTwo.value) === Number(lastMatch)) {
|
|
|
+ if (cateTwo.value === lastMatch) {
|
|
|
selectedCateIdOne = cateOne.value
|
|
|
self.cateNameOne = cateOne.label
|
|
|
self.cateNameTwo = cateTwo.label
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
- if (Number(selectedCateIdOne) > 0) {
|
|
|
+ if (selectedCateIdOne) {
|
|
|
this.pagination.selectedCateIdOne = selectedCateIdOne
|
|
|
this.pagination.selectedCateIdTwo = lastMatch
|
|
|
}
|
|
|
@@ -91,7 +92,7 @@ export default class DealSeoData {
|
|
|
skillCate = skillCate.map(item => {
|
|
|
let children = item.child_list.map(child => {
|
|
|
return {
|
|
|
- value: child.category_id,
|
|
|
+ value: child.f_name,
|
|
|
label: child.name
|
|
|
}
|
|
|
})
|
|
|
@@ -141,7 +142,7 @@ export default class DealSeoData {
|
|
|
|
|
|
return skillList
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
dealThisMeta() {
|
|
|
let head = {
|
|
|
title: "",
|
|
|
@@ -154,7 +155,7 @@ export default class DealSeoData {
|
|
|
|
|
|
if (this.req) {
|
|
|
const { headers: { host }, url } = this.req
|
|
|
-
|
|
|
+
|
|
|
//拼接canonical
|
|
|
if (host.indexOf('local') !== -1) {
|
|
|
head.canonical = 'http://' + host + url
|
|
|
@@ -174,7 +175,7 @@ export default class DealSeoData {
|
|
|
head.keyword = "IT技术学习、IT培训、编程开发学习、自学编程";
|
|
|
head.description = "程序员客栈技术培训是一个提供了编程的基础技术教程, 介绍了HTML、CSS、Javascript、Python,Java,Ruby,C,PHP , MySQL等各种编程语言的培训课程。 同时也提供了大量的高端程序员,通过一对一教学,帮助您更好的学习编程。";
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
return head
|
|
|
}
|
|
|
}
|