Commit 24da050b by 胡悦

Merge branch 'dev_v1.0.0' of http://192.168.3.233:8090/gh/data-view into dev_v1.0.0

2 parents 3da7c835 d1b555e2
<template>
<div class="line-box">
<p v-if="title" class="title">{{ title }}</p>
<div id="line-chart" class="line-chart"></div>
<div class="rank-box">
<div>
<p :class="[ 'rank-title', rankFlag == 'first' ? 'rank-active' : '' ]" @click="handleRankChange('first')">前5{{ storeOrBrandTxt }}</p>
<p :class="[ 'rank-title', rankFlag == 'last' ? 'rank-active' : '' ]" @click="handleRankChange('last')">后5{{ storeOrBrandTxt }}</p>
</div>
</div>
</div>
</template>
<script>
import * as echarts from 'echarts'
import options from './lineOptions'
export default {
name: 'LineChart',
props: {
// height: {
// type: String,
// default: '19.8vh'
// },
apiName: {
type: String,
default: ''
},
title: {
type: String,
default: ''
},
storeOrBrandTxt: {
type: String,
default: '门店'
}
},
data() {
return {
// first,last
rankFlag: 'first',
lineOptions: JSON.parse(JSON.stringify(options))
// chartHeight: this.height
}
},
created() {
},
mounted() {
this.drawLine()
},
methods: {
drawLine() {
var lineDom = document.getElementById('line-chart')
var lineChart = echarts.init(lineDom)
lineChart.setOption(this.lineOptions)
},
handleRankChange(value) {
this.rankFlag = value
}
}
}
</script>
<style lang="scss" scoped>
p {
margin: 0 0;
}
.line-box {
color: #ffffff;
padding: 4px 8px;
font-size: 0.75em;
.title {
height: 17px;
color: #e8e8e8;
}
.line-chart {
height: calc(100% - 25px - 30px);
}
.rank-box {
display: flex;
height: 30px;
.rank-title {
box-sizing: border-box;
font-size: 0.6em;
background: #353535;
padding: 1px 5px;
height: 15px;
line-height: 15px;
opacity: 0.7;
cursor: pointer;
}
.rank-active {
opacity: 1;
color: #ffffff;
background: #eb6001;
}
}
}
</style>
<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: 0
}
},
data () {
return {
move: false,
valueWidth: 0,
target: 0,
boxWidth: 0,
speed: 0
}
},
mounted () {
setTimeout(() => {
let { marqueeBox, marqueeText } = this.$refs
let boxWidth = marqueeBox.offsetWidth,
valueWidth = marqueeText.offsetWidth
this.valueWidth = valueWidth
this.boxWidth = boxWidth
if (boxWidth - 20 <= valueWidth) this.run(valueWidth)
}, this.delay)
},
methods: {
run () {
let { valueWidth, direction } = this
this.target = `-${valueWidth}px`
this.move = true
this.speed = direction / 1000
setTimeout(() => {
this.again()
}, direction)
},
again () {
let { 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 () {
let awaitTime = (this.speed + 2) * 1000
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>
\ No newline at end of file \ No newline at end of file
...@@ -8,6 +8,9 @@ ...@@ -8,6 +8,9 @@
@click="change(index)" @click="change(index)"
> >
{{i}} {{i}}
<template v-if="index == 1">
<div class="arrow"></div>
</template>
</div> </div>
</template> </template>
<div <div
...@@ -68,7 +71,6 @@ export default { ...@@ -68,7 +71,6 @@ export default {
mounted () { mounted () {
test.map(e => e.active = false) test.map(e => e.active = false)
this.brands = test this.brands = test
console.log(this.$store)
}, },
methods: { methods: {
change (index, item) { change (index, item) {
...@@ -127,15 +129,36 @@ export default { ...@@ -127,15 +129,36 @@ export default {
border-radius: 4px 0px 0px 4px; border-radius: 4px 0px 0px 4px;
} }
.brand { .brand {
padding-left: 16px; padding: 0 16px;
border-radius: 0 4px 4px 0; border-radius: 0 4px 4px 0;
&:hover ~ .options-box { &:hover ~ .options-box {
display: block; display: block;
} }
.arrow {
position: relative;
top: 4.5px;
border-top: 4.5px solid #eb6001;
border-right: 4.5px solid transparent;
border-bottom: 4.5px solid transparent;
border-left: 4.5px solid transparent;
margin-left: auto;
transition: all 0.25s;
}
&:hover {
.arrow {
transform: rotate(-180deg);
top: 0;
}
}
} }
.active { .active {
color: #fff; color: #fff;
background: #eb6001; background: #eb6001;
.arrow {
border-top-color: #fff;
transform: rotate(-180deg);
top: 0;
}
} }
.options-box { .options-box {
display: none; display: none;
......
<template> <template>
<div class="tabs"> <div class="tabs">
<div class="tab"> <div class="tab pointer">
<div class="tab-left box"> <div class="tab-left box">
<div class="title inline">客户总数</div> <div class="title inline">客户总数</div>
</div> </div>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
alt="logo" alt="logo"
> >
</div> </div>
<div class="title flex user-select">广汇集团客户池数据大屏</div> <div class="view-title flex user-select">广汇集团客户池数据大屏</div>
<div class="time"> <div class="time">
<div class="top">{{now}}</div> <div class="top">{{now}}</div>
<div class="bottom">数据截止至 {{yesterday}}</div> <div class="bottom">数据截止至 {{yesterday}}</div>
...@@ -47,7 +47,7 @@ export default { ...@@ -47,7 +47,7 @@ export default {
box-sizing: border-box; box-sizing: border-box;
padding: 0 24px; padding: 0 24px;
position: relative; position: relative;
.title { .view-title {
color: transparent; color: transparent;
background: linear-gradient(left, #e60115 10%, #eb6001 25%, #f5aa01 50%, #fdf006 100%); background: linear-gradient(left, #e60115 10%, #eb6001 25%, #f5aa01 50%, #fdf006 100%);
-webkit-background-clip: text; -webkit-background-clip: text;
......
var lineOptions = {
visualMap: [
{
show: false,
type: 'continuous',
seriesIndex: 0,
min: 0,
max: 400
},
{
show: false,
type: 'continuous',
seriesIndex: 1,
dimension: 0,
min: 0,
max: 0
}
],
title: [
{
left: 'center',
text: 'Gradient along the y axis'
},
{
top: '55%',
left: 'center',
text: 'Gradient along the x axis'
}
],
tooltip: {
trigger: 'axis'
},
xAxis: [
{
data: []
},
{
data: [],
gridIndex: 1
}
],
yAxis: [
{},
{
gridIndex: 1
}
],
grid: [
{
bottom: '60%'
},
{
top: '60%'
}
],
series: [
{
type: 'line',
showSymbol: false,
data: []
},
{
type: 'line',
showSymbol: false,
data: [],
xAxisIndex: 1,
yAxisIndex: 1
}
]
}
export default lineOptions
...@@ -3,7 +3,7 @@ export default { ...@@ -3,7 +3,7 @@ export default {
watchReportParams: { watchReportParams: {
immediate: true, immediate: true,
handler (newval) { handler (newval) {
this.init() // this.init()
} }
} }
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!