From 391d7db141245798c64aa8acb0f143ab4152aa79 Mon Sep 17 00:00:00 2001 From: Mila <Mila@pollex.com.tw> Date: 星期三, 10 十一月 2021 10:47:46 +0800 Subject: [PATCH] TODO#130015/130016 [推薦保險顧問/我的顧問清單] api 串接 --- PAMapp/pages/index.vue | 117 +++++++++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 91 insertions(+), 26 deletions(-) diff --git a/PAMapp/pages/index.vue b/PAMapp/pages/index.vue index a85fe90..041596f 100644 --- a/PAMapp/pages/index.vue +++ b/PAMapp/pages/index.vue @@ -1,16 +1,22 @@ <template> <div> + <el-button @click="login">��</el-button> + <el-button @click="remove">��</el-button> <Ui-Carousel></Ui-Carousel> <div class="page-container"> <h5 class="mdTxt mb-30">����憿批��</h5> <el-button - class="reserveBtn" + class="reserveBtn recommendConsultant" @click="routerPush('/recommendConsultant')" - >������</el-button> + > + <p>������</p> + </el-button> <el-button - class="reserveBtn" + class="reserveBtn quickFilter" @click="routerPush('/quickFilter')" - >敹恍�祟�</el-button> + > + <p>敹恍�祟�</p> + </el-button> <el-row class="mb-30 rowStyle"> <el-col :span="16"> <span class="mdTxt">���“���</span> @@ -23,37 +29,40 @@ :agents="consultantList.slice(0, 3)" @removeAgent="removeAgent" ></ConsultantList> - <h5 class="mdTxt mb-30 mt-30">��靽憿批��</h5> - <ConsultantSwiper :agents="agents"></ConsultantSwiper> + <div class='pam-recommend pb-30 pt-30'> + <h5 class="mdTxt">��靽憿批��</h5> + <img class="absulate img" src="~/assets/images/index_recommend.svg" alt=""> + </div> + <ConsultantSwiper :agents="recommendList"></ConsultantSwiper> </div> </div> </template> <script lang="ts"> -import { Vue, Component } from 'nuxt-property-decorator'; -import { Agents } from '~/plugins/api/home'; -import { Context } from '@nuxt/types/app'; +import { Vue, Component, State, Action } from 'nuxt-property-decorator'; +import { Consultants } from '~/assets/ts/api/consultant'; +import { login, recommend, getFavoriteConsultant } from '~/assets/ts/api/consultant'; +import { isLogin } from '~/assets/ts/auth'; @Component({ layout: 'home' }) export default class MainComponent extends Vue { - agents: Agents[] = []; - consultantList: Agents[] = []; + consultantList: Consultants[] = []; + agents: Consultants[] = []; + @State('recommendList') recommendList!: Consultants[]; + @Action storeRecommendList!: any; - async asyncData(context: Context) { - let agents: Agents[] = []; - let consultantList: Agents[] = []; - await context.$service.home.recommendConsultantList().then((result: Agents[]) => { - agents = result; - }) + mounted() { - consultantList = agents.filter(item => item.contactStatus !== 'contacted'); - - return { - agents, - consultantList + if (!this.recommendList) { + this.storeRecommendList(); } + + if (isLogin()) { + getFavoriteConsultant().then((response) => this.consultantList = response.data); + } + } routerPush(path: string) { @@ -61,11 +70,30 @@ } removeAgent(agentNo: number) { - const findIndex = this.agents.findIndex((item, i) => { + const findIndex = this.consultantList.findIndex((item, i) => { return item.agentNo === agentNo; }) this.consultantList.splice(findIndex, 1) } + + // TODO: ��TP隤����� ���蝙� + login() { + const user = { + username: "user", + password: "user" + } + login(user).then((res) => { + localStorage.setItem('id_token', res.data.id_token); + this.$router.go(0); + }) + } + + // TODO: ��TP隤����� ���蝙� + remove() { + localStorage.clear(); + this.$router.go(0) + } + } </script> @@ -76,23 +104,51 @@ padding: 0px 20px 30px 20px; } - .reserveBtn { + .reserveBtn.el-button--default { width: 100%; height: 110px; border-radius: 10px; - box-shadow: 0px 0px 6px #22222229; margin: 0 auto 17px auto; font-size: 32px; font-weight: 700; - color: $PRIMARY_BLACK; + background-position: right; + background-size: cover; + color: #68737A; + text-align: left; + background-repeat: no-repeat; + box-shadow: 0px 0px 6px #a79b9b29; + border-width: 0; + + p { + text-shadow: 1px 1px 5px $PRIMARY_WHITE; + } &:nth-child(3) { margin-bottom: 42px; } + } .reserveBtn+.reserveBtn { margin-left: 0px; + } + + .quickFilter { + background-image: url('~/assets/images/quickFilter/banner_mob.svg'); + } + + .recommendConsultant { + background-image: url('~/assets/images/recommendConsultant/banner_mob.svg'); + } + + @media (min-width: 576px) and (max-width: 1023px) { + .quickFilter.el-button--default { + background-image: url('~/assets/images/quickFilter/banner_web.svg'); + } + + .recommendConsultant.el-button--default { + background-image: url('~/assets/images/recommendConsultant/banner_web.svg'); + } } .rowStyle { @@ -119,7 +175,16 @@ margin-right: 15px; } } + } + .pam-recommend { + position: relative; + + .img { + position: absolute; + right: 20px; + bottom: 0px; + } } </style> -- Gitblit v1.8.0