<template>
    <div id="user-info">
        <van-nav-bar
                title="个人信息"
                left-text="返回"
                left-arrow
                @click-left="onClickLeft"
        />
        <van-cell-group>
            <van-cell icon="contact" title="修改密码" is-link @click="onUpdatePassword"/>
        </van-cell-group>

            <div class="logout" >
                <van-button ref="onLogin" redround block type="info" @click="onLogout">注销</van-button>
        </div>

    </div>
</template>

<script>
    import {Logout} from '@/api/user'
    import {Toast} from 'vant';
    export default {
        name: "UserInfo"
        ,
        components: {},
        created(){
        },
        methods: {
            onClickLeft() {
                this.$router.go(-1);
            },
            onUpdatePassword() {
                this.$router.push("update/password");
            },
            onLogout() {
                Logout().then(res=>{
                    window.console.log(res)
                    Toast("退出成功")
                    localStorage.removeItem('ACCESS_TOKEN')
                    localStorage.removeItem('UserInfo')
                    this.$router.push("home");
                })
            }
        }
    }
</script>

<style scoped>
    body {
        height: 100%;
        padding: 0;
        margin: 0;
    }

    .logout {
        position: absolute;
        bottom: 0;
        width: 90%;
        margin: 16px;
    }
</style>
