leftNav.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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. </p>
  18. </div>
  19. </div>
  20. </div>
  21. </template>
  22. <script>
  23. export default {
  24. name: "leftNav",
  25. data() {
  26. return {
  27. logo: '',
  28. img_http:'http://kfadmin.bocai186.com',//图片路径域
  29. // img_http: 'http://192.168.2.187:8090',//图片路径域
  30. titleActive: "TheCurrentSession",
  31. data: [
  32. {
  33. title: "当前会话",
  34. type: "TheCurrentSession",
  35. imgsrc: require("@/assets/img/left1.png"),
  36. imgsrcA: require("@/assets/img/left1a.png")
  37. },
  38. {
  39. title: "留言",
  40. type: "LeaveMessage",
  41. imgsrc: require("@/assets/img/left2.png"),
  42. imgsrcA: require("@/assets/img/left2a.png")
  43. },
  44. {
  45. title: "历史会话",
  46. type: "SessionHistory",
  47. imgsrc: require("@/assets/img/left3.png"),
  48. imgsrcA: require("@/assets/img/left3a.png")
  49. },
  50. {
  51. title: "个人信息",
  52. type: "PersonalInformation",
  53. imgsrc: require("@/assets/img/left4.png"),
  54. imgsrcA: require("@/assets/img/left4a.png")
  55. },
  56. {
  57. title: "快捷回复",
  58. type: "FastReply",
  59. imgsrc: require("@/assets/img/left5.png"),
  60. imgsrcA: require("@/assets/img/left5a.png")
  61. }
  62. ]
  63. };
  64. },
  65. methods: {
  66. // 激活样式
  67. titleClick(str) {
  68. this.titleActive = str;
  69. let path = '/'
  70. if (str != 'TheCurrentSession') {
  71. path = "/" + str
  72. }
  73. this.$store.dispatch("SET_NAVSTATE", str);
  74. // this.$store.dispatch("SET_DRAWER",false);
  75. this.$router.push(path);
  76. }
  77. },
  78. // computed: {
  79. // getTitleActive() {
  80. // return this.titleActive;
  81. // }
  82. // },
  83. // watch: {
  84. // getTitleActive(val) {
  85. // console.log(this.titleActive =='TheCurrentSession'? '' : val)
  86. // this.$router.push("/" + this.titleActive =='TheCurrentSession'? '' : val);
  87. // }
  88. // },
  89. mounted() {
  90. this.titleActive = this.$store.getters.get_navState;
  91. this.logo = sessionStorage.getItem('logo');
  92. console.log(this.logo, '========logo')
  93. // // 获取系统时间
  94. // this.get('api'+this.$ports.TIME).then(res => {
  95. // if (res.data.data.time) {
  96. // sessionStorage.setItem("time", res.data.data.time);
  97. // let apiToken = this.$md5('customer-service'+res.data.data.time+window.location.origin)
  98. // sessionStorage.setItem('apiToken',apiToken)
  99. // }
  100. // });
  101. },
  102. };
  103. </script>
  104. <style scoped>
  105. #logo {
  106. width: 40px;
  107. height: 40px;
  108. }
  109. .left_box {
  110. width: 10vw;
  111. height: 100vh;
  112. background: #122757;
  113. }
  114. .header {
  115. height: 60px;
  116. font-size: 24px;
  117. color: #eaf3ff;
  118. font-weight: bold;
  119. }
  120. .title {
  121. font-size: 14px;
  122. padding: 0 20px;
  123. height: 48px;
  124. color: #7ba2d8;
  125. }
  126. .titleActive {
  127. color: #eaf3ff;
  128. background: #0d1f47;
  129. }
  130. </style>