| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
- <!-- -->
- <template>
- <div class="layout">
- <!-- 上侧固定导航栏 -->
- <div class="lay_top">
- <div class="login">
- <img src="@/assets/img/logo.png" alt="" />
- <p> 中国人民解放军 陆 军 勤 务 学 院</p>
- </div>
- <!-- 右边的盒子 -->
- <div class="conten">
- <!-- 当前时间 -->
- <div class="bot_time">
- {{ moment().format("LL") }} {{ moment().format("dddd") }}
- </div>
- <!-- tab栏 -->
- <div class="tab">
- <div
- class="tab_row"
- v-for="item in tabArr"
- :key="item.id"
- @click="jump(item.url)"
- >
- <div :class="{ active: $route.meta.myInd === item.id }">
- {{ item.name }}
- </div>
- <img
- v-show="$route.meta.myInd === item.id"
- src="@/assets/img/active.png"
- alt=""
- />
- </div>
- </div>
- </div>
- </div>
- <!-- 下侧内容 -->
- <div class="right_con">
- <Router-view />
- </div>
- </div>
- </template>
- <script>
- export default {
- name: "layout",
- components: {},
- data() {
- // 这里存放数据
- return {
- tabArr: [
- { url: "tab1", id: 1, name: "数字史馆" },
- { url: "tab2", id: 2, name: "校园全景" },
- { url: "tab3", id: 3, name: "文物典藏" },
- { url: "tab4", id: 4, name: "信息检索" }
- ],
- };
- },
- // 监听属性 类似于data概念
- computed: {},
- // 监控data中的数据变化
- watch: {},
- // 方法集合
- methods: {
- // 点击tab栏
- jump(url) {
- if (url === "tab1") url = "/index?m=TEST";
- this.$router.replace(url).catch(() => {});
- if (url === "/index?m=TEST") {
- this.$nextTick(() => {
- setTimeout(() => {
- location.reload(true);
- }, 300);
- });
- }
- },
- },
- // 生命周期 - 创建完成(可以访问当前this实例)
- created() {},
- // 生命周期 - 挂载完成(可以访问DOM元素)
- mounted() {},
- beforeCreate() {}, // 生命周期 - 创建之前
- beforeMount() {}, // 生命周期 - 挂载之前
- beforeUpdate() {}, // 生命周期 - 更新之前
- updated() {}, // 生命周期 - 更新之后
- beforeDestroy() {}, // 生命周期 - 销毁之前
- destroyed() {}, // 生命周期 - 销毁完成
- activated() {}, // 如果页面有keep-alive缓存功能,这个函数会触发
- };
- </script>
- <style lang='less' scoped>
- .layout {
- display: flex;
- flex-direction: column;
- width: 100%;
- height: 100%;
- min-width: 1900px;
- min-height: 900px;
- color: #fff;
- .lay_top {
- display: flex;
- z-index: 999;
- position: relative;
- width: 100%;
- height: 120px;
- background-color: #b0111e;
- .login {
- display: flex;
- align-items: center;
- margin-left: 100px;
- width: 320px;
- height: 120px;
- background-size: 100% 100%;
- & > img {
- width: 90px;
- height: 86px;
- }
- & > p {
- font-size: 24px;
- color: #f2cd83;
- font-weight: 700;
- padding: 21px;
- }
- }
- .conten {
- color: #f2cd83;
- flex: 1;
- .bot_time {
- text-align: right;
- padding-right: 260px;
- height: 40px;
- line-height: 40px;
- border-bottom: 1px solid #f2cd83;
- }
- .tab {
- padding-top: 13px;
- height: 79px;
- background: url('../../assets/img/layTopBac.png') no-repeat right;
- display: flex;
- justify-content: space-around;
- padding-right: 120px;
- .tab_row {
- cursor: pointer;
- text-align: center;
- font-size: 18px;
- height: 60px;
- & > div {
- color: #fff;
- }
- .active {
- color: #f2cd83;
- font-weight: 700;
- }
- & > img {
- width: 53px;
- height: 19px;
- }
- &:hover div{
- color: #f2cd83;
- }
- }
- }
- }
- }
- .right_con {
- background: url('../../assets/img/layoutBac.png');
- background-size: 100% 100%;
- position: relative;
- flex: 1;
- }
- }
- </style>
|