head.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <template>
  2. <div id="heads">
  3. <div class="w_0100">
  4. <div class="superbanner">
  5. <img :src="top_bg" />
  6. </div>
  7. <div class="supertop">
  8. <div class="w_1200">
  9. <p>
  10. 欢迎来到中科在线(长春)技术交易平台
  11. </p>
  12. <p class="username">
  13. <span v-if="user.uid">
  14. {{ user.name }}
  15. <button
  16. type="text"
  17. class="userCenter"
  18. @click="stnmae"
  19. v-if="user.role == '2' || user.role == '3' || user.role == '4' || user.role == '6' || user.role == '7'"
  20. >
  21. 个人中心
  22. </button>
  23. <button type="button" class="logininfo" @click="zhuxiao">注销</button>
  24. </span>
  25. <span v-else>
  26. {{ user.name }}
  27. <button type="button" class="logininfo" @click="btnLogin">登录</button>
  28. <button type="button" class="logininfo" @click="btnLogin">注册</button>
  29. </span>
  30. </p>
  31. </div>
  32. </div>
  33. <div class="superlogo">
  34. <div class="w_1200">
  35. <a href="/platlive">
  36. <img :src="logo" />
  37. <span>
  38. 中科在线(长春)技术交易平台
  39. </span>
  40. </a>
  41. </div>
  42. </div>
  43. <div class="supermenu">
  44. <div class="w_1200">
  45. <div class="info">
  46. <ul>
  47. <li :class="isTab('hallList') ? 'active' : ''">
  48. <a @click="turnTo('hallList')" target="">直播大厅</a>
  49. <span></span>
  50. </li>
  51. <li :class="isTab('market') ? 'active' : ''">
  52. <a @click="turnTo('market')" target="">科技超市</a>
  53. <span></span>
  54. </li>
  55. <li :class="isTab('service') ? 'active' : ''">
  56. <a @click="fuwu()" target="">创新服务</a>
  57. <span></span>
  58. </li>
  59. <li :class="isTab('dynamic') ? 'active' : ''">
  60. <a @click="turnTo('dynamic')" target="">动态监测</a>
  61. <span></span>
  62. </li>
  63. <li :class="isTab('technical') ? 'active' : ''">
  64. <a @click="turnTo('technical')" target="">技术交流</a>
  65. </li>
  66. </ul>
  67. </div>
  68. </div>
  69. </div>
  70. </div>
  71. </div>
  72. </template>
  73. <script>
  74. import { mapState, createNamespacedHelpers } from 'vuex';
  75. const { mapActions: login } = createNamespacedHelpers('login');
  76. export default {
  77. name: 'heads',
  78. props: {},
  79. components: {},
  80. data: () => {
  81. return {
  82. top_bg: require('@/assets/live/top_bg.png'),
  83. logo: require('@/assets/live/logo.png'),
  84. };
  85. },
  86. created() {
  87. console.log(this.user);
  88. },
  89. methods: {
  90. ...login({ logout: 'logout', transactiondtetle: 'delete' }),
  91. fuwu() {
  92. this.$router.push({ path: '/live/service' });
  93. },
  94. turnTo(type) {
  95. if (type == 'index') {
  96. } else if (type == 'hall_index') this.$router.push({ path: '/live/hall/index' });
  97. else this.$router.push({ path: `/${type}/index` });
  98. },
  99. isTab(type) {
  100. if (type == 'index') return this.$route.path.includes('/live/index');
  101. else return this.$route.path.includes(`/${type}`);
  102. },
  103. btnLogin() {
  104. this.$router.push({ path: '/newlogin' });
  105. },
  106. stnmae() {
  107. if (this.user.role == '2' || this.user.role == '3' || this.user.role == '6' || this.user.role == '7') {
  108. this.$router.push({ path: '/userCenter/index', query: { num: '1' } });
  109. } else if (this.user.role == '5') {
  110. this.$router.push('/hallList/index');
  111. } else if (this.user.role == '4') {
  112. this.$router.push({ path: '/adminCenter/index', query: { num: '1' } });
  113. } else {
  114. this.$router.push('/market/index');
  115. }
  116. },
  117. async zhuxiao() {
  118. this.logout();
  119. this.$message({
  120. message: '注销成功',
  121. type: 'success',
  122. });
  123. window.location.reload();
  124. },
  125. },
  126. computed: {
  127. ...mapState(['user']),
  128. },
  129. };
  130. </script>
  131. <style lang="less" scoped>
  132. @import '~@/style/style.css';
  133. .logininfo {
  134. font-size: 20px;
  135. margin: 0 0 0 5px;
  136. }
  137. .username span {
  138. cursor: pointer;
  139. }
  140. /deep/ button {
  141. cursor: pointer;
  142. }
  143. .userCenter {
  144. font-size: 16px;
  145. color: #fff;
  146. padding: 3px 10px;
  147. border-radius: 5px;
  148. font-weight: bold;
  149. border: 2px solid transparent;
  150. }
  151. .userCenter:hover {
  152. color: #fe950e;
  153. // border-color: #fe950e;
  154. }
  155. </style>