NaviBar.vue 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <template>
  2. <header class="main-header">
  3. <router-link class="logo" style="position: relative;" to="/">
  4. <span class="logo-mini">{{logoMiniText}}</span>
  5. <span class="logo-lg">{{logoText}}</span>
  6. <!-- <span class='logo-lg label label-warning' style='position: absolute;top:8px;right: 20px;font-size: 8px;' v-if="versionText">{{versionText}}</span> -->
  7. </router-link>
  8. <nav class="navbar navbar-static-top">
  9. <a class="sidebar-toggle" data-toggle="push-menu" role="button">
  10. <span class="sr-only">Toggle navigation</span>
  11. </a>
  12. <div class="navbar-custom-menu">
  13. <ul class="nav navbar-nav">
  14. <li v-if="serverInfo.IsDemo">
  15. <a target="_blank" href="//www.liveqing.com/docs/download/LiveGBS.html"><i class="fa fa-download"></i> 下载使用</a>
  16. </li>
  17. <li v-if="serverInfo.IsDemo">
  18. <a target="_blank" href="/apidoc/"><i class="fa fa-book"></i> 开发接口</a>
  19. </li>
  20. <li class="dropdown" v-if="userInfo">
  21. <a href="#" class="dropdown-toggle" data-toggle="dropdown">欢迎, {{userInfo.Name}}</a>
  22. <ul class="dropdown-menu">
  23. <li>
  24. <a @click.prevent="$emit('modify-password')" role="button"><i class="fa fa-key"></i> 修改密码</a>
  25. </li>
  26. <router-link to="/logout" tag="li">
  27. <a><i class="fa fa-sign-out"></i> 注 销</a>
  28. </router-link>
  29. </ul>
  30. </li>
  31. <li v-else>
  32. <a href="/login.html"><i class="fa fa-user"></i> 登录</a>
  33. </li>
  34. </ul>
  35. </div>
  36. </nav>
  37. </header>
  38. </template>
  39. <script>
  40. import { mapState } from "vuex";
  41. export default {
  42. props: {
  43. logoText: {
  44. default: ""
  45. },
  46. logoMiniText: {
  47. default: ""
  48. },
  49. versionText: {
  50. default: ""
  51. }
  52. },
  53. computed: {
  54. ...mapState(["userInfo", "serverInfo"])
  55. }
  56. }
  57. </script>
  58. <style lang="less" scoped="true">
  59. .main-header .navbar,
  60. .main-header .logo {
  61. /* Fix for IE */
  62. -webkit-transition: none;
  63. -o-transition: none;
  64. transition: none;
  65. }
  66. .main-header .logo {
  67. padding: 0;
  68. }
  69. .main-header .navbar .dropdown-menu li a {
  70. color: #777;
  71. &:hover {
  72. background-color: #e1e3e9;
  73. }
  74. }
  75. </style>