TraceHeader.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <template>
  2. <nav class="navbar navbar-default">
  3. <div class="container-fluid">
  4. <div class="navbar-header">
  5. <button
  6. type="button"
  7. class="navbar-toggle collapsed"
  8. data-toggle="collapse"
  9. data-target="#bs-example-navbar-collapse-1"
  10. aria-expanded="false"
  11. >
  12. <span class="sr-only">Toggle navigation</span>
  13. <span class="icon-bar" />
  14. <span class="icon-bar" />
  15. <span class="icon-bar" />
  16. </button>
  17. <a
  18. class="navbar-brand"
  19. href="javascript:void(0)"
  20. style="padding-top: 6px"
  21. >
  22. <span
  23. class="glyphicon glyphicon-circle-arrow-left m-image"
  24. style="font-size: 36px; color: black"
  25. @click="goBack"
  26. />
  27. </a>
  28. </div>
  29. <div id="bs-example-navbar-collapse-1" class="collapse navbar-collapse">
  30. <ul class="nav navbar-nav">
  31. <li :class="{ active: type == 'traceProject' }" @click="openProject">
  32. <a class="nav-item-a" href="javascript:void(0)">项目</a>
  33. </li>
  34. <li :class="{ active: type == 'traceList' }" @click="openSelf">
  35. <a class="nav-item-a" href="javascript:void(0)">我自己</a>
  36. </li>
  37. <li :class="{ active: type == 'traceDynamic' }" @click="openDynamic">
  38. <a class="nav-item-a" href="javascript:void(0)">动态</a>
  39. </li>
  40. <li :class="{ active: type == 'team' }" @click="team">
  41. <a class="nav-item-a" href="javascript:void(0)">团队</a>
  42. </li>
  43. <li @click="goHome">
  44. <a class="nav-item-a" href="javascript:void(0)">主页</a>
  45. </li>
  46. <li v-if="isShow" @click="traceSetting">
  47. <a class="nav-item-a" href="javascript:void(0)">任务配置</a>
  48. </li>
  49. </ul>
  50. </div>
  51. </div>
  52. </nav>
  53. </template>
  54. <script>
  55. import Common from '../common/Common.js';
  56. export default {
  57. // props: ['type'],
  58. props: {
  59. type: {
  60. type: String,
  61. default: '',
  62. },
  63. },
  64. data: function () {
  65. return {
  66. isShow: 'false',
  67. };
  68. },
  69. mounted: function () {
  70. this.queryIsAdmin();
  71. },
  72. methods: {
  73. /**
  74. * 打开项目界面
  75. */
  76. openProject() {
  77. var _self = this;
  78. this.$router.push('/trace/projectList');
  79. },
  80. /**
  81. * 打开动态界面
  82. */
  83. openDynamic() {
  84. var _self = this;
  85. // this.$router.push('/trace/traceDynamic');
  86. this.$router.push({
  87. path: '/trace/traceDynamic',
  88. query: {
  89. currentPage: 1,
  90. pageSize: 20,
  91. },
  92. });
  93. },
  94. /**
  95. * 打开我自己界面
  96. */
  97. openSelf() {
  98. // this.$router.push('/trace/traceList/I_LAUNCH');
  99. this.$router.push({
  100. path: '/trace/traceList/I_LAUNCH',
  101. query: {
  102. currentPage: 1,
  103. pageSize: 20,
  104. },
  105. });
  106. },
  107. /**
  108. * 打开团队界面
  109. */
  110. team() {
  111. this.$router.push('/trace/teamList');
  112. },
  113. goBack() {
  114. history.back();
  115. },
  116. goHome() {
  117. this.$router.push('/desktop/dashboard');
  118. },
  119. traceSetting() {
  120. this.$router.push('/trace/traceConfig');
  121. },
  122. /**
  123. * 查询配置信息
  124. * @return {[type]} [description]
  125. */
  126. queryIsAdmin: function () {
  127. var _self = this;
  128. $.ajax({
  129. url: Common.getApiURL('TraceResource/queryIsAdmin'),
  130. type: 'get',
  131. dataType: 'json',
  132. beforeSend: function (request) {
  133. Common.addTokenToRequest(request);
  134. },
  135. success: function (data) {
  136. _self.isShow = data;
  137. },
  138. error: function (XMLHttpRequest, textStatus, errorThrown) {
  139. Common.processException(XMLHttpRequest, textStatus, errorThrown);
  140. },
  141. });
  142. },
  143. },
  144. };
  145. </script>
  146. <style scoped>
  147. .nav-item-a {
  148. padding-top: 15px;
  149. padding-bottom: 15px;
  150. }
  151. </style>