|
|
@@ -1,6 +1,8 @@
|
|
|
<template>
|
|
|
- <div :class="mobile ? 'mobileMain' : ''" :style="{marginTop: mainMarginTop}">
|
|
|
- <div class="works-wrapper" v-if="!mobile" v-loading="firstLoad">
|
|
|
+ <div
|
|
|
+ :class="mobile ? 'mobileMain' : ''"
|
|
|
+ :style="{marginTop: mainMarginTop, marginBottom: mobile ? '0px !important' : '30px !important'}">
|
|
|
+ <div class="works-wrapper" v-if="!mobile">
|
|
|
<div class="works-category">
|
|
|
<div class="works-category-one">
|
|
|
<div
|
|
|
@@ -31,14 +33,14 @@
|
|
|
class="works-category-two-wrapper"
|
|
|
:class="categoryExpanded ? 'expand' : ''"
|
|
|
v-show="currentCategoryIndex === 0">
|
|
|
- <div
|
|
|
+ <a
|
|
|
class="works-category-two-item"
|
|
|
:class="pagination.cate_id_two.indexOf(category.category_id) > -1 ? 'active' : ''"
|
|
|
v-for="category in categoryAll"
|
|
|
:key="`category-all-${category.category_id}`"
|
|
|
- @click="handleClickCategoryTwo(category.category_id)">
|
|
|
+ :href="`/works/${category.category_id}`">
|
|
|
{{ category.name }}
|
|
|
- </div>
|
|
|
+ </a>
|
|
|
</div>
|
|
|
<!-- 接口返回的二级分类 -->
|
|
|
<div
|
|
|
@@ -47,14 +49,14 @@
|
|
|
v-for="(category, index) in categoryList"
|
|
|
:key="`category-two-wrapper-${category.category_id}`"
|
|
|
v-show="currentCategoryIndex === index + 1">
|
|
|
- <div
|
|
|
+ <a
|
|
|
class="works-category-two-item"
|
|
|
:class="pagination.cate_id_two.indexOf(categoryChild.category_id) > -1 ? 'active' : ''"
|
|
|
v-for="categoryChild in category.child"
|
|
|
:key="`category-two-${categoryChild.category_id}`"
|
|
|
- @click="handleClickCategoryTwo(categoryChild.category_id)">
|
|
|
+ :href="`/works/${categoryChild.category_id}`">
|
|
|
{{ categoryChild.name }}
|
|
|
- </div>
|
|
|
+ </a>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -91,9 +93,9 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="result-empty-wrapper" v-else>
|
|
|
- <img src="@/assets/img/common/empty@2x.png" alt="empty">
|
|
|
- <span>暂无搜索内容</span>
|
|
|
- </div>
|
|
|
+ <img src="@/assets/img/common/empty@2x.png" alt="empty">
|
|
|
+ <span>暂无搜索内容</span>
|
|
|
+ </div>
|
|
|
<div class="pagination-wrapper" v-if="pagination.total > pagination.pagesize">
|
|
|
<el-pagination
|
|
|
background
|
|
|
@@ -253,33 +255,62 @@
|
|
|
|
|
|
<script>
|
|
|
import {mapState} from "vuex";
|
|
|
+import DealSeoList from "@/components/work_down/dealSeoList"
|
|
|
|
|
|
export default {
|
|
|
data () {
|
|
|
return {
|
|
|
baseUrl: '',
|
|
|
- categoryAll: [],
|
|
|
- categoryList: [],
|
|
|
- worksList: [],
|
|
|
+ // categoryAll: [],
|
|
|
+ // categoryList: [],
|
|
|
+ // worksList: [],
|
|
|
currentCategoryIndex: 0,
|
|
|
currentDrawerCategoryIndex: 0,
|
|
|
categoryExpanded: false,
|
|
|
- firstLoad: true,
|
|
|
+ firstLoad: false,
|
|
|
loadingWorksList: false,
|
|
|
showCategoryDrawer: false,
|
|
|
- pagination: {
|
|
|
- page: 1,
|
|
|
- keywords: '',
|
|
|
- cate_id_two: [],
|
|
|
- // 非接口参数
|
|
|
- pagesize: 20,
|
|
|
- total: 0,
|
|
|
- loading: true,
|
|
|
- noMore: true
|
|
|
- },
|
|
|
+ // pagination: {
|
|
|
+ // page: 1,
|
|
|
+ // keywords: '',
|
|
|
+ // cate_id_two: [],
|
|
|
+ // // 非接口参数
|
|
|
+ // pagesize: 20,
|
|
|
+ // total: 0,
|
|
|
+ // loading: true,
|
|
|
+ // noMore: true
|
|
|
+ // },
|
|
|
isWeixinApp: true
|
|
|
}
|
|
|
},
|
|
|
+ head() {
|
|
|
+ const {
|
|
|
+ title = "",
|
|
|
+ keyword = "",
|
|
|
+ description = "",
|
|
|
+ h1 = "",
|
|
|
+ canonical = "",
|
|
|
+ metaLocation
|
|
|
+ } = this.head || {}
|
|
|
+ let obj = {
|
|
|
+ title: title,
|
|
|
+ meta: [{
|
|
|
+ name: "keywords",
|
|
|
+ content: keyword
|
|
|
+ }, {
|
|
|
+ name: "description",
|
|
|
+ content: description
|
|
|
+ }, {
|
|
|
+ name: "h1",
|
|
|
+ content: h1
|
|
|
+ }],
|
|
|
+ link: [{rel: "canonical", href: canonical}]
|
|
|
+ }
|
|
|
+ if (metaLocation) {
|
|
|
+ obj.meta.push({name: "location", content: metaLocation})
|
|
|
+ }
|
|
|
+ return obj
|
|
|
+ },
|
|
|
computed: {
|
|
|
...mapState(["deviceType"]),
|
|
|
showWxHeader () {
|
|
|
@@ -288,32 +319,33 @@ export default {
|
|
|
},
|
|
|
mainMarginTop () {
|
|
|
if (this.mobile && this.showWxHeader) {
|
|
|
- return '64px'
|
|
|
+ return '64px !important'
|
|
|
} else if (this.mobile) {
|
|
|
- return '0px'
|
|
|
+ return '0px !important'
|
|
|
} else {
|
|
|
- return '20px'
|
|
|
+ return '20px !important'
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
async asyncData ({...params}) {
|
|
|
+ let dealDataObj = new DealSeoList(params)
|
|
|
+ let ans = await dealDataObj.dealData()
|
|
|
+
|
|
|
return {
|
|
|
- mobile: params.app.$deviceType.isMobile()
|
|
|
+ ...ans
|
|
|
}
|
|
|
},
|
|
|
- created() {
|
|
|
- this.baseUrl = this.$store.state.domainConfig.siteUrl;
|
|
|
- },
|
|
|
mounted () {
|
|
|
+ this.baseUrl = this.$store.state.domainConfig.siteUrl
|
|
|
this.isWeixinApp = navigator.userAgent.indexOf("miniProgram") > -1
|
|
|
- const self = this
|
|
|
- const getWorksCategoryPromise = this._getWorksCategory()
|
|
|
- const getWorksListPromise = this._getWorksList()
|
|
|
+ // const self = this
|
|
|
+ // const getWorksCategoryPromise = this._getWorksCategory()
|
|
|
+ // const getWorksListPromise = this._getWorksList()
|
|
|
|
|
|
- Promise.all([getWorksCategoryPromise, getWorksListPromise]).then(([a, b]) => {
|
|
|
- console.log(a, b)
|
|
|
- self.firstLoad = false
|
|
|
- })
|
|
|
+ // Promise.all([getWorksCategoryPromise, getWorksListPromise]).then(([a, b]) => {
|
|
|
+ // console.log(a, b)
|
|
|
+ // self.firstLoad = false
|
|
|
+ // })
|
|
|
},
|
|
|
methods: {
|
|
|
/**
|
|
|
@@ -440,9 +472,10 @@ export default {
|
|
|
* 分页页码改变时
|
|
|
*/
|
|
|
handlePageChange (val) {
|
|
|
- this.pagination.page = val
|
|
|
+ // this.pagination.page = val
|
|
|
|
|
|
- this._getWorksList()
|
|
|
+ // this._getWorksList()
|
|
|
+ window.location.href = `${window.location.origin}${window.location.pathname}?page=${val}`
|
|
|
},
|
|
|
/**
|
|
|
* mobile 加载更多
|
|
|
@@ -587,7 +620,7 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-.wx-header {
|
|
|
+.wx-header-custom {
|
|
|
position: fixed;
|
|
|
z-index: 11;
|
|
|
}
|