index.vue 2.53 KB
<!--
 * @Date: 2024-10-18 17:57:33
 * @LastEditors: hookehuyr hookehuyr@gmail.com
 * @LastEditTime: 2024-10-20 13:19:23
 * @FilePath: /hager/src/views/user/index.vue
 * @Description: 文件描述
-->
<template>
  <div class="hager-user-page">
    <div class="centered-div">
      <el-row>
        <el-col :span="13">
          <div class="user-box" style="background-color: #EFF7FB;">
            <div class="user-logo"></div>
            <div class="user-bg"></div>
          </div>
        </el-col>
        <el-col :span="11">
          <router-view id="router-view"></router-view>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script>
import mixin from 'common/mixin';
import $ from 'jquery';

export default {
  mixins: [mixin.init],
  data () {
    return {

    }
  },
  mounted () {
    // 设置用户盒子高度
    // this.handleHeight();
    // 监听窗口的 resize 事件
    window.addEventListener('resize', this.handleHeight);
  },
  methods: {
    handleHeight () {
      //
      if ($('#router-view').outerHeight() > $('.user-box').height()) {
        $('.user-box').height($('#router-view').outerHeight())
      }
    }
  },
  beforeDestroy() {
    // 在组件销毁前移除监听器,防止内存泄漏
    window.removeEventListener('resize', this.handleHeight);
  }
}
</script>

<style lang="less" scoped>
  .hager-user-page {
    background-image: url(https://cdn.ipadbiz.cn/hager/img/user/dd-bg.png);
    background-size: cover;
    background-position: center;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    .centered-div {
      margin: 15rem 20vw 0;
      background-color: #fff; /* 设置背景颜色,方便看到元素 */
      box-shadow: 0rem 0.25rem 0.5rem 0.08rem rgba(0,0,0,0.16);
      border-radius: 5px;
      .user-box {
        overflow: hidden;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        border-top-left-radius: 5px;
        border-bottom-left-radius: 5px;
      }
      .user-logo {
        background-image: url(https://cdn.ipadbiz.cn/hager/img/user/logo02.png);
        height: 15vh;
        width: 15vw;
        background-size: contain;
        background-position: center;
        background-repeat: no-repeat;
        margin-top: 2rem;
      }
      .user-bg {
        background-image: url(https://cdn.ipadbiz.cn/hager/img/user/l-bg.png);
        height: 36vh;
        width: 45vw;
        background-size: contain;
        background-position: center;
        background-repeat: no-repeat;
      }
    }
  }
</style>