| | |
| | | import { Context } from '@nuxt/types'; |
| | | import { Vue, Component, Watch } from 'vue-property-decorator'; |
| | | import { Route } from 'vue-router/types/router.d' |
| | | import { Agents } from '~/plugins/api/home'; |
| | | import { Consultants, getFavoriteConsultant } from '~/assets/ts/api/consultant'; |
| | | import { isLogin } from '~/assets/ts/auth'; |
| | | |
| | | @Component |
| | | export default class myConsultantList extends Vue { |
| | | activeTabName = 'consultantList'; |
| | | agents: Agents[] = []; |
| | | contactedList: Agents[] = []; |
| | | consultantList: Agents[] = []; |
| | | agents: Consultants[] = []; |
| | | contactedList: Consultants[] = []; |
| | | consultantList: Consultants[] = []; |
| | | |
| | | tabClick(path: string) { |
| | | this.activeTabName = path; |
| | |
| | | } |
| | | |
| | | async asyncData(context: Context) { |
| | | let agents: Agents[] = []; |
| | | let contactedList: Agents[] = []; |
| | | let consultantList: Agents[] = []; |
| | | let agents: Consultants[] = []; |
| | | let contactedList: Consultants[] = []; |
| | | let consultantList: Consultants[] = []; |
| | | |
| | | await context.$service.home.recommendConsultantList().then((result: Agents[]) => { |
| | | agents = result; |
| | | }) |
| | | if (isLogin()) { |
| | | await getFavoriteConsultant().then((response) => agents = response.data); |
| | | } |
| | | |
| | | contactedList = agents.filter(item => item.contactStatus === 'contacted'); |
| | | consultantList = agents.filter(item => item.contactStatus !== 'contacted'); |