| | |
| | | <template> |
| | | <div> |
| | | <el-button @click="login('user')">客戶登入</el-button> |
| | | <el-button @click="login('admin')">顧問登入</el-button> |
| | | <el-button @click="remove">登出</el-button> |
| | | <Ui-Carousel></Ui-Carousel> |
| | | <div class="page-container"> |
| | | <h5 class="mdTxt mb-30">預約保險顧問</h5> |
| | |
| | | </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> |
| | |
| | | |
| | | 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) { |
| | |
| | | deleteConsultant(agentNo).then(res => this.$router.go(0)) |
| | | } |
| | | } |
| | | |
| | | // TODO: 僅OTP認證開發前 暫時使用 |
| | | login(account: string) { |
| | | const user = { |
| | | username: account, |
| | | password: account |
| | | } |
| | | login(user).then((res) => { |
| | | localStorage.setItem('id_token', res.data.id_token); |
| | | |
| | | if (account === 'admin') { |
| | | this.$router.push('/myAppointmentList/appointmentList'); |
| | | } else { |
| | | this.$router.go(0); |
| | | } |
| | | |
| | | }) |
| | | |
| | | |
| | | } |
| | | |
| | | // TODO: 僅OTP認證開發前 暫時使用 |
| | | remove() { |
| | | localStorage.removeItem('id_token'); |
| | | this.$router.go(0) |
| | | } |
| | | |
| | | } |
| | | |
| | | </script> |
| | |
| | | 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'); |
| | | } |