
<template>
  <div class="camera-content-1-1">
    <button
      class="return"
      @click="emit('close')"
    />
    <h1>{{ title }}</h1>
    <div class="content-wrap">
      <div
        class="design-wrap"
      >
        <div
          class="design-wrap-left"
          :style="$isAndroidFullScreen ? {
            paddingLeft: '50px'
          } : {}"
        >
          <p class="card-title left">
            {{ curContent.title }}
          </p>
          <div
            class="left-text text-indent"
            v-html="curContent.content"
          />
        </div>
        <div class="design-wrap-right">
          <img
            class="detail-img"
            :src="require(`@/assets/images/CameraContent-3-1-3-img-${currentSwitchIdx + 1}.png`)"
            alt=""
          >

          <div
            class="pre-btn"
            :style="{opacity: currentSwitchIdx == 0 ? '0.4':'1'}"
            @click="previous()"
          >
            <span>上一页</span>
          </div>
          <div
            class="next-btn"
            :style="{opacity: currentSwitchIdx == imgLists.length - 1 ? '0.4':'1'}"
            @click="next()"
          >
            <span>下一页</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref, computed, inject } from "vue"

const {
  windowSizeInCssForRef,
  windowSizeWhenDesignForRef,
} = useSizeAdapt(1920, 968)


const emit = defineEmits(['close'])
const $isAndroidFullScreen = inject('$isAndroidFullScreen')

const currentSwitchIdx = ref(0)

const title = '百工精巧'

const imgLists = [
  '@/assets/images/CameraContent-3-1-3-img-1.png',
  '@/assets/images/CameraContent-3-1-3-img-2.png',
  '@/assets/images/CameraContent-3-1-3-img-3.png',
  '@/assets/images/CameraContent-3-1-3-img-4.png',
  '@/assets/images/CameraContent-3-1-3-img-5.png',
  '@/assets/images/CameraContent-3-1-3-img-6.png'
]

const curContent = computed(() => {
  switch (currentSwitchIdx.value) {
  case 0:
    return {
      title: '元代漆器',
      content: '<p>从文献记载和出土实物看，元代内府也使用漆器，这类漆器可能是在武昌、嘉兴、杭州等地的官府作坊中生产的。元代漆器的生产，主要集中在南方地区，尤以嘉兴最为知名，元初就曾在此设置漆作局，著名的元代漆工彭君宝、张成、杨茂也都是此地人。元代漆器品类不少，其中螺钿、雕漆都取得了很高成就，最常见的则属色髹器。</p>'
    }
  case 1:
    return {
      title: '元代服饰',
      content: '<p>元朝是中国纺织业发展的重要阶段。一方面，棉纺织业已经相当发达，普遍改变了传统以麻布为衣着原料的习惯；另一方面，适应蒙古贵族审美需要得以发展的织金等纺织技术，将元朝高级的纺织品装饰得别具特色、富丽堂皇。可以说在元代织物中，织金锦也就是“纳石失”这样一种以金线织花的丝绸最得青睐，也最具影响。</p>'
    }
  case 2:
    return {
      title: '元代玉器',
      content: '<p>元代玉石器以各种美玉和玛瑙为主要材质，大抵为观赏和典制所需。题材与风格均发生了明显的创新与转变，在继承宋辽文化传统的基础上，较多的融入了本民族生活与文化的典型特征，体现了中原传统文化和北方少数民族文化的交流、融合和相互渗透。艺术表现手法方面与宋代玉器纤细秀丽的风格迥然不同，比较讲究作品的气韵和粗放性，不求具体描绘，不讲究细部的刻画，颇具元人健壮豪迈的气魄。</p>'
    }
  case 3:
    return {
      title: '元代砚台',
      content: '<p>元代制砚基本上延续了宋代，但略显粗犷和朴拙。在砚材上，结束了长久以来石、陶并举的局面，石砚成为一支独秀。这一时期，砚逐渐摆脱了实用的束缚，开启了集实用和赏玩于一体的风尚。</p>'
    }
  case 4:
    return {
      title: '元代笔架',
      content: '<p>笔架又称笔格、笔搁，是一种传统的文房用具，用于书写或作画间隙暂时搁置湿笔。笔架形制多样，其中别名“笔山”的山形笔架更是别具一格，以其峰峦起伏的山势促成了实用性与观赏性的和谐统一。元大都北城垣桦皮厂东部，曾出土一件青白釉山形笔架，造型非常精美，质量上乘，极具文人气息。</p>'
    }
  default:
    return {
      title: '元代金银器',
      content: '<p>元代使用黄金的风气之盛，旷古未有。统治集团的帐幕、宫室、衣饰、器用无不用金，甚至以金做大酒瓮、以银为马槽。来到中国游历的马可·波罗惊叹于忽必烈金银酒具之众多与奢华，说“非亲见者未能信也”。以此为效，风气不胫而走，民间的金银器也极其风靡。</p>'
    }
  }
})

const previous = () => {
  console.log('上一页', currentSwitchIdx.value)
  if (currentSwitchIdx.value > 0 ) {
    console.log('上一页2')
    currentSwitchIdx.value -= 1
  } else {
    return
  }
}

const next = () => {
  console.log('下一页')
  if (currentSwitchIdx.value < imgLists.length - 1) {
    currentSwitchIdx.value += 1
  } else {
    return
  }
}



</script>

<style lang="less" scoped>
@page-height-design-px: 970;

.camera-content-1-1 {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(60px);

  >button.return {
    position: absolute;
    width: 58px;
    height: 58px;
    left: 42px;
    top: 68px;
    background-image: url(@/assets/images/btn-return.png);
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center center;
    z-index: 10;
  }

  >h1 {
    position: absolute;
    left: 0;
    top: calc(10 / @page-height-design-px * 100vh);
    width: 100%;
    height: calc(140 / @page-height-design-px * 100vh);
    background-image: url(@/assets/images/camera-content-3-1-3-title-bg.png);
    background-size: auto 100%;
    background-repeat: no-repeat;
    background-position: center center;
    font-size: 36px;
    font-family: "SourceHanSerifCN-SemiBold";
    color: #FFEEC0;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1;
  }

  >.content-wrap {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;

    >.switch-wrap {
      position: absolute;
      right: calc(65 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
      bottom: calc(83 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
      z-index: 10;

      >button {
        width: calc(118 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
        height: calc(118 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
        background-image: url(@/assets/images/camera-content-1-1-1-swtich-btn-bg.png);
        background-size: 60%;
        background-repeat: no-repeat;
        background-position: center center;
        font-size: calc(24 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
        font-family: Source Han Sans SC, Source Han Sans SC;
        font-weight: 400;
        color: #FFFFFF;
        line-height: calc(28 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
        letter-spacing: calc(4 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
      }

      >button:last-of-type {
        margin-left: calc(60 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
      }

      >button.active {
        background-image: url(@/assets/images/camera-content-1-1-1-swtich-btn-bg-active.png);
        background-size: 100%;
      }
    }

    >.design-wrap {
      position: absolute;
      left: 0;
      top: 0;
      width: 100%;
      height: 100%;
      padding: 0 30px;
      background-image: url(@/assets/images/mobile/bg_3-min.jpg);
      background-size: 100% 100%;
      background-repeat: no-repeat;
      background-position: center center;
      display: flex;
      justify-content: center;
      align-items: center;
      >.design-wrap-left {
        flex: 1;
        padding-left: constant(safe-area-inset-left);
        padding-left: env(safe-area-inset-left);

        .card-title {
          width: 80%;
        }
        >.left-text {
          font-family: 'SourceHanSansSC-Normal';
          margin-top: 25px;
          padding-right: 20px;
          height: calc(300 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
          overflow: auto;
          font-family: 'SourceHanSansSC-Normal';
          // letter-spacing: 3px;
          line-height: 30px;
          font-size: 20px;
          >strong {
            color: #000000;
            font-family: 'SourceHanSansSC-Bold';
            margin-bottom: 10px;
          }
        }
      }
      >.design-wrap-right {
        flex-shrink: 0;
        width: calc(1000 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
        padding-bottom: calc(70 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
        position: relative;

        >.next-btn,
        >.pre-btn {
          right: calc(245 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
          bottom: 0;
        }
        .pre-btn {
          left: 0;
        }
        .next-btn {
          right: 0;
        }
        >.detail-img {
          width: 100%;
        }
      }
    }
  }
}

@media screen and (max-height: 480px) {
  .camera-content-1-1 {
    > h1 {
      font-size: calc(36 / 970* 100vh);
    }
    .content-wrap > .design-wrap {
      .design-wrap-left {
        width: calc(820 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
        .left-title {
          font-size: 26px;
        }
        .left-text {
          height: calc(400 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
        }
      }
      .design-wrap-right {
        padding-bottom: calc(100 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
      }
    }
  }
}
</style>
