| | |
| | | </el-col> |
| | | <el-col |
| | | :span="8" |
| | | class="mdTxt readMore" |
| | | class="mdTxt readMore fix-chrome-click--issue" |
| | | v-if="consultantList.length > 3" |
| | | @click.native="routerPush('/myConsultantList/consultantList')">查看更多</el-col> |
| | | </el-row> |
| | |
| | | <script lang="ts"> |
| | | import { Vue, Component, State, Action } from 'nuxt-property-decorator'; |
| | | import { getFavoriteFromStorage, setFavoriteToStorage } from '~/assets/ts/storageConsultant'; |
| | | import { addFavoriteConsultant, Consultants } from '~/assets/ts/api/consultant'; |
| | | import { addFavoriteConsultant, Consultants, deleteConsultant } from '~/assets/ts/api/consultant'; |
| | | import { login, getFavoriteConsultant } from '~/assets/ts/api/consultant'; |
| | | import { isLogin } from '~/assets/ts/auth'; |
| | | |
| | |
| | | |
| | | if (isLogin()) { |
| | | this.addFavoriteFromStorageToApi(); |
| | | getFavoriteConsultant().then((response) => this.consultantList = response.data); |
| | | } 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) |
| | | if (agentNoList.length > 0) { |
| | | addFavoriteConsultant(agentNoList).then(res => res); |
| | | addFavoriteConsultant(agentNoList).then(res => this.getMyConsutant()); |
| | | localStorage.removeItem('favoriteConsultant'); |
| | | return; |
| | | } |
| | | this.getMyConsutant(); |
| | | } |
| | | |
| | | routerPush(path: string) { |
| | |
| | | } |
| | | |
| | | removeAgent(agentNo: string) { |
| | | const findIndex = this.consultantList.findIndex((item, i) => { |
| | | return item.agentNo === agentNo; |
| | | }) |
| | | this.consultantList.splice(findIndex, 1); |
| | | |
| | | if (!isLogin()) { |
| | | const findIndex = this.consultantList.findIndex((item, i) => { |
| | | return item.agentNo === agentNo; |
| | | }) |
| | | this.consultantList.splice(findIndex, 1); |
| | | setFavoriteToStorage(this.consultantList) |
| | | } else { |
| | | deleteConsultant(agentNo).then(res => this.$router.go(0)) |
| | | } |
| | | } |
| | | } |
| | |
| | | background-image: url('~/assets/images/recommendConsultant/banner_mob.svg'); |
| | | } |
| | | |
| | | @media (min-width: 576px) and (max-width: 1023px) { |
| | | @media (min-width: 576px) and (max-width: 768px) { |
| | | .quickFilter.el-button--default { |
| | | background-image: url('~/assets/images/quickFilter/banner_web.svg'); |
| | | } |