mainHeader.vue 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <template>
  2. <header>
  3. <div class="container">
  4. <div class="w-logo pull-left">
  5. <a href="#"><img src="/uas.png"></a>
  6. <div class="w-nav">
  7. <ul class="list-inline">
  8. <li><a href="http://uas.ubtob.com/#/index">B2B商务</a></li>
  9. <li><a href="https://www.usoftmall.com/">优软商城</a></li>
  10. <li><a href="https://www.ubtob.com/saas/about">优企云服</a></li>
  11. <li><a href="http://www.yitoa-fintech.com">金融服务</a></li>
  12. <li><a href="https://www.ubtob.com/#/uuzcJob">人才招聘</a></li>
  13. <li><a href="http://www.uuzcc.com/">英唐众创</a></li>
  14. <li><a href="http://diymall.ubtob.com/">定制商城</a></li>
  15. <li><a href="https://www.ubtob.com/#/help">供应链服务</a></li>
  16. </ul>
  17. </div>
  18. </div>
  19. <div class="w-login pull-right">
  20. <template v-if="logged">
  21. <a href="javascript:void(0)"><span v-text="user.vipName"/> <span>:&nbsp;</span> <span v-text="user.spaceName"/></a>
  22. <a href="javascript:void(0)" @click="logoutClick">退出</a>
  23. </template>
  24. <template v-else>
  25. <a href="javascript:void(0)" @click="loginClick">登录</a>
  26. <a href="javascript:void(0)" @click="registerClick">注册</a>
  27. </template>
  28. </div>
  29. </div>
  30. </header>
  31. </template>
  32. <script>
  33. export default {
  34. name: 'MainHeader',
  35. computed: {
  36. user () {
  37. return this.$store.state.option.user.data.content
  38. },
  39. logged () {
  40. return this.$store.state.option.user.logged
  41. }
  42. },
  43. methods: {
  44. loginClick () {
  45. this.$http.get('/login')
  46. .then(response => {
  47. if (response.data.success) {
  48. let localhost = window.location.href
  49. let url = response.data.content.replace('{returnURL}', localhost).replace('{baseUrl}', localhost)
  50. window.location.href = url
  51. }
  52. }).catch(err => {
  53. console.log(err)
  54. })
  55. },
  56. logoutClick () {
  57. this.$http.get('/logout')
  58. .then(response => {
  59. if (response.data.success) {
  60. this.$store.state.option.cookies = ''
  61. window.location.href = response.data.redirectUrl
  62. }
  63. }).catch(err => {
  64. console.log(err)
  65. })
  66. },
  67. registerClick () {}
  68. }
  69. }
  70. </script>