You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

264 lines
7.9 KiB

4 years ago
<!--
* @Author: xw
* @Date: 2021-10-09 14:25:05
4 years ago
* @LastEditTime: 2021-10-28 11:56:49
4 years ago
* @LastEditors: Please set LastEditors
* @Description: 大数据统计gif
* @FilePath: /data-show/src/views/Index/dynamicNumber/index.vue
-->
<template>
4 years ago
<div class="dy-outter" v-loading="load">
4 years ago
<div class="d1" @click="handlerClick(6)">
4 years ago
<span class="s1">APP</span>
<span class="s2">
4 years ago
<countTo :startVal='form.app-100 >= 0 ? form.app-100 : 0' :endVal='form.app' :duration='3000'></countTo>
4 years ago
</span>
</div>
4 years ago
<div class="d1 dd1" @click="handlerClick(8)">
4 years ago
<span class="s1">其他</span>
<span class="s2">
4 years ago
<countTo :startVal='form.other-100 >= 0 ? form.other-100 : 0' :endVal='form.other' :duration='3000'></countTo>
4 years ago
</span>
</div>
4 years ago
<div class="d1 dd2" @click="handlerClick(4)">
4 years ago
<span class="s1">微信</span>
<span class="s2">
4 years ago
<countTo :startVal='form.wecat-100 >= 0 ? form.wecat-100 : 0' :endVal='form.wecat' :duration='3000'></countTo>
4 years ago
</span>
</div>
4 years ago
<div class="d2 dd3" @click="handlerClick(3)">
4 years ago
<span class="s1">
4 years ago
<countTo :startVal='form.forum-100 >= 0 ? form.forum-100 : 0' :endVal='form.forum' :duration='3000'></countTo>
4 years ago
</span>
4 years ago
<span class="s2">论坛</span>
4 years ago
</div>
4 years ago
<div class="d2 dd4" @click="handlerClick(5)">
4 years ago
<span class="s1">
4 years ago
<countTo :startVal='form.weipo-100 >= 0 ? form.weipo-100 : 0' :endVal='form.weipo' :duration='3000'></countTo>
4 years ago
</span>
4 years ago
<span class="s2">微博</span>
4 years ago
</div>
4 years ago
<div class="d2 dd5" @click="handlerClick(1)">
4 years ago
<span class="s1">
4 years ago
<countTo :startVal='form.news-100 >= 0 ? form.news-100 : 0' :endVal='form.news' :duration='3000'></countTo>
4 years ago
</span>
4 years ago
<span class="s2">新闻</span>
4 years ago
</div>
4 years ago
<div class="d3" @click="handlerClick(-1)">
4 years ago
<span class="s1">系统入库 数据总量</span>
<span class="s2">
4 years ago
<countTo :startVal='form.total-100 >= 0 ? form.total-100 : 0' :endVal='form.total' :duration='3000'></countTo>
4 years ago
</span>
</div>
</div>
</template>
<script>
4 years ago
import countTo from "vue-count-to";
import { getHomeCount0528 } from "@/api/home";
4 years ago
export default {
name: "dynamic-number",
components: {
4 years ago
countTo,
4 years ago
},
data() {
return {
4 years ago
load: false,
4 years ago
form: {
total: 0,
app: 0,
news: 0,
weipo: 0,
other: 0,
short: 0,
forum: 0,
4 years ago
wecat: 0,
},
begin: true,
intval: null,
};
4 years ago
},
created() {
4 years ago
this.load = true;
this.getData(1).then(() => {
this.load = false;
this.startDyfun(6000);
});
},
destroyed() {
if(this.intval) {
clearTimeout(this.intval)
}
4 years ago
},
methods: {
4 years ago
// 获取后台数据
4 years ago
getData(n) {
return new Promise((resolve, reject) => {
let obj = Object.assign({}, this.getCommTime, { iStatus: n });
getHomeCount0528(obj).then((res) => {
let data = res.data;
this.form.total = data.count;
let sourcetypeCount = data.sourcetypeCount;
if (Array.isArray(sourcetypeCount)) {
sourcetypeCount.forEach((ele) => {
if (ele.key == "新闻") {
this.form.news = ele.value;
} else if (ele.key == "APP") {
this.form.app = ele.value;
} else if (ele.key == "论坛") {
this.form.forum = ele.value;
} else if (ele.key == "微信") {
this.form.wecat = ele.value;
} else if (ele.key == "微博") {
this.form.weipo = ele.value;
} else {
this.form.other = ele.value;
}
});
}
resolve(res)
}).catch(() => {
reject(false)
});
});
4 years ago
},
4 years ago
// // 点击中间的全网数据显示
// handlerAllData() {
// this.$emit("allData");
// },
4 years ago
// 定时器调后台数据
startDyfun(time) {
this.intval = self.setTimeout(() => {
if (this.begin) {
this.begin = false;
this.getData(2)
.then(() => {
this.begin = true;
this.startDyfun(time);
})
.catch(() => {
this.begin = false;
});
}
}, time);
},
4 years ago
handlerClick(n) {
this.$emit("allData", n);
}
4 years ago
},
};
4 years ago
</script>
<style lang="less" scoped>
.dy-outter {
position: relative;
width: 100%;
height: 100%;
4 years ago
background-image: url("../../../assets/images/Index/d3.gif");
4 years ago
background-repeat: no-repeat;
background-size: cover;
.d1 {
position: absolute;
display: flex;
width: 280px;
height: 60px;
4 years ago
background-image: url("../../../assets/images/Index/img_jbtter.png");
4 years ago
background-repeat: no-repeat;
background-size: cover;
justify-content: flex-start;
align-items: center;
top: 240px;
left: 0px;
4 years ago
cursor: pointer;
4 years ago
.s1 {
display: block;
font-size: 18px;
margin-left: 32px;
color: #d2dadf;
}
.s2 {
display: block;
font-size: 28px;
font-family: Bebas;
4 years ago
color: #ffffff;
4 years ago
margin-left: 24px;
}
}
.d2 {
position: absolute;
display: flex;
width: 280px;
height: 60px;
4 years ago
background-image: url("../../../assets/images/Index/img_jbtter.png");
4 years ago
background-repeat: no-repeat;
background-size: cover;
justify-content: flex-end;
align-items: center;
top: 240px;
left: 0px;
4 years ago
cursor: pointer;
4 years ago
.s2 {
display: block;
font-size: 18px;
margin-left: 32px;
color: #d2dadf;
margin-right: 32px;
}
.s1 {
display: block;
font-size: 28px;
font-family: Bebas;
4 years ago
color: #ffffff;
4 years ago
}
}
.d3 {
position: absolute;
width: 320px;
height: 82px;
4 years ago
background-image: url("../../../assets/images/Index/img_jbtt.png");
4 years ago
background-repeat: no-repeat;
background-size: cover;
left: 308px;
top: 323px;
display: flex;
justify-content: flex-start;
align-items: center;
4 years ago
cursor: pointer;
4 years ago
.s1 {
display: block;
font-size: 18px;
color: #d2dadf;
width: 72px;
margin-left: 38px;
}
.s2 {
display: block;
font-size: 32px;
font-family: Bebas;
4 years ago
color: #ffffff;
4 years ago
margin-left: 23px;
}
}
}
4 years ago
.dd1 {
top: 360px !important;
left: 0px !important;
}
.dd2 {
top: 60px !important;
left: 456px !important;
}
.dd3 {
top: 220px !important;
left: 622px !important;
}
.dd4 {
top: 360px !important;
left: 622px !important;
}
.dd5 {
top: 460px !important;
left: 250px !important;
}
4 years ago
</style>