NoviceGuide.vue 3.62 KB
<template>
  <view
    class="noviceGuide-box"
    v-if="showNoviceGuide"
  >
    <!-- <template v-if="step == 1">
      <img
        :src="step_1[1]"
        class="step-1-1"
      >
      <img
        :src="step_1[2]"
        class="step-1-2"
        @click="step = 2"
      >
    </template>
    <template v-else-if="step = 2">
      <img
        :src="step_1[1]"
        class="step-2-1"
      >
      <img
        :src="step_1[2]"
        class="step-2-2"
        @click="step = 2"
      >
    </template> -->
    <template v-for="(i,index) in stepList">
      <view
        :key="index"
        v-if="index == step"
      >
        <image
          :src="i[1]"
          :class="['step',`step-${index + 1}-1`]"
        />
        <image
          :src="i[2]"
          :class="['step',`step-${index + 1}-2`]"
          @click="jump"
        />
      </view>
    </template>
  </view>

</template>

<script type='text/ecmascript-6'>
export default {
  name: 'NoviceGuide',
  computed: {
    watchUpdateStatus () {
      return this.$store.state.update.status
    },
  },
  watch: {
    watchUpdateStatus: {
      immediate: true,
      handler (newval) {
        this.showNoviceGuide = !newval && !uni.$storage.get('noviceGuideStatus')
      }
    },
  },
  data () {
    return {
      showNoviceGuide: false,
      step: 0,
      stepList: [
        {
          '1': require('@/assets/images/noviceGuide/step1-1.webp'),
          '2': require('@/assets/images/noviceGuide/step1-2.webp')
        },
        {
          '1': require('@/assets/images/noviceGuide/step2-1.webp'),
          '2': require('@/assets/images/noviceGuide/step2-2.webp')
        },
        {
          '1': require('@/assets/images/noviceGuide/step3-1.webp'),
          '2': require('@/assets/images/noviceGuide/step3-2.webp')
        },
        {
          '1': require('@/assets/images/noviceGuide/step4-1.webp'),
          '2': require('@/assets/images/noviceGuide/step4-2.webp')
        },
        {
          '1': require('@/assets/images/noviceGuide/step5-1.webp'),
          '2': require('@/assets/images/noviceGuide/step5-2.webp')
        }
      ],
    }
  },
  mounted () {
  },
  methods: {
    jump () {
      this.step += 1
      if (this.step == 2) this.$emit('nextStep')
      if(this.step == 5) {
        this.showNoviceGuide = false
        uni.$storage.set('noviceGuideStatus', Date.now())
        this.$emit('back')
      }
    }
  }
}
</script>

<style scoped lang='scss'>
.noviceGuide-box {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  z-index: 10086;
  background-color: #000000bf;
  .step {
    position: absolute;
  }
  .step-1-1 {
    width: 2060rpx;
    height: 244rpx;
    top: 70rpx;
    left: 256rpx;
  }
  .step-1-2 {
    width: 662rpx;
    height: 462rpx;
    top: 424rpx;
    left: 50%;
    transform: translateX(-50%);
  }
  .step-2-1 {
    left: 8rpx;
    bottom: 152rpx;
    width: 294rpx;
    height: 120rpx;
  }
  .step-2-2 {
    left: 326rpx;
    bottom: 150rpx;
    width: 1066rpx;
    height: 350rpx;
  }
  .step-3-1 {
    width: 2168rpx;
    height: 340rpx;
    top: 262rpx;
    left: 50%;
    transform: translateX(-50%);
  }
  .step-3-2 {
    width: 662rpx;
    height: 510rpx;
    top: 602rpx;
    left: 50%;
    transform: translateX(-50%);
  }
  .step-4-1 {
    width: 190rpx;
    height: 1248rpx;
    top: 96rpx;
    right: 20rpx;
  }
  .step-4-2 {
    width: 1074rpx;
    height: 312rpx;
    top: 50%;
    right: 226rpx;
    transform: translateY(-50%);
  }
  .step-5-1 {
    width: 190rpx;
    height: 192rpx;
    bottom: 96rpx;
    right: 20rpx;
  }
  .step-5-2 {
    width: 1074rpx;
    height: 312rpx;
    right: 226rpx;
    bottom: 144rpx;
  }
}
</style>