From 4ffc0db28966ad106ded6ff0058c2dad7850bf78 Mon Sep 17 00:00:00 2001 From: HelenHuang <LinHuang@pollex.com.tw> Date: 星期五, 12 十一月 2021 16:19:03 +0800 Subject: [PATCH] TODO#130024 [顧問細節] API 串接 --- PAMapp/components/Consultant/ConsultantCard.vue | 6 ++ PAMapp/components/QuickFilter/QuickFilterConsultantList.vue | 5 ++ PAMapp/pages/agentInfo/_agentNo.vue | 48 +++++++++++++---------- PAMapp/store/index.ts | 11 ++++- PAMapp/components/Consultant/ConsultantSwiper.vue | 3 + PAMapp/assets/ts/api/consultant.ts | 5 ++ 6 files changed, 51 insertions(+), 27 deletions(-) diff --git a/PAMapp/assets/ts/api/consultant.ts b/PAMapp/assets/ts/api/consultant.ts index 9d3ecf9..6865bb2 100644 --- a/PAMapp/assets/ts/api/consultant.ts +++ b/PAMapp/assets/ts/api/consultant.ts @@ -57,6 +57,11 @@ export function appointmentDemand(data: AppointmentParams) { return service.post('/appointment/customer/create', data) } + +//憿批�底蝝啗��� +export function getConsultantDetail(agentNo:string){ + return service.get('/consultant/detail', {params:{agentNo:agentNo}}) +} export interface Consultants { agentNo: string, name: string, diff --git a/PAMapp/components/Consultant/ConsultantCard.vue b/PAMapp/components/Consultant/ConsultantCard.vue index 2210e4c..46be292 100644 --- a/PAMapp/components/Consultant/ConsultantCard.vue +++ b/PAMapp/components/Consultant/ConsultantCard.vue @@ -9,7 +9,7 @@ :size="50" :src="agentInfo.img" class="cursor--pointer" - @click.native="$router.push(`/agentInfo`)" + @click.native="showAgentDetail(agentInfo.agentNo);" ></el-avatar> <div class="satisfaction"> <i class="icon-star pam-icon icon--yellow satisfaction"></i> @@ -109,6 +109,10 @@ @Emit('removeAgent') removeAgent() { return this.agentInfo.agentNo; } + + showAgentDetail(agentNo: string): void { + this.$router.push(`/agentInfo/${agentNo}`); + } } </script> diff --git a/PAMapp/components/Consultant/ConsultantSwiper.vue b/PAMapp/components/Consultant/ConsultantSwiper.vue index 44d95ed..21e04da 100644 --- a/PAMapp/components/Consultant/ConsultantSwiper.vue +++ b/PAMapp/components/Consultant/ConsultantSwiper.vue @@ -56,7 +56,8 @@ } clkItem(loopIndex: number, realIndex: number) { - this.$router.push('/agentInfo'); + const agentNo = this.agents[realIndex].agentNo; + this.$router.push(`/agentInfo/${agentNo}`); console.log(loopIndex, realIndex, 'clkItem') } diff --git a/PAMapp/components/QuickFilter/QuickFilterConsultantList.vue b/PAMapp/components/QuickFilter/QuickFilterConsultantList.vue index cebf8c7..9658e72 100644 --- a/PAMapp/components/QuickFilter/QuickFilterConsultantList.vue +++ b/PAMapp/components/QuickFilter/QuickFilterConsultantList.vue @@ -20,7 +20,7 @@ <el-avatar :size="200" class="mx-auto cursor--pointer" - @click="$router.push('/agentInfo')" + @click.native="showAgentDetail(item.agentNo)" :src="item.img" /> <div class="mdTxt mt-30 mb-30 text--center">{{item.name}}(隡舀��蝬�鈭�)</div> @@ -112,6 +112,9 @@ this.popUpTxt = txt; this.isVisiblePopUp = true; } + showAgentDetail(agentNo: string): void { + this.$router.push(`/agentInfo/${agentNo}`); + } } diff --git a/PAMapp/pages/agentInfo/index.vue b/PAMapp/pages/agentInfo/_agentNo.vue similarity index 83% rename from PAMapp/pages/agentInfo/index.vue rename to PAMapp/pages/agentInfo/_agentNo.vue index 91391e9..0c9d297 100644 --- a/PAMapp/pages/agentInfo/index.vue +++ b/PAMapp/pages/agentInfo/_agentNo.vue @@ -3,10 +3,10 @@ <el-row type="flex" justify="center"> - <el-avatar + <el-avatar size="large" src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png"> - </el-avatar> + </el-avatar> </el-row> <el-row @@ -15,7 +15,7 @@ justify="center" align="middle"> <i class="pam-icon icon--primary icon-star"></i> - <h3 class="mdTxt">{{ agentInfo.avgReviews }}</h3> + <h3 class="mdTxt">{{ agentInfo.avgScore }}</h3> </el-row> <el-row @@ -158,27 +158,23 @@ </template> <script lang="ts"> +import { Context } from '@nuxt/types'; import { Vue, Component } from 'vue-property-decorator'; +import { getConsultantDetail } from '~/assets/ts/api/consultant'; @Component export default class AgentInfoComponent extends Vue { - agentInfo: AgentInfo = { - name: '�蝢��', - role: '隡舀��蝬�鈭�', - avgReviews: 4.8, - title: '撠����', - phoneNumber: '0912345689', - serveArea: '������������', - companyAddress: '����縑蝢拙�敹�頝臭�畾�1���', - lastestLoginTime: new Date(), - seniority: '4撟�2���', - suitability: 53, - evaluation: 31, - expertises: ['鞎∪����', '鞈蝘餉��', '蝭�蝔�', '璅暑��隡�'], - concept: '憯賡頝臭���敺���策摰X靽∩遙����������憟賜�瘜��平隞乩�����蝘���鈭箇敹急����縑敹萄����旦�靽∴���末��平��犖�嚗������憿敹鈭箇����瘞貊���ˊ�鈭平��������', - experiences: ['�憭扯瓷��頂', '蝢��移蝞葦��'], - awards: '��嚗�2020撟港摩璅�之��雿單平�� ����嚗犖頨思�璆剖�霅��馳�隞�霅�犖頨思�隞���犖霅�瓷�靽隞���犖霅' + agentInfo!: AgentInfo; + + async asyncData(context: Context) { + const agentNo = context.route.params.agentNo; + let agentInfo = {}; + await getConsultantDetail(agentNo).then((res) => agentInfo = res.data ) + return { + agentInfo + } } + get agentName(): string { return `${this.agentInfo.name}(${this.agentInfo.role})`; @@ -187,13 +183,15 @@ interface AgentInfo { name: string; + agentNo:string; role: string; - avgReviews: number; + image: string; + avgScore: number; title: string; phoneNumber: string; serveArea: string; companyAddress: string; - lastestLoginTime: Date; + lastestLoginTime: Date | null; seniority: string; suitability: number; evaluation: number; @@ -253,3 +251,11 @@ } </style> + +function getConsultantDetail() { + throw new Error('Function not implemented.'); +} + +function getConsultantDetail() { + throw new Error('Function not implemented.'); +} diff --git a/PAMapp/store/index.ts b/PAMapp/store/index.ts index d175d60..cc3a13b 100644 --- a/PAMapp/store/index.ts +++ b/PAMapp/store/index.ts @@ -1,18 +1,23 @@ import { Module, VuexModule, Mutation, Action } from 'vuex-module-decorators' -import { Consultants } from '~/assets/ts/api/consultant'; -import { recommend } from '~/assets/ts/api/consultant' +import { Consultants,recommend,AgentOfStrictQuery} from '~/assets/ts/api/consultant'; + @Module export default class Store extends VuexModule { recommendList: Consultants[] | null = null; + strictQueryList: AgentOfStrictQuery[] = []; @Mutation updateRecommend(data: Consultants[]) { this.recommendList = data; } + @Mutation updateStrictQueryList(data: AgentOfStrictQuery[]) { + this.strictQueryList = data; + } + @Action storeRecommendList() { recommend().then(res => { this.context.commit('updateRecommend', res.data) - }) + }) } } \ No newline at end of file -- Gitblit v1.8.0