+
345,235
// 引入echarts
import * as echarts from "echarts";
+// 引入api
+import * as homeApi from '@/api/home'
var uChartsInstance = {};
export default {
@@ -260,6 +249,10 @@ export default {
unit: "日",
},
],
+ // 条线图
+ bar_data:[],
+ // 柱子图x轴
+ bar_tdata:[],
selectVal1: "年",
};
},
@@ -268,6 +261,8 @@ export default {
this.home_bar();
// 折线图
this.line_zone();
+
+ this.getStat();
},
methods: {
clickItme(val) {
@@ -277,27 +272,34 @@ export default {
this.selectVal1 = val;
},
+ //获取统计数据
+ getStat(){
+ let that = this
+ homeApi.allGroupTimeNum().then(res=>{
+ // get allTimeData
+ const tmpdata = res.data.allTimeData
+ let btdata = new Array();
+ let bvdata = new Array();
+ tmpdata.foreach(function(item,index){
+ console.log(item);
+ });
+
+ });
+ },
+
// 透明背景柱状统计图
home_bar() {
var chartDom = document.getElementById("homebar");
var myChart = echarts.init(chartDom);
var option;
+ //
+ let that = this
+
option = {
xAxis: {
type: "category",
- data: [
- "Mon",
- "Tue",
- "Wed",
- "Thu",
- "Fri",
- "Sat",
- "Sun",
- "0c",
- "90",
- "10",
- ],
+ data: that.bar_tdata,
},
yAxis: {
type: "value",
@@ -311,7 +313,8 @@ export default {
},
series: [
{
- data: [120, 200, 150, 80, 70, 110, 130, 630, 530, 460],
+ //data: [120, 200, 150, 80, 70, 110, 130, 630, 530, 460],
+ data: that.bar_data,
type: "bar",
showBackground: true,
// 设置顶部圆形
diff --git a/src/main.js b/src/main.js
index d8f187c..1f30159 100644
--- a/src/main.js
+++ b/src/main.js
@@ -4,10 +4,14 @@ import Vue from 'vue'
import App from './App'
import router from './router'
import less from 'less'
-Vue.config.productionTip = false
+//axios
+import axios from 'axios'
+Vue.config.productionTip = false
Vue.use(less)
+Vue.use(axios)
+
/* eslint-disable no-new */
new Vue({
el: '#app',
diff --git a/src/utils/request.js b/src/utils/request.js
index b77a513..4d14201 100644
--- a/src/utils/request.js
+++ b/src/utils/request.js
@@ -1,14 +1,17 @@
import axios from 'axios'
+
+//https://www.jb51.net/article/246548.htm
+
// 创建一个 axios 实例
const service = axios.create({
- baseURL: '/api', // 所有的请求地址前缀部分
+ //baseURL: '/api', // 所有的请求地址前缀部分
+ //baseURL: publicConfig.BASE_API,
+ //baseURL:ahost,
timeout: 60000, // 请求超时时间毫秒
withCredentials: true, // 异步请求携带cookie
headers: {
// 设置后端需要的传参类型
'Content-Type': 'application/json',
- 'token': 'your token',
- 'X-Requested-With': 'XMLHttpRequest',
},
})
@@ -20,7 +23,6 @@ service.interceptors.request.use(
},
function (error) {
// 对请求错误做些什么
- console.log(error)
return Promise.reject(error)
}
)
@@ -28,7 +30,7 @@ service.interceptors.request.use(
// 添加响应拦截器
service.interceptors.response.use(
function (response) {
- console.log(response)
+ //console.log(response)
// 2xx 范围内的状态码都会触发该函数。
// 对响应数据做点什么
// dataAxios 是 axios 返回数据中的 data