slide.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. <template>
  2. <div class="slide-layout nav-menu">
  3. <div class="navigator_menu">
  4. <span>导航面板</span>
  5. </div>
  6. <el-menu text-color="#999" :default-active="actice_idx" active-text-color="#333" class="el-menu-vertical-demo" @select='handleSelect'>
  7. <template v-for="(nav, i) in navs">
  8. <router-link tag="div" :to="nav.link" :key="i" v-if="!nav.children">
  9. <el-menu-item :index="i+''" style="padding-left: 49px;">
  10. <i class="iconfonts i-fix" :style="{backgroundPosition: '0px -'+(Number(actice_idx)===i?nav.top + 14:nav.top)+'px'}"></i>
  11. <span slot="title">{{nav.text}}</span>
  12. </el-menu-item>
  13. </router-link>
  14. <el-submenu v-else :key="i" :index="i+''">
  15. <template slot="title">
  16. <i class="iconfonts i-fix" :style="{backgroundPosition: '0px -'+nav.top+'px'}"></i>
  17. <span style="padding-left:30px">{{nav.text}}</span>
  18. </template>
  19. <router-link tag="div" :to="nav.link" v-for="(nav, j) in nav.children" :key="j">
  20. <el-menu-item :index="i+'-'+j">{{nav.text}}</el-menu-item>
  21. </router-link>
  22. </el-submenu>
  23. </template>
  24. </el-menu>
  25. </div>
  26. </template>
  27. <script>
  28. export default {
  29. name: 'm-aside',
  30. component: {},
  31. data () {
  32. let navs = [
  33. { text: '首页', link: {name: 'Home'}, top: 14 },
  34. { text: '订单管理', link: {name: 'Order'},
  35. children: [
  36. // { text: '相机订单', link: {name: 'Order'} },
  37. { text: '权益订单', link: {name: 'qyOrder'} },
  38. { text: '下载订单', link: {name: 'downloadOrder'} }
  39. ],
  40. top: 42 },
  41. // { text: '增值服务', link: {name: 'Added'}, top: 70 },
  42. // {
  43. // text: '代理平台',
  44. // link: {name: 'home'},
  45. // children: [
  46. // { text: '代理管理', link: {name: 'hone'} },
  47. // { text: '代理查询', link: {name: 'hone'} },
  48. // { text: '公告设置', link: {name: 'hone'} }
  49. // ],
  50. // top: 98
  51. // },
  52. { text: '设备管理', link: {name: 'device'}, top: 126 },
  53. { text: '场景管理', link: {name: 'scene'}, top: 154 },
  54. // { text: '反馈管理', link: {name: 'feedback'}, top: 182 },
  55. {
  56. text: '版本管理',
  57. link: {name: 'edition'},
  58. children: [
  59. { text: '八目相机', link: {name: 'edition'}, top: 182 },
  60. { text: '转台相机', link: {name: 'turntableCamera'}, top: 182 },
  61. { text: '激光相机', link: {name: 'laserCamera'}, top: 182 }
  62. ],
  63. top: 98
  64. },
  65. // { text: '反馈消息', link: {name: 'feedback'} },
  66. { text: '发票管理', link: {name: 'invoice'}, top: 126 },
  67. // {
  68. // text: '更多设置',
  69. // link: {name: 'home'},
  70. // children: [
  71. // { text: '激光场景', link: {name: 'laser'} },
  72. // { text: '场景管理', link: {name: 'scene'} },
  73. // { text: '反馈消息', link: {name: 'feedback'} },
  74. // { text: '设备管理', link: {name: 'device'} },
  75. // { text: '客户管理', link: {name: 'client'} }
  76. // ],
  77. // top: 154
  78. // },
  79. // { text: '经销商申请', link: {name: 'distributor-list'}, top: 98 },
  80. // { text: '留言管理', link: {name: 'leaving'}, top: 182 },
  81. // {
  82. // text: '版本管理',
  83. // link: {name: 'edition'},
  84. // children: [
  85. // { text: '八目相机', link: {name: 'edition'}, top: 182 },
  86. // { text: '转台相机', link: {name: 'turntableCamera'}, top: 182 },
  87. // { text: '激光相机', link: {name: 'laserCamera'}, top: 182 }
  88. // ],
  89. // top: 154
  90. // },
  91. // // { text: '版本管理', link: {name: 'edition'}, top: 182 },
  92. // { text: '数据统计', link: {name: 'Statistics'}, top: 210 },
  93. // {
  94. // text: 'SDK 发布管理',
  95. // link: {name: 'sdkManage'},
  96. // children: [
  97. // { text: 'SpaceTarget', link: {name: 'spaceTarget'}, top: 182 }
  98. // ],
  99. // top: 154
  100. // },
  101. { text: '用户列表', link: {name: 'userList'}, top: 126 },
  102. { text: '客户管理', link: {name: 'client'},top: 127 }
  103. // { text: '操作日志', link: {name: 'oplog'}, top: 210 }
  104. // { text: '数据下载', link: {name: 'Down'}, top: 210 }
  105. // ,
  106. // {
  107. // text: 'BBS',
  108. // link: {name: 'home'},
  109. // children: [
  110. // { text: '文章列表', link: {name: 'home'} },
  111. // { text: '评论管理', link: {name: 'home'} },
  112. // { text: '用户管理', link: {name: 'home'} }
  113. // ],
  114. // top: 182
  115. // }
  116. ]
  117. return {
  118. actice_idx: 1,
  119. navs: navs
  120. }
  121. },
  122. mounted () {
  123. let index = this.navs.findIndex((i) => {
  124. console.log(i.link.name, this.$route.name)
  125. return i.link.name === this.$route.name
  126. })
  127. console.log(index)
  128. if (index !== -1) {
  129. this.actice_idx = index
  130. }
  131. },
  132. methods: {
  133. handleSelect (key) {
  134. console.log(key)
  135. this.actice_idx = key
  136. },
  137. openNotice () {
  138. this.$store.commit('SET_OPENNOTICE', true)
  139. }
  140. }
  141. }
  142. </script>
  143. <style scoped>
  144. .slide-layout {
  145. border: 1px solid #ebeef5;
  146. background: #ffffff;
  147. z-index: 1;
  148. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  149. }
  150. .nav-menu {
  151. padding-left: 5px;
  152. user-select: none;
  153. font-size: 20px;
  154. }
  155. .nav-menu-item {
  156. margin: 20px 0;
  157. }
  158. .menu-title {
  159. font-size: 18px;
  160. margin-left: 15px;
  161. }
  162. .jiantou {
  163. width: 8px;
  164. height: 8px;
  165. border-top: 2px solid #000;
  166. border-right: 2px solid #000;
  167. transform: rotate(135deg);
  168. display: inline-block;
  169. margin-left: 64px;
  170. }
  171. .flex-item {
  172. cursor: pointer;
  173. display: flex;
  174. align-items: center;
  175. transition: all 0.3s;
  176. }
  177. .flex-item-list {
  178. margin-left: 32px;
  179. margin-top: 20px;
  180. }
  181. .flex-item-list li {
  182. cursor: pointer;
  183. margin-top: 20px;
  184. color: #999;
  185. }
  186. .fade-enter-active,
  187. .fade-leave-active {
  188. transition: opacity .5s;
  189. }
  190. .fade-enter,
  191. .fade-leave-to
  192. /* .fade-leave-active below version 2.1.8 */
  193. {
  194. opacity: 0;
  195. }
  196. .iconfont {
  197. margin-right: 10px;
  198. }
  199. .navigator_menu {
  200. line-height: 56px;
  201. height: 56px;
  202. }
  203. .navigator_menu>span {
  204. padding-left: 20px;
  205. font-size: 12px;
  206. color: #999;
  207. }
  208. </style>
  209. <style type="text/css">
  210. .el-menu-item.is-active {
  211. background: #f2f2f2;
  212. /*color: #333;*/
  213. }
  214. .i-fix {
  215. display: inline-block;
  216. background-repeat: no-repeat;
  217. width: 14px;
  218. height: 14px;
  219. vertical-align: middle;
  220. background-image: url('~@/assets/images/icon/sys_icon.png')
  221. }
  222. .iconfonts {
  223. position: absolute;
  224. left: 20px;
  225. top: 50%;
  226. margin-top: -9px;
  227. }
  228. </style>