<template>
  <div class="start-view">
    <img
      class="logo"
      src="@/assets/images/logo.png"
      alt=""
      draggable="false"
    >
    <img
      class="start-view-banner"
      src="@/assets/images/start-view-banner.png"
      alt=""
      draggable="false"
    >
    <div class="btn-group">
      <button @click="$router.push({name: 'DrawView'})">
        体验版画过程
      </button>
      <button @click="copy('sldkfksfklslkdf')">
        分享
      </button>
    </div>
  </div>
</template>

<script setup>
import { watch, ref } from "vue"
import { useClipboard } from '@vueuse/core'
import { showToast } from "@/store/index.js"

const {
  windowSizeInCssForRef,
  windowSizeWhenDesignForRef,
} = useSizeAdapt()

const source = ref('Hello')
const { text, copy, copied, isSupported } = useClipboard({
  source,
  legacy: true,
})
watch(copied, (vNew) => {
  if (vNew) {
    showToast('地址已复制到剪贴板')
  }
})

</script>

<style lang="less" scoped>
.start-view{
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-image: url(/src/assets/images/bg.jpg);
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center center;
  >img.logo{
    position: absolute;
    top: 19px;
    left: 23px;
    height: 35px;
  }
  >img.start-view-banner{
    position: absolute;
    top: 42.27%;
    left: 50%;
    width: calc(375 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
    height: calc(500 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));;
    transform: translate(-50%, -50%);
  }
  >.btn-group{
    position: absolute;
    bottom: calc(52 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
    width: 100%;
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    >button{
      flex: 0 0 auto;
      font-size: calc(20 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
      font-family: Source Han Serif CN-Bold, Source Han Serif CN;
      font-weight: bold;
      color: #484238;
      line-height: calc(23 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
      height: calc(55 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));;
    }
    >button:first-of-type{
      background-image: url(@/assets/images/btn-long-bright.png);
      background-size: contain;
      background-repeat: no-repeat;
      background-position: center center;
      width: calc(186 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
    }
    >button:last-of-type{
      background-image: url(@/assets/images/btn-short-dark.png);
      background-size: contain;
      background-repeat: no-repeat;
      background-position: center center;
      width: calc(144 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));;
    }
  }
}
</style>