浏览代码

样式适配

306132416@qq.com 5 年之前
父节点
当前提交
893e153533
共有 1 个文件被更改,包括 23 次插入10 次删除
  1. 23 10
      pages/index/index.vue

+ 23 - 10
pages/index/index.vue

@@ -1,7 +1,7 @@
 <template>
 	<view class="content">
 		  <!-- #ifdef MP-WEIXIN -->
-		                <official-account class="relevance" @error="loadFail"></official-account>
+		                <official-account class="relevance" @error="loadFail" @load='loadSucc'></official-account>
 		  <!-- #endif -->
 		<image class="logo" src="/static/bg-home.jpg" mode="widthFix" :style="{marginTop:marginTopCss}"></image>
 		<view class="getPhone-box" :style="{ bottom: bottomCss}">
@@ -26,9 +26,10 @@
 				isAuthPhone:getApp().globalData.user_phone,
 				productList:[
 				],
-				bottomCss:'20%',
-				marginTopCss:'75px',
+				bottomCss:'15%',
+				marginTopCss:'0',
 				userInfoObj:{},
+				// phoneHeight:'',
 			}
 		},
 		onLoad() {
@@ -49,13 +50,21 @@
 		},
 		methods: {
 			loadFail(e){
-				console.log(e)
-				this.marginTopCss = 0;
+				// console.log('getLoad')
+				// this.marginTopCss = 0;
+				let phoneHeight = uni.getSystemInfoSync().windowHeight;
+				this.bottomCss = phoneHeight > 640 ? '35%':'25%';
+				if(phoneHeight > 820){
+					this.bottomCss = '45%';
+				}
+			},
+			loadSucc(e){
 			},
 			getEquipmentHeight(){
+				console.log('getHeight')
 			    let phoneHeight = uni.getSystemInfoSync().windowHeight;
 				console.log(phoneHeight)
-				this.bottomCss = phoneHeight > 672 ? '30%':'20%';
+				this.bottomCss = phoneHeight > 640 ? '25%':'15%';
 				if(phoneHeight > 820){
 					this.bottomCss = '35%';
 				}
@@ -197,23 +206,27 @@
 		flex-direction: column;
 		align-items: center;
 		justify-content: center;
+		// height: 100%;
 		// background-image: url('/static/bg-home.jpg');
 		// background-repeat: no-repeat;
 		// background-size: 100% 100%;
 	}
+	.more-height{
+		height: 100%!important;
+	}
 	/* #ifdef MP-WEIXIN */
     .relevance {
 		width: 100%;
-		height: 60px;
-		position: absolute;
-		top: 0;
+		// height: 10px;
+		// position: absolute;
+		// top: 0;
 		z-index: 999;
 	}
 	/* #endif */
 	.logo {
 		width: 100%;
 		position: relative;
-		margin-top: 75px;
+		// margin-top: 75px;
 	}
 	.getPhone-box {
 		width: 100%;