|
@@ -36,7 +36,7 @@ export default class DealSeoData {
|
|
|
let match = params.pathMatch || ''
|
|
let match = params.pathMatch || ''
|
|
|
let matchList = match.split('/')
|
|
let matchList = match.split('/')
|
|
|
matchList.pop()
|
|
matchList.pop()
|
|
|
- let lastMatch = matchList.pop()
|
|
|
|
|
|
|
+ let lastMatch = matchList.pop() || ''
|
|
|
// console.log(`match: ${match}, matchList: ${matchList}, lastMatch: ${lastMatch}`)
|
|
// console.log(`match: ${match}, matchList: ${matchList}, lastMatch: ${lastMatch}`)
|
|
|
|
|
|
|
|
// 重定向
|
|
// 重定向
|
|
@@ -44,45 +44,46 @@ export default class DealSeoData {
|
|
|
this.redirect(301, '/learn/' + lastMatch)
|
|
this.redirect(301, '/learn/' + lastMatch)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- let learnCate = await this._getSkillCate()
|
|
|
|
|
- let learnCateAll = []
|
|
|
|
|
- learnCate.forEach(item => {
|
|
|
|
|
- if (item.children && item.children.length) {
|
|
|
|
|
- item.children.forEach(child => {
|
|
|
|
|
- learnCateAll.push(child)
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
-
|
|
|
|
|
- if (lastMatch) {
|
|
|
|
|
- // 遍历分类数组,因为每个 children 都添加了“全部”,此处逻辑无需修改
|
|
|
|
|
- let selectedCateIdOne = ''
|
|
|
|
|
- learnCate.forEach(cateOne => {
|
|
|
|
|
- cateOne.children.forEach(cateTwo => {
|
|
|
|
|
- if (cateTwo.value === lastMatch) {
|
|
|
|
|
- selectedCateIdOne = cateOne.value
|
|
|
|
|
- self.cateNameOne = cateOne.label
|
|
|
|
|
- if (cateTwo.label === '全部') {
|
|
|
|
|
- self.cateNameTwo = cateOne.label
|
|
|
|
|
- } else {
|
|
|
|
|
- self.cateNameTwo = cateTwo.label
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- })
|
|
|
|
|
- if (selectedCateIdOne) {
|
|
|
|
|
- this.pagination.selectedCateIdOne = selectedCateIdOne
|
|
|
|
|
- this.pagination.selectedCateIdTwo = lastMatch
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // 无需分类信息
|
|
|
|
|
+ // let learnCate = await this._getSkillCate()
|
|
|
|
|
+ // let learnCateAll = []
|
|
|
|
|
+ // learnCate.forEach(item => {
|
|
|
|
|
+ // if (item.children && item.children.length) {
|
|
|
|
|
+ // item.children.forEach(child => {
|
|
|
|
|
+ // learnCateAll.push(child)
|
|
|
|
|
+ // })
|
|
|
|
|
+ // }
|
|
|
|
|
+ // })
|
|
|
|
|
+
|
|
|
|
|
+ // if (lastMatch) {
|
|
|
|
|
+ // // 遍历分类数组,因为每个 children 都添加了“全部”,此处逻辑无需修改
|
|
|
|
|
+ // let selectedCateIdOne = ''
|
|
|
|
|
+ // learnCate.forEach(cateOne => {
|
|
|
|
|
+ // cateOne.children.forEach(cateTwo => {
|
|
|
|
|
+ // if (cateTwo.value === lastMatch) {
|
|
|
|
|
+ // selectedCateIdOne = cateOne.value
|
|
|
|
|
+ // self.cateNameOne = cateOne.label
|
|
|
|
|
+ // if (cateTwo.label === '全部') {
|
|
|
|
|
+ // self.cateNameTwo = cateOne.label
|
|
|
|
|
+ // } else {
|
|
|
|
|
+ // self.cateNameTwo = cateTwo.label
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
|
|
+ // })
|
|
|
|
|
+ // })
|
|
|
|
|
+ // if (selectedCateIdOne) {
|
|
|
|
|
+ // this.pagination.selectedCateIdOne = selectedCateIdOne
|
|
|
|
|
+ // this.pagination.selectedCateIdTwo = lastMatch
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
|
|
|
|
|
// 处理完分类信息,再获取数据
|
|
// 处理完分类信息,再获取数据
|
|
|
let learnList = await this._getLearnList()
|
|
let learnList = await this._getLearnList()
|
|
|
|
|
|
|
|
return {
|
|
return {
|
|
|
root_type,
|
|
root_type,
|
|
|
- learnCate,
|
|
|
|
|
- learnCateAll,
|
|
|
|
|
|
|
+ // learnCate,
|
|
|
|
|
+ // learnCateAll,
|
|
|
learnList, //首次获取的数据
|
|
learnList, //首次获取的数据
|
|
|
mobile: this.mobile,
|
|
mobile: this.mobile,
|
|
|
pagination: this.pagination,
|
|
pagination: this.pagination,
|
|
@@ -90,41 +91,6 @@ export default class DealSeoData {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /** 获取技能分类 */
|
|
|
|
|
- async _getSkillCate () {
|
|
|
|
|
- let res = await this.$axios.$post('/api/sale/cateListYes', { type: 2, root_type: this.root_type })
|
|
|
|
|
- let learnCate = []
|
|
|
|
|
-
|
|
|
|
|
- if (Number(res.status) === 1) {
|
|
|
|
|
- learnCate = res.data || []
|
|
|
|
|
- learnCate = learnCate.map(item => {
|
|
|
|
|
- let children = item.child_list.map(child => {
|
|
|
|
|
- return {
|
|
|
|
|
- value: child.f_name,
|
|
|
|
|
- label: child.name
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- return {
|
|
|
|
|
- value: item.f_name,
|
|
|
|
|
- label: item.name,
|
|
|
|
|
- children: children
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
-
|
|
|
|
|
- // web 端,为所有二级分类添加 “全部”
|
|
|
|
|
- if (!this.mobile) {
|
|
|
|
|
- learnCate.forEach(item => {
|
|
|
|
|
- if (item.children) {
|
|
|
|
|
- let allItem = { value: item.value, label: '全部' }
|
|
|
|
|
- item.children.splice(0, 0, allItem)
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- return learnCate
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
/** 获取技能服务列表 */
|
|
/** 获取技能服务列表 */
|
|
|
async _getLearnList () {
|
|
async _getLearnList () {
|
|
|
// 接口参数释义:https://www.yesdev.cn/apidocs-detail-20.html
|
|
// 接口参数释义:https://www.yesdev.cn/apidocs-detail-20.html
|
|
@@ -164,9 +130,9 @@ export default class DealSeoData {
|
|
|
|
|
|
|
|
dealThisMeta() {
|
|
dealThisMeta() {
|
|
|
let head = {
|
|
let head = {
|
|
|
- title: "",
|
|
|
|
|
- keyword: "",
|
|
|
|
|
- description: "",
|
|
|
|
|
|
|
+ title: "客栈学院",
|
|
|
|
|
+ keyword: "客栈学院",
|
|
|
|
|
+ description: "客栈学院",
|
|
|
h1: "",
|
|
h1: "",
|
|
|
canonical: "",
|
|
canonical: "",
|
|
|
metaLocation: ""
|
|
metaLocation: ""
|
|
@@ -183,17 +149,17 @@ export default class DealSeoData {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (this.cateNameTwo) {
|
|
|
|
|
- // 分类页
|
|
|
|
|
- head.title = `${this.cateNameTwo}技能服务-程序员客栈技术服务`;
|
|
|
|
|
- head.keyword = `${this.cateNameTwo}开发,${this.cateNameTwo}编程,自学${this.cateNameTwo},${this.cateNameTwo}教学`;
|
|
|
|
|
- head.description = "技能服务是程序员客栈远程工作平台为企业和自由职业者提供的标准化数字服务,通过标准定价的模块化技能,帮助企业和自由职业者快速达成合作。";
|
|
|
|
|
- } else {
|
|
|
|
|
- // 列表页,无筛选参数
|
|
|
|
|
- head.title = "程序员客栈技能商城-【程序员客栈技能服务】";
|
|
|
|
|
- head.keyword = "程序员客栈技能商城,远程工作,Logo设计,网页设计,微信公众号运营,PPT设计,社群运营,文案编辑,视频剪辑,音频录制,翻译";
|
|
|
|
|
- head.description = "技能服务是程序员客栈远程工作平台为企业和自由职业者提供的标准化数字服务,通过标准定价的模块化技能,帮助企业和自由职业者快速达成合作。";
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // if (this.cateNameTwo) {
|
|
|
|
|
+ // // 分类页
|
|
|
|
|
+ // head.title = `${this.cateNameTwo}技能服务-程序员客栈技术服务`;
|
|
|
|
|
+ // head.keyword = `${this.cateNameTwo}开发,${this.cateNameTwo}编程,自学${this.cateNameTwo},${this.cateNameTwo}教学`;
|
|
|
|
|
+ // head.description = "技能服务是程序员客栈远程工作平台为企业和自由职业者提供的标准化数字服务,通过标准定价的模块化技能,帮助企业和自由职业者快速达成合作。";
|
|
|
|
|
+ // } else {
|
|
|
|
|
+ // // 列表页,无筛选参数
|
|
|
|
|
+ // head.title = "程序员客栈技能商城-【程序员客栈技能服务】";
|
|
|
|
|
+ // head.keyword = "程序员客栈技能商城,远程工作,Logo设计,网页设计,微信公众号运营,PPT设计,社群运营,文案编辑,视频剪辑,音频录制,翻译";
|
|
|
|
|
+ // head.description = "技能服务是程序员客栈远程工作平台为企业和自由职业者提供的标准化数字服务,通过标准定价的模块化技能,帮助企业和自由职业者快速达成合作。";
|
|
|
|
|
+ // }
|
|
|
|
|
|
|
|
return head
|
|
return head
|
|
|
}
|
|
}
|