header.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. <template>
  2. <header class="header">
  3. <div class="container clearfix">
  4. <div class="nav-list pull-left">
  5. <a href="http://town.ubtob.com">
  6. <img src="/logo.png">
  7. </a>
  8. <nuxt-link to="/" exact>
  9. <span>首页</span>
  10. </nuxt-link>
  11. <nuxt-link to="/repairs">
  12. <span>园区服务</span>
  13. </nuxt-link>
  14. <a href="https://www.ubtob.com/saas/about"><span>信息化服务</span></a>
  15. <a href="http://uas.ubtob.com"><span>市场开拓</span></a>
  16. <a href="http://zb.uuzcc.com/" target="_blank"><span>众创空间</span></a>
  17. <a href="http://www.yitoa-fintech.com/" target="_blank"><span>金融服务</span></a>
  18. <a href="https://www.usoftmall.com" target="_blank"><span>电子商城</span></a>
  19. <a href="http://job.uuzcc.com/"><span>人才招聘</span></a>
  20. <nuxt-link to="/park"><span>园区介绍</span></nuxt-link>
  21. <nuxt-link to="/about"><span>联系我们</span></nuxt-link>
  22. </div>
  23. <div class="nav-right pull-right">
  24. <div class="nav-search">
  25. <i class="fa fa-search"/>
  26. </div>
  27. <template v-if="user != null && user.name">
  28. <div class="info">
  29. <i class="fa fa-user-circle"/>
  30. <span v-text="user.name"/>
  31. <ul class="list-unstyled">
  32. <li>个人中心</li>
  33. <li>消息中心</li>
  34. <li>订单中心</li>
  35. <li @click="logout()">安全退出</li>
  36. </ul>
  37. </div>
  38. </template>
  39. <template v-if="user == null || !user.name">
  40. <div class="info">
  41. <a @click="onLoginClick()">登录</a>&nbsp;/&nbsp;
  42. <a @click="onRegisterClick">注册</a>
  43. </div>
  44. </template>
  45. </div>
  46. </div>
  47. </header>
  48. </template>
  49. <script>
  50. export default {
  51. name: 'HeaderView',
  52. computed: {
  53. user () {
  54. return this.$store.state.option.user.data
  55. }
  56. },
  57. methods: {
  58. logout () {
  59. this.$http.get('/logout/crossBefore').then(response => {
  60. if (response.data) {
  61. window.location.href = response.data.logoutUrl + '&baseUrl=' + encodeURIComponent(window.location.protocol + '//' + window.location.host + response.data.baseUrl)
  62. }
  63. })
  64. },
  65. onLoginClick () {
  66. this.$http.get('/login/page', {params: {returnUrl: window.location.href}}).then(response => {
  67. if (response.data) {
  68. window.location.href = response.data.content + '&baseUrl=' + encodeURIComponent(window.location.protocol + '//' + window.location.host + response.data.baseUrl)
  69. }
  70. })
  71. // TODO 待Account Center改版
  72. },
  73. onRegisterClick () {
  74. this.$http.get('/register/page').then(response => {
  75. if (response.data && response.data.content) {
  76. window.location.href = response.data.content + '&fromDomain=thxz'
  77. // console.log(response.data.content + '&fromDomain=thxz')
  78. }
  79. })
  80. }
  81. }
  82. }
  83. </script>
  84. <style scoped type="text/scss" lang="scss">
  85. .header{
  86. position:fixed;
  87. top:0;
  88. left:0;
  89. z-index:100;
  90. height:70px;
  91. background: #122931;
  92. .nav-list{
  93. height:70px;
  94. a{
  95. &:first-child{
  96. margin-left:16px;
  97. margin-right:20px;
  98. }
  99. &.nuxt-link-active span{
  100. color:#149ccf;
  101. &:after{
  102. content:'';
  103. position:absolute;
  104. bottom:0;
  105. left:50%;
  106. display:block;
  107. height:5px;
  108. width:30px;
  109. margin-left:-15px;
  110. background: #149ccf;
  111. }
  112. }
  113. }
  114. span{
  115. position:relative;
  116. display:inline-block;
  117. height:70px;
  118. line-height: 70px;
  119. padding:0 15px;
  120. font-size: 14px;
  121. color:#dce1e9;
  122. &:hover{
  123. color:#149ccf;
  124. &:after{
  125. content:'';
  126. position:absolute;
  127. bottom:0;
  128. left:50%;
  129. display:block;
  130. height:5px;
  131. width:30px;
  132. margin-left:-15px;
  133. background: #149ccf;
  134. }
  135. }
  136. }
  137. }
  138. .nav-right{
  139. text-align: right;
  140. line-height:70px;
  141. .nav-search{
  142. display:inline-block;
  143. vertical-align: middle;
  144. i{
  145. display:block;
  146. padding:12px;
  147. font-size: 18px;
  148. background: #101f24;
  149. color:#dce1e9;
  150. }
  151. }
  152. .info{
  153. display:inline-block;
  154. vertical-align: top;
  155. position:relative;
  156. margin-left:20px;
  157. color:#dce1e9;
  158. ul{
  159. display:none;
  160. position:absolute;
  161. top: 100%;
  162. right:0;
  163. z-index:1000;
  164. background: #13252b;
  165. padding-bottom:20px;
  166. li{
  167. line-height: 40px;
  168. text-align: center;
  169. width:110px;
  170. color:#f5f5f5;
  171. &:hover{
  172. color:#149ccf;
  173. }
  174. }
  175. }
  176. &:hover{
  177. background: #142e37;
  178. cursor:pointer;
  179. i{
  180. color:#149ccf;
  181. }
  182. span{
  183. color:#149ccf;
  184. }
  185. ul{
  186. display:block;
  187. }
  188. }
  189. >i{
  190. position:relative;
  191. top:1px;
  192. left:-5px;
  193. font-size: 16px;
  194. color:#f5f5f5;
  195. }
  196. >span{
  197. display:inline-block;
  198. vertical-align: top;
  199. text-align: left;
  200. width:80px;
  201. overflow: hidden;
  202. text-overflow: ellipsis;
  203. white-space:nowrap;
  204. font-size: 14px;
  205. color:#f5f5f5;
  206. }
  207. a{
  208. color:#dce1e9;
  209. text-decoration: none;
  210. &:hover{
  211. color:#149ccf;
  212. cursor:pointer;
  213. }
  214. }
  215. }
  216. }
  217. }
  218. </style>