TODO#128784 首頁-推薦保險顧問 畫面刻版+串假資料
¤ñ¹ï·sÀÉ®× |
| | |
| | | <template> |
| | | <div class="consultantCardStyle"> |
| | | <img class="avator" :src="agentInfo.img" alt=""> |
| | | <div class="name">{{agentInfo.name}}</div> |
| | | <div class="star">{{agentInfo.satisfaction}}</div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script lang="ts"> |
| | | import { Vue, Component, Prop } from 'vue-property-decorator'; |
| | | import { Agents } from '~/plugins/api/home'; |
| | | |
| | | @Component |
| | | export default class Avator extends Vue { |
| | | @Prop() agentInfo!: Agents; |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .consultantCardStyle { |
| | | text-align: center; |
| | | |
| | | .avator { |
| | | width: 80px; |
| | | height: 80px; |
| | | border-radius: 50px; |
| | | margin: 0 auto 8px auto; |
| | | } |
| | | |
| | | .name { |
| | | font-size: 16px; |
| | | font-weight: bold; |
| | | } |
| | | |
| | | .star { |
| | | font-size: 20px; |
| | | |
| | | &:before { |
| | | content: '\2605'; |
| | | color: #ED1B2E; |
| | | margin-right: 10px; |
| | | font-size: 15px; |
| | | } |
| | | } |
| | | } |
| | | </style> |
| | |
| | | <div> |
| | | <swiper ref="mySwiper" |
| | | :options="swiperOptions" |
| | | class="swiperStyle" |
| | | @click-slide="clkItem" |
| | | > |
| | | <swiper-slide |
| | | v-for="(i, index) in 5" |
| | | v-for="(info, index) in agents" |
| | | :key="index" |
| | | > |
| | | <span>é£çµå°æ¥åå¡{{i}}詳細è³è¨</span> |
| | | <SwiperConsultantCard :agentInfo="info"></SwiperConsultantCard> |
| | | </swiper-slide> |
| | | |
| | | <div class="swiper-button-prev" slot="button-prev"></div> |
| | |
| | | </template> |
| | | |
| | | <script lang="ts"> |
| | | import { Vue, Component } from 'vue-property-decorator'; |
| | | import { Vue, Component, Prop } from 'vue-property-decorator'; |
| | | import { SwiperOptions } from 'swiper'; |
| | | import { Agents } from '~/plugins/api/home' |
| | | |
| | | @Component |
| | | export default class UiSwiper extends Vue { |
| | | @Prop() agents!: Agents; |
| | | |
| | | swiperOptions: SwiperOptions = { |
| | | loop: true, |
| | | slideToClickedSlide: false, |
| | |
| | | }, |
| | | breakpoints: { |
| | | 320: { |
| | | slidesPerView: 2, |
| | | slidesPerGroup: 2, |
| | | spaceBetween: 20 |
| | | slidesPerView: 3, |
| | | slidesPerGroup: 3, |
| | | spaceBetween: 3 |
| | | }, |
| | | 1024: { |
| | | slidesPerView: 4, |
| | | slidesPerGroup: 4, |
| | | spaceBetween: 40 |
| | | 768: { |
| | | slidesPerView: 6, |
| | | slidesPerGroup: 6, |
| | | spaceBetween: 3 |
| | | } |
| | | } |
| | | } |
| | |
| | | this.$router.push('/agentInfo') |
| | | } |
| | | } |
| | | |
| | | |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .swiper-container { |
| | | height: 80px; |
| | | width: 90%; |
| | | } |
| | | .swiperStyle { |
| | | box-shadow: 0 0 6px #22222229; |
| | | border-radius: 10px; |
| | | padding: 45px 0 37px 0; |
| | | background-color: #FFFFFF; |
| | | |
| | | .swiper-slide { |
| | | border: solid 1px; |
| | | padding: 5px; |
| | | cursor: pointer; |
| | | } |
| | | |
| | | .swiper-button-next,.swiper-button-prev { |
| | | background-color: white; |
| | | top: 20px; |
| | | height: 100%; |
| | | |
| | | &:after { |
| | | font-size: 20px; |
| | | font-weight: bold; |
| | | color: #707A81; |
| | | } |
| | | } |
| | | |
| | | .swiper-button-prev { |
| | | left: 0; |
| | | } |
| | | |
| | | .swiper-button-next { |
| | | right: 0; |
| | | } |
| | | } |
| | | </style> |
| | |
| | | // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins |
| | | plugins: [ |
| | | '~/plugins/element-ui.js', |
| | | { src: '~/plugins/vue-awesome-swiper.js', mode: 'client' } |
| | | { src: '~/plugins/vue-awesome-swiper.js', mode: 'client' }, |
| | | '~/plugins/service.ts' |
| | | ], |
| | | |
| | | // Auto import components: https://go.nuxtjs.dev/config-components |
| | |
| | | <template> |
| | | <div>é¦é |
| | | <div> |
| | | <Ui-Carousel></Ui-Carousel> |
| | | <h5>é ç´é¡§å</h5> |
| | | <el-button @click="routerPush('/recommendConsultant')">å´é¸é
å°</el-button> |
| | |
| | | <el-button @click="routerPush('/contactList/consultantList')">æ¥çæ´å¤</el-button> |
| | | <el-button @click="routerPush('/communication/consult')">諮詢</el-button> |
| | | <h5>æ¨è¦é¡§å</h5> |
| | | <Ui-Swiper></Ui-Swiper> |
| | | <Ui-Swiper :agents="agents"></Ui-Swiper> |
| | | </div> |
| | | </template> |
| | | |
| | | <script lang="ts"> |
| | | import { Vue, Component } from 'vue-property-decorator' |
| | | import { Vue, Component } from 'nuxt-property-decorator'; |
| | | import { Agents } from '~/plugins/api/home'; |
| | | import { Context } from '@nuxt/types/app'; |
| | | |
| | | @Component({ |
| | | layout: 'home' |
| | | }) |
| | | export default class MainComponent extends Vue { |
| | | agents: Agents[] = []; |
| | | |
| | | async asyncData(context: Context) { |
| | | let agents: Agents[] = []; |
| | | |
| | | await context.$service.home.recommendConsultantList().then((result: Agents[]) => { |
| | | agents = result; |
| | | }) |
| | | |
| | | return { |
| | | agents |
| | | } |
| | | } |
| | | |
| | | routerPush(path: string) { |
| | | this.$router.push(path); |
| | | } |
¤ñ¹ï·sÀÉ®× |
| | |
| | | |
| | | |
| | | import axios from 'axios'; |
| | | |
| | | const LOCAL_DEV = false; |
| | | |
| | | export class CommonService { |
| | | |
| | | withDebugData(debugData: any, apiPath: string) { |
| | | |
| | | if (LOCAL_DEV) { |
| | | return axios.get(apiPath); |
| | | } else { |
| | | return new Promise((resolve) => resolve(debugData)); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
¤ñ¹ï·sÀÉ®× |
| | |
| | | |
| | | import { CommonService } from '~/plugins/api/common'; |
| | | |
| | | export default () => ({ |
| | | recommendConsultantList(){ |
| | | const debugData = [ |
| | | { |
| | | id: 0, |
| | | name: 'å¼µå°ç¾', |
| | | img: 'https://randomuser.me/api/portraits/women/31.jpg', |
| | | loginState: 'ä¸ç·', |
| | | satisfaction: 4.8 |
| | | }, |
| | | { |
| | | id: 1, |
| | | name: 'è£å¸¥å¥', |
| | | img: 'https://randomuser.me/api/portraits/men/32.jpg', |
| | | loginState: 'ä¸ç·', |
| | | satisfaction: 4 |
| | | }, |
| | | { |
| | | id: 2, |
| | | name: 'æç¾å¥³', |
| | | img: 'https://randomuser.me/api/portraits/women/33.jpg', |
| | | loginState: 'é¢ç·', |
| | | satisfaction: 5 |
| | | }, |
| | | { |
| | | id: 3, |
| | | name: 'è¡ç¾ç', |
| | | img: 'https://randomuser.me/api/portraits/women/34.jpg', |
| | | loginState: 'ä¸ç·', |
| | | satisfaction: 4.3 |
| | | }, |
| | | { |
| | | id: 4, |
| | | name: 'å¼µå°ç¾', |
| | | img: 'https://randomuser.me/api/portraits/women/35.jpg', |
| | | loginState: 'å¿ç¢', |
| | | satisfaction: 4.8 |
| | | }, |
| | | { |
| | | id: 5, |
| | | name: 'è£å¸¥å¥', |
| | | img: 'https://randomuser.me/api/portraits/men/36.jpg', |
| | | loginState: 'é¢ç·', |
| | | satisfaction: 4 |
| | | }, |
| | | { |
| | | id: 6, |
| | | name: 'æç¾å¥³', |
| | | img: 'https://randomuser.me/api/portraits/women/37.jpg', |
| | | loginState: 'å¿ç¢', |
| | | satisfaction: 5 |
| | | }, |
| | | { |
| | | id: 7, |
| | | name: 'è¡ç¾ç', |
| | | img: 'https://randomuser.me/api/portraits/women/38.jpg', |
| | | loginState: 'ä¸ç·', |
| | | satisfaction: 4.3 |
| | | } |
| | | ] |
| | | return CommonService.prototype.withDebugData(debugData, 'https://randomuser.me/api/') |
| | | } |
| | | }) |
| | | |
| | | export interface Agents { |
| | | id: number, |
| | | name: string, |
| | | img: string, |
| | | loginState: string, |
| | | satisfaction: number |
| | | } |
¤ñ¹ï·sÀÉ®× |
| | |
| | | import Home from '~/plugins/api/home' |
| | | import { Inject, Context } from '@nuxt/types/app'; |
| | | |
| | | export default (context: Context, inject: Inject) => { |
| | | |
| | | const factories = { |
| | | home: Home() |
| | | }; |
| | | |
| | | inject('service', factories); |
| | | } |
| | | |
| | | declare module "vue/types/vue" { |
| | | interface Vue { |
| | | $service: any; |
| | | } |
| | | } |
| | | |
| | | declare module "@nuxt/types" { |
| | | interface Context { |
| | | $service: any; |
| | | } |
| | | } |