header.js 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. (function(){
  2. Vue.component('page-header', {
  3. template: '<div class="bgc-fff c-border-b">\
  4. <div class="bgc-f2f2f2 c-666">\
  5. <div class="container">\
  6. <div class="row ptb10">\
  7. <div class="col-md-6">\
  8. <div class="bgc-fff pl10 pr20" style="width:360px; height:30px; line-height:30px; border-radius: 15px;">\
  9. <img src="../../../images/icon_laba.png" width="20" style="vertical-align: super;" class="mr5">\
  10. <span class="c-nowrap c-909090" style="display: inline-block; width: calc(100% - 30px)">[满意度调查]您于2018年2月14日10点30分预约了上饶市第一医院眼科的门诊</span>\
  11. </div>\
  12. </div>\
  13. <div class="col-md-6 c-t-right c-909090" style="line-height: 30px;">\
  14. <span v-show="!isLogin" class="plr20 c-border-r">您好,<a :href="loginUrl" class="c-0ad8c8">请登录</a></span>\
  15. <a v-show="isLogin" class="plr20 c-border-r" @click="goToCenter">\
  16. <img :src="loginInfo.imgRemotePath" width="30" height="30" class="c-images-cycle mr5">\
  17. <span class="c-0ad8c8">个人中心</span>\
  18. </a>\
  19. <span class="plr20 c-border-r" @click="download">下载APP</span>\
  20. <a class="plr20 c-909090" @click="logout">安全退出</a>\
  21. </div>\
  22. </div>\
  23. </div>\
  24. </div>\
  25. <div class="container c-birder-b">\
  26. <div class="ui-grid ui-grid-middle">\
  27. <div class="ui-col-0 ptb30 pr60">\
  28. <img src="../../../images/LOGO.png">\
  29. </div>\
  30. <div class="ui-col-0 pl15">\
  31. <span v-for="(item, index) in navList" class="nav-item" :class="{\'active\': index==selectedNav}" @click="chooseNav(index, item.link)">{{item.text}}</span>\
  32. </div>\
  33. <div class="ui-col-1 ptb10">\
  34. <div class="input-group search-box">\
  35. <input type="text" class="form-control search-input" v-model="searchText" placeholder="请输入医院、医生姓名">\
  36. <span class="input-group-btn">\
  37. <img src="../../../images/icon_sousuo.png" width="23">\
  38. </span>\
  39. </div>\
  40. </div>\
  41. </div>\
  42. </div>\
  43. </div>',
  44. props: [],
  45. data: function(){
  46. return {
  47. isLogin: false,
  48. searchText: '',
  49. navList: [{
  50. id: 0,
  51. text: "首页",
  52. link: '../../home/html/index.html',
  53. pathname: "home/html/index.html"
  54. },{
  55. id: 1,
  56. text: "预约挂号",
  57. link: '../../appointment/html/home.html',
  58. pathname: "appointment/html/home.html"
  59. },{
  60. id: 2,
  61. text: "健康档案",
  62. link: '../../',
  63. pathname: "health/html/"
  64. },{
  65. id: 3,
  66. text: "我的就诊",
  67. link: '../../mineJiuZhen/html/mineJiuZhen.html',
  68. pathname: "mineJiuZhen/html/mineJiuZhen.html"
  69. }],
  70. selectedNav: 0,
  71. loginInfo: {},
  72. loginUrl: "../../login/html/login.html",
  73. userCenterUrl: ""
  74. }
  75. },
  76. mounted: function(){
  77. //判断页面中是否存在登录信息
  78. var oauthInfo = window.sessionStorage.getItem("oauthInfo");
  79. if(oauthInfo){
  80. this.isLogin = true;
  81. oauthInfo = JSON.parse(oauthInfo);
  82. this.loginInfo = oauthInfo;
  83. }
  84. //判断当前页面是第几个菜单页
  85. var selectedNav = window.sessionStorage.getItem("selectedNav"),
  86. pathname = window.location.pathname;
  87. var obj = _.find(this.navList, function(o){
  88. if(pathname.indexOf(o.pathname) > -1){
  89. return o;
  90. }
  91. });
  92. if(selectedNav && obj){
  93. this.selectedNav = obj.id;
  94. window.sessionStorage.setItem("selectedNav", obj.id);
  95. }else if(selectedNav && !obj){
  96. this.selectedNav = selectedNav;
  97. }
  98. },
  99. methods: {
  100. login: function(){
  101. //跳转到登录页面
  102. },
  103. goToCenter: function(){
  104. //跳转去个人中心页面
  105. window.location.href = "../../mine/html/personal-info.html";
  106. },
  107. logout: function(){
  108. },
  109. download: function(){
  110. //下载APP
  111. },
  112. chooseNav: function(val){
  113. window.sessionStorage.setItem("selectedNav", val);
  114. this.selectedNav = val;
  115. var url = this.navList[val].link;
  116. window.location.href = url;
  117. }
  118. }
  119. })
  120. })()