代码提交
This commit is contained in:
commit
6922280fa8
|
@ -1,11 +1,11 @@
|
|||
import axios from 'axios'
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
axios.defaults.baseURL = '/api'
|
||||
} else if (process.env.NODE_ENV === 'test') {
|
||||
axios.defaults.baseURL = 'https://309k63x452.oicp.vip'
|
||||
}
|
||||
//设置请求头参数 common 为设置所有的接口 post为设置post请求的接口
|
||||
// axios.defaults.headers.common['Authorization'] = `Bearer ${localStorage.getItem('access_token')}`;
|
||||
// if (process.env.NODE_ENV === 'development') {
|
||||
// axios.defaults.baseURL = '/api'
|
||||
// } else if (process.env.NODE_ENV === 'test') {
|
||||
// axios.defaults.baseURL = 'https://309k63x452.oicp.vip'
|
||||
// }
|
||||
// 设置请求头参数 common 为设置所有的接口 post为设置post请求的接口
|
||||
axios.defaults.headers.common['Authorization'] = `Bearer ${localStorage.getItem('access_token')}`;
|
||||
// 首页数据
|
||||
axios.interceptors.request.use(function (config) {
|
||||
const tokenStr = localStorage.getItem('tokenStr')
|
||||
|
@ -25,87 +25,58 @@ axios.interceptors.request.use(function (config) {
|
|||
})
|
||||
// 登录的请求
|
||||
export const doLogin = (data) =>{
|
||||
return axios.post('/login/doLogin',data)
|
||||
return axios.post('api/login/doLogin',data)
|
||||
}
|
||||
// export const getHomePageInfo = (params) => {
|
||||
// return axios.post('/gk/homePage/getHomePageInfo?cityId='+params)
|
||||
// };
|
||||
// 环境信息
|
||||
// export const getEnvironmentInfo = (params) => {
|
||||
// return axios.post('/gk/info/getEnvironmentInfo?siteId='+params
|
||||
// )
|
||||
// };
|
||||
// 获取城市列表
|
||||
export const getCityList = (params)=>{
|
||||
return axios.post('/gk/homePage/getCityList')
|
||||
}
|
||||
// 点击城市查询详情列表
|
||||
export const getCityDetail = (params)=>{
|
||||
return axios.post('/gk/homePage/getCityDetail?cityId='+params)
|
||||
}
|
||||
// export const getSiteInfo = (params) => {
|
||||
// return axios.get('api/gk/info/getSiteInfo', {
|
||||
// params
|
||||
// })
|
||||
// };
|
||||
// export const getSwitchInfo = (params) => {
|
||||
// return axios.get('api/gk/info/getSwitchInfo', {
|
||||
// params
|
||||
// })
|
||||
// };
|
||||
//查询实时事件
|
||||
// export const getDeviceRecord = (params) => {
|
||||
// return axios.get('api/gk/info/getDeviceRecord', {
|
||||
// params
|
||||
// })
|
||||
// };
|
||||
//查询实时记录下拉框
|
||||
// export const getDeviceNum = (params) => {
|
||||
// return axios.get('api/gk/info/getDeviceNum', {
|
||||
// params
|
||||
// })
|
||||
// };
|
||||
// 修改提交
|
||||
// export const updateDeviceRecord = (params) => {
|
||||
// return axios.get('api/gk/info/updateDeviceRecord', {
|
||||
// params
|
||||
// })
|
||||
// };
|
||||
// 首页数据
|
||||
export const getHomePageInfo = (params) => {
|
||||
return axios.get('/gk/homePage/getHomePageInfo', {
|
||||
params
|
||||
})
|
||||
};
|
||||
export const getSwitchInfo = (params) => {
|
||||
return axios.get('/gk/info/getSwitchInfo', {
|
||||
return axios.get('api/gk/homePage/getHomePageInfo', {
|
||||
params
|
||||
})
|
||||
};
|
||||
// 环境信息
|
||||
export const getEnvironmentInfo = (params) => {
|
||||
return axios.get('/gk/info/getEnvironmentInfo', { params
|
||||
return axios.get('api/gk/info/getEnvironmentInfo', { params
|
||||
})
|
||||
};
|
||||
export const getSiteInfo = (params) => {
|
||||
return axios.get('/gk/info/getSiteInfo', {
|
||||
return axios.get('api/gk/info/getSiteInfo', {
|
||||
params
|
||||
})
|
||||
};
|
||||
export const getSwitchInfo = (params) => {
|
||||
return axios.get('api/gk/info/getSwitchInfo', {
|
||||
params
|
||||
})
|
||||
};
|
||||
|
||||
//查询实时事件
|
||||
export const getDeviceRecord = (params) => {
|
||||
return axios.get('/gk/info/getDeviceRecord', {
|
||||
return axios.get('api/gk/info/getDeviceRecord', {
|
||||
params
|
||||
})
|
||||
};
|
||||
//查询实时记录下拉框
|
||||
export const getDeviceNum = (params) => {
|
||||
return axios.get('/gk/info/getDeviceNum', {
|
||||
return axios.get('api/gk/info/getDeviceNum', {
|
||||
params
|
||||
})
|
||||
};
|
||||
// 修改提交
|
||||
export const updateDeviceRecord = (params) => {
|
||||
return axios.get('/gk/info/updateDeviceRecord', {
|
||||
return axios.get('api/gk/info/updateDeviceRecord', {
|
||||
params
|
||||
})
|
||||
};
|
||||
// 获取城市列表
|
||||
// export const getCityList = (params)=>{
|
||||
// return axios.post('/gk/homePage/getCityList')
|
||||
// }
|
||||
// 点击城市查询详情列表
|
||||
// export const getCityDetail = (params)=>{
|
||||
// return axios.post('/gk/homePage/getCityDetail?cityId='+params)
|
||||
// }
|
||||
|
||||
|
||||
|
|
|
@ -863,7 +863,7 @@
|
|||
<div class="select">
|
||||
<div class="seSearch">查询</div>
|
||||
<div class="changeselect">
|
||||
<el-select v-model="chaValue" placeholder="请选择" @change="searchChange">
|
||||
<el-select v-model="chaValue" placeholder="请选择" @change="searchChange" clearable >
|
||||
<el-option v-for="item in optionsOpen" :key="item.value" :label="item.label" :value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
|
|
|
@ -169,7 +169,7 @@ import dialogComponent from "@/components/dialog";
|
|||
import Chart from "./chart.vue";
|
||||
// import io from 'socket.io-client'
|
||||
import BasicBox5 from "@/components/BasicBox5";
|
||||
import { getHomePageInfo, getCityList, getCityDetail } from "@/api/api";
|
||||
import { getHomePageInfo} from "@/api/api";//getCityList, getCityDetail
|
||||
import mqtt from "mqtt";
|
||||
// let socketRefs = '';
|
||||
|
||||
|
@ -432,12 +432,12 @@ export default {
|
|||
computed: {
|
||||
},
|
||||
mounted() {
|
||||
getCityList().then(res => {
|
||||
console.log(res, '城市数据');
|
||||
})
|
||||
getCityDetail(1).then(res => {
|
||||
console.log(res, '城市详情数据');
|
||||
})
|
||||
// getCityList().then(res => {
|
||||
// console.log(res, '城市数据');
|
||||
// })
|
||||
// getCityDetail(1).then(res => {
|
||||
// console.log(res, '城市详情数据');
|
||||
// })
|
||||
// this.getDataByMqtt(
|
||||
// "ws://175.24.235.243:8083/mqtt",
|
||||
// "tra_topic"
|
||||
|
@ -457,38 +457,11 @@ export default {
|
|||
window.setTimeout(() => {
|
||||
that.nanjingIconShow = true;
|
||||
}, 2600);
|
||||
if (this.shijiIconShow) {
|
||||
// window.setInterval(() => {
|
||||
// if (this.shijiIconShow) {
|
||||
window.setInterval(() => {
|
||||
// 获取省级数据
|
||||
getHomePageInfo('').then((res) => {
|
||||
console.log(res, '省级数据');
|
||||
that.leftNum = []
|
||||
that.totalCustomer = res.data.result.totalCustomer;
|
||||
that.totalTransformationSite = res.data.result.totalTransformationSite;
|
||||
let realTimeLoad = res.data.result.realTimeLoad.toString();
|
||||
let realData = realTimeLoad.substring(0, realTimeLoad.indexOf(".") + 3);
|
||||
for (var key in res.data.result) {
|
||||
for (let i = 0; i < that.leftInfodata.length; i++) {
|
||||
if (key == that.leftInfodata[i].name) {
|
||||
that.leftInfodata[i].num = res.data.result[key];
|
||||
that.leftNum.push(that.leftInfodata[i].num)
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < that.rightInfodata.length; i++) {
|
||||
if (key == that.rightInfodata[i].name) {
|
||||
that.rightInfodata[i].num = res.data.result[key];
|
||||
that.rightInfodata[1].num = realData;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// }, 3000);
|
||||
} else {
|
||||
// window.setInterval(() => {
|
||||
// 获取市级数据
|
||||
getHomePageInfo('1').then((res) => {
|
||||
console.log(res, '市级数据');
|
||||
getHomePageInfo().then((res) => {
|
||||
// console.log(res, '省级数据');
|
||||
that.leftNum = []
|
||||
that.totalCustomer = res.data.data.totalCustomer;
|
||||
that.totalTransformationSite = res.data.data.totalTransformationSite;
|
||||
|
@ -510,8 +483,35 @@ export default {
|
|||
}
|
||||
});
|
||||
|
||||
// }, 3000);
|
||||
}
|
||||
}, 3000);
|
||||
// } else {
|
||||
// window.setInterval(() => {
|
||||
// 获取市级数据
|
||||
// getHomePageInfo('1').then((res) => {
|
||||
// console.log(res, '市级数据');
|
||||
// that.leftNum = []
|
||||
// that.totalCustomer = res.data.data.totalCustomer;
|
||||
// that.totalTransformationSite = res.data.data.totalTransformationSite;
|
||||
// let realTimeLoad = res.data.data.realTimeLoad.toString();
|
||||
// let realData = realTimeLoad.substring(0, realTimeLoad.indexOf(".") + 3);
|
||||
// for (var key in res.data.data) {
|
||||
// for (let i = 0; i < that.leftInfodata.length; i++) {
|
||||
// if (key == that.leftInfodata[i].name) {
|
||||
// that.leftInfodata[i].num = res.data.data[key];
|
||||
// that.leftNum.push(that.leftInfodata[i].num)
|
||||
// }
|
||||
// }
|
||||
// for (let i = 0; i < that.rightInfodata.length; i++) {
|
||||
// if (key == that.rightInfodata[i].name) {
|
||||
// that.rightInfodata[i].num = res.data.data[key];
|
||||
// that.rightInfodata[1].num = realData;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
|
||||
// // }, 3000);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -72,17 +72,17 @@ export default {
|
|||
password:passwordA
|
||||
}
|
||||
// console.log(this.loginForm, '密码');
|
||||
doLogin(userMsg).then(res => {
|
||||
// doLogin(userMsg).then(res => {
|
||||
|
||||
if (res.data.code == 200) {
|
||||
// 存储token
|
||||
localStorage.setItem('tokenStr', res.data.result.token)
|
||||
// 存储用户名
|
||||
localStorage.setItem('account', res.data.result.account)
|
||||
localStorage.setItem('roleId', res.data.result.roleId)
|
||||
// if (res.data.code == 200) {
|
||||
// // 存储token
|
||||
// localStorage.setItem('tokenStr', res.data.result.token)
|
||||
// // 存储用户名
|
||||
// localStorage.setItem('account', res.data.result.account)
|
||||
// localStorage.setItem('roleId', res.data.result.roleId)
|
||||
|
||||
}
|
||||
})
|
||||
// }
|
||||
// })
|
||||
this.$message.success("登录成功");
|
||||
this.$router.push("/index");
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue