<template>
  <div class="plate">
    <div>
      <ul>
        <li app-border dir-bottom>
          <div class="preview-con">
            <div class="preview">
              <img :src="info.logo||require('@/assets/images/default/img_logo_default.png')" alt="" />
            </div>
            <div class="upload-con">
              <button
                class="ui-button submit"
                @click="$emit('openMaterial'), (param = 'logo')"
              >
                选择图片
              </button>
              <div class="ui-remark">
                建议300*300px，600kb以内，支持jpg/png格式
              </div>
            </div>
          </div>
        </li>
        <li>
          <div class="title">显示设置</div>
          <div class="switch-con">
            <span class="title">显示logo</span>
            <switcher
              name="pano"
              :value="info.isLogo"
              @change="onSwitcherChange"
            ></switcher>
          </div>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
import Switcher from "@/components/shared/Switcher";
import { mapGetters } from "vuex";

export default {
  props: ["select"],
  components: {
    Switcher,
  },
  computed: {
    ...mapGetters({
      info: "info",
    }),
  },
  watch: {
    select(newVal) {
      if (newVal) {
        this.info[this.param] = newVal;
        this.info.logoChange = true
        this.select = "";
      }
    },
  },

  data() {
    return {
      param: "",
    };
  },
  methods: {
    onFileChange() {},
    onSwitcherChange(data) {
      this.info.isLogo = data;
    },
  },
};
</script>
<style lang="less" src="./style.less"></style>

<style lang="less" scoped>
.preview-con {
  display: flex;
  .preview {
    width: 100px;
    height: 100px;
    overflow: hidden;
    >img{
      max-width: 100px;
      max-height: 100px;
    }
  }
  .upload-con {
    flex: 1;
    .ui-button {
      width: 100%;
    }
    .ui-remark {
      margin-top: 10px;
      width: 100%;
      word-break: keep-all;
    }
  }
  .bars {
  }
}
</style>

