3.31
This commit is contained in:
parent
10993487f6
commit
d9c0542a6d
|
@ -1,11 +1,11 @@
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
if (process.env.NODE_ENV === 'development') {
|
// if (process.env.NODE_ENV === 'development') {
|
||||||
axios.defaults.baseURL = '/api'
|
// axios.defaults.baseURL = '/api'
|
||||||
} else if (process.env.NODE_ENV === 'test') {
|
// } else if (process.env.NODE_ENV === 'test') {
|
||||||
axios.defaults.baseURL = 'https://309k63x452.oicp.vip'
|
// axios.defaults.baseURL = 'https://309k63x452.oicp.vip'
|
||||||
}
|
// }
|
||||||
// 设置请求头参数 common 为设置所有的接口 post为设置post请求的接口
|
// 设置请求头参数 common 为设置所有的接口 post为设置post请求的接口
|
||||||
// axios.defaults.headers.common['Authorization'] = `Bearer ${localStorage.getItem('access_token')}`;
|
axios.defaults.headers.common['Authorization'] = `Bearer ${localStorage.getItem('access_token')}`;
|
||||||
// 首页数据
|
// 首页数据
|
||||||
axios.interceptors.request.use(function (config) {
|
axios.interceptors.request.use(function (config) {
|
||||||
const tokenStr = localStorage.getItem('tokenStr')
|
const tokenStr = localStorage.getItem('tokenStr')
|
||||||
|
@ -27,22 +27,19 @@ axios.interceptors.request.use(function (config) {
|
||||||
export const doLogin = (data) =>{
|
export const doLogin = (data) =>{
|
||||||
return axios.post('/login/doLogin',data)
|
return axios.post('/login/doLogin',data)
|
||||||
}
|
}
|
||||||
|
// export const getHomePageInfo = (params) => {
|
||||||
|
// return axios.post('/gk/homePage/getHomePageInfo?cityId='+params)
|
||||||
|
// };
|
||||||
|
// 首页数据
|
||||||
export const getHomePageInfo = (params) => {
|
export const getHomePageInfo = (params) => {
|
||||||
return axios.post('/gk/homePage/getHomePageInfo?cityId='+params)
|
return axios.get('api/gk/homePage/getHomePageInfo', {
|
||||||
|
params
|
||||||
|
})
|
||||||
};
|
};
|
||||||
// 环境信息
|
|
||||||
export const getEnvironmentInfo = (params) => {
|
export const getEnvironmentInfo = (params) => {
|
||||||
return axios.post('/gk/info/getEnvironmentInfo?siteId='+params
|
return axios.get('api/gk/info/getEnvironmentInfo', { 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) => {
|
export const getSiteInfo = (params) => {
|
||||||
return axios.get('api/gk/info/getSiteInfo', {
|
return axios.get('api/gk/info/getSiteInfo', {
|
||||||
params
|
params
|
||||||
|
@ -71,3 +68,13 @@ export const updateDeviceRecord = (params) => {
|
||||||
params
|
params
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
// 获取城市列表
|
||||||
|
// export const getCityList = (params)=>{
|
||||||
|
// return axios.post('/gk/homePage/getCityList')
|
||||||
|
// }
|
||||||
|
// 点击城市查询详情列表
|
||||||
|
// export const getCityDetail = (params)=>{
|
||||||
|
// return axios.post('/gk/homePage/getCityDetail?cityId='+params)
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1812,7 +1812,7 @@ export default {
|
||||||
// //查询实时记录
|
// //查询实时记录
|
||||||
window.setInterval(() => {
|
window.setInterval(() => {
|
||||||
if (this.unityChange == 0) {
|
if (this.unityChange == 0) {
|
||||||
getEnvironmentInfo( "2" ).then((res) => {
|
getEnvironmentInfo( {siteId:"2"} ).then((res) => {
|
||||||
// this.eniorArr
|
// this.eniorArr
|
||||||
console.log(res,'实时记录');
|
console.log(res,'实时记录');
|
||||||
for (const key in res.data.data) {
|
for (const key in res.data.data) {
|
||||||
|
@ -1888,7 +1888,7 @@ export default {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
getEnvironmentInfo("96445C7C4AD6F0C5" ).then((res) => {
|
getEnvironmentInfo({siteId:"96445C7C4AD6F0C5"} ).then((res) => {
|
||||||
// this.eniorArr
|
// this.eniorArr
|
||||||
for (const key in res.data.data) {
|
for (const key in res.data.data) {
|
||||||
if (key == "doorState") {
|
if (key == "doorState") {
|
||||||
|
|
|
@ -169,7 +169,7 @@ import dialogComponent from "@/components/dialog";
|
||||||
import Chart from "./chart.vue";
|
import Chart from "./chart.vue";
|
||||||
// import io from 'socket.io-client'
|
// import io from 'socket.io-client'
|
||||||
import BasicBox5 from "@/components/BasicBox5";
|
import BasicBox5 from "@/components/BasicBox5";
|
||||||
import { getHomePageInfo, getCityList, getCityDetail } from "@/api/api";
|
import { getHomePageInfo} from "@/api/api";//getCityList, getCityDetail
|
||||||
import mqtt from "mqtt";
|
import mqtt from "mqtt";
|
||||||
// let socketRefs = '';
|
// let socketRefs = '';
|
||||||
|
|
||||||
|
@ -432,12 +432,12 @@ export default {
|
||||||
computed: {
|
computed: {
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
getCityList().then(res => {
|
// getCityList().then(res => {
|
||||||
console.log(res, '城市数据');
|
// console.log(res, '城市数据');
|
||||||
})
|
// })
|
||||||
getCityDetail(1).then(res => {
|
// getCityDetail(1).then(res => {
|
||||||
console.log(res, '城市详情数据');
|
// console.log(res, '城市详情数据');
|
||||||
})
|
// })
|
||||||
// this.getDataByMqtt(
|
// this.getDataByMqtt(
|
||||||
// "ws://175.24.235.243:8083/mqtt",
|
// "ws://175.24.235.243:8083/mqtt",
|
||||||
// "tra_topic"
|
// "tra_topic"
|
||||||
|
@ -457,38 +457,11 @@ export default {
|
||||||
window.setTimeout(() => {
|
window.setTimeout(() => {
|
||||||
that.nanjingIconShow = true;
|
that.nanjingIconShow = true;
|
||||||
}, 2600);
|
}, 2600);
|
||||||
if (this.shijiIconShow) {
|
// if (this.shijiIconShow) {
|
||||||
// window.setInterval(() => {
|
window.setInterval(() => {
|
||||||
// 获取省级数据
|
// 获取省级数据
|
||||||
getHomePageInfo('').then((res) => {
|
getHomePageInfo().then((res) => {
|
||||||
console.log(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, '市级数据');
|
|
||||||
that.leftNum = []
|
that.leftNum = []
|
||||||
that.totalCustomer = res.data.data.totalCustomer;
|
that.totalCustomer = res.data.data.totalCustomer;
|
||||||
that.totalTransformationSite = res.data.data.totalTransformationSite;
|
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
|
password:passwordA
|
||||||
}
|
}
|
||||||
// console.log(this.loginForm, '密码');
|
// console.log(this.loginForm, '密码');
|
||||||
doLogin(userMsg).then(res => {
|
// doLogin(userMsg).then(res => {
|
||||||
|
|
||||||
if (res.data.code == 200) {
|
// if (res.data.code == 200) {
|
||||||
// 存储token
|
// // 存储token
|
||||||
localStorage.setItem('tokenStr', res.data.result.token)
|
// localStorage.setItem('tokenStr', res.data.result.token)
|
||||||
// 存储用户名
|
// // 存储用户名
|
||||||
localStorage.setItem('account', res.data.result.account)
|
// localStorage.setItem('account', res.data.result.account)
|
||||||
localStorage.setItem('roleId', res.data.result.roleId)
|
// localStorage.setItem('roleId', res.data.result.roleId)
|
||||||
|
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
this.$message.success("登录成功");
|
this.$message.success("登录成功");
|
||||||
this.$router.push("/index");
|
this.$router.push("/index");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -16,7 +16,9 @@ module.exports = {
|
||||||
// port: 8989, // 开发服务器运行端口号
|
// port: 8989, // 开发服务器运行端口号
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': { //代理的名字
|
'/api': { //代理的名字
|
||||||
target: 'https://309k63x452.oicp.vip',
|
// target: 'https://309k63x452.oicp.vip',
|
||||||
|
target: 'http://221.226.19.85:10123/',
|
||||||
|
|
||||||
ws: true,
|
ws: true,
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
pathRewrite:{
|
pathRewrite:{
|
||||||
|
|
Loading…
Reference in New Issue