nHeader.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <template>
  2. <div class="bheader">
  3. <div class="bg-topbar">
  4. <div class="b-bg"></div>
  5. <div class="b-navbar">
  6. <div class="left logo"><img src="../../assets/img/logo.png"></div>
  7. <router-link to='/home'>
  8. <div class="left nav-title"><p>首页</p></div>
  9. </router-link>
  10. <div class="left nav-title active"><p>申请经纪商</p><i class="hot">HOT</i></div>
  11. <div class="right" v-show='usertip==2'>
  12. <router-link to='/'>
  13. <div class="nav-log">注册</div>
  14. </router-link>
  15. <router-link to='/'>
  16. <div class="nav-register">登陆</div>
  17. </router-link>
  18. </div>
  19. <div class="user" v-show='usertip==1'>
  20. <span><img src="../../../static/img/usericon2.png"><p>{{username}}</p></span>
  21. <span @click='toLoginOut()'><img src="../../../static/img/logout2.png"><p>退出</p></span>
  22. </div>
  23. </div>
  24. </div>
  25. </div>
  26. </template>
  27. <script>
  28. export default{
  29. data(){
  30. return{
  31. username:'',
  32. usertip:2,
  33. Authorization:'',
  34. regshow:2,
  35. }
  36. },
  37. methods:{
  38. toLoginOut: function(){
  39. this.axios({
  40. method: 'get',
  41. url: 'https://dev407.33.cn/api/member/loginout',
  42. headers: {Authorization: this.Authorization}
  43. }).then((res)=>{
  44. const result = res.data;
  45. if(result.code!=200){
  46. this.$notify({
  47. title:'提示',
  48. message: result.message,
  49. type:'warning',
  50. })
  51. }else{
  52. this.$notify({
  53. title:'成功',
  54. message:'退出成功',
  55. type:'success'
  56. })
  57. this.regshow=2;
  58. this.usertip=2;
  59. this.username='';
  60. this.Authorization='';
  61. sessionStorage.setItem('regshow',this.regshow);
  62. sessionStorage.setItem('usertip',this.usertip);
  63. sessionStorage.setItem('username',this.username);
  64. sessionStorage.setItem('token_code',this.Authorization);
  65. }
  66. })
  67. },
  68. changemsg: function(){
  69. this.regshow = sessionStorage.getItem('regshow')? sessionStorage.getItem('regshow'):2;
  70. this.usertip = sessionStorage.getItem('usertip')? sessionStorage.getItem('usertip'):2;
  71. this.username = sessionStorage.getItem('username')? sessionStorage.getItem('username'):'';
  72. this.Authorization = sessionStorage.getItem('token_code')? sessionStorage.getItem('token_code'):'';
  73. }
  74. },
  75. watch:{
  76. '$route':'changemsg'
  77. },
  78. mounted(){
  79. this.changemsg();
  80. }
  81. }
  82. </script>
  83. <style scoped>
  84. .bheader{
  85. position: relative;
  86. .bg-topbar{
  87. z-index: 30;
  88. position: fixed;
  89. top: 0;
  90. width: 100%;
  91. .b-bg{
  92. position: absolute;
  93. width: 100%;
  94. height: 75px;
  95. background-color: rgba(255, 255, 255, 1);
  96. opacity: 1;
  97. }
  98. .b-navbar{
  99. position: relative;
  100. margin: 0 auto;
  101. width: 1200px;
  102. height: 75px;
  103. .hot{
  104. position: absolute;
  105. background-color: #ff4e00;
  106. color: #fff;
  107. display: block;
  108. width: 38px;
  109. height: 18px;
  110. line-height: 18px;
  111. font-size: 12px;
  112. border-radius: 2px;
  113. top: 8px;
  114. left: 350px;
  115. }
  116. .user{
  117. display: inline;
  118. float: right;
  119. margin-top: 25px;
  120. span{
  121. float: left;
  122. cursor: pointer;
  123. margin-left: 30px;
  124. }
  125. p{
  126. float: right;
  127. margin-left: 5px;
  128. font-size: 14px;
  129. }
  130. img{
  131. width: 20px;
  132. }
  133. }
  134. .hot{
  135. position: absolute;
  136. background-color: #ff4e00;
  137. color: #fff;
  138. display: block;
  139. width: 38px;
  140. height: 18px;
  141. line-height: 18px;
  142. font-size: 12px;
  143. border-radius: 2px;
  144. top: 8px;
  145. left: 350px;
  146. }
  147. .left{
  148. float: left;
  149. line-height: 75px;
  150. img{
  151. margin-top: 20px;
  152. }
  153. p{
  154. font-family: MicrosoftYaHei;
  155. font-size: 14px;
  156. line-height: 24px;
  157. color: #333;
  158. line-height: 75px;
  159. }
  160. }
  161. .right{
  162. float: right;
  163. color: #333;
  164. margin-top: 27px;
  165. }
  166. .nav-log{
  167. float: right;
  168. height: 17px;
  169. width: 55px;
  170. font-size: 14px;
  171. }
  172. .nav-register{
  173. float: right;
  174. height: 17px;
  175. width: 55px;
  176. font-size: 14px;
  177. }
  178. .logo{
  179. margin-right: 55px;
  180. img{
  181. width: 98px;
  182. height: 33px;
  183. }
  184. }
  185. .nav-title{
  186. width: 118px;
  187. cursor: pointer;
  188. }
  189. .active{
  190. background: #1a6fa6;
  191. p{
  192. color: #fff;
  193. }
  194. }
  195. }
  196. }
  197. }
  198. </style>