|
|
@@ -1,60 +1,89 @@
|
|
|
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.mobile = this.app.$deviceType.isMobile()
|
|
|
+ constructor({ $axios, req, app, redirect, error }) {
|
|
|
+ this.$axios = $axios
|
|
|
+ this.req = req
|
|
|
+ this.app = app
|
|
|
+ this.redirect = redirect
|
|
|
+ this.error = error
|
|
|
+ this.mobile = this.app.$deviceType.isMobile()
|
|
|
+ this.pagination = {
|
|
|
+ page: 1,
|
|
|
+ pagesize: 10,
|
|
|
+ total: 0,
|
|
|
+ pageCount: 1,
|
|
|
+ loading: false,
|
|
|
+ selectedTabVal: 0, // 0 全部 19 技术服务商 18 人力外包
|
|
|
+ noMore: true
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- async dealData() {
|
|
|
- const self = this
|
|
|
- let {
|
|
|
- name,
|
|
|
- query: { page = 1, root_type = 0 },
|
|
|
- path,
|
|
|
- params,
|
|
|
- fullPath
|
|
|
- } = this.app.context.route
|
|
|
- let match = params.pathMatch || ''
|
|
|
- let matchList = match.split('/')
|
|
|
- matchList.pop();
|
|
|
- let lastMatch = matchList.pop() || '';
|
|
|
-
|
|
|
- // 重定向
|
|
|
- if (path.indexOf('/company/list') > -1) {
|
|
|
- this.redirect(301, '/company/' + lastMatch)
|
|
|
- }
|
|
|
- return {
|
|
|
- mobile: this.mobile,
|
|
|
- head: this.dealThisMeta()
|
|
|
- }
|
|
|
+ async dealData() {
|
|
|
+ const self = this
|
|
|
+ let {
|
|
|
+ name,
|
|
|
+ query: { page = 1, root_type = 0 },
|
|
|
+ path,
|
|
|
+ params,
|
|
|
+ fullPath
|
|
|
+ } = this.app.context.route
|
|
|
+ let match = params.pathMatch || ''
|
|
|
+ let matchList = match.split('/')
|
|
|
+ matchList.pop();
|
|
|
+ let lastMatch = matchList.pop() || '';
|
|
|
+ this.pagination.page = Number(page)
|
|
|
+ // 重定向
|
|
|
+ if (path.indexOf('/company/list') > -1) {
|
|
|
+ this.redirect(301, '/company/' + lastMatch)
|
|
|
+ }
|
|
|
+ if(['0', '18', '19'].includes(lastMatch)){
|
|
|
+ this.pagination.selectedTabVal = lastMatch
|
|
|
+ }
|
|
|
+ let companyList = await this._companyList()
|
|
|
+ return {
|
|
|
+ mobile: this.mobile,
|
|
|
+ companyList,
|
|
|
+ pagination: this.pagination,
|
|
|
+ head: this.dealThisMeta()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 列表数据
|
|
|
+ async _companyList() {
|
|
|
+ let companyList = []
|
|
|
+ let data = {
|
|
|
+ cert_id: this.pagination.selectedTabVal,
|
|
|
+ page: this.pagination.page,
|
|
|
+ pagesize: this.pagination.pagesize
|
|
|
+ }
|
|
|
+ let res = await this.$axios.$post('/uapi/company', data)
|
|
|
+ if (res.status === 1) {
|
|
|
+ companyList = res.data.list || []
|
|
|
+ this.pagination.total = res.data.count
|
|
|
+ return companyList
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dealThisMeta() {
|
|
|
+ let head = {
|
|
|
+ title: "",
|
|
|
+ keyword: "",
|
|
|
+ description: "",
|
|
|
+ h1: "",
|
|
|
+ canonical: "",
|
|
|
+ metaLocation: ""
|
|
|
}
|
|
|
|
|
|
- dealThisMeta() {
|
|
|
- let head = {
|
|
|
- title: "",
|
|
|
- keyword: "",
|
|
|
- description: "",
|
|
|
- h1: "",
|
|
|
- canonical: "",
|
|
|
- metaLocation: ""
|
|
|
- }
|
|
|
-
|
|
|
- if (this.req) {
|
|
|
- const { headers: { host }, url } = this.req
|
|
|
+ if (this.req) {
|
|
|
+ const { headers: { host }, url } = this.req
|
|
|
|
|
|
- //拼接canonical
|
|
|
- if (host.indexOf('local') !== -1) {
|
|
|
- head.canonical = 'http://' + host + url
|
|
|
- } else {
|
|
|
- head.canonical = 'https://' + host + url
|
|
|
- }
|
|
|
- }
|
|
|
- head.title = "程序员兼职,程序员私活,程序员接单平台-程序员客栈";
|
|
|
- head.keyword = "网站建设,程序员外包,APP开发制作,APP小程序,程序员招聘";
|
|
|
- head.description = "高级兼职程序员,帮您解决软件开发、UI设计、APP小程序、前端、原型产品经理、测试运维、人工智能、大数据区块链、网站建设制作、程序员招聘等问题";
|
|
|
- return head
|
|
|
+ //拼接canonical
|
|
|
+ if (host.indexOf('local') !== -1) {
|
|
|
+ head.canonical = 'http://' + host + url
|
|
|
+ } else {
|
|
|
+ head.canonical = 'https://' + host + url
|
|
|
+ }
|
|
|
}
|
|
|
+ head.title = "程序员兼职,程序员私活,程序员接单平台-程序员客栈";
|
|
|
+ head.keyword = "网站建设,程序员外包,APP开发制作,APP小程序,程序员招聘";
|
|
|
+ head.description = "高级兼职程序员,帮您解决软件开发、UI设计、APP小程序、前端、原型产品经理、测试运维、人工智能、大数据区块链、网站建设制作、程序员招聘等问题";
|
|
|
+ return head
|
|
|
+ }
|
|
|
}
|