| | |
| | | |
| | | if (isLogin()) { |
| | | this.addFavoriteFromStorageToApi(); |
| | | getFavoriteConsultant().then((response) => { |
| | | this.consultantList = response.data.filter(item => item.contactStatus !== 'contacted') |
| | | }); |
| | | } else { |
| | | this.consultantList = getFavoriteFromStorage(); |
| | | } |
| | | } |
| | | |
| | | getMyConsutant() { |
| | | getFavoriteConsultant().then((response) => { |
| | | this.consultantList = response.data |
| | | .filter(item => item.contactStatus !== 'contacted') |
| | | .sort((a, b) => a.updateTime > b.updateTime ? -1 : 1) |
| | | }); |
| | | } |
| | | |
| | | addFavoriteFromStorageToApi() { |
| | | const agentNoList = getFavoriteFromStorage().map(i => i.agentNo) |
| | | console.log(agentNoList, 'agentNoList') |
| | | if (agentNoList.length > 0) { |
| | | addFavoriteConsultant(agentNoList).then(res => res); |
| | | addFavoriteConsultant(agentNoList).then(res => this.getMyConsutant()); |
| | | localStorage.removeItem('favoriteConsultant'); |
| | | return; |
| | | } |
| | | this.getMyConsutant(); |
| | | } |
| | | |
| | | routerPush(path: string) { |