heads.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <template>
  2. <div id="heads">
  3. <el-row>
  4. <div class="superbanner">
  5. <img :src="top_bg" />
  6. </div>
  7. <div class="supertop">
  8. <div class="w_1200">
  9. <el-col :span="12" class="left">
  10. <span>欢迎来到中科在线(长春)</span>
  11. </el-col>
  12. <el-col :span="12" class="right" v-if="user || user.name || user.adminuser">
  13. <span>{{ user.name || user.adminuser }}</span>
  14. <el-button type="danger" size="mini" @click="zhuxiao">退出登录</el-button>
  15. </el-col>
  16. </div>
  17. </div>
  18. <div class="superlogo">
  19. <div class="w_1200">
  20. <el-col :span="24" @click.native="linkBtn()">
  21. <img :src="logo" />
  22. <span>
  23. 中科在线(长春)
  24. </span>
  25. </el-col>
  26. </div>
  27. </div>
  28. </el-row>
  29. </div>
  30. </template>
  31. <script>
  32. import Vue from 'vue';
  33. import { mapState, createNamespacedHelpers } from 'vuex';
  34. const { mapActions: login } = createNamespacedHelpers('login');
  35. const { mapActions: dockLogin } = createNamespacedHelpers('dockLogin');
  36. export default {
  37. name: 'heads',
  38. props: {},
  39. components: {},
  40. data: () => {
  41. return {
  42. top_bg: require('@/assets/live/top_bg.png'),
  43. logo: require('@/assets/live/logo.png'),
  44. };
  45. },
  46. created() {},
  47. methods: {
  48. ...login({ logout: 'logout', transactiondtetle: 'delete' }),
  49. ...dockLogin({ docklogout: 'logout', transactiondtetle: 'delete' }),
  50. async zhuxiao() {
  51. if (this.user.role === '3' || this.user.role === '8') {
  52. this.docklogout();
  53. this.$message({
  54. message: '注销成功',
  55. type: 'success',
  56. });
  57. this.toLogin();
  58. } else {
  59. this.logout();
  60. this.$message({
  61. message: '注销成功',
  62. type: 'success',
  63. });
  64. this.toLogin();
  65. }
  66. },
  67. async toLogin() {
  68. this.$router.push({ path: '/' });
  69. },
  70. // 返回科技超市页面
  71. linkBtn() {
  72. // this.$router.push({ path: `${process.env.NODE_ENV === 'development' ? '' : Vue.config.weixin.baseUrl}/market/index` });
  73. this.$router.push({ path: '/market/index' });
  74. },
  75. },
  76. computed: {
  77. ...mapState(['user']),
  78. },
  79. };
  80. </script>
  81. <style lang="less" scoped>
  82. .w_1200 {
  83. width: 1200px;
  84. margin: 0 auto;
  85. }
  86. /deep/.superbanner {
  87. position: relative;
  88. height: 250px;
  89. overflow: hidden;
  90. }
  91. .supertop {
  92. .left {
  93. height: 40px;
  94. line-height: 40px;
  95. font-size: 16px;
  96. span:last-child {
  97. padding: 0 10px;
  98. font-weight: bold;
  99. }
  100. span:last-child:hover {
  101. cursor: pointer;
  102. color: #0085d2;
  103. font-weight: bold;
  104. }
  105. }
  106. .right {
  107. text-align: right;
  108. height: 40px;
  109. line-height: 40px;
  110. span {
  111. color: #000;
  112. font-weight: bold;
  113. font-size: 16px;
  114. padding: 0 10px;
  115. }
  116. }
  117. }
  118. .superlogo {
  119. position: absolute;
  120. top: 40px;
  121. width: 100%;
  122. padding: 50px 0 0 0;
  123. }
  124. .superlogo img {
  125. width: 76px;
  126. height: 64px;
  127. overflow: hidden;
  128. }
  129. .superlogo span {
  130. color: #2d64b3;
  131. font-size: 36px;
  132. font-family: cursive;
  133. text-shadow: -1px 0 white, 0 1px white, 1px 0 white, 0 -1px white;
  134. font-weight: 600;
  135. position: relative;
  136. top: 10px;
  137. padding: 0 0 0 10px;
  138. }
  139. .superlogo:hover {
  140. cursor: pointer;
  141. }
  142. </style>