(function(){
    Vue.component('doctor-header', {
        template: `<div class="bgc-fff c-border-b">
            <div class="container">
                <div class="row">
                    <div class="clearfix ui-grid-middle">
                        <div class="fl ui-col-0">
                            <img src="../../../images/doctor_logo_menhu_img.png">
                        </div>
                        <div class="fl ml20">
	                        <div class="nav">
	                            <a v-for="(item, index) in navList" class="nav-item" :class="{'active': selectedNav==index}" @click="chooseNav(index)">{{item.text}}</a>
	                        </div>
	                    </div>
                    </div>
                </div>
            </div>
        </div>`,
        props: [],
        data: function(){
            return {
                navList: [{
                	id: 0,
                    text: "首页",
                    link: 'index.html'
                },{
                	id: 1,
                    text: "远程医学教育",
                    link: ''
                },{
                	id: 2,
                    text: "远程会诊服务",
                    link: ''
                },{
                	id: 3,
                    text: "双向转诊服务",
                    link: ''
                }],
                selectedNav: null
            }
        },
        mounted: function() {
        	//判断当前页面是第几个菜单页
            var selectedNav = window.sessionStorage.getItem("selectedDocNav") ? window.sessionStorage.getItem("selectedDocNav") : '0';
            this.selectedNav = selectedNav;
        },
        methods: {
            login: function(){
                //跳转到登录页面
            },
            logout: function(){
                
            },
            download: function(){
                //下载APP
            },
            chooseNav: function(val){
            	window.sessionStorage.setItem("selectedDocNav", val);
                this.selectedNav = val;
                window.location.href = this.navList[val].link
            }
        }
    })
})()
