|
|
@@ -206,19 +206,21 @@
|
|
|
</style>-->
|
|
|
<template>
|
|
|
<div class="statistics">
|
|
|
- <ul class="list-inline pull-left" ref="pingdanListWrapper" :style="{top: topLeft + 'rem'}" :class="{no_tran: topLeft == 2.4}">
|
|
|
- <li v-for="(item, index) in itemData" v-if="index <= 4">
|
|
|
+ <!--<ul class="list-inline pull-left" :style="{top: topLeft + 'rem'}" :class="{no_tran: topLeft == 2.4}">-->
|
|
|
+ <ul class="list-inline pull-left" ref="pingdanListWrapper" :style="'top: -' + 1 * timerIndexL + 'rem'" :class="{'topL': isTopL}">
|
|
|
+ <li v-for="(item, index) in itemLeft">
|
|
|
<span class="number">
|
|
|
- <span class="name" v-html="count[index]"></span>
|
|
|
+ <span class="name" v-html="countLeft[index]"></span>
|
|
|
<span class="num" v-html="formatNumber(item.count, index)"></span>
|
|
|
<span class="unit" v-if="item.type === 3">家</span>
|
|
|
</span>
|
|
|
</li>
|
|
|
</ul>
|
|
|
- <ul class="list-inline pull-right" ref="pingdanListWrapper" :style="{top: topRight + 'rem'}" :class="{no_tran: topRight == 2.4}">
|
|
|
- <li v-for="(item, index) in itemData" v-if="index > 4">
|
|
|
+ <!--<ul class="list-inline pull-right" :style="{top: topRight + 'rem'}" :class="{no_tran: topRight == 2.4}">-->
|
|
|
+ <ul class="list-inline pull-right" ref="pingdanListWrapper" :style="'top: -' + 1 * timerIndexR + 'rem'" :class="{'topR': isTopR}">
|
|
|
+ <li v-for="(item, index) in itemRight">
|
|
|
<span class="number">
|
|
|
- <span class="name" v-html="count[index]"></span>
|
|
|
+ <span class="name" v-html="countRight[index]"></span>
|
|
|
<span class="month" v-if="index === 5">(上月)</span>
|
|
|
<span class="month" v-if="index === 6">(本月)</span>
|
|
|
<span class="num" v-html="formatDouble(item.count)"></span>
|
|
|
@@ -235,11 +237,18 @@
|
|
|
data () {
|
|
|
return {
|
|
|
step: 1,
|
|
|
- count: ['现货', '品牌', '规格书', '供应商', '店铺', '询价求购', '询价求购', '上年交易', '本年交易'],
|
|
|
+ countLeft: ['现货', '品牌', '规格书', '供应商', '店铺'],
|
|
|
+ countRight: ['询价求购', '询价求购', '上年交易', '本年交易'],
|
|
|
topLeft: 0,
|
|
|
topRight: 0,
|
|
|
+ timer: {},
|
|
|
timerIndex: 0,
|
|
|
- timer: {}, // 定时器实体
|
|
|
+ timerIndexL: 0,
|
|
|
+ timerIndexR: 0,
|
|
|
+ isTopL: false,
|
|
|
+ isTopR: false,
|
|
|
+ timerL: {},
|
|
|
+ timerR: {}, // 定时器实体
|
|
|
imgbox: {
|
|
|
'src': ''
|
|
|
}
|
|
|
@@ -247,17 +256,17 @@
|
|
|
},
|
|
|
mounted () {
|
|
|
this.$nextTick(() => {
|
|
|
- this.changeIntervalL()
|
|
|
- this.changeIntervalR()
|
|
|
+ this.changeIntervalL(true)
|
|
|
+// this.changeIntervalR(true)
|
|
|
})
|
|
|
},
|
|
|
methods: {
|
|
|
// changeIntervalL () {
|
|
|
// setInterval(() => {
|
|
|
// this.topLeft += -1
|
|
|
-// let arr1 = this.itemData.slice(0, 5)
|
|
|
-// let arr2 = arr1.shift()
|
|
|
-// arr1.push(arr2)
|
|
|
+// // let arr1 = this.itemData.slice(0, 5)
|
|
|
+// // let arr2 = arr1.shift()
|
|
|
+// // arr1.push(arr2)
|
|
|
// if (this.topLeft === -5) {
|
|
|
// this.topLeft = 0
|
|
|
// }
|
|
|
@@ -266,10 +275,10 @@
|
|
|
// changeIntervalR () {
|
|
|
// setInterval(() => {
|
|
|
// this.topRight += -1
|
|
|
-// let arr1 = this.itemData.slice(5, 9)
|
|
|
-// let arr2 = arr1.shift()
|
|
|
-// arr1.push(arr2)
|
|
|
-// this.itemDataTemp.push(this.itemData)
|
|
|
+// // let arr1 = this.itemData.slice(5, 9)
|
|
|
+// // let arr2 = arr1.shift()
|
|
|
+// // arr1.push(arr2)
|
|
|
+// // this.itemDataTemp.push(this.itemData)
|
|
|
// if (this.topRight === -4) {
|
|
|
// this.topRight = 0
|
|
|
// }
|
|
|
@@ -277,50 +286,50 @@
|
|
|
// },
|
|
|
changeIntervalL: function (flag) {
|
|
|
if (flag) {
|
|
|
- this.timer = setInterval(() => {
|
|
|
- this.isTop = false
|
|
|
+ this.timerL = setInterval(() => {
|
|
|
+ this.isTopL = false
|
|
|
let isChange = true
|
|
|
- this.timerIndex++
|
|
|
+ this.timerIndexL++
|
|
|
let _transitionEvent = whichTransitionEvent()
|
|
|
_transitionEvent && this.$refs.pingdanListWrapper[0].addEventListener(
|
|
|
_transitionEvent, () => {
|
|
|
console.log(isChange)
|
|
|
if (isChange) {
|
|
|
- let title = this.itemData.slice(0, 5).shift()
|
|
|
+ let title = this.itemLeft.shift()
|
|
|
this.title.push(title)
|
|
|
- this.timerIndex = 0
|
|
|
+ this.timerIndexL = 0
|
|
|
isChange = false
|
|
|
- this.isTop = true
|
|
|
+ this.isTopL = true
|
|
|
}
|
|
|
})
|
|
|
}, 2400)
|
|
|
} else {
|
|
|
- clearInterval(this.timer)
|
|
|
- }
|
|
|
- },
|
|
|
- changeIntervalR: function (flag) {
|
|
|
- if (flag) {
|
|
|
- this.timer = setInterval(() => {
|
|
|
- this.isTop = false
|
|
|
- let isChange = true
|
|
|
- this.timerIndex++
|
|
|
- let _transitionEvent = whichTransitionEvent()
|
|
|
- _transitionEvent && this.$refs.pingdanListWrapper[0].addEventListener(
|
|
|
- _transitionEvent, () => {
|
|
|
- console.log(isChange)
|
|
|
- if (isChange) {
|
|
|
- let title = this.itemData.slice(5, 9).shift()
|
|
|
- this.title.push(title)
|
|
|
- this.timerIndex = 0
|
|
|
- isChange = false
|
|
|
- this.isTop = true
|
|
|
- }
|
|
|
- })
|
|
|
- }, 3000)
|
|
|
- } else {
|
|
|
- clearInterval(this.timer)
|
|
|
+ clearInterval(this.timerL)
|
|
|
}
|
|
|
},
|
|
|
+// changeIntervalR: function (flag) {
|
|
|
+// if (flag) {
|
|
|
+// this.timerR = setInterval(() => {
|
|
|
+// this.isTopR = false
|
|
|
+// let isChange = true
|
|
|
+// this.timerIndexR++
|
|
|
+// let _transitionEvent = whichTransitionEvent()
|
|
|
+// _transitionEvent && this.$refs.pingdanListWrapper[0].addEventListener(
|
|
|
+// _transitionEvent, () => {
|
|
|
+// console.log(isChange)
|
|
|
+// if (isChange) {
|
|
|
+// let title = this.itemRight.shift()
|
|
|
+// this.title.push(title)
|
|
|
+// this.timerIndexR = 0
|
|
|
+// isChange = false
|
|
|
+// this.isTopR = true
|
|
|
+// }
|
|
|
+// })
|
|
|
+// }, 3000)
|
|
|
+// } else {
|
|
|
+// clearInterval(this.timerR)
|
|
|
+// }
|
|
|
+// },
|
|
|
formatNumber (num, type) {
|
|
|
if (num.toString().indexOf('E') !== -1) {
|
|
|
let arr = num.toString().split('E')
|
|
|
@@ -408,6 +417,12 @@
|
|
|
str.push({id: '店铺', count: this.list ? this.list : 0, type: 3})
|
|
|
str = [str[1], str[0], str[2], str[3], str[8], str[5], str[4], str[6], str[7]]
|
|
|
return str
|
|
|
+ },
|
|
|
+ itemLeft () {
|
|
|
+ return this.itemData.slice(0, 5)
|
|
|
+ },
|
|
|
+ itemRight () {
|
|
|
+ return this.itemData.slice(5, 9)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -426,6 +441,18 @@
|
|
|
width:50%;
|
|
|
position:relative;
|
|
|
transition: .5s all linear;
|
|
|
+ &.topL {
|
|
|
+ transition: top 0s;
|
|
|
+ -moz-transition: top 0s; /* Firefox 4 */
|
|
|
+ -webkit-transition: top 0s; /* Safari and Chrome */
|
|
|
+ -o-transition: top 0s; /* Opera */
|
|
|
+ }
|
|
|
+ &.topR {
|
|
|
+ transition: top 0s;
|
|
|
+ -moz-transition: top 0s; /* Firefox 4 */
|
|
|
+ -webkit-transition: top 0s; /* Safari and Chrome */
|
|
|
+ -o-transition: top 0s; /* Opera */
|
|
|
+ }
|
|
|
&:first-child{
|
|
|
margin-left: .0rem;
|
|
|
}
|