Browse Source

页面顶部链接等状态的配置和交互完成

raolu 7 years ago
parent
commit
0308e45de4
3 changed files with 60 additions and 14 deletions
  1. 55 11
      component/common/header.js
  2. 3 1
      css/cross.css
  3. 2 2
      page/home/js/index.js

+ 55 - 11
component/common/header.js

@ -11,9 +11,13 @@
                            </div>\
                        </div>\
                        <div class="col-md-6 c-t-right c-909090" style="line-height: 30px;">\
                            <span class="plr20 c-border-r " @click="login">{{loginText}}</span>\
                            <span class="plr20 c-border-r " @click="download">下载APP</span>\
                            <span class="plr20 " @click="logout">安全退出</span>\
                            <span v-show="!isLogin" class="plr20 c-border-r">您好,<a :href="loginUrl" class="c-0ad8c8">请登录</a></span>\
                            <a v-show="isLogin" class="plr20 c-border-r" @click="goToCenter">\
                                <img :src="loginInfo.imgRemotePath" width="30" height="30" class="c-images-cycle mr5">\
                                <span class="c-0ad8c8">个人中心</span>\
                            </a>\
                            <span class="plr20 c-border-r" @click="download">下载APP</span>\
                            <a class="plr20 c-909090" @click="logout">安全退出</a>\
                        </div>\
                    </div>\
                </div>\
@ -40,32 +44,69 @@
        props: [],
        data: function(){
            return {
                loginText: '您好,请登录',
                isLogin: false,
                searchText: '',
                navList: [{
                    id: 0,
                    text: "首页",
                    link: ''
                },
                {
                    link: '../../home/html/index.html',
                    pathname: "home/html/index.html"
                },{
                    id: 1,
                    text: "预约挂号",
                    link: ''
                    link: '../../appointment/html/home.html',
                    pathname: "appointment/html/home.html"
                },{
                    id: 2,
                    text: "健康档案",
                    link: ''
                    link: '../../',
                    pathname: "health/html/"
                },{
                    id: 3,
                    text: "我的就诊",
                    link: ''
                    link: '../../mineJiuZhen/html/mineJiuZhen.html',
                    pathname: "mineJiuZhen/html/mineJiuZhen.html"
                }],
                selectedNav: 0
                selectedNav: 0,
                loginInfo: {},
                loginUrl: "../../login/html/login.html",
                userCenterUrl: ""
            }
        },
        mounted: function(){
            //判断页面中是否存在登录信息
            var oauthInfo = window.sessionStorage.getItem("oauthInfo");
            if(oauthInfo){
                this.isLogin = true;
                oauthInfo = JSON.parse(oauthInfo);
                this.loginInfo = oauthInfo;
            }
            
            //判断当前页面是第几个菜单页
            var selectedNav = window.sessionStorage.getItem("selectedNav"),
                pathname = window.location.pathname;
            var obj = _.find(this.navList, function(o){
                    if(pathname.indexOf(o.pathname) > -1){
                        return o;
                    }
                });
            
            if(selectedNav && obj){
                this.selectedNav = obj.id;
                window.sessionStorage.setItem("selectedNav", obj.id);
            }else if(selectedNav && !obj){
                this.selectedNav = selectedNav;
            }
            
        },
        methods: {
            login: function(){
                //跳转到登录页面
            },
            goToCenter: function(){
                //跳转去个人中心页面
                window.location.href = "../../mine/html/personal-info.html";
            },
            logout: function(){
                
            },
@ -73,7 +114,10 @@
                //下载APP
            },
            chooseNav: function(val){
                window.sessionStorage.setItem("selectedNav", val);
                this.selectedNav = val;
                var url = this.navList[val].link;
                window.location.href = url;
            }
        }
    })

+ 3 - 1
css/cross.css

@ -140,7 +140,9 @@
.c-62baf4 {
    color: #62baf4;
}
.c-0ad8c8{
    color: #0ad8c8;
}
.bgc-fff {
    background-color: #fff;
}

+ 2 - 2
page/home/js/index.js

@ -9,11 +9,11 @@ $(function(){
               hospital:''
            }
        },
        mounted () {
        mounted: function() {
            $("#myCarousel").carousel('cycle')
        },
        methods: {
            setYiYuan(value){
            setYiYuan: function(value){
                this.yuYue.hospital = value
            }
        }