Commit a531739b by 匡雅琴

Merge branch 'v1.0.0' of http://192.168.3.233:8090/h5/glsk-data-view-pd into v1.0.0

2 parents 9eb44eaa 191ba880
......@@ -67,7 +67,7 @@ function getBarLineOptions(obj) {
data: [],
label: {
show: true,
position: 'insideTop',
position: 'top',
color: '#fff'
},
itemStyle: {
......@@ -107,7 +107,7 @@ function getBarLineOptions(obj) {
stack: 'one',
label: {
show: true,
position: 'insideTop',
position: 'top',
color: '#fff'
},
data: [],
......
......@@ -3,7 +3,7 @@
* @Author: huyue
* @Date: 2023-07-07 14:04:52
* @LastEditors: huyue
* @LastEditTime: 2023-07-10 14:50:24
* @LastEditTime: 2023-07-10 15:33:57
*/
import * as echarts from 'echarts'
function getBarLineOptions(obj) {
......@@ -43,7 +43,9 @@ function getBarLineOptions(obj) {
type: 'bar',
data: [],
label: {
show: true
show: true,
position: 'top',
color: '#fff'
},
itemStyle: {
barBorderRadius: [2, 2, 0, 0], // 柱体圆角
......@@ -69,7 +71,9 @@ function getBarLineOptions(obj) {
name: 'bar2',
type: 'bar',
label: {
show: true
show: true,
position: 'top',
color: '#fff'
},
data: [],
itemStyle: {
......@@ -96,7 +100,9 @@ function getBarLineOptions(obj) {
name: 'bar3',
type: 'bar',
label: {
show: true
show: true,
position: 'top',
color: '#fff'
},
data: [],
itemStyle: {
......@@ -123,7 +129,9 @@ function getBarLineOptions(obj) {
name: 'bar4',
type: 'bar',
label: {
show: true
show: true,
position: 'top',
color: '#fff'
},
data: [],
itemStyle: {
......
<template>
<div class="marquee-box" ref="marqueeBox">
<span class="marquee" ref="marqueeText" :style="[{ transition: `all ${move ? speed : 0}s linear` }, { left: target }]">{{ text }}</span>
</div>
</template>
<script type="text/ecmascript-6">
export default {
name: 'Marquee',
props: {
text: String,
direction: {
type: Number,
default: 5000
},
delay: {
type: Number,
default: 1000
}
},
data() {
return {
move: false,
valueWidth: 0,
target: 0,
boxWidth: 0,
speed: 0
}
},
mounted() {
setTimeout(() => {
const { marqueeBox, marqueeText } = this.$refs
if (!marqueeBox) return
const boxWidth = marqueeBox.offsetWidth
const valueWidth = marqueeText.offsetWidth
this.valueWidth = valueWidth
this.boxWidth = boxWidth
if (boxWidth - 20 <= valueWidth) this.run(valueWidth)
}, this.delay)
},
methods: {
run() {
const { valueWidth, direction } = this
this.target = `-${valueWidth}px`
this.move = true
this.speed = direction / 1000
setTimeout(() => {
this.again()
}, direction)
},
again() {
const { boxWidth, valueWidth, direction } = this
this.move = false
this.target = `${boxWidth}px`
setTimeout(() => {
this.speed = direction * (boxWidth / valueWidth).toFixed(2) / 1000
this.move = true
this.reset()
}, 500)
},
reset() {
const awaitTime = (this.speed + 2) * this.delay
this.target = 0
setTimeout(() => {
this.run()
}, awaitTime)
}
}
}
</script>
<style scoped lang="scss">
.marquee-box {
width: 100%;
height: 100%;
overflow: hidden;
position: relative;
.marquee {
position: absolute;
white-space: nowrap;
display: flex;
align-items: center;
}
.move {
transform: translateX(-100%);
}
}
</style>
......@@ -17,7 +17,9 @@ const DefaultData = {
label: '业务数据 | 2.1会员权益',
value: '4'
}
]
],
directionTimer: 3000,
delayTimer: 3000
}
const RankColor = ['linear-gradient(180deg, #FFDA0B 0%, #FFBC24 100%)', 'linear-gradient(180deg, #EBE5D6 0%, #BDB4A6 100%)', 'linear-gradient(180deg, #EEC08E 0%, #B86E3A 100%)']
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!