index.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <!-- -->
  2. <template>
  3. <div class="layout">
  4. <!-- 上侧固定导航栏 -->
  5. <div class="lay_top">
  6. <div class="login">
  7. <img src="@/assets/img/logo.png" alt="" />
  8. <p>&nbsp;中国人民解放军 陆 军 勤 务 学 院</p>
  9. </div>
  10. <!-- 右边的盒子 -->
  11. <div class="conten">
  12. <!-- 当前时间 -->
  13. <div class="bot_time">
  14. {{ moment().format("LL") }} {{ moment().format("dddd") }}
  15. </div>
  16. <!-- tab栏 -->
  17. <div class="tab">
  18. <div
  19. class="tab_row"
  20. v-for="item in tabArr"
  21. :key="item.id"
  22. @click="jump(item.url)"
  23. >
  24. <div :class="{ active: $route.meta.myInd === item.id }">
  25. {{ item.name }}
  26. </div>
  27. <img
  28. v-show="$route.meta.myInd === item.id"
  29. src="@/assets/img/active.png"
  30. alt=""
  31. />
  32. </div>
  33. </div>
  34. </div>
  35. </div>
  36. <!-- 下侧内容 -->
  37. <div class="right_con">
  38. <Router-view />
  39. </div>
  40. </div>
  41. </template>
  42. <script>
  43. export default {
  44. name: "layout",
  45. components: {},
  46. data() {
  47. // 这里存放数据
  48. return {
  49. tabArr: [
  50. { url: "tab1", id: 1, name: "数字史馆" },
  51. { url: "tab2", id: 2, name: "校园全景" },
  52. { url: "tab3", id: 3, name: "文物典藏" },
  53. { url: "tab4", id: 4, name: "信息检索" }
  54. ],
  55. };
  56. },
  57. // 监听属性 类似于data概念
  58. computed: {},
  59. // 监控data中的数据变化
  60. watch: {},
  61. // 方法集合
  62. methods: {
  63. // 点击tab栏
  64. jump(url) {
  65. if (url === "tab1") url = "/index?m=TEST";
  66. this.$router.replace(url).catch(() => {});
  67. if (url === "/index?m=TEST") {
  68. this.$nextTick(() => {
  69. setTimeout(() => {
  70. location.reload(true);
  71. }, 300);
  72. });
  73. }
  74. },
  75. },
  76. // 生命周期 - 创建完成(可以访问当前this实例)
  77. created() {},
  78. // 生命周期 - 挂载完成(可以访问DOM元素)
  79. mounted() {},
  80. beforeCreate() {}, // 生命周期 - 创建之前
  81. beforeMount() {}, // 生命周期 - 挂载之前
  82. beforeUpdate() {}, // 生命周期 - 更新之前
  83. updated() {}, // 生命周期 - 更新之后
  84. beforeDestroy() {}, // 生命周期 - 销毁之前
  85. destroyed() {}, // 生命周期 - 销毁完成
  86. activated() {}, // 如果页面有keep-alive缓存功能,这个函数会触发
  87. };
  88. </script>
  89. <style lang='less' scoped>
  90. .layout {
  91. display: flex;
  92. flex-direction: column;
  93. width: 100%;
  94. height: 100%;
  95. min-width: 1900px;
  96. min-height: 900px;
  97. color: #fff;
  98. .lay_top {
  99. display: flex;
  100. z-index: 999;
  101. position: relative;
  102. width: 100%;
  103. height: 120px;
  104. background-color: #b0111e;
  105. .login {
  106. display: flex;
  107. align-items: center;
  108. margin-left: 100px;
  109. width: 320px;
  110. height: 120px;
  111. background-size: 100% 100%;
  112. & > img {
  113. width: 90px;
  114. height: 86px;
  115. }
  116. & > p {
  117. font-size: 24px;
  118. color: #f2cd83;
  119. font-weight: 700;
  120. padding: 21px;
  121. }
  122. }
  123. .conten {
  124. color: #f2cd83;
  125. flex: 1;
  126. .bot_time {
  127. text-align: right;
  128. padding-right: 260px;
  129. height: 40px;
  130. line-height: 40px;
  131. border-bottom: 1px solid #f2cd83;
  132. }
  133. .tab {
  134. padding-top: 13px;
  135. height: 79px;
  136. background: url('../../assets/img/layTopBac.png') no-repeat right;
  137. display: flex;
  138. justify-content: space-around;
  139. padding-right: 120px;
  140. .tab_row {
  141. cursor: pointer;
  142. text-align: center;
  143. font-size: 18px;
  144. height: 60px;
  145. & > div {
  146. color: #fff;
  147. }
  148. .active {
  149. color: #f2cd83;
  150. font-weight: 700;
  151. }
  152. & > img {
  153. width: 53px;
  154. height: 19px;
  155. }
  156. &:hover div{
  157. color: #f2cd83;
  158. }
  159. }
  160. }
  161. }
  162. }
  163. .right_con {
  164. background: url('../../assets/img/layoutBac.png');
  165. background-size: 100% 100%;
  166. position: relative;
  167. flex: 1;
  168. }
  169. }
  170. </style>