| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- export default class DealSeoData {
- constructor({$axios, req, app, redirect, error}) {
- this.$axios = $axios
- this.req = req
- this.app = app
- this.redirect = redirect
- this.error = error
- this.skillDetail = {}
- this.isExist = true
- }
- async dealData() {
- let {
- name,
- query: { act },
- path,
- params,
- fullPath
- } = this.app.context.route
- const sale_id = params.id || ''
- // 重定向
- if (path.indexOf('/frontend/learn/detail') > -1) {
- this.redirect(301, '/l/' + sale_id)
- }
- const skillDetail = {}
- return {
- isExist: this.isExist,
- sale_id,
- skillDetail,
- mobile: this.app.$deviceType.isMobile(),
- head: this.dealThisMeta(),
- act
- }
- }
- dealThisMeta() {
- if (!this.isExist) {
- // 页面不存在时
- return {
- title: "页面不存在-程序员客栈",
- keyword: "",
- description: "",
- h1: "",
- canonical: "",
- metaLocation: ""
- }
- }
- let head = {
- title: `客栈学院`,
- keyword: `客栈学院`,
- description: `客栈学院`,
- h1: "",
- canonical: "",
- metaLocation: ""
- }
- return head
- }
- }
|