diff --git a/src/api/index.js b/src/api/index.js index b4b83ee..1cf0687 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -14,11 +14,17 @@ function sendGetRequest(url, data) { params: data }) .then(function (res) { //请求成功,response接收返回参数 + if (res.data.code == 401) { localStorage.removeItem('token') - router.push({ - name: 'login' - }) + if(router.currentRoute.name!='login'){ + router.push({ + name: 'login' + }) + } + // router.push({ + // name: 'login' + // }) } resolve(res); @@ -43,9 +49,11 @@ function sendUploadRequest(url, data) { (res) => { if (res.data.code == 401) { localStorage.removeItem('token') - router.push({ - name: 'login' - }) + if(router.currentRoute.name!='login'){ + router.push({ + name: 'login' + }) + } } resolve(res); }, @@ -70,9 +78,11 @@ function sendPostRequest(url, data) { (res) => { if (res.data.code == 401) { localStorage.removeItem('token') - router.push({ - name: 'login' - }) + if(router.currentRoute.name!='login'){ + router.push({ + name: 'login' + }) + } } resolve(res); }, @@ -100,9 +110,11 @@ function sendDelRequest(url, data) { (res) => { if (res.data.code == 401) { localStorage.removeItem('token') - router.push({ - name: 'login' - }) + if(router.currentRoute.name!='login'){ + router.push({ + name: 'login' + }) + } } resolve(res); }, @@ -126,9 +138,11 @@ function sendPutRequest(url, data) { (res) => { if (res.data.code == 401) { localStorage.removeItem('token') - router.push({ - name: 'login' - }) + if(router.currentRoute.name!='login'){ + router.push({ + name: 'login' + }) + } } resolve(res); }, diff --git a/src/assets/css/main.css b/src/assets/css/main.css index 33e2af8..1986862 100644 --- a/src/assets/css/main.css +++ b/src/assets/css/main.css @@ -782,6 +782,11 @@ textarea { padding: 0 10px; } +.input-main-80 span.tips { + color: rgba(255, 255, 255, 0.7); + font-size: 16px; +} + .input-main-80 input { width: 80px; height: 44px; @@ -2228,6 +2233,7 @@ textarea { background-size: 100% 100%; position: relative; overflow: hidden; + flex-shrink: 0; } .realTime .page-content .realTime-bottom .left-view > div .video-control .video-btn-big > div { diff --git a/src/assets/css/main.scss b/src/assets/css/main.scss index b2b5bce..c5c6a5d 100644 --- a/src/assets/css/main.scss +++ b/src/assets/css/main.scss @@ -817,6 +817,10 @@ textarea{ span { padding: 0 10px; + &.tips{ + color: rgba(255, 255, 255, 0.7); + font-size: 16px; + } } input { @@ -2344,6 +2348,7 @@ textarea{ background-size: 100% 100%; position: relative; overflow: hidden; + flex-shrink: 0; >div { width: 230px; diff --git a/src/views/index.vue b/src/views/index.vue index 9f95bc6..26e6e27 100644 --- a/src/views/index.vue +++ b/src/views/index.vue @@ -112,7 +112,7 @@ export default { activeNames: [3], leftList: [ { name: '首页', img: require('../assets/image/index-icon.png'), list: [], router: 'realTime', isRouter: true, }, - { name: '温室', routerList: ['realTime', 'dataAnalysis', 'historyData', 'exitSettings', 'videoMonitoring','imageData', 'skylight', 'control', 'systemSet-con', 'fan', 'upload-con', 'sensorSet-con', 'synthesis-con', 'alarmSettings', 'waterPump', 'geothermalFan', 'uptake', 'downtake', 'rollByRoll', 'snowRemoval', "targetTemperature", "targetHumidity", "targetCo2", "sunroofControl", "outsizeSunshade", "insizeSunshade", "wetFan", "LED", 'electromagneticControl', "coercionMist", "circulationCan", "internalInsulation", "forceOutput", "intrinsicParameter", "parameterSet"], img: require('../assets/image/left-img0.png'), list: [] }, + { name: '温室', routerList: ['realTime', 'dataAnalysis', 'historyData','air-conditioning', 'exitSettings', 'videoMonitoring','imageData', 'skylight', 'control', 'systemSet-con', 'fan', 'upload-con', 'sensorSet-con', 'synthesis-con', 'alarmSettings', 'waterPump', 'geothermalFan', 'uptake', 'downtake', 'rollByRoll', 'snowRemoval', "targetTemperature", "targetHumidity", "targetCo2", "sunroofControl", "outsizeSunshade", "insizeSunshade", "wetFan", "LED", 'electromagneticControl', "coercionMist", "circulationCan", "internalInsulation", "forceOutput", "intrinsicParameter", "parameterSet"], img: require('../assets/image/left-img0.png'), list: [] }, // { name: '二号温室', img: require('../assets/image/left-img1.png'), list: [] }, { name: '施肥机', routerList: ['status-soil','formula', 'dataAnalysis', 'historyData', 'irrigateSet', 'videoMonitoring','imageData', 'PIDSet', 'systemSet', 'upload', 'sensorSet', 'realTime', 'history', 'dataAnalysis'], img: require('../assets/image/left-img2.png'), list: [] }, { name: '智能灌溉', routerList: ['realTime', 'dataAnalysis', 'historyData','irrigateSet-soil', 'videoMonitoring','imageData','PIDSet-soil', 'systemSet-soil', 'upload-soil', 'sensorSet-soil', 'realTime', 'history', 'dataAnalysis'], img: require('../assets/image/irrigateSet-icon1-act.png'), list: [] }, @@ -288,8 +288,19 @@ export default { return value1 - value2; }; }, + // 根据deviceName获取router + deviceNameRouter(deviceName){ + if(deviceName==1){ + return 'formula' + }else if(deviceName==10){ + return 'control' + }else if(deviceName==20){ + return 'soil' + } + }, //获取设备 getEqbyid(selTrue) { + const that = this var userInfo = localStorage.getItem('userInfo') ? JSON.parse(localStorage.getItem('userInfo')) : { userid: -1 } var store = this.$store.state this.api.getEqbyid(userInfo.userid).then((res) => { @@ -297,7 +308,7 @@ export default { this.$store.state.equipmentList = res.data.data.map((item, index) => { return { ...item, - router: 'formula', + router: that.deviceNameRouter(item.deviceName), index: index + 1, }; }); @@ -350,7 +361,7 @@ export default { userId: item.userId, deviceTypeName: item.deviceName, index: list[list.length - 1].index + index + 1, - router: 'formula', + router: that.deviceNameRouter(item.deviceName), deviceName: '30' }; })) @@ -496,23 +507,17 @@ export default { if (item.router) { if (item.http) { window.location.href = item.http; - } else if (item.router == 'formula' && this.$route.query.index != item.index) { - if (this.routerNow == 'realTime') { + }else if(item.isRouter){ + this.$router.push({ path: item.router }) + } else if ( this.$route.query.index != item.index) { + if (this.routerNow == 'realTime'||item.router=='realTime') { this.$store.state.equipmentIndex = item.index - this.$router.push({ path: `/realTime?index=${item.index ? item.index : 1}&name=${item.deviceName}` }) - } else if (this.routerNow == 'history') { + this.$router.push({ path: `/realTime?index=${item.index ? item.index : 1}&name=${item.deviceName? item.deviceName : 1}` }) + } else if (this.routerNow == 'history'||this.routerNow == 'dataAnalysis'||this.routerNow == 'historyData'||this.routerNow == 'imageData') { this.$store.state.equipmentIndex = item.index - this.$router.push({ path: `/history?index=${item.index ? item.index : 1}` }) - } else if (this.routerNow == 'dataAnalysis') { - this.$store.state.equipmentIndex = item.index - this.$router.push({ path: `/dataAnalysis?index=${item.index ? item.index : 1}` }) - } else if (this.routerNow == 'historyData') { - this.$store.state.equipmentIndex = item.index - this.$router.push({ path: `/historyData?index=${item.index ? item.index : 1}` }) - } else if (this.routerNow == 'imageData') { - this.$store.state.equipmentIndex = item.index - this.$router.push({ path: `/imageData?index=${item.index ? item.index : 1}` }) - } else if (this.routerNow == 'videoMonitoring') { + this.$router.push({ path: `/${this.routerNow}?index=${item.index ? item.index : 1}` }) + } + else if (this.routerNow == 'videoMonitoring') { this.$store.state.equipmentIndex = item.index this.routerIndex = item.index // this.$router.push({ path: `/videoMonitoring?index=${item.index ? item.index : 1}` }) @@ -538,8 +543,7 @@ export default { this.$router.push({ path: `/irrigateSet?change=${item.index}` }) } } else if (item.deviceName == 20 ) { - // 智能灌溉 - + // 智能灌溉s if(this.routerNow == 'irrigateSet-soil'){ this.$store.state.equipmentIndex = item.index this.routerIndex = item.index @@ -553,7 +557,7 @@ export default { this.$message('气象站无该页面'); } } - } else if (item.router == 'formula' && this.$route.query.index == item.index) { + } else if ( this.$route.query.index == item.index) { return } else if (item.router != this.routerNow && !item.http) { this.$router.push({ name: item.router }) diff --git a/src/views/page/air-conditioning.vue b/src/views/page/air-conditioning.vue index 3ea2551..e32ae83 100644 --- a/src/views/page/air-conditioning.vue +++ b/src/views/page/air-conditioning.vue @@ -40,15 +40,37 @@ -