Commit 4fc2bea1 by 匡雅琴

提交

1 parent e702e8a7
...@@ -51,77 +51,77 @@ export default { ...@@ -51,77 +51,77 @@ export default {
}, },
created() {}, created() {},
mounted() { mounted() {
var carousel = document.querySelector('.carousel') // var carousel = document.querySelector('.carousel')
var cells = carousel.querySelectorAll('.carousel__cell') // // var cells = carousel.querySelectorAll('.carousel__cell')
var cellCount // cellCount set from cells-range input value // var cellCount // cellCount set from cells-range input value
var selectedIndex = 0 // var selectedIndex = 0
var cellWidth = carousel.offsetWidth // var cellWidth = carousel&&carousel.offsetWidth
var cellHeight = carousel.offsetHeight // var cellHeight = carousel&&carousel.offsetHeight
var isHorizontal = true // var isHorizontal = true
var rotateFn = isHorizontal ? 'rotateY' : 'rotateX' // var rotateFn = isHorizontal ? 'rotateY' : 'rotateX'
var radius, theta // var radius, theta
// console.log( cellWidth, cellHeight ); // // console.log( cellWidth, cellHeight );
function rotateCarousel() { // function rotateCarousel() {
var angle = theta * selectedIndex * -1 // var angle = theta * selectedIndex * -1
carousel.style.transform = 'translateZ(' + -radius + 'px) ' + rotateFn + '(' + angle + 'deg)' // carousel.style.transform = 'translateZ(' + -radius + 'px) ' + rotateFn + '(' + angle + 'deg)'
} // }
var prevButton = document.querySelector('.previous-button') // var prevButton = document.querySelector('.previous-button')
prevButton.addEventListener('click', function () { // prevButton.addEventListener('click', function () {
selectedIndex-- // selectedIndex--
rotateCarousel() // rotateCarousel()
}) // })
var nextButton = document.querySelector('.next-button') // var nextButton = document.querySelector('.next-button')
nextButton.addEventListener('click', function () { // nextButton.addEventListener('click', function () {
selectedIndex++ // selectedIndex++
rotateCarousel() // rotateCarousel()
}) // })
var cellsRange = document.querySelector('.cells-range') // var cellsRange = document.querySelector('.cells-range')
cellsRange.addEventListener('change', changeCarousel) // cellsRange.addEventListener('change', changeCarousel)
cellsRange.addEventListener('input', changeCarousel) // cellsRange.addEventListener('input', changeCarousel)
function changeCarousel() { // function changeCarousel() {
cellCount = cellsRange.value // cellCount = cellsRange.value
theta = 360 / cellCount // theta = 360 / cellCount
var cellSize = isHorizontal ? cellWidth : cellHeight // var cellSize = isHorizontal ? cellWidth : cellHeight
radius = Math.round(cellSize / 2 / Math.tan(Math.PI / cellCount)) // radius = Math.round(cellSize / 2 / Math.tan(Math.PI / cellCount))
for (var i = 0; i < cells.length; i++) { // for (var i = 0; i < cells.length; i++) {
var cell = cells[i] // var cell = cells[i]
if (i < cellCount) { // if (i < cellCount) {
// visible cell // // visible cell
cell.style.opacity = 1 // cell.style.opacity = 1
var cellAngle = theta * i // var cellAngle = theta * i
cell.style.transform = rotateFn + '(' + cellAngle + 'deg) translateZ(' + radius + 'px) ' + `translateZ (100px)` // cell.style.transform = rotateFn + '(' + cellAngle + 'deg) translateZ(' + radius + 'px) ' + `translateZ (100px)`
} else { // } else {
// hidden cell // // hidden cell
cell.style.opacity = 0 // cell.style.opacity = 0
cell.style.transform = 'none' // cell.style.transform = 'none'
} // }
} // }
rotateCarousel() // rotateCarousel()
} // }
var orientationRadios = document.querySelectorAll('input[name="orientation"]') // var orientationRadios = document.querySelectorAll('input[name="orientation"]')
;(function () { // ;(function () {
for (var i = 0; i < orientationRadios.length; i++) { // for (var i = 0; i < orientationRadios.length; i++) {
var radio = orientationRadios[i] // var radio = orientationRadios[i]
radio.addEventListener('change', onOrientationChange) // radio.addEventListener('change', onOrientationChange)
} // }
})() // })()
function onOrientationChange() { // function onOrientationChange() {
var checkedRadio = document.querySelector('input[name="orientation"]:checked') // var checkedRadio = document.querySelector('input[name="orientation"]:checked')
isHorizontal = checkedRadio.value == 'horizontal' // isHorizontal = checkedRadio.value == 'horizontal'
rotateFn = isHorizontal ? 'rotateY' : 'rotateX' // rotateFn = isHorizontal ? 'rotateY' : 'rotateX'
changeCarousel() // changeCarousel()
} // }
// set initials // // set initials
onOrientationChange() // onOrientationChange()
}, },
methods: {} methods: {}
} }
......
...@@ -8,14 +8,14 @@ ...@@ -8,14 +8,14 @@
--> -->
<template> <template>
<div> <div>
<div :id="domId" style="width: 100%;" :style="{ height }"></div> <div :id="domId" style="width: 100%" :style="{ height }"></div>
</div> </div>
</template> </template>
<script type="text/ecmascript-6"> <script type="text/ecmascript-6">
import * as echarts from 'echarts' import * as echarts from 'echarts'
import getBarLineOptions from './BarLineOptions' import getBarLineOptions from './BarLineOptions'
export default { export default {
name: 'BarLineChart', name: 'BarLineChart',
props: { props: {
height: { height: {
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
} }
} }
}, },
data() { data() {
return { return {
barLineOptions: [], barLineOptions: [],
...@@ -52,7 +53,10 @@ ...@@ -52,7 +53,10 @@
this.barLineDom = document.getElementById(this.domId) this.barLineDom = document.getElementById(this.domId)
this[this.domId] = echarts.init(this.barLineDom) this[this.domId] = echarts.init(this.barLineDom)
this.chartBindEvent() this.chartBindEvent()
this.drawBarLine() setTimeout(()=>{
},
1000)
}, },
methods: { methods: {
drawBarLine() { drawBarLine() {
...@@ -69,9 +73,7 @@ ...@@ -69,9 +73,7 @@
}) })
} }
} }
} }
</script> </script>
<style scoped lang="scss">
</style>
<style scoped lang="scss"></style>
<template> <template>
<div class="big-module-box"> <div class="big-module-box">
<BoxTitle :title="'使用大模型创建活动的趋势'" :fontSize="16"></BoxTitle> <BoxTitle :title="'使用大模型创建活动的趋势'" :fontSize="16"></BoxTitle>
<BarChart ref="bigModuleChartRef" :height="'15.83'" domId="bigModuleChart" :dataList.sync="bigModuleChartDataList"></BarChart> <BarChart ref="bigModuleChartRef" :height="'15.83vh'" domId="bigModuleChart" :dataList.sync="bigModuleChartDataList"></BarChart>
</div> </div>
</template> </template>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<div class="near-thread-box"> <div class="near-thread-box">
<BoxTitle :title="'近12个月的线索推送情况'" :fontSize="18"></BoxTitle> <BoxTitle :title="'近12个月的线索推送情况'" :fontSize="18"></BoxTitle>
<img class="bottom-line" src="@/assets/images/bottomLine.png" alt="" /> <img class="bottom-line" src="@/assets/images/bottomLine.png" alt="" />
<BarChart ref="nearThreadChartRef" :height="'22.83'" domId="nearThreadChart" :dataList.sync="nearThreadDataList"></BarChart> <BarChart ref="nearThreadChartRef" :height="'22.83vh'" domId="nearThreadChart" :dataList.sync="nearThreadDataList"></BarChart>
</div> </div>
</template> </template>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!