<template>
  <div class="home-cell" id="quickVisit">
    <CellHeaderVue title="快速访问">
      <span class="el-icon-setting" title="设置" @click="openSetting"></span>
    </CellHeaderVue>

    <quick
      ref="quick"
      :cellScrollHeight="cellScrollHeight"
      quickType="visit"
    ></quick>
  </div>
</template>

<script>
import CellHeaderVue from "./common/CellHeader.vue";
import quick from "./common/quick.vue";

import defaultVisitItems from "./common/defaultQuickVisitItems.js";

export default {
  name: "QuickVisit",
  components: { CellHeaderVue, quick },
  props: {
    cellScrollHeight: {
      type: Number,
      required: true,
    },
  },
  created() {
    const admin = localStorage.getItem("quick-visit-admin");
    if (!admin) {
      localStorage.setItem(
        "quick-visit-admin",
        JSON.stringify(defaultVisitItems.admin)
      );
    }
    const normal = localStorage.getItem("quick-visit-normal");
    if (!normal) {
      localStorage.setItem(
        "quick-visit-normal",
        JSON.stringify(defaultVisitItems.normal)
      );
    }
  },
  methods: {
    openSetting() {
      this.$refs.quick.openSetting();
    },
  },
};
</script>

<style scoped></style>
