Commit 47a6aefa authored by zhanglw's avatar zhanglw

首页地区排名

parent 2b3f44fd
......@@ -215,6 +215,20 @@ export default {
}).then((res) => {
this.topSuppliers = res.data.topSuppliers
this.topProducts = res.data.topProducts
const random = (min, max) => {
return Math.floor(Math.random() * (max - min)) + min
}
const arr = res.data.topArea[0].topArea
arr.forEach((item, index) => {
this.topAreas.push({
name: item,
top: `${random(0, 382)}px`,
left: `${random(0, 324)}px`,
size: `${Math.max(80 - index * 7, 12)}px`
})
})
this.topAreas[0].top = '180px'
this.topAreas[0].left = '120px'
})
HttpReq.webClientApi.homePageGetPartners({
preview: false
......@@ -226,20 +240,6 @@ export default {
}).then((res) => {
this.showcaseSuppliers = res.data.showcaseSuppliers
})
const random = (min, max) => {
return Math.floor(Math.random() * (max - min)) + min
}
const arr = ['北京', '上海', '广州', '深圳', '青岛', '南京', '杭州', '天津', '石家庄', '济南', '烟台', '威海', '大连', '连云港', '潍坊']
arr.forEach((item, index) => {
this.topAreas.push({
name: item,
top: `${random(0, 382)}px`,
left: `${random(0, 324)}px`,
size: `${Math.max(80 - index * 7, 12)}px`
})
})
this.topAreas[0].top = '180px'
this.topAreas[0].left = '120px'
})
},
methods: {
......
......@@ -158,7 +158,11 @@ export default {
}).then((res) => {
this.informationList = res.data.information.data
this.total = res.data.information.total
this.promotionObj = res.data.advertisement.data[0] || { imgSrc: '', url: '' }
if (res.data.advertisement.data) {
this.promotionObj = res.data.advertisement.data[0]
} else {
this.promotionObj = { imgSrc: '', url: '' }
}
if (this.page === 1) {
this.topList = []
if (this.informationList[0]) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment