保誠-保戶業務員媒合平台
PAMapp/pages/index.vue
@@ -1,8 +1,5 @@
<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>
@@ -25,7 +22,7 @@
                </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>
@@ -65,18 +62,27 @@
        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) {
@@ -95,33 +101,6 @@
            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>
@@ -169,7 +148,7 @@
        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');
        }