hookehuyr

用户注册页面自适应调整

...@@ -11,7 +11,6 @@ declare module 'vue' { ...@@ -11,7 +11,6 @@ declare module 'vue' {
11 ElBreadcrumbItem: typeof import('element-ui/lib/breadcrumb-item')['default'] 11 ElBreadcrumbItem: typeof import('element-ui/lib/breadcrumb-item')['default']
12 ElCarousel: typeof import('element-ui/lib/carousel')['default'] 12 ElCarousel: typeof import('element-ui/lib/carousel')['default']
13 ElCarouselItem: typeof import('element-ui/lib/carousel-item')['default'] 13 ElCarouselItem: typeof import('element-ui/lib/carousel-item')['default']
14 - ElCheckbox: typeof import('element-ui/lib/checkbox')['default']
15 ElCol: typeof import('element-ui/lib/col')['default'] 14 ElCol: typeof import('element-ui/lib/col')['default']
16 ElCollapse: typeof import('element-ui/lib/collapse')['default'] 15 ElCollapse: typeof import('element-ui/lib/collapse')['default']
17 ElCollapseItem: typeof import('element-ui/lib/collapse-item')['default'] 16 ElCollapseItem: typeof import('element-ui/lib/collapse-item')['default']
......
1 <!-- 1 <!--
2 * @Date: 2024-10-20 09:59:52 2 * @Date: 2024-10-20 09:59:52
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-10-21 10:36:22 4 + * @LastEditTime: 2024-10-21 18:21:31
5 * @FilePath: /hager/src/components/common/hagerInput.vue 5 * @FilePath: /hager/src/components/common/hagerInput.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -105,7 +105,12 @@ export default { ...@@ -105,7 +105,12 @@ export default {
105 margin-right: 0.5rem; 105 margin-right: 0.5rem;
106 } 106 }
107 &.normal { 107 &.normal {
108 - margin-left: 1rem; 108 + // margin-left: 1rem;
109 + }
110 + &.normal::before {
111 + content: '*';
112 + color: #FFF;
113 + margin-right: 0.5rem;
109 } 114 }
110 115
111 .input-box { 116 .input-box {
......
1 <!-- 1 <!--
2 * @Date: 2024-10-18 17:57:33 2 * @Date: 2024-10-18 17:57:33
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-10-20 13:19:23 4 + * @LastEditTime: 2024-10-21 18:13:26
5 * @FilePath: /hager/src/views/user/index.vue 5 * @FilePath: /hager/src/views/user/index.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
8 <template> 8 <template>
9 <div class="hager-user-page"> 9 <div class="hager-user-page">
10 - <div class="centered-div"> 10 + <div v-if="!is_xs" class="centered-div">
11 - <el-row> 11 + <el-row style="background-color: #EFF7FB;">
12 <el-col :span="13"> 12 <el-col :span="13">
13 - <div class="user-box" style="background-color: #EFF7FB;"> 13 + <div class="user-box">
14 <div class="user-logo"></div> 14 <div class="user-logo"></div>
15 <div class="user-bg"></div> 15 <div class="user-bg"></div>
16 </div> 16 </div>
17 </el-col> 17 </el-col>
18 <el-col :span="11"> 18 <el-col :span="11">
19 - <router-view id="router-view"></router-view> 19 + <router-view id="router-view" style="background-color: #FFF;"></router-view>
20 </el-col> 20 </el-col>
21 </el-row> 21 </el-row>
22 </div> 22 </div>
23 + <div v-else class="centered-div xs">
24 + <div class="user-logo-xs">
25 + <img src="https://cdn.ipadbiz.cn/hager/img/user/logo02.png" style="width: auto; height: 2rem;">
26 + </div>
27 + <router-view id="router-view"></router-view>
28 + </div>
23 </div> 29 </div>
24 </template> 30 </template>
25 31
...@@ -36,9 +42,14 @@ export default { ...@@ -36,9 +42,14 @@ export default {
36 }, 42 },
37 mounted () { 43 mounted () {
38 // 设置用户盒子高度 44 // 设置用户盒子高度
39 - // this.handleHeight();
40 // 监听窗口的 resize 事件 45 // 监听窗口的 resize 事件
41 window.addEventListener('resize', this.handleHeight); 46 window.addEventListener('resize', this.handleHeight);
47 + // 判断是否被遮挡,让屏幕能滚动
48 + if (!this.isElementInViewport('#router-view')) { // #router-view 被屏幕遮挡
49 + $('.hager-user-page').css('height', 'auto')
50 + } else {
51 + $('.hager-user-page').css('height', '100vh')
52 + }
42 }, 53 },
43 methods: { 54 methods: {
44 handleHeight () { 55 handleHeight () {
...@@ -46,6 +57,23 @@ export default { ...@@ -46,6 +57,23 @@ export default {
46 if ($('#router-view').outerHeight() > $('.user-box').height()) { 57 if ($('#router-view').outerHeight() > $('.user-box').height()) {
47 $('.user-box').height($('#router-view').outerHeight()) 58 $('.user-box').height($('#router-view').outerHeight())
48 } 59 }
60 + // 判断是否被遮挡,让屏幕能滚动
61 + if (!this.isElementInViewport('#router-view')) { // #router-view 被屏幕遮挡
62 + $('.hager-user-page').css('height', 'auto')
63 + } else {
64 + $('.hager-user-page').css('height', '100vh')
65 + }
66 + },
67 + isElementInViewport(element) {
68 + var rect = $(element)[0].getBoundingClientRect(); // 获取元素相对于视口的大小和位置
69 +
70 + // 检查是否完全在视口内
71 + return (
72 + rect.top >= 0 &&
73 + rect.left >= 0 &&
74 + rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && // 窗口高度
75 + rect.right <= (window.innerWidth || document.documentElement.clientWidth) // 窗口宽度
76 + );
49 } 77 }
50 }, 78 },
51 beforeDestroy() { 79 beforeDestroy() {
...@@ -68,6 +96,9 @@ export default { ...@@ -68,6 +96,9 @@ export default {
68 background-color: #fff; /* 设置背景颜色,方便看到元素 */ 96 background-color: #fff; /* 设置背景颜色,方便看到元素 */
69 box-shadow: 0rem 0.25rem 0.5rem 0.08rem rgba(0,0,0,0.16); 97 box-shadow: 0rem 0.25rem 0.5rem 0.08rem rgba(0,0,0,0.16);
70 border-radius: 5px; 98 border-radius: 5px;
99 + &.xs {
100 + margin: 10rem 1.5rem;
101 + }
71 .user-box { 102 .user-box {
72 overflow: hidden; 103 overflow: hidden;
73 display: flex; 104 display: flex;
...@@ -94,6 +125,13 @@ export default { ...@@ -94,6 +125,13 @@ export default {
94 background-position: center; 125 background-position: center;
95 background-repeat: no-repeat; 126 background-repeat: no-repeat;
96 } 127 }
128 + .user-logo-xs {
129 + display: flex;
130 + flex-direction: column;
131 + align-items: center;
132 + height: 6rem;
133 + justify-content: center;
134 + }
97 } 135 }
98 } 136 }
99 </style> 137 </style>
......
1 <!-- 1 <!--
2 * @Date: 2024-10-18 18:00:47 2 * @Date: 2024-10-18 18:00:47
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-10-21 09:47:23 4 + * @LastEditTime: 2024-10-21 18:04:13
5 * @FilePath: /hager/src/views/user/register.vue 5 * @FilePath: /hager/src/views/user/register.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
8 <template> 8 <template>
9 - <div class="hager-register-page"> 9 + <div :class="['hager-register-page', is_xs ? 'xs' : '']">
10 <div class="input-title">用户注册</div> 10 <div class="input-title">用户注册</div>
11 <div style="padding: 1rem 1.5rem 1rem 1rem;"> 11 <div style="padding: 1rem 1.5rem 1rem 1rem;">
12 <hagerInput type="email" required v-model="email" placeholder="请输入注册邮箱地址" /> 12 <hagerInput type="email" required v-model="email" placeholder="请输入注册邮箱地址" />
...@@ -60,6 +60,14 @@ export default { ...@@ -60,6 +60,14 @@ export default {
60 .hager-register-page { 60 .hager-register-page {
61 padding: 2rem 0.5rem 0; 61 padding: 2rem 0.5rem 0;
62 box-sizing: border-box; 62 box-sizing: border-box;
63 + &.xs {
64 + background: linear-gradient(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.5)), url('https://cdn.ipadbiz.cn/hager/img/user/l-bg.png');
65 + background-size: 80% 50%;
66 + background-position: bottom;
67 + background-repeat: no-repeat;
68 + padding-top: 0;
69 + padding-bottom: 5rem;
70 + }
63 .input-title { 71 .input-title {
64 color: @secondary-color; 72 color: @secondary-color;
65 font-weight: bold; 73 font-weight: bold;
......