Browse Source

接口接通

lite
123456 3 years ago
parent
commit
6699c4dc68
  1. 2
      bak/src/utils/request.js
  2. 43
      src/api/home.js
  3. 4
      src/main.js
  4. 2
      src/utils/request.js
  5. 26
      src/views/cultrue/index.vue
  6. 127
      src/views/index.vue
  7. 18
      vue.config.js

2
bak/src/utils/request.js

@ -11,7 +11,7 @@ const service = axios.create({
withCredentials: true, // 异步请求携带cookie withCredentials: true, // 异步请求携带cookie
headers: { headers: {
// 设置后端需要的传参类型 // 设置后端需要的传参类型
'Content-Type': 'application/json', 'Content-Type': 'application/json',
}, },
}) })

43
src/api/home.js

@ -4,7 +4,8 @@ import request from '@/utils/request'
// 定义接口的传参 // 定义接口的传参
const api={ const api={
// 日客流趋势 // 日客流趋势
daily_klqs:'index.php/allGroupTimeNum?granularity=daily' daily_klqs:'index.php/allGroupTimeNum?granularity=daily',
zonglan_data:'http://btgym.xingtongworld.com/index.php?s=/api/pass.passcc/allGroupNum'
} }
// 获取群组 // 获取群组
@ -15,3 +16,43 @@ export function allGroupTimeNum(param) {
param, param,
}) })
} }
export function homeBarData(param) {
return request({
url: 'http://btgym.xingtongworld.com/index.php?s=/api/pass.passcc/allGroupTimeNum&granularity=daily',
method: 'post',
param,
})
}
export function allGroupNum(param) {
return request({
url: 'http://btgym.xingtongworld.com/index.php?s=/api/pass.passcc/allGroupNum',
method: 'post',
param,
})
}
export function allInfoDatas(param) {
return request({
url: 'http://btgym.xingtongworld.com/index.php?s=/api/pass.passcc/realTimeData',
method: 'post',
param,
})
}
export function allGcgNumDatas(param) {
return request({
url: 'http://btgym.xingtongworld.com/index.php?s=/api/pass.passcc/toDayGroupsEnterNum',
method: 'post',
param,
})
}
export function allTsgInfoDatas(param) {
return request({
url: 'http://btgym.xingtongworld.com/index.php?s=/api/library.pass/allFlowTrends',
method: 'post',
param,
})
}

4
src/main.js

@ -4,6 +4,8 @@ import router from './router';
import store from './store'; import store from './store';
import dataV from '@jiaminghi/data-view'; import dataV from '@jiaminghi/data-view';
import VScaleScreen from 'v-scale-screen'; import VScaleScreen from 'v-scale-screen';
// import axios from 'axios'
Vue.use(VScaleScreen); Vue.use(VScaleScreen);
Vue.use(dataV); Vue.use(dataV);
@ -30,6 +32,8 @@ import '@/common/flexible.js';
import echarts from 'echarts' import echarts from 'echarts'
Vue.prototype.$echarts = echarts Vue.prototype.$echarts = echarts
// Vue.prototype.$http = axios
Vue.config.productionTip = false; Vue.config.productionTip = false;
// Vue.use(VScaleScreen); // Vue.use(VScaleScreen);
new Vue({ new Vue({

2
src/utils/request.js

@ -4,7 +4,7 @@ import axios from 'axios'
// 创建一个 axios 实例 // 创建一个 axios 实例
const service = axios.create({ const service = axios.create({
//baseURL: '/api', // 所有的请求地址前缀部分 // baseURL: 'http://btgym.xingtongworld.com/', // 所有的请求地址前缀部分
//baseURL: publicConfig.BASE_API, //baseURL: publicConfig.BASE_API,
//baseURL:ahost, //baseURL:ahost,
timeout: 60000, // 请求超时时间毫秒 timeout: 60000, // 请求超时时间毫秒

26
src/views/cultrue/index.vue

@ -74,6 +74,10 @@
<script> <script>
// echarts // echarts
import * as echarts from "echarts"; import * as echarts from "echarts";
// api
import * as homeApi from '@/api/home'
export default { export default {
data() { data() {
return {}; return {};
@ -96,6 +100,7 @@ export default {
this.addNumber(0,890098,'cmdval1') this.addNumber(0,890098,'cmdval1')
this.addNumber(0,890098,'cmdval2') this.addNumber(0,890098,'cmdval2')
this.addNumber(0,234098,'cmdval3') this.addNumber(0,234098,'cmdval3')
this.getTsgInfoDatas()
// var name = ['', '', ''] // var name = ['', '', '']
}, },
methods: { methods: {
@ -660,6 +665,27 @@ export default {
} }
}, 10); // }, 10); //
} }
},
getTsgInfoDatas() {
let that = this
console.log(that);
homeApi.allTsgInfoDatas().then(res => {
// get allTimeData
const tmpdata = res.data
console.log(tmpdata);
// this.day_num = tmpdata.day.noRepeatInNum
// this.week_num_num = tmpdata.week.noRepeatInNum
// this.mon_num = tmpdata.month.noRepeatInNum
// this.year_num = tmpdata.year.noRepeatInNum
// let btdata = new Array();
// let bvdata = new Array();
// tmpdata.foreach(function(item,index){
// console.log(item);
// console.log(index);
// });
});
} }
}, },
}; };

127
src/views/index.vue

@ -73,17 +73,17 @@
<div class="centerbox"> <div class="centerbox">
<!-- 今日进馆人数 --> <!-- 今日进馆人数 -->
<div class="jgrs"> <div class="jgrs">
<span id="jgval1" class="jgval jgval1">345,235</span> <span id="jgval1" class="jgval jgval1">{{ day_num }}</span>
<span class="jgdesc jgdesc1">今日进馆人数</span> <span class="jgdesc jgdesc1">今日进馆人数</span>
</div> </div>
<!-- 本周进馆人数 --> <!-- 本周进馆人数 -->
<div class="jgrs"> <div class="jgrs">
<span id="jgval2" class="jgval">345,235</span> <span id="jgval2" class="jgval">{{ week_num }}</span>
<span class="jgdesc">本周进馆人数</span> <span class="jgdesc">本周进馆人数</span>
</div> </div>
<!-- 本月进馆人数 --> <!-- 本月进馆人数 -->
<div class="jgrs"> <div class="jgrs">
<span id="jgval3" class="jgval jgval3">345,235</span> <span id="jgval3" class="jgval jgval3">{{ mon_num }}</span>
<span class="jgdesc jgdesc3">本月进馆人数</span> <span class="jgdesc jgdesc3">本月进馆人数</span>
</div> </div>
<!-- 会动的体育馆image --> <!-- 会动的体育馆image -->
@ -91,7 +91,7 @@
<!-- 年度进馆人数 --> <!-- 年度进馆人数 -->
<div class="ndjgrs"> <div class="ndjgrs">
<span class="nddesc">年度进馆人数</span> <span class="nddesc">年度进馆人数</span>
<span class="ndval">33,532,890</span> <span class="ndval">{{ year_num }}</span>
</div> </div>
</div> </div>
<!-- 右边 --> <!-- 右边 -->
@ -151,11 +151,19 @@
// echarts // echarts
import * as echarts from "echarts"; import * as echarts from "echarts";
// api
import * as homeApi from '@/api/home'
export default { export default {
data() { data() {
return { return {
// , // ,
klselt: "d", klselt: "d",
day_num: 0,
week_num: 0,
mon_num: 0,
year_num: 0,
klqsDatas: []
}; };
}, },
// //
@ -174,9 +182,13 @@ export default {
// 线 // 线
this.line_zone(); this.line_zone();
this.addNumber(0, 345235, 'jgval1'); // this.addNumber(0, 345235, 'jgval1');
this.addNumber(0, 345235, 'jgval2'); // this.addNumber(0, 345235, 'jgval2');
this.addNumber(0, 345235, 'jgval3'); // this.addNumber(0, 345235, 'jgval3');
this.getStat();
this.getHomeBarData();
this.getInfoDatas();
this.getGcgNumDatas()
}, },
methods: { methods: {
// //
@ -291,6 +303,7 @@ export default {
// var xData = ['09:00', '10:00', '11:00','12:00', '13:00', '14:00','15:00', '16:00', '17:00','18:00', '20:00', '21:00', '22:00']; // var xData = ['09:00', '10:00', '11:00','12:00', '13:00', '14:00','15:00', '16:00', '17:00','18:00', '20:00', '21:00', '22:00'];
var data = [100, 200, 100, 200, 100, 200, 250, 50, 30, 130, 150, 110, 120] var data = [100, 200, 100, 200, 100, 200, 250, 50, 30, 130, 150, 110, 120]
// var data = this.klqsDatas
// var data = [Math.random() * 300] // var data = [Math.random() * 300]
option = { option = {
// backgroundColor: '#031245', // backgroundColor: '#031245',
@ -511,7 +524,7 @@ export default {
extraCssText: 'box-shadow: 0 0 3px rgba(255, 255, 255, 0.4);', // extraCssText: 'box-shadow: 0 0 3px rgba(255, 255, 255, 0.4);', //
formatter: function (params) { formatter: function (params) {
if (params.seriesName != "") { if (params.seriesName != "") {
return params.name + ' 有 ' + params.value + ' 人'; return params.name + ' : 有 ' + params.value + ' 人';
} }
}, },
}, },
@ -774,6 +787,103 @@ export default {
} }
}, 10); // }, 10); //
} }
},
getStat() {
let that = this
console.log(that);
homeApi.allGroupNum().then(res => {
// get allTimeData
const tmpdata = res.data.returnData
console.log(tmpdata);
this.day_num = tmpdata.day.noRepeatInNum
this.week_num_num = tmpdata.week.noRepeatInNum
this.mon_num = tmpdata.month.noRepeatInNum
this.year_num = tmpdata.year.noRepeatInNum
// let btdata = new Array();
// let bvdata = new Array();
// tmpdata.foreach(function(item,index){
// console.log(item);
// console.log(index);
// });
});
},
getHomeBarData() {
let that = this
console.log(that);
homeApi.homeBarData().then(res => {
// get allTimeData
const tmpdata = res.data.data.allTimeData
let datas = []
Object.values(tmpdata).forEach((value) => {
console.log(value.num);
datas.push(value.num)
});
console.log(datas);
this.klqsDatas = datas
console.log(tmpdata);
// this.day_num = tmpdata.day.noRepeatInNum
// this.week_num_num = tmpdata.week.noRepeatInNum
// this.mon_num = tmpdata.month.noRepeatInNum
// this.year_num = tmpdata.year.noRepeatInNum
// let btdata = new Array();
// let bvdata = new Array();
// tmpdata.foreach(function(item,index){
// console.log(item);
// console.log(index);
// });
});
},
getInfoDatas() {
let that = this
console.log(that);
homeApi.allInfoDatas().then(res => {
// get allTimeData
const tmpdata = res.data.returnData
console.log(tmpdata);
// this.day_num = tmpdata.day.noRepeatInNum
// this.week_num_num = tmpdata.week.noRepeatInNum
// this.mon_num = tmpdata.month.noRepeatInNum
// this.year_num = tmpdata.year.noRepeatInNum
// let btdata = new Array();
// let bvdata = new Array();
// tmpdata.foreach(function(item,index){
// console.log(item);
// console.log(index);
// });
});
},
getGcgNumDatas() {
let that = this
console.log(that);
homeApi.allGcgNumDatas().then(res => {
// get allTimeData
const tmpdata = res.data.returnData
console.log(tmpdata);
// this.day_num = tmpdata.day.noRepeatInNum
// this.week_num_num = tmpdata.week.noRepeatInNum
// this.mon_num = tmpdata.month.noRepeatInNum
// this.year_num = tmpdata.year.noRepeatInNum
// let btdata = new Array();
// let bvdata = new Array();
// tmpdata.foreach(function(item,index){
// console.log(item);
// console.log(index);
// });
});
} }
}, },
}; };
@ -1111,6 +1221,7 @@ export default {
background-position: 100% 100%; background-position: 100% 100%;
background-repeat: no-repeat; background-repeat: no-repeat;
} }
.screen-box { .screen-box {
background: none !important; background: none !important;
} }

18
vue.config.js

@ -9,4 +9,22 @@ module.exports = {
config.resolve.alias config.resolve.alias
.set('_c', resolve('src/components')) // key,value自行定义,比如.set('@@', resolve('src/components')) .set('_c', resolve('src/components')) // key,value自行定义,比如.set('@@', resolve('src/components'))
}, },
// Proxy:{
// '/':{
// target:process.env.VUE_APP_BASE_API,
// changeOrigin:true,
// }
// }
// devServer: {
// proxy: {
// '/api/*': {
// target: 'http://btgym.xingtongworld.com', //跨域请求的公共地址
// changeOrigin: true, //是否开启跨域,值为 true 就是开启, false 不开启
// pathRewrite: {
// '^/api': '' //注册全局路径, 但是在你请求的时候前面需要加上 /api
// }
// }
// },
// }
} }
Loading…
Cancel
Save