menuInfo.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <template>
  2. <div id="menuInfo">
  3. <el-row>
  4. <el-col :span="24">
  5. <el-col :span="24" class="top">
  6. <el-image :src="topUrl"></el-image>
  7. <span>管理中心</span>
  8. </el-col>
  9. <el-col :span="24">
  10. <el-menu :default-active="num" @select="selectMenu" text-color="#999" active-text-color="#044b79">
  11. <!-- <el-menu-item :index="index + ''" v-for="(item, index) in menu" :key="index">
  12. <template slot="title">
  13. <i class="el-icon-tickets"></i>
  14. <span>{{ item.title }}</span>
  15. </template>
  16. </el-menu-item> -->
  17. <el-menu-item index="1">
  18. <template slot="title">
  19. <i class="el-icon-tickets"></i>
  20. <span>基本信息</span>
  21. </template>
  22. </el-menu-item>
  23. <el-menu-item index="2">
  24. <template slot="title">
  25. <i class="el-icon-chat-dot-square"></i>
  26. <span :style="`color:${haveMsg ? 'red' : ''}`">消息管理</span>
  27. </template>
  28. </el-menu-item>
  29. <el-menu-item index="3">
  30. <template slot="title">
  31. <i class="el-icon-pie-chart"></i>
  32. <span>我的发布</span>
  33. </template>
  34. </el-menu-item>
  35. <el-menu-item index="4">
  36. <template slot="title">
  37. <i class="el-icon-notebook-1"></i>
  38. <span>事项管理</span>
  39. </template>
  40. </el-menu-item>
  41. <el-menu-item index="5">
  42. <template slot="title">
  43. <i class="el-icon-video-camera"></i>
  44. <span>展会管理</span>
  45. </template>
  46. </el-menu-item>
  47. <el-menu-item index="6">
  48. <template slot="title">
  49. <i class="el-icon-s-order"></i>
  50. <span>调研调查</span>
  51. </template>
  52. </el-menu-item>
  53. <el-menu-item index="7">
  54. <template slot="title">
  55. <i class="el-icon-edit"></i>
  56. <span>修改密码</span>
  57. </template>
  58. </el-menu-item>
  59. <el-menu-item index="8">
  60. <template slot="title">
  61. <i class="el-icon-circle-close"></i>
  62. <span>退出登录</span>
  63. </template>
  64. </el-menu-item>
  65. </el-menu>
  66. </el-col>
  67. </el-col>
  68. </el-row>
  69. </div>
  70. </template>
  71. <script>
  72. import { mapState, createNamespacedHelpers } from 'vuex';
  73. const { mapActions: login } = createNamespacedHelpers('login');
  74. const { mapActions: personalChat } = createNamespacedHelpers('personalchat');
  75. export default {
  76. name: 'menuInfo',
  77. props: {},
  78. components: {},
  79. data: function() {
  80. return {
  81. topUrl: require('@/assets/live/square_big.png'),
  82. num: '1',
  83. haveMsg: false,
  84. };
  85. },
  86. created() {
  87. this.$set(this, `num`, this.$route.query.num);
  88. this.onMessage();
  89. },
  90. async mounted() {
  91. this.channel();
  92. },
  93. methods: {
  94. ...login({ logout: 'logout', transactiondtetle: 'delete' }),
  95. ...personalChat({ getChatList: 'query' }),
  96. // 查询是否新消息
  97. async onMessage(message) {
  98. let res = await this.getChatList({ status: 0, receiver_id: this.user.uid });
  99. console.log(res.data);
  100. if (this.$checkRes(res)) {
  101. this.$set(this, `haveMsg`, res.data.length > 0);
  102. }
  103. },
  104. channel() {
  105. this.$stomp({
  106. [`/exchange/chat_message/${this.user.uid}`]: this.onMessage,
  107. });
  108. },
  109. // 菜单跳转
  110. selectMenu(key) {
  111. if (key == '8') {
  112. this.logout();
  113. this.$message({
  114. message: '退出登录成功',
  115. type: 'success',
  116. });
  117. this.$router.push({ path: '/webLogin' });
  118. } else {
  119. this.$router.push({ path: '/userCenter/index', query: { num: key } });
  120. }
  121. },
  122. },
  123. computed: {
  124. ...mapState(['user']),
  125. pageTitle() {
  126. return `${this.$route.meta.title}`;
  127. },
  128. },
  129. metaInfo() {
  130. return { title: this.$route.meta.title };
  131. },
  132. };
  133. </script>
  134. <style lang="less" scoped>
  135. .top {
  136. height: 50px;
  137. line-height: 50px;
  138. text-align: center;
  139. border-bottom: 1px solid #2d64b3;
  140. .el-image {
  141. float: left;
  142. padding: 10px 40px;
  143. width: 30px;
  144. height: 30px;
  145. }
  146. span {
  147. font-size: 24px;
  148. color: #92959a;
  149. font-weight: 600;
  150. float: left;
  151. text-align: left;
  152. }
  153. }
  154. /deep/.el-menu-item {
  155. font-weight: bold;
  156. font-size: 20px;
  157. text-align: center;
  158. border-bottom: 1px solid #2d64b3;
  159. margin: 0 20px;
  160. }
  161. </style>