(function(){
    Vue.component('doctor-top', {
        template: `<div class="c-border-b bgc-f5f5f5 c-666">
                <div class="container">
                    <div class="clearfix row ptb10">
                        <div class="fr col-md-6 h24 c-t-right" v-if="!islogin">
                        	<span class="plr10 btn" @click="login">登录</span>
                            <span class="plr10 lh24 c-border-l span-hover" @click="download">下载APP</span>
                        </div>
                        <div class="fr col-md-6 h24 c-t-right" v-if="islogin">
                        	<span class="plr10 lh24 span-hover" :class="{'span-active': selectedNav == -1}" @click="mine" @click>个人中心</span>
                            <span class="plr10 lh24 c-border-l span-hover" @click="download">下载APP</span>
                            <span class="plr10 lh24 c-border-l span-hover" @click="logout">安全退出</span>
                        </div>
                    </div>
                </div>
            </div>`,
        props: [],
        data: function(){
            return {
            	islogin: true,
            	selectedNav: null
            }
        },
        mounted: function() {
        	var selectedNav = window.sessionStorage.getItem("selectedDocNav")
        	if(selectedNav) {
        		this.selectedNav = selectedNav
        	}
        },
        methods: {
            login: function(){
                //跳转到登录页面
                window.location.href = '../../login/html/login.html'
            },
            mine: function() {
            	window.sessionStorage.setItem("selectedDocNav", -1);
            	window.location.href = 'mine.html'
            },
            logout: function(){
            	window.sessionStorage.removeItem("selectedDocNav")
                this.login()
            },
            download: function(){
                //下载APP
            }
        }
    })
})()
