<template>
  <div class="museum">
    <!-- <NavBar /> -->
    <div class="main">
      <div class="content">
        <el-row :gutter="20">
          <el-col :span="24" class="rclist">
            <div class="search">
              <SearchBar @search="search" />
            </div>
            <div class="display-group">
              <el-row :gutter="60">
                <el-col
                  :span="6"
                  class="display-item"
                  @click.native="handleClick(item)"
                  v-for="(item, index) in list"
                  :key="index"
                >
                  <div class="img" v-if="item.faceImageUrl">
                    <img
                      :src="item.faceImageUrl"
                      alt=""
                      srcset=""
                      v-if="item.faceImageUrl"
                      width="100%"
                      @error="defImg"
                      class="cr-img"
                    />
                    <img
                      v-else
                      src="@/assets/404_images/no-pic.png"
                      alt=""
                      width="100%"
                      height="100%"
                    />
                    <div class="desc">
                      <span class="name">{{ item.name }}</span>
                      <!-- <span class="deptName">{{ item.deptName }}</span> -->
                    </div>
                  </div>
                </el-col>
              </el-row>
            </div>
          </el-col>
        </el-row>
      </div>
    </div>
    <!-- <Footer /> -->
  </div>
</template>

<script>
import SearchBar from "@/components/SearchBar";
// import NavBar from "@/components/NavBar";
// import Footer from "@/components/Footer";
import { getMuseumTreeV1 } from "@/api/org";
export default {
  name: "Museum",
  // components: { SearchBar, NavBar, Footer },
  components: { SearchBar },
  data() {
    return {
      selectValue: "",
      keyword: "",
      currentType: "all",
      list: [],
    };
  },
  created() {
    setTimeout(() => {
      // console.log(this.dicts);
    });
  },
  mounted() {
    this.loadData();
  },
  methods: {
    async loadData() {
      var params = {
        dept: "",
      };
      let res = await getMuseumTreeV1(params);
      if (res.code == 0) {
        this.list = res.data[0].children;
      }
    },

    async search() {
      var params = {
        name: this.keyword,
      };
      console.log("params", params);
      //   let res = await getCulturalRelicList(params);
      //   if (res.code == 0) {
      //     this.list = res.data;
      //   }
    },

    handleClick(item) {
      const { id } = item;
      this.$router.push({
        path: "museum/" + id,
      });
    },

    defImg(e) {
      e.target.src = require("@/assets/404_images/no-pic.png");
    },
  },
};
</script>

<style lang="scss" scoped>
$blue: #1e5fbb;
$text-indent: 16px;
.museum {
  width: 100%;
  // background-color: #2069c4;
  // color: #fff;
  .main {
    display: flex;
    align-items: center;
    flex-direction: column;
    padding: 0 60px;
    .search {
      display: flex;
      justify-content: center;
      align-items: center;
      margin-bottom: 40px;
      // margin-top: 20px;
    }
    .search-bar {
      width: 1200px;
      margin-right: 10px;
      // border-radius: 48px !important;
    }

    .total {
      margin-bottom: 40px;
    }
    .divider {
      width: 100%;
      height: 1px;
      background-color: $blue;
      margin-bottom: 20px;
    }

    .content {
      width: 100%;
      .selectors {
        margin-top: 80px;

        .select-card {
          width: 100%;
          box-shadow: 0 2px 10px 6px rgba(0, 0, 0, 0.12);
          border-radius: 8px;
          margin-bottom: 16px;
          .title {
            padding: 10px 20px;
            background-color: #1e5fbb;
            border-radius: 8px 8px 0 0;
            color: #fff;
            font-weight: bold;
          }
          .body {
            padding: 10px 20px;
            background-color: #fff;
            border-radius: 0 0 8px 8px;
            .select-items {
              display: flex;
              margin-bottom: 20px;
              cursor: pointer;
              margin-top: 24px;
              .check-box {
                border: 2px solid #563f17;
                width: 20px;
                height: 20px;
                margin-right: 15px;
                i {
                  color: $blue;
                  width: 2px;
                  font-weight: bold;
                }
              }
              .check-value {
                color: #563f17;
                font-size: 14px;
                font-weight: bold;
              }
            }
          }
        }
      }
      .rclist {
        .img {
          width: 100%;
          margin-bottom: 10px;
          position: relative;
          .cr-img {
            width: 100%;
          }
          .showIcon {
            position: absolute;
            opacity: 0.7;
            top: 10px;
            right: 10px;
            width: 24px;
            height: 24px;
            background-color: #fff;
            opacity: 0.2;
            border-radius: 4px;
            padding: 2px;
            .icon {
              width: 100%;
              height: 100%;
            }
          }
          .desc {
            position: absolute;
            width: 100%;
            padding: 10px;
            background-color: #fff;
            opacity: 0.7;
            bottom: 0;
            left: 0;
          }

          .collect {
            position: absolute;
            right: 20px;
            bottom: 20px;
            .collect-box {
              width: 40px;
              height: 40px;
              display: flex;
              justify-content: center;
              align-items: center;
              background-color: rgba(0, 0, 0, 0.15);
              border-radius: 8px;
              cursor: pointer;
              img {
                width: 20px;
                height: 20px;
                opacity: 0.5;
              }
            }
          }
        }

        .display-item {
          cursor: pointer;
          .img {
            img {
              width: 100%;
              height: 250px;
            }
          }
        }
      }
    }
  }

  .pagination {
    margin-top: 24px;
    display: flex;
    justify-content: center;
  }
}
</style>