保誠-保戶業務員媒合平台
wayne
2022-01-26 6fa4bba623713c396432ba8b863846883d6a1906
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<template>
<div>
    <swiper ref="mySwiper"
      :options="swiperOptions"
      class="swiperStyle"
      @click-slide="clkItem"
    >
        <swiper-slide class="fix-chrome-click--issue"
          v-for="(agentInfo, index) in agents"
          :key="index"
        >
            <div class="consultantCardStyle" >
              <UiAvatar
                class="mb-10"
                :size="80"
                :agentNo="agentInfo.agentNo"
              >
              </UiAvatar>
              <div class="name">{{agentInfo.name}}</div>
              <div v-if="!hideReviews">
                <!-- TODO:隱藏滿意度 -->
                <i class="icon-star pam-icon icon--yellow"></i>
                <span class="satisfaction">{{agentInfo.avgScore}}</span>
              </div>
          </div>
        </swiper-slide>
 
        <div class="swiper-button-prev" slot="button-prev">
          <i class="icon-left"></i>
        </div>
        <div class="swiper-button-next" slot="button-next">
          <i class="icon-right"></i>
        </div>
    </swiper>
</div>
</template>
 
<script lang="ts">
import { Vue, Component, Prop } from 'vue-property-decorator';
import { SwiperOptions } from 'swiper';
import { Consultant } from '~/shared/models/consultant.model';
import { hideReviews } from '~/shared/const/hide-reviews';
 
@Component
export default class UiSwiper extends Vue {
 
    @Prop()
    agents!: Consultant[];
 
    hideReviews = hideReviews ;
    swiperOptions: SwiperOptions = {
      loop: false,
        slideToClickedSlide: false,
        navigation: {
          nextEl: '.swiper-button-next',
          prevEl: '.swiper-button-prev'
        },
        breakpoints: {
          320: {
            slidesPerView: 3,
            spaceBetween: -20
          },
          768: {
            slidesPerView: 6,
            spaceBetween: -20
          }
        }
    }
 
    //////////////////////////////////////////////////////////////////////
 
    clkItem(loopIndex: number, realIndex: number) {
      const agentNo = this.agents[loopIndex].agentNo;
      this.$router.push(`/agentInfo/${agentNo}`);
    }
 
}
 
 
</script>
 
<style lang="scss" scoped>
.swiperStyle {
  box-shadow: 0 0 6px #22222229;
  border-radius: 10px;
  padding: 45px 0 37px 0;
  background-color: $PRIMARY_WHITE;
 
  .swiper-slide {
    cursor: pointer;
  }
 
  .swiper-button-next,.swiper-button-prev {
    @extend .fix-chrome-click--issue;
    background-color: $PRIMARY_WHITE;
    top: 0px;
    height: 100%;
 
    &:after {
      display: none;
    }
 
    .icon-right,.icon-left {
      font-size: 20px;
      color: $CORAL;
    }
 
    &.swiper-button-disabled {
      pointer-events: auto;
    }
  }
 
  .swiper-button-prev {
    left: 0;
  }
 
  .swiper-button-next {
    right: 0;
  }
}
 
.consultantCardStyle {
        text-align: center;
 
        .name {
            font-size: 16px;
            font-weight: bold;
        }
 
        .satisfaction {
            font-size: 20px;
        }
    }
</style>