IonicIndex.vue 4.3 KB
<template>
<div class="bg-color" style="height:100%;">
  <el-container>
      <div class="aside-body">
    <el-aside width="120PX">
        <div class="aside">
            <div class="homeImg" @click="toHome"  :class="{curActive: 'home'==isShaw}">
              <img class="home-size" src="../assets/img/home.png"  alt="">
            </div>
            <div style="widht:120px;height:15px;background:#242424;"></div>
            <div style="margin-top:15px;">
                <div class="aside-menu"
                    :class="{curActive:v.id==isShaw}"
                    v-for="(v,i) in asideList" 
                    :key ="i"
                    draggable="true" 
                    @dragstart="start(v,i)"
                    @dragover="over($event)"
                    @drop="drop(i)"

                    @click="toMenu(v,i)">
                    <img class="aside-img" :src="v.imgURL"  alt="">
                    <div class="aside-text">{{changeMenu(v.id)}}</div>
                </div>
            </div>
        </div>
        
   </el-aside>
    </div>
    <el-container>
      <el-header>
         <Header ref="header" @logoOut ="signOut"> </Header>
      </el-header>
      <el-main>
        <router-view/>
      </el-main>
    </el-container>
  </el-container>
</div>
</template>

<script>

import Header from '@/components/IonicsoilHeader'
export default {
  name: 'Index',
  data() {
    return {
        index:false,
        htmlHeight:'',
        asideList:[
            {id:'test',path:'/IonicTest',imgURL:require('../assets/img/test.png'),name:'KANBAN'},
            {id:'system',path:'/IonicSystem',imgURL:require('../assets/img/system.png'),name:'KANBAN'},
            {id:'help',path:'/IonicHelp',imgURL:require('../assets/img/help.png'),name:'KANBAN'},
            // {id:'rinse',path:'/IonicRinse',imgURL:require('../../assets/img/help.png'),name:'KANBAN'},
         
        ]
    }
  },
  components: {
   
    Header
  },
  computed:{
    changeMenu(){
        return function(id){
            return this.$t('IonicHome["'+id+'"]');
        }
    },
    isShaw(){
        return this.$store.state.menuPath;
    },
    isShow(){
        return this.$store.state.asideFlag
      }
  },
  created(){
    },
  methods:{
    toHome(){
      localStorage.setItem("asideId",'home');
      this.$store.dispatch("changePath")
      this.$router.push('/IonicHome');
    },
      start(item,index){
            this.currMoveItem = item; // 当前移动元素
            this.currMoveIndex = index; // 当前移动数组下标
            console.log('开始移动',item,index);
        },
        over(ev){
            ev.preventDefault();
        },
        drop(index){
            console.log('放下',index);
            if(index == this.currMoveIndex) return false; // 不是原地移动
        
            console.log('从'+this.currMoveIndex+'移动到'+index);
            this.asideList.splice(this.currMoveIndex,1); // 删除元素之前所在位置
            this.asideList.splice(index,0,this.currMoveItem); // 在需要放下元素的位置前插入移动元素
            // 下面有无都无所谓
            this.currMoveIndex = false;
            this.currMoveItem = false;
        },
      toMenu(v,i){
          localStorage.setItem("asideId",v.id);
        this.$store.dispatch("changePath")
        //   this.index = i;
         if(v.id=='tmviewer'){
            location.href="teamviewer8://remotecontrol";
        }else{
            //  this.$router.push('/Kanban');
             this.$router.push(v.path);
        }

      },
    signOut(){
      //  this.$router.push('/Kanban')
           this.$infoBox(this.$t('backTips.content'), {
            status: 'default',
            title: this.$t('backTips.title'),
            confirmTitle: this.$t('backTips.confirm'),
            cancelTitle: this.$t('backTips.cancel'),
            confirm: () => { this.$router.push('/Login') },
            cancel: () => { this.asidebox; }
        });
    }
  },
  mounted() {
  }
}
</script>

<style lang="less">
@import url('../styles/ionicindex.less');
.el-main{
  padding: 0 !important;
  background-color: #242424;
}

 .el-header {
    min-width: 450px;
    background-color: transparent;
    color: #333;
    text-align: center;
   height: 85px !important;
  }
  .curActive{
    background-color: #323333 !important;
}
.bg-color{
    height: 100%;
    background-color:#232423 !important;
}
</style>