<!--
 * @FilePath: \wwwd:\code\screenFront\src\views\AerialView\content\statusBar.vue
 * @Author: 王路平
 * @文件版本: V1.0.0
 * @Date: 2023-04-04 08:11:07
 * @Description: 
 * 
 * 版权信息         : 2023 by ${再登软件}, All Rights Reserved.
-->
<template>
   <div ref="statusbarref" :key="numkey">
      <div class="tip-box-border" :style="{width: mapSize.width+'px',height:mapSize.height+'px'}" >
        <div class="DirectionalSign">
          
        </div>
        <div class="iconTip">
          <ul>
            <li v-for="item in iconList" :key="item.id" >
              <i :class="'iconfont ' + item.name + ' icon-logo'"></i
              >{{ `&nbsp&nbsp&nbsp${ t(item.i18n)}` }}
              <div>{{ `&nbsp${item.counts}/${item.allnum}` }}</div>
            </li>
            <li v-for="item in devList" :key="item.id" >
              <i :class="'iconfont ' + item.name + ' icon-logo SSCBar'"></i
              >{{ `&nbsp&nbsp&nbsp${ t(item.i18n)}` }}
              <div>{{ `&nbsp${item.counts}/${item.allnum}` }}</div>
            </li>
          </ul>
        </div>
      </div>
    </div>
</template>

<script setup lang="ts">
import {reactive, ref, watch} from "vue"
import { useAerialViewStore } from "@/store/module/AerialView";
import { useI18n } from 'vue-i18n'
let {t} = useI18n();
const store = useAerialViewStore();
let numkey=ref(0)
let statusbarref=ref()
let props = defineProps<{
  width: number;
  height: number;
}>();
let mapSize = reactive({
  width: 0,
  height: 0,
});
watch(
  () => props,
  (newVal, oldVal) => {
    //监听父组件宽高变化，随时重置本组件尺寸
    reset(newVal);
    
  },
  { immediate: true, deep: true, flush: "post" }
);
function reset(val: any) {
  //宽高为0时跳出该方法

  if (!val.width && !val.height) return;
  mapSize.width=val.width
  mapSize.height=val.height
  numkey.value++
//   statusbarref.value.style.width=val.width
//   statusbarref.value.style.height=val.height
  //重置盒子尺寸
}

watch(
  () => store.iconList,
  (newVal, oldVal) => {
    
    
    iconList= reactive(newVal)
    console.log();
    numkey.value++
  },
  { deep: true, flush: "post" }
);
watch(
  () => store.devList,
  (newVal, oldVal) => {
    
    
    devList= reactive(newVal)
    numkey.value++
  },
  { deep: true, flush: "post" }
);
let iconList = reactive([])
let devList = reactive([])
</script>

<style scoped>
@import url("@/assets/css/iconfont.css");
.tip-box-border{
  position: fixed;
  top: 0;
  bottom: 0;
  right: 0;
  height: 97%;
  width: 99%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color:rgba(0,0,0,0.5);
} 
.DirectionalSign{
  width: 60%;
  height: 20%;
  background-image: url(@/assets/img/AerialView/direction.png);
  background-size: 100% 100%;
}
.iconTip{
  width: 100%;
  height: 80%;
  }
.iconTip>ul>li{
  padding-left: 10%;
  margin-top: 10px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  font-size: 1.5rem;
  color: #fff;
}
.iconTip>ul>li>i{
  font-size: 1.5rem;
}
</style>
