PageHeader.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <template>
  2. <div class="container">
  3. <div class="header">
  4. <router-link class="logo-link" :to="{ path: '/' }">
  5. <img class="logo" src="../assets/img/nav_logo@3x.png" alt=""
  6. /></router-link>
  7. <div class="content">
  8. <div class="tabs">
  9. <div
  10. class="tab"
  11. :class="{ active: active === item }"
  12. v-for="(item, index) in tabs"
  13. :key="index"
  14. @click="tab(item)"
  15. >
  16. {{ item }}
  17. <div class="slip" :class="{ active: item === active }"></div>
  18. </div>
  19. </div>
  20. <div class="btn-list" v-if="isLogin">
  21. <el-dropdown @command="onCommand" style="margin-left: 20px" trigger="click">
  22. <span class="el-dropdown-link">
  23. <img class="img" :src="avatarBox" />
  24. </span>
  25. <el-dropdown-menu slot="dropdown">
  26. <el-dropdown-item command="nickname" style="word-break: keep-all"
  27. >{{ userInfo.username }}
  28. </el-dropdown-item>
  29. <div class="border"></div>
  30. <el-dropdown-item command="supply" style="word-break: keep-all">去认证 </el-dropdown-item>
  31. <el-dropdown-item command="edit" style="word-break: keep-all">编辑资料 </el-dropdown-item>
  32. <div class="border"></div>
  33. <el-dropdown-item command="logout">退出登录 </el-dropdown-item>
  34. </el-dropdown-menu>
  35. </el-dropdown>
  36. </div>
  37. <div v-else class="login" @click="show = true">[登录]</div>
  38. <div class="login login1">中文</div>
  39. </div>
  40. </div>
  41. <login-info :Show="show" @close="show = false"></login-info>
  42. </div>
  43. </template>
  44. <script>
  45. import LoginInfo from '../components/LoginInfo.vue';
  46. import { mapState } from 'vuex';
  47. export default {
  48. components: { LoginInfo },
  49. data() {
  50. return {
  51. tabs: ['铸造者', '收藏探索', '数字盲盒', '我的NFT', '了解更多'],
  52. active: '',
  53. show: false
  54. };
  55. },
  56. computed: {
  57. ...mapState(['userInfo']),
  58. avatarBox() {
  59. return this.userInfo.avatar
  60. ? this.userInfo.avatar
  61. : 'https://zhirongip.oss-cn-hangzhou.aliyuncs.com/image/2021-06-30-17-02-42uzAOUPcw.jpeg';
  62. },
  63. type() {
  64. return this.userInfo.authorities.find(item => {
  65. return item.name == 'ROLE_INSTITUTION' || item.name == 'ROLE_PERSONAL';
  66. });
  67. }
  68. },
  69. mounted() {
  70. this.$EventBus.$on('login', () => {
  71. this.show = true;
  72. });
  73. },
  74. methods: {
  75. tab(item) {
  76. this.active = item;
  77. if (item === '铸造者') {
  78. this.$router.push('/casting');
  79. } else if (item === '收藏探索') {
  80. this.$router.push('/collection');
  81. } else if (item === '数字盲盒') {
  82. this.$router.push('/blindbox?flag=' + 1);
  83. } else if (item === '我的NFT') {
  84. this.$router.push('/my');
  85. }
  86. },
  87. batchRead() {},
  88. onCommand(command) {
  89. if (command === 'edit') {
  90. this.$router.push('/accountdata');
  91. } else if (command === 'logout') {
  92. localStorage.removeItem('webToken');
  93. this.$router.push('/');
  94. } else if (command === 'supply') {
  95. if (this.type) {
  96. if (this.type.name == 'ROLE_INSTITUTION') {
  97. this.$nextTick(() => {
  98. // if (this.institutionInfo.status == 'PASS') {
  99. this.$router.push('/enterpriseauthentication');
  100. // }
  101. });
  102. } else if (this.type.name == 'ROLE_PERSONAL') {
  103. this.$nextTick(() => {
  104. // if (this.institutionInfo.status == 'PASS') {
  105. this.$router.push('/userauthentication');
  106. // }
  107. });
  108. }
  109. } else {
  110. this.$router.push('/authentication');
  111. }
  112. }
  113. }
  114. }
  115. };
  116. </script>
  117. <style lang="less" scoped>
  118. /deep/ .el-dropdown-menu__item {
  119. font-weight: bold;
  120. text-align: center;
  121. }
  122. .border {
  123. margin: 6px 16px;
  124. height: 1px;
  125. background: #f2f3f5;
  126. }
  127. /deep/ .el-tabs__nav-scroll {
  128. padding-left: 13px;
  129. }
  130. /deep/ .el-tabs__item {
  131. font-weight: bold;
  132. font-size: 14px;
  133. width: 300px;
  134. }
  135. .container {
  136. height: 90px;
  137. background: #0f1111;
  138. width: 100%;
  139. .header {
  140. display: flex;
  141. align-items: center;
  142. justify-content: space-between;
  143. .logo {
  144. width: 170px;
  145. height: 60px;
  146. }
  147. .logo-link {
  148. padding: 15px 0px 15px 30px;
  149. }
  150. .content {
  151. display: flex;
  152. align-items: center;
  153. justify-content: space-between;
  154. .tabs {
  155. display: flex;
  156. align-items: center;
  157. padding-top: 10px;
  158. cursor: pointer;
  159. .tab {
  160. width: 130px;
  161. font-size: 18px;
  162. font-weight: bold;
  163. text-align: center;
  164. color: #939599;
  165. line-height: 28px;
  166. &.active {
  167. color: #ffffff;
  168. font-weight: bold;
  169. }
  170. .slip {
  171. width: 26px;
  172. margin: 0 auto;
  173. padding-bottom: 13px;
  174. &.active {
  175. border-bottom: 2px solid #fff;
  176. border-radius: 2px;
  177. }
  178. }
  179. }
  180. }
  181. .btn-list {
  182. .img {
  183. width: 34px;
  184. height: 34px;
  185. border-radius: 50%;
  186. display: block;
  187. }
  188. }
  189. .login {
  190. width: 83px;
  191. height: 30px;
  192. border-radius: 4px;
  193. border: 1px solid;
  194. // border-image: linear-gradient(135deg, rgba(0, 255, 203, 1), rgba(0, 110, 255, 1)) 1 1;
  195. line-height: 30px;
  196. text-align: center;
  197. color: #00ffcb;
  198. font-size: 16px;
  199. // .line();
  200. margin: 0 30px;
  201. .login1 {
  202. border: 1px solid #939599;
  203. color: #939599;
  204. border-image: linear-gradient(0);
  205. margin: 0;
  206. }
  207. }
  208. }
  209. }
  210. }
  211. </style>