index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <div class="layout">
  3. <div class="top">
  4. <div class="logo">
  5. <img src="@/assets/img/logo.png" alt="" />
  6. </div>
  7. <div class="right">
  8. <div class="txt">项目资料管理系统</div>
  9. <div class="user">
  10. <span>用户名</span>
  11. <img src="@/assets/img/user.jpg" alt="" />
  12. </div>
  13. </div>
  14. </div>
  15. <div class="conten">
  16. <div class="leftTab">
  17. <div class="title">数据管理</div>
  18. <ul>
  19. <li v-for="item in tabList1" :key="item.id" :class="{active:index===item.id}" @click="skip(item.id,item.path)">{{item.name}}</li>
  20. </ul>
  21. <div class="title">系统管理</div>
  22. <ul>
  23. <li v-for="item in tabList2" :key="item.id" :class="{active:index===item.id}" @click="skip(item.id,item.path)">{{item.name}}</li>
  24. </ul>
  25. </div>
  26. <!-- 右侧内容 -->
  27. <Router-view style="width: 1630px;"/>
  28. </div>
  29. </div>
  30. </template>
  31. <script>
  32. // 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  33. // 例如:import 《组件名称》 from '《组件路径》';
  34. export default {
  35. // import引入的组件需要注入到对象中才能使用
  36. components: {},
  37. data () {
  38. // 这里存放数据
  39. return {
  40. index: 1,
  41. tabList1: [
  42. { id: 1, name: '项目资料', path: '/layout/tab1' },
  43. { id: 2, name: '文物案例', path: '/layout/tab2' },
  44. { id: 3, name: '场景案例', path: '/layout/tab3' }
  45. ],
  46. tabList2: [
  47. { id: 4, name: '用户管理', path: '/layout/tab4' },
  48. { id: 5, name: '操作日志', path: '/layout/tab5' }
  49. ]
  50. }
  51. },
  52. // 监听属性 类似于data概念
  53. computed: {},
  54. // 监控data中的数据变化
  55. watch: {},
  56. // 方法集合
  57. methods: {
  58. skip (id, url) {
  59. this.index = id
  60. this.$router.push(url).catch(() => {})
  61. }
  62. },
  63. // 生命周期 - 创建完成(可以访问当前this实例)
  64. created () {},
  65. // 生命周期 - 挂载完成(可以访问DOM元素)
  66. mounted () {},
  67. beforeCreate () {}, // 生命周期 - 创建之前
  68. beforeMount () {}, // 生命周期 - 挂载之前
  69. beforeUpdate () {}, // 生命周期 - 更新之前
  70. updated () {}, // 生命周期 - 更新之后
  71. beforeDestroy () {}, // 生命周期 - 销毁之前
  72. destroyed () {}, // 生命周期 - 销毁完成
  73. activated () {} // 如果页面有keep-alive缓存功能,这个函数会触发
  74. }
  75. </script>
  76. <style lang='less' scoped>
  77. .layout {
  78. .top {
  79. display: flex;
  80. padding: 10px 0;
  81. height: 60px;
  82. background-color: #f6f8f9;
  83. }
  84. .logo {
  85. width: 290px;
  86. border-right: 3px dashed #343a40;
  87. text-align: center;
  88. }
  89. .right {
  90. flex: 1;
  91. padding: 0 60px;
  92. height: 100%;
  93. display: flex;
  94. align-items: center;
  95. justify-content: space-between;
  96. .txt {
  97. font-size: 24px;
  98. font-weight: 700;
  99. }
  100. .user {
  101. display: flex;
  102. align-items: center;
  103. img {
  104. margin-left: 15px;
  105. width: 34px;
  106. height: 34px;
  107. border-radius: 50%;
  108. overflow: hidden;
  109. }
  110. }
  111. }
  112. .leftTab {
  113. font-size: 24px;
  114. color: #fff;
  115. padding: 30px 25px;
  116. width: 290px;
  117. height: calc(100vh - 60px);
  118. min-height: 870px;
  119. background-color: rgba(0, 0, 0, 0.8);
  120. .title {
  121. margin-top: 30px;
  122. width: 230px;
  123. height: 60px;
  124. display: flex;
  125. justify-content: center;
  126. align-items: center;
  127. background-color: #dc3545;
  128. }
  129. ul {
  130. margin-top: 15px;
  131. li {
  132. cursor: pointer;
  133. width: 230px;
  134. height: 60px;
  135. display: flex;
  136. justify-content: center;
  137. align-items: center;
  138. }
  139. li:hover{
  140. background-color:rgba(220, 53, 69, .6) ;
  141. }
  142. .active {
  143. background-color:rgba(220, 53, 69, .6) ;
  144. }
  145. }
  146. }
  147. .conten{
  148. display: flex;
  149. }
  150. }
  151. </style>