对接产品分页接口数据
This commit is contained in:
parent
c6b7e34e3a
commit
a1fd60420d
@ -4,6 +4,7 @@
|
|||||||
.img_reset {
|
.img_reset {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
object-fit: cover;
|
||||||
}
|
}
|
||||||
.box_shadow {
|
.box_shadow {
|
||||||
transition: all 0.3s linear;
|
transition: all 0.3s linear;
|
||||||
|
@ -1,15 +1,22 @@
|
|||||||
<template>
|
<template>
|
||||||
<aside class="aside-tree">
|
<aside class="aside-tree">
|
||||||
<div>
|
<div>
|
||||||
<h3 class="aside-header">{{ headerTitle }}</h3>
|
<nuxt-link class="aside-header" :to="baseUrl">
|
||||||
<nav class="tree-box">
|
<h3>{{ headerTitle }}</h3>
|
||||||
|
</nuxt-link>
|
||||||
|
<nav class="tree-box">
|
||||||
|
<no-ssr>
|
||||||
<el-tree
|
<el-tree
|
||||||
:data="treeData"
|
:data="treeData"
|
||||||
node-key="id"
|
node-key="id"
|
||||||
highlight-current
|
highlight-current
|
||||||
|
default-expand-all
|
||||||
:props="props"
|
:props="props"
|
||||||
|
current-node-key="43bb1e22091c0f674453c8db7e89b4a3"
|
||||||
|
@current-change="handleNodeClick"
|
||||||
/>
|
/>
|
||||||
</nav>
|
</no-ssr>
|
||||||
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mt-2">
|
<div class="mt-2">
|
||||||
@ -57,13 +64,38 @@ export default {
|
|||||||
label: 'label'
|
label: 'label'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
baseUrl: {
|
||||||
|
type: String,
|
||||||
|
default: '/'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {}
|
return {
|
||||||
|
currentNodeKey: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
'$route.query.catgId': {
|
||||||
|
handler (val) {
|
||||||
|
this.currentNodeKey = val
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleNodeClick(row,node) {
|
||||||
|
if (node.isLeaf) {
|
||||||
|
this.$router.push({
|
||||||
|
path: `${this.baseUrl}`,
|
||||||
|
query: {
|
||||||
|
...this.$route.query,
|
||||||
|
catgId: row.id
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -75,6 +107,7 @@ export default {
|
|||||||
.aside-tree {
|
.aside-tree {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
@mixin header {
|
@mixin header {
|
||||||
|
display: block;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 1.5rem 0;
|
padding: 1.5rem 0;
|
||||||
text-indent: 2.125rem;
|
text-indent: 2.125rem;
|
||||||
|
@ -27,7 +27,7 @@ export default {
|
|||||||
total: {
|
total: {
|
||||||
default: 99
|
default: 99
|
||||||
},
|
},
|
||||||
page: {
|
pageNum : {
|
||||||
default: 1
|
default: 1
|
||||||
},
|
},
|
||||||
rows: {
|
rows: {
|
||||||
@ -35,7 +35,7 @@ export default {
|
|||||||
},
|
},
|
||||||
pageKey: {
|
pageKey: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'page'
|
default: 'pageNum'
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -5,7 +5,12 @@
|
|||||||
|
|
||||||
<section class="container pt-4 pb-4">
|
<section class="container pt-4 pb-4">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<AsideTree class="col-md-3 mb-4 mb-md-0" :treeData="categoryTree" :headerTitle="$t('products.allProducts')"/>
|
<AsideTree
|
||||||
|
class="col-md-3 mb-4 mb-md-0"
|
||||||
|
:treeData="categoryTree"
|
||||||
|
:headerTitle="$t('products.allProducts')"
|
||||||
|
baseUrl="/products"
|
||||||
|
/>
|
||||||
<main class="col-md-9">
|
<main class="col-md-9">
|
||||||
<div class="pretty-header">
|
<div class="pretty-header">
|
||||||
<h2>Low Bed Trailer</h2>
|
<h2>Low Bed Trailer</h2>
|
||||||
|
@ -2,30 +2,32 @@
|
|||||||
<!-- 产品列表 -->
|
<!-- 产品列表 -->
|
||||||
<section class="products-list">
|
<section class="products-list">
|
||||||
<ul class="row pl-0">
|
<ul class="row pl-0">
|
||||||
<li class="col-12 col-md-4" v-for="item in 6" :key="item">
|
<li class="col-12 col-md-4" v-for="item in pordObj.records" :key="item.id">
|
||||||
<nuxt-link
|
<nuxt-link
|
||||||
class="products-item box_shadow mt-2"
|
class="products-item box_shadow mt-2"
|
||||||
to="/products/123123"
|
to="/products/123123"
|
||||||
>
|
>
|
||||||
<article class="product-card box_shadow">
|
<article class="product-card box_shadow">
|
||||||
<b-img src="~assets/image/banner/home-pord1.png" fluid alt="product"></b-img>
|
<img style="height: 200px;" class="img_reset" :src="item.mainPic" alt="product"></img>
|
||||||
<div class="product-card-content">
|
<div class="product-card-content">
|
||||||
<h4 class="text-ellipsis">SINOTRUK HOWO Tractor Truck Head</h4>
|
<h4 class="text-ellipsis">{{ item.title }}</h4>
|
||||||
<p>{{ $t('common.truckModel') }}: ZZ4257N3247C1</p>
|
<div class="prod-desc text-ellipsis" v-html="item.description"></div>
|
||||||
|
<!-- <p>{{ $t('common.truckModel') }}: ZZ4257N3247C1</p>
|
||||||
<p>{{ $t('common.dimension') }}: 6800x2490x3668</p>
|
<p>{{ $t('common.dimension') }}: 6800x2490x3668</p>
|
||||||
<p>{{ $t('common.approachingAngle/Departure') }}: 16/70</p>
|
<p>{{ $t('common.approachingAngle/Departure') }}: 16/70</p> -->
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
</nuxt-link>
|
</nuxt-link>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<SeoPagination class="mt-4" />
|
<SeoPagination class="mt-4" :total="pordObj.total" />
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'products-list',
|
name: 'products-list',
|
||||||
|
watchQuery: ['pageNum', 'catgId'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
bannerTopOptions: {
|
bannerTopOptions: {
|
||||||
@ -33,6 +35,19 @@ export default {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
async asyncData({$axios,query}) {
|
||||||
|
let params = {
|
||||||
|
pageNum: query.pageNum || 1,
|
||||||
|
pageSize: 9,
|
||||||
|
catgId: query.catgId || '',
|
||||||
|
}
|
||||||
|
let {data: pordObj} = await $axios('/web/prodPageList', {params})
|
||||||
|
console.log(pordObj);
|
||||||
|
|
||||||
|
return {
|
||||||
|
pordObj
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -47,8 +62,16 @@ export default {
|
|||||||
li {
|
li {
|
||||||
padding: 0 .3125rem;
|
padding: 0 .3125rem;
|
||||||
.products-item {
|
.products-item {
|
||||||
|
width: 100%;
|
||||||
|
display: inline-block;
|
||||||
border: 1px solid #e6e8ec;
|
border: 1px solid #e6e8ec;
|
||||||
|
.product-card {
|
||||||
|
width: 100%;
|
||||||
|
height: min-content;
|
||||||
|
}
|
||||||
.product-card-content {
|
.product-card-content {
|
||||||
|
width: 100%;
|
||||||
|
height: 8.25rem;
|
||||||
padding: 1.125rem 1rem;
|
padding: 1.125rem 1rem;
|
||||||
border-top: .0625rem solid #e6e8ec;
|
border-top: .0625rem solid #e6e8ec;
|
||||||
font-size: .875rem;
|
font-size: .875rem;
|
||||||
@ -61,6 +84,9 @@ export default {
|
|||||||
p {
|
p {
|
||||||
color: #878b90;
|
color: #878b90;
|
||||||
}
|
}
|
||||||
|
.prod-desc {
|
||||||
|
-webkit-line-clamp: 4; //行数
|
||||||
|
}
|
||||||
.view-details {
|
.view-details {
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
margin-top: 2rem;
|
margin-top: 2rem;
|
||||||
|
Loading…
Reference in New Issue
Block a user