slide.vue 6.3 KB

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