<template>
  <div>
      <template v-if="pageStatus == 5||(pageStatus == 4 && isFlag)">
        <slot></slot>
      </template>
      <div v-else style="text-align: center;margin-top:40px">
        {{
          (pageStatus == 0 ? tipArr[0] || "配置加载中..." : "") 
          + (pageStatus == 1 ? tipArr[1] || "此页面不对此账号开放" : "")
          + (pageStatus == 2 ? tipArr[2] || "没有此页内容的配置权限，请检查集团上的配置":"")
          + (pageStatus == 3 ? tipArr[3] || "加载发生错误" : "")
          + (pageStatus == 4 ? tipArr[4] || "开关暂未开启" : "")
        }}
      </div>
  </div>
</template>

<script>

export default {
  name: "PermissionContainer",
  data() {
    return {
      pageStatus:0,
    };
  },
  async created() {
    try {
      this.pageStatus = await this.queryPageStatus(this.jiBieArr,this.type)
    } catch (error) {
      console.log(error);
      this.pageStatus = 3  
    } 
  },
  props: {
    jiBieArr: {
      type: Array,
      default() {
        return [0, 1, 2];
      },
    },
    type: {
      type: Number
    },
    isFlag: { // 是开关界面，状态 5 和 4 都会显示出 内容
      type: Boolean,
      default: false
    },
    tipArr: {
      type: Array,
      default() {
        return [];
      },
    },
  },
};
</script>

<style scoped>
</style>
