leftNav.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <div>
  3. <div class="left_box">
  4. <div class="header row center">
  5. <img id="logo" :src="img_http + logo" alt="">
  6. </div>
  7. <div class="nav">
  8. <p
  9. class="title row item-center"
  10. :class="titleActive == item.type?'titleActive':''"
  11. v-for="(item,index) in data"
  12. :key="index"
  13. @click="titleClick(item.type)"
  14. >
  15. <img style="margin-right:10px;" :src="titleActive == item.type?item.imgsrcA:item.imgsrc"/>
  16. {{item.title}}
  17. <el-badge :value="megnum" class="item" v-if="index == 0 && titleActive != 'TheCurrentSession'">
  18. <i style="font-size:14px; color:#5399F5; margin-left: 10px;"
  19. class="el-icon-chat-dot-square"> </i>
  20. </el-badge>
  21. </p>
  22. </div>
  23. </div>
  24. </div>
  25. </template>
  26. <script>
  27. export default {
  28. name: "leftNav",
  29. data() {
  30. return {
  31. megnum: 0,
  32. showMeg: false,
  33. logo: '',
  34. img_http: 'http://manage.281570.com',//图片路径域
  35. // img_http: 'http://192.168.2.187:8090',//图片路径域
  36. titleActive: "TheCurrentSession",
  37. data: [
  38. {
  39. title: "当前会话",
  40. type: "TheCurrentSession",
  41. imgsrc: require("@/assets/img/left1.png"),
  42. imgsrcA: require("@/assets/img/left1a.png"),
  43. },
  44. {
  45. title: "留言",
  46. type: "LeaveMessage",
  47. imgsrc: require("@/assets/img/left2.png"),
  48. imgsrcA: require("@/assets/img/left2a.png")
  49. },
  50. {
  51. title: "历史会话",
  52. type: "SessionHistory",
  53. imgsrc: require("@/assets/img/left3.png"),
  54. imgsrcA: require("@/assets/img/left3a.png")
  55. },
  56. {
  57. title: "个人信息",
  58. type: "PersonalInformation",
  59. imgsrc: require("@/assets/img/left4.png"),
  60. imgsrcA: require("@/assets/img/left4a.png")
  61. },
  62. {
  63. title: "快捷回复",
  64. type: "FastReply",
  65. imgsrc: require("@/assets/img/left5.png"),
  66. imgsrcA: require("@/assets/img/left5a.png")
  67. }
  68. ]
  69. };
  70. },
  71. methods: {
  72. // 激活样式
  73. titleClick(str) {
  74. this.titleActive = str;
  75. let path = '/'
  76. if (str != 'TheCurrentSession') {
  77. path = "/" + str
  78. }
  79. if(str == 'TheCurrentSession'){
  80. this.$store.dispatch("SET_MEG", false);
  81. this.megnum = 0;
  82. this.$store.dispatch("SET_MEGNNUM",0);
  83. }else {
  84. this.$store.dispatch("SET_MEG", true);
  85. }
  86. this.$store.dispatch("SET_NAVSTATE", str);
  87. // this.$store.dispatch("SET_DRAWER",false);
  88. this.$router.push({path, query: {pid: escape("这就是一个编码没有什么用啊")}});
  89. }
  90. },
  91. computed: {
  92. getTitleActive() {
  93. return this.$store.getters.get_megnum
  94. }
  95. },
  96. watch: {
  97. getTitleActive(val){
  98. this.megnum = this.megnum = val;
  99. }
  100. },
  101. mounted() {
  102. this.titleActive = this.$store.getters.get_navState;
  103. this.logo = sessionStorage.getItem('logo');
  104. this.showMeg = this.$store.getters.get_meg;
  105. this.megnum = this.$store.getters.get_megnum;
  106. },
  107. };
  108. </script>
  109. <style scoped>
  110. #logo {
  111. width: 40px;
  112. height: 40px;
  113. }
  114. .left_box {
  115. width: 10vw;
  116. height: 100vh;
  117. background: #122757;
  118. }
  119. .header {
  120. height: 60px;
  121. font-size: 24px;
  122. color: #eaf3ff;
  123. font-weight: bold;
  124. }
  125. .title {
  126. font-size: 14px;
  127. padding: 0 20px;
  128. height: 48px;
  129. color: #7ba2d8;
  130. }
  131. .titleActive {
  132. color: #eaf3ff;
  133. background: #0d1f47;
  134. }
  135. .nav p {
  136. cursor: pointer;
  137. }
  138. </style>