pc-master #10
@ -43,7 +43,12 @@ input::-webkit-inner-spin-button {
 | 
			
		||||
  -webkit-appearance: none !important;
 | 
			
		||||
  margin: 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#app{
 | 
			
		||||
  min-width: 1290px;
 | 
			
		||||
  min-height: 900px;
 | 
			
		||||
  width: 100vw;
 | 
			
		||||
  height: 100vh;
 | 
			
		||||
}
 | 
			
		||||
@font-face {
 | 
			
		||||
  font-family: Oswald;
 | 
			
		||||
  src: url(./assets/ttf/Oswald-Medium.ttf);
 | 
			
		||||
 | 
			
		||||
@ -112,4 +112,8 @@ export default {
 | 
			
		||||
  getGethls(data){
 | 
			
		||||
    return sendGetRequest("/camera/gethls",data);
 | 
			
		||||
  },
 | 
			
		||||
  //根据ID查询用户信息
 | 
			
		||||
  getUser(data){
 | 
			
		||||
    return sendGetRequest('/api/sel/user',data)
 | 
			
		||||
  },
 | 
			
		||||
};
 | 
			
		||||
@ -203,8 +203,8 @@
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.index {
 | 
			
		||||
  width: 100vw;
 | 
			
		||||
  height: 100vh;
 | 
			
		||||
  width: 100%;
 | 
			
		||||
  height: 100%;
 | 
			
		||||
  min-height: 900px;
 | 
			
		||||
  overflow: auto;
 | 
			
		||||
  background: url(../image/index-background.png) no-repeat;
 | 
			
		||||
@ -377,11 +377,13 @@
 | 
			
		||||
  height: 100%;
 | 
			
		||||
  background: rgba(0, 29, 68, 0.25);
 | 
			
		||||
  border-right: 2px solid rgba(0, 180, 255, 0.25);
 | 
			
		||||
  overflow: auto;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.index .index-content .right {
 | 
			
		||||
  width: calc(100% - 240px);
 | 
			
		||||
  height: 100%;
 | 
			
		||||
  overflow: auto;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.input-view {
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										2
									
								
								src/assets/css/main.min.css
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								src/assets/css/main.min.css
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@ -217,14 +217,13 @@
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.index {
 | 
			
		||||
    width: 100vw;
 | 
			
		||||
    height: 100vh;
 | 
			
		||||
    width: 100%;
 | 
			
		||||
    height: 100%;
 | 
			
		||||
    min-height: 900px;
 | 
			
		||||
    overflow: auto;
 | 
			
		||||
    background: url(../image/index-background.png) no-repeat;
 | 
			
		||||
    background-size: 1920px 1080px;
 | 
			
		||||
    background-position: center top;
 | 
			
		||||
 | 
			
		||||
    .no-list {
 | 
			
		||||
        color: #fff;
 | 
			
		||||
        display: flex;
 | 
			
		||||
@ -392,12 +391,13 @@
 | 
			
		||||
            background: rgba(0, 29, 68, 0.25);
 | 
			
		||||
            border-right: 2px solid rgba(0, 180, 255, 0.25);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            overflow: auto;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        .right {
 | 
			
		||||
            width: calc(100% - 240px);
 | 
			
		||||
            height: 100%;
 | 
			
		||||
            overflow: auto;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -104,8 +104,8 @@ export default {
 | 
			
		||||
</script>
 | 
			
		||||
<style lang="scss">
 | 
			
		||||
.home {
 | 
			
		||||
  width: 100vw;
 | 
			
		||||
  height: 100vh;
 | 
			
		||||
  width: 100%;
 | 
			
		||||
  height: 100%;
 | 
			
		||||
  min-height: 900px;
 | 
			
		||||
  overflow: auto;
 | 
			
		||||
  background: url(../assets/image/background.jpg) no-repeat;
 | 
			
		||||
 | 
			
		||||
@ -2,7 +2,7 @@
 | 
			
		||||
    <div class="index">
 | 
			
		||||
        <div class="header">
 | 
			
		||||
            <div class="header-left">
 | 
			
		||||
                <img  src="../assets/image/logo.png" alt="">
 | 
			
		||||
                <img src="../assets/image/logo.png" alt="">
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="header-center">
 | 
			
		||||
                <div @click="toRouter(item)" :class="item.routerList.indexOf(routerNow) != -1 ? 'active' : ''"
 | 
			
		||||
@ -73,12 +73,12 @@ export default {
 | 
			
		||||
                { name: '首页', img: require('../assets/image/index-icon.png'), list: [], router: 'realTime', isRouter: true, },
 | 
			
		||||
                { name: '一号温室', img: require('../assets/image/left-img0.png'), list: [] },
 | 
			
		||||
                { name: '二号温室', img: require('../assets/image/left-img1.png'), list: [] },
 | 
			
		||||
                { name: '施肥机', routerList: ['formula', 'irrigateSet', 'PIDSet', 'systemSet', 'upload', 'sensorSet','realTime'], img: require('../assets/image/left-img2.png'), list: [] },],
 | 
			
		||||
                { name: '施肥机', routerList: ['formula', 'irrigateSet', 'PIDSet', 'systemSet', 'upload', 'sensorSet', 'realTime'], img: require('../assets/image/left-img2.png'), list: [] },],
 | 
			
		||||
            routerNow: 'realTime',
 | 
			
		||||
            routerIndex: 1,
 | 
			
		||||
            equipmentList: [],
 | 
			
		||||
            userInfo: null,
 | 
			
		||||
            loading:true,//页面加载
 | 
			
		||||
            loading: true,//页面加载
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
    watch: {
 | 
			
		||||
@ -88,50 +88,65 @@ export default {
 | 
			
		||||
    },
 | 
			
		||||
    mounted() {
 | 
			
		||||
        this.getTime()
 | 
			
		||||
        if (localStorage.getItem('token')) {
 | 
			
		||||
            this.userInfo = JSON.parse(localStorage.getItem('userInfo'))
 | 
			
		||||
        var router = this.$route.query
 | 
			
		||||
        if (router.token && router.userid) {
 | 
			
		||||
            localStorage.setItem('token', router.token)
 | 
			
		||||
 | 
			
		||||
            this.api.getUser({ userId: router.userid }).then(res => {
 | 
			
		||||
                var data=res.data.data
 | 
			
		||||
                data.userid=router.userid
 | 
			
		||||
                localStorage.setItem('userInfo', JSON.stringify(data))
 | 
			
		||||
                this.userInfo = JSON.parse(localStorage.getItem('userInfo'))
 | 
			
		||||
                this.gerRouter();
 | 
			
		||||
                this.getEqbyid()
 | 
			
		||||
            })
 | 
			
		||||
            return
 | 
			
		||||
        } else {
 | 
			
		||||
            if (localStorage.getItem('token')) {
 | 
			
		||||
                this.userInfo = JSON.parse(localStorage.getItem('userInfo'))
 | 
			
		||||
            }
 | 
			
		||||
            this.gerRouter();
 | 
			
		||||
            this.getEqbyid()
 | 
			
		||||
        }
 | 
			
		||||
        this.gerRouter();
 | 
			
		||||
        this.getEqbyid()
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    },
 | 
			
		||||
    methods: {
 | 
			
		||||
        //获取设备名称/配方名称
 | 
			
		||||
        getByid(){
 | 
			
		||||
            var store=this.$store.state
 | 
			
		||||
      var data = {
 | 
			
		||||
        deviceId:store.equipmentList[store.equipmentIndex-1].deviceId,
 | 
			
		||||
      };
 | 
			
		||||
      this.api.getByid(data).then((res) => {
 | 
			
		||||
        if (res.data.code == 200) {
 | 
			
		||||
            store.equipmentName=res.data.data
 | 
			
		||||
        } else {
 | 
			
		||||
          this.$message.error(res.data.msg);
 | 
			
		||||
        }
 | 
			
		||||
        this.loading=false
 | 
			
		||||
      });
 | 
			
		||||
        getByid() {
 | 
			
		||||
            var store = this.$store.state
 | 
			
		||||
            var data = {
 | 
			
		||||
                deviceId: store.equipmentList[store.equipmentIndex - 1].deviceId,
 | 
			
		||||
            };
 | 
			
		||||
            this.api.getByid(data).then((res) => {
 | 
			
		||||
                if (res.data.code == 200) {
 | 
			
		||||
                    store.equipmentName = res.data.data
 | 
			
		||||
                } else {
 | 
			
		||||
                    this.$message.error(res.data.msg);
 | 
			
		||||
                }
 | 
			
		||||
                this.loading = false
 | 
			
		||||
            });
 | 
			
		||||
        },
 | 
			
		||||
        //获取设备
 | 
			
		||||
        getEqbyid() {
 | 
			
		||||
            var userInfo = JSON.parse(localStorage.getItem('userInfo'))
 | 
			
		||||
            this.api.getEqbyid(userInfo.userid).then((res) => {
 | 
			
		||||
                if (res.data.code == 200) {
 | 
			
		||||
                    this.$store.state.equipmentList = res.data.data.map((item,index) => {
 | 
			
		||||
                    this.$store.state.equipmentList = res.data.data.map((item, index) => {
 | 
			
		||||
                        return {
 | 
			
		||||
                            ...item,
 | 
			
		||||
                            router: 'formula',
 | 
			
		||||
                            index: index+1,
 | 
			
		||||
                            index: index + 1,
 | 
			
		||||
                        };
 | 
			
		||||
                    });
 | 
			
		||||
                  
 | 
			
		||||
 | 
			
		||||
                    this.leftList.forEach((el, index) => {
 | 
			
		||||
                        if (el.name == '施肥机') {
 | 
			
		||||
                            this.leftList[index].list = this.$store.state.equipmentList
 | 
			
		||||
                        }
 | 
			
		||||
                    })
 | 
			
		||||
                    this.getByid()
 | 
			
		||||
                    
 | 
			
		||||
 | 
			
		||||
                }
 | 
			
		||||
            })
 | 
			
		||||
        },
 | 
			
		||||
@ -163,9 +178,9 @@ export default {
 | 
			
		||||
                if (item.http) {
 | 
			
		||||
                    window.location.href = item.http;
 | 
			
		||||
                } else if (item.router == 'formula' && this.$route.query.index != item.index) {
 | 
			
		||||
                    this.$store.state.equipmentIndex=item.index
 | 
			
		||||
                    this.$store.state.equipmentIndex = item.index
 | 
			
		||||
                    this.$router.push({ path: `/${item.router}?index=${item.index ? item.index : 1}` })
 | 
			
		||||
                
 | 
			
		||||
 | 
			
		||||
                } else if (item.router != this.routerNow && !item.http) {
 | 
			
		||||
                    this.$router.push({ name: item.router })
 | 
			
		||||
                }
 | 
			
		||||
@ -178,13 +193,13 @@ export default {
 | 
			
		||||
                if (item.http) {
 | 
			
		||||
                    window.location.href = item.http;
 | 
			
		||||
                } else if (item.router == 'formula' && this.$route.query.index != item.index) {
 | 
			
		||||
                  if(this.routerNow=='realTime'){
 | 
			
		||||
                    this.$router.push({ path: `/realTime?index=${item.index ? item.index : 1}` })
 | 
			
		||||
                  }else{
 | 
			
		||||
                    this.$store.state.equipmentIndex=item.index
 | 
			
		||||
                    this.$router.push({ path: `/formula?index=${item.index ? item.index : 1}` })
 | 
			
		||||
                
 | 
			
		||||
                  }
 | 
			
		||||
                    if (this.routerNow == 'realTime') {
 | 
			
		||||
                        this.$router.push({ path: `/realTime?index=${item.index ? item.index : 1}` })
 | 
			
		||||
                    } else {
 | 
			
		||||
                        this.$store.state.equipmentIndex = item.index
 | 
			
		||||
                        this.$router.push({ path: `/formula?index=${item.index ? item.index : 1}` })
 | 
			
		||||
 | 
			
		||||
                    }
 | 
			
		||||
                } else if (item.router != this.routerNow && !item.http) {
 | 
			
		||||
                    this.$router.push({ name: item.router })
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user