|
@@ -24,17 +24,21 @@
|
|
|
</router-link>
|
|
</router-link>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+ <h3>活动作品数统计</h3>
|
|
|
|
|
+ <div id="myChart" :style="{width: '100%', height: '600px'}">
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
-import {censusAllTotal, censusTodayTotal} from "@/api/wel/index";
|
|
|
|
|
|
|
+ import {activeTotal, censusAllTotal, censusTodayTotal} from "@/api/wel/index";
|
|
|
|
|
|
|
|
-export default {
|
|
|
|
|
|
|
+ var echarts = require('echarts');
|
|
|
|
|
+ export default {
|
|
|
name: "wel",
|
|
name: "wel",
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
- option:{
|
|
|
|
|
|
|
+ option: {
|
|
|
xAxis: {
|
|
xAxis: {
|
|
|
type: 'category',
|
|
type: 'category',
|
|
|
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
|
|
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
|
|
@@ -209,20 +213,179 @@ export default {
|
|
|
created() {
|
|
created() {
|
|
|
this.init()
|
|
this.init()
|
|
|
},
|
|
},
|
|
|
|
|
+ mounted() {
|
|
|
|
|
+ this.drawLine();
|
|
|
|
|
+ },
|
|
|
methods: {
|
|
methods: {
|
|
|
- init(){
|
|
|
|
|
|
|
+ drawLine() {
|
|
|
|
|
+/* activeTotal().then(res => {
|
|
|
|
|
+ const titleList = [];
|
|
|
|
|
+ const countList = [];
|
|
|
|
|
+ res.data.data.forEach(ele => {
|
|
|
|
|
+ titleList.push(ele.name);
|
|
|
|
|
+ countList.push(ele.value);
|
|
|
|
|
+ })
|
|
|
|
|
+ // 基于准备好的dom,初始化echarts实例
|
|
|
|
|
+ let myChart = echarts.init(document.getElementById('myChart'))
|
|
|
|
|
+ // 绘制图表
|
|
|
|
|
+ myChart.setOption({
|
|
|
|
|
+ title: {
|
|
|
|
|
+ text: '活动作品统计'
|
|
|
|
|
+ },
|
|
|
|
|
+ tooltip: {},
|
|
|
|
|
+ xAxis: {
|
|
|
|
|
+ data: titleList,
|
|
|
|
|
+ name: "活动名称",
|
|
|
|
|
+ axisLabel : {//坐标轴刻度标签的相关设置。
|
|
|
|
|
+ formatter : function(params){
|
|
|
|
|
+ var newParamsName = "";// 最终拼接成的字符串
|
|
|
|
|
+ var paramsNameNumber = params.length;// 实际标签的个数
|
|
|
|
|
+ var provideNumber = 6;// 每行能显示的字的个数
|
|
|
|
|
+ var rowNumber = Math.ceil(paramsNameNumber / provideNumber);// 换行的话,需要显示几行,向上取整
|
|
|
|
|
+ // 条件等同于rowNumber>1
|
|
|
|
|
+ if (paramsNameNumber > provideNumber) {
|
|
|
|
|
+
|
|
|
|
|
+ for (var p = 0; p < rowNumber; p++) {
|
|
|
|
|
+ var tempStr = "";// 表示每一次截取的字符串
|
|
|
|
|
+ var start = p * provideNumber;// 开始截取的位置
|
|
|
|
|
+ var end = start + provideNumber;// 结束截取的位置
|
|
|
|
|
+ // 此处特殊处理最后一行的索引值
|
|
|
|
|
+ if (p == rowNumber - 1) {
|
|
|
|
|
+ // 最后一次不换行
|
|
|
|
|
+ tempStr = params.substring(start, paramsNameNumber);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 每一次拼接字符串并换行
|
|
|
|
|
+ tempStr = params.substring(start, end) + "\n";
|
|
|
|
|
+ }
|
|
|
|
|
+ newParamsName += tempStr;// 最终拼成的字符串
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 将旧标签的值赋给新标签
|
|
|
|
|
+ newParamsName = params;
|
|
|
|
|
+ }
|
|
|
|
|
+ //将最终的字符串返回
|
|
|
|
|
+ return newParamsName
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ yAxis: {},
|
|
|
|
|
+ series: [{
|
|
|
|
|
+ name: '作品数',
|
|
|
|
|
+ type: 'bar',
|
|
|
|
|
+ data: countList
|
|
|
|
|
+ }],
|
|
|
|
|
+ grid:{//直角坐标系内绘图网格
|
|
|
|
|
+ bottom:"40%" //
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ });
|
|
|
|
|
+ });*/
|
|
|
|
|
+ /*activeTotal().then(res => {
|
|
|
|
|
+ let myChart = echarts.init(document.getElementById('myChart'))
|
|
|
|
|
+ myChart.setOption({
|
|
|
|
|
+ //backgroundColor: "#fff",
|
|
|
|
|
+ title: {
|
|
|
|
|
+ text: '活动作品统计',
|
|
|
|
|
+ left: 'center',
|
|
|
|
|
+ top: 20,
|
|
|
|
|
+ textStyle: {
|
|
|
|
|
+ color: '#000'
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ tooltip: {
|
|
|
|
|
+ trigger: 'item'
|
|
|
|
|
+ },
|
|
|
|
|
+ visualMap: {
|
|
|
|
|
+ show: false,
|
|
|
|
|
+ min: 80,
|
|
|
|
|
+ max: 600,
|
|
|
|
|
+ inRange: {
|
|
|
|
|
+ colorLightness: [0, 1]
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ series: [
|
|
|
|
|
+ {
|
|
|
|
|
+ name: '作品数',
|
|
|
|
|
+ type: 'pie',
|
|
|
|
|
+ radius: '55%',
|
|
|
|
|
+ center: ['50%', '50%'],
|
|
|
|
|
+ data: res.data.data
|
|
|
|
|
+ .sort(function (a, b) {
|
|
|
|
|
+ return a.value - b.value;
|
|
|
|
|
+ }),
|
|
|
|
|
+ roseType: 'radius',
|
|
|
|
|
+ label: {
|
|
|
|
|
+ color: '#000'
|
|
|
|
|
+ },
|
|
|
|
|
+ labelLine: {
|
|
|
|
|
+ lineStyle: {
|
|
|
|
|
+ color: '#000'
|
|
|
|
|
+ },
|
|
|
|
|
+ smooth: 0.2,
|
|
|
|
|
+ length: 10,
|
|
|
|
|
+ length2: 20
|
|
|
|
|
+ },
|
|
|
|
|
+ itemStyle: {
|
|
|
|
|
+ color: '#c23531',
|
|
|
|
|
+ shadowBlur: 200,
|
|
|
|
|
+ shadowColor: 'rgba(0, 0, 0, 0.5)'
|
|
|
|
|
+ },
|
|
|
|
|
+ animationType: 'scale',
|
|
|
|
|
+ animationEasing: 'elasticOut',
|
|
|
|
|
+ animationDelay: function () {
|
|
|
|
|
+ return Math.random() * 200;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ ]
|
|
|
|
|
+ })
|
|
|
|
|
+ })*/
|
|
|
|
|
+ activeTotal().then(res => {
|
|
|
|
|
+ var myChart = echarts.init(document.getElementById("myChart"));
|
|
|
|
|
+ myChart.setOption({
|
|
|
|
|
+ backgroundColor: '#fff',
|
|
|
|
|
+ title: {
|
|
|
|
|
+ left: 'center'
|
|
|
|
|
+ },
|
|
|
|
|
+ tooltip: {
|
|
|
|
|
+ trigger: 'item'
|
|
|
|
|
+ },
|
|
|
|
|
+ // legend: {
|
|
|
|
|
+ // orient: 'vertical',
|
|
|
|
|
+ // left: 'left'
|
|
|
|
|
+ // },
|
|
|
|
|
+ series: [
|
|
|
|
|
+ {
|
|
|
|
|
+ name: '作品数',
|
|
|
|
|
+ type: 'pie',
|
|
|
|
|
+ radius: '50%',
|
|
|
|
|
+ data: res.data.data,
|
|
|
|
|
+ emphasis: {
|
|
|
|
|
+ itemStyle: {
|
|
|
|
|
+ shadowBlur: 10,
|
|
|
|
|
+ shadowOffsetX: 0,
|
|
|
|
|
+ shadowColor: 'rgba(0, 0, 0, 0.5)'
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ ],
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ init() {
|
|
|
censusAllTotal().then(res => {
|
|
censusAllTotal().then(res => {
|
|
|
- let { data } = res.data
|
|
|
|
|
|
|
+ let {data} = res.data
|
|
|
this.dataSummaryData.map(item => {
|
|
this.dataSummaryData.map(item => {
|
|
|
return (item.count = data[item.key]) && item
|
|
return (item.count = data[item.key]) && item
|
|
|
})
|
|
})
|
|
|
- })
|
|
|
|
|
- censusTodayTotal().then(res=>{
|
|
|
|
|
- let { data } = res.data
|
|
|
|
|
|
|
+ });
|
|
|
|
|
+ censusTodayTotal().then(res => {
|
|
|
|
|
+ let {data} = res.data
|
|
|
this.addedTodayData.map(item => {
|
|
this.addedTodayData.map(item => {
|
|
|
return (item.count = data[item.key]) && item
|
|
return (item.count = data[item.key]) && item
|
|
|
})
|
|
})
|
|
|
- })
|
|
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
};
|
|
};
|
|
@@ -256,20 +419,25 @@ export default {
|
|
|
&:nth-child(1) {
|
|
&:nth-child(1) {
|
|
|
background-color: #4065E0;
|
|
background-color: #4065E0;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
&:nth-child(2) {
|
|
&:nth-child(2) {
|
|
|
background-color: #6F7FFA;
|
|
background-color: #6F7FFA;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
&:nth-child(3) {
|
|
&:nth-child(3) {
|
|
|
background-color: #6FCAFA;
|
|
background-color: #6FCAFA;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
&:nth-child(4) {
|
|
&:nth-child(4) {
|
|
|
background-color: #1DD3B7;
|
|
background-color: #1DD3B7;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
.info {
|
|
.info {
|
|
|
margin-left: 40px;
|
|
margin-left: 40px;
|
|
|
display: flex;
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
flex-direction: column;
|
|
|
align-items: center;
|
|
align-items: center;
|
|
|
|
|
+
|
|
|
.count {
|
|
.count {
|
|
|
font-weight: bold;
|
|
font-weight: bold;
|
|
|
font-size: 36px;
|
|
font-size: 36px;
|
|
@@ -279,20 +447,24 @@ export default {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
.added-today {
|
|
.added-today {
|
|
|
border-radius: 10px;
|
|
border-radius: 10px;
|
|
|
|
|
+
|
|
|
.list-item {
|
|
.list-item {
|
|
|
display: flex;
|
|
display: flex;
|
|
|
justify-content: center;
|
|
justify-content: center;
|
|
|
align-items: center;
|
|
align-items: center;
|
|
|
height: 280px;
|
|
height: 280px;
|
|
|
background-color: #fff;
|
|
background-color: #fff;
|
|
|
|
|
+
|
|
|
.item {
|
|
.item {
|
|
|
flex: 1;
|
|
flex: 1;
|
|
|
display: flex;
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
flex-direction: column;
|
|
|
justify-content: center;
|
|
justify-content: center;
|
|
|
align-items: center;
|
|
align-items: center;
|
|
|
|
|
+
|
|
|
.icon {
|
|
.icon {
|
|
|
width: 90px;
|
|
width: 90px;
|
|
|
height: 90px;
|
|
height: 90px;
|
|
@@ -302,12 +474,14 @@ export default {
|
|
|
justify-content: center;
|
|
justify-content: center;
|
|
|
align-items: center;
|
|
align-items: center;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
.count {
|
|
.count {
|
|
|
color: #409EFF;
|
|
color: #409EFF;
|
|
|
font-weight: bold;
|
|
font-weight: bold;
|
|
|
font-size: 36px;
|
|
font-size: 36px;
|
|
|
margin: 30px 0 20px;
|
|
margin: 30px 0 20px;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
.tips {
|
|
.tips {
|
|
|
font-size: 14px;
|
|
font-size: 14px;
|
|
|
color: #888;
|
|
color: #888;
|