doctor-top.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. (function(){
  2. Vue.component('doctor-top', {
  3. template: `<div class="c-border-b bgc-f5f5f5 c-666">
  4. <div class="container">
  5. <div class="clearfix row ptb10">
  6. <div class="fr col-md-6 h24 c-t-right" v-if="!islogin">
  7. <span class="plr10 btn" @click="login">登录</span>
  8. <span class="plr10 lh24 c-border-l span-hover" @click="download">下载APP</span>
  9. </div>
  10. <div class="fr col-md-6 h24 c-t-right" v-if="islogin">
  11. <span class="plr10 lh24 span-hover" :class="{'span-active': selectedNav == -1}" @click="mine" @click>个人中心</span>
  12. <span class="plr10 lh24 c-border-l span-hover" @click="download">下载APP</span>
  13. <span class="plr10 lh24 c-border-l span-hover" @click="logout">安全退出</span>
  14. </div>
  15. </div>
  16. </div>
  17. </div>`,
  18. props: [],
  19. data: function(){
  20. return {
  21. islogin: true,
  22. selectedNav: null
  23. }
  24. },
  25. mounted: function() {
  26. var selectedNav = window.sessionStorage.getItem("selectedDocNav")
  27. if(selectedNav) {
  28. this.selectedNav = selectedNav
  29. }
  30. },
  31. methods: {
  32. login: function(){
  33. //跳转到登录页面
  34. window.location.href = '../../login/html/login.html'
  35. },
  36. mine: function() {
  37. window.sessionStorage.setItem("selectedDocNav", -1);
  38. window.location.href = 'mine.html'
  39. },
  40. logout: function(){
  41. window.sessionStorage.removeItem("selectedDocNav")
  42. this.login()
  43. },
  44. download: function(){
  45. //下载APP
  46. }
  47. }
  48. })
  49. })()