order-slide-item.vue 2.6 KB
<template>
  <div class="order-wrapper">
    <Slide :data="list"
          :loop="false"
          :autoPlay="false"
          class="slide-container"
          @change="slideChangeHandler"
          :threshold="0.05"
          @options="slideOptions"
    >
      <SlideItem v-for="i in list">
        <div class="image-wrapper">
          <img class="image" :src="i" alt="">
        </div>
      </SlideItem>

      <template slot="dots"><i></i></template>
    </Slide>

    <div class="image-preview-footer">
      <span class="image-preview-counter">{{currentPageIndex + 1}}/{{list.length}}</span>
    </div>

    <AvatarHeader class="avatar-wrapper"></AvatarHeader>

    <DescFooter class="footer-wrapper" @on-comment-click="onCommentClick"></DescFooter>
  </div>
</template>

<script>

import {Slide} from 'cube-ui';
import AvatarHeader from './avatar-header';
import DescFooter from './desc-footer';

export default {
  name: 'ShowOrderItem',
  components: {
    AvatarHeader,
    DescFooter,
    Slide,
    SlideItem: Slide.Item,
  },
  data() {
    return {
      list: [
        'https://wx1.sinaimg.cn/mw1024/686d7361ly1fpha0mpd5uj21hc0tyws2.jpg',
        'https://wx1.sinaimg.cn/mw1024/686d7361ly1fpha0ncnnej21hc0zetxo.jpg',
        'https://wx1.sinaimg.cn/mw1024/686d7361ly1fpha0mqvu5j21hc0zkgzz.jpg',
      ],
      currentPageIndex: 0,
      slideOptions: {
        listenScroll: true,
        probeType: 3,
        click: false,
        directionLockThreshold: 0,
        stopPropagation: true
      }
    };
  },
  methods: {
    close() {

    },
    onclick(e) {
      console.log('huangtao12=>',e);
    },
    slideChangeHandler(currentPageIndex) {
      this.currentPageIndex = currentPageIndex;
    },
    onCommentClick() {
      this.$emit('on-comment-click', {});
    }
  }
};
</script>

<style lang="scss" scoped>
.order-wrapper {
  width: 100%;
  height: 100%;
  position: relative;
  background-image: url('~statics/image/showorder/sd_bg@2x.png');
  background-size: cover;
}

.avatar-wrapper {
  position: absolute;
  width: 100%;
  top: 0;
  z-index: 2;
}

.image-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;

  .image {
    width: 100%;
  }
}

.image-preview-footer {
  position: absolute;
  width: 180px;
  height: 60px;
  background: rgba(0, 0, 0, 0.4);
  top: 110px;
  right: -60px;
  border-radius: 30px;
}

.image-preview-counter {
  margin-left: 40px;
  font-size: 26px;
  color: white;
  height: 60px;
  line-height: 60px;
}

.footer-wrapper {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
}

.test {
  position: absolute;
  top: 50px;
  left: 100px;
}
</style>