left.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <div class='box-shadow-blue full-height' style="background-color: #F4F3EE">
  3. <div class='padding mt-20'>
  4. <div class='flex flex-center mt-10' style="margin-bottom: 60px">
  5. <img src='@/assets/svg/logo.svg'/>
  6. </div>
  7. </div>
  8. <div>
  9. <div class="flex flex-center flex-col bold font-18 item-bg padding-bottom full-width ">
  10. <div v-for="(item,index) in data" :key="item.name" class="full-width flex flex-col flex-center pointer ">
  11. <div class='full-width flex flex-center padding' style='z-index: 2' :class="active === index ? 'item-s' : 'item'" @click="navClick(item,index)">
  12. <img :src=item.img>
  13. <span class="flex-child-average">{{ item.name }}</span>
  14. </div>
  15. <div v-if='item.children && item.children.length > 0 && active === index' class=' flex flex-col flex-center item-sub padding'>
  16. <div v-for='(sub,subIndex) in item.children' :key='item' class='padding full-width flex flex-center' :class='subIndex === subActive ? "item-sub-active":"" ' @click='subClick(sub,subIndex)'>
  17. <div class='mr-10 main-color'>·</div>
  18. <span>{{ sub.name }}</span>
  19. </div>
  20. </div>
  21. </div>
  22. </div>
  23. </div>
  24. </div>
  25. </template>
  26. <script>
  27. export default {
  28. data () {
  29. return {
  30. active: 0,
  31. subActive: 0,
  32. data: [
  33. {
  34. name: '项 目 库',
  35. img: new URL('../assets/svg/icon1.svg', import.meta.url).href,
  36. path: '/'
  37. },
  38. {
  39. name: '任务列表',
  40. img: new URL('../assets/svg/icon1.svg', import.meta.url).href,
  41. path: '/task'
  42. },
  43. {
  44. name: '资 料 库',
  45. img: new URL('../assets/svg/icon2.svg', import.meta.url).href,
  46. children: [
  47. {
  48. name: '项目资料',
  49. img: new URL('../assets/svg/icon1.svg', import.meta.url).href,
  50. path: '/database'
  51. },
  52. {
  53. name: '公司资料',
  54. img: new URL('../assets/svg/icon1.svg', import.meta.url).href,
  55. path: '/company'
  56. }
  57. ]
  58. },
  59. {
  60. name: '回 收 站',
  61. img: new URL('../assets/svg/icon3.svg', import.meta.url).href,
  62. path: '/recycle'
  63. }
  64. ],
  65. currentPage: ''
  66. }
  67. },
  68. created () {
  69. this.currentPage = window.location.href
  70. this.init()
  71. },
  72. methods: {
  73. init () {
  74. if (this.currentPage.indexOf('/task') > -1) {
  75. this.active = 1
  76. } else if (this.currentPage.indexOf('/database') > -1) {
  77. this.active = 2
  78. } else if (this.currentPage.indexOf('/recycle') > -1) {
  79. this.active = 3
  80. } else {
  81. this.active = 0
  82. }
  83. },
  84. navClick (item, index) {
  85. this.active = index
  86. if (item.children && item.children.length > 0) {
  87. this.subActive = 0
  88. this.$router.push(item.children[0].path)
  89. } else {
  90. this.$router.push(item.path)
  91. }
  92. },
  93. subClick (item, index) {
  94. this.subActive = index
  95. this.$router.push(item.path)
  96. }
  97. }
  98. }
  99. </script>
  100. <style scoped>
  101. .box-shadow-blue {
  102. position: fixed;
  103. width: 200px;
  104. left: 0;
  105. z-index: 2;
  106. background-color: white;
  107. box-shadow: 5px 0 10px -5px rgba(0, 0, 0, 0.1);
  108. }
  109. .item-bg {
  110. border-top: 1px solid #D1D1D1;
  111. border-bottom: 1px solid #D1D1D1;
  112. }
  113. .item-s {
  114. width: 150px;
  115. border-radius: 14px;
  116. margin-top: 30px;
  117. color: white;
  118. background-color: #AB7630;
  119. box-shadow: 2px 2px 10px 2px rgba(242, 162, 58, 0.49);
  120. }
  121. .item {
  122. width: 150px;
  123. border-radius: 14px;
  124. margin-top: 30px;
  125. color: #707070;
  126. }
  127. .item-sub {
  128. width: 150px;
  129. border-bottom-left-radius: 14px;
  130. border-bottom-right-radius: 14px;
  131. margin-top: -10px;
  132. padding-top: 20px;
  133. color: #939393;
  134. background-color: #E4E4E4;
  135. }
  136. .item-sub-active {
  137. background-color: #D3D3D3;
  138. }
  139. </style>