DESKTOP-O04BTUJ\muzen 3 vuotta sitten
vanhempi
commit
57693c5ab1
2 muutettua tiedostoa jossa 9 lisäystä ja 4 poistoa
  1. 4 1
      src/pages/lottery/detail.vue
  2. 5 3
      src/pages/lottery/index.vue

+ 4 - 1
src/pages/lottery/detail.vue

@@ -1,6 +1,6 @@
 <template>
   <view class="app-container">
-    <view class="nav" :style="{'margin-top': '44rpx'}">
+    <view class="nav" :style="{'margin-top': statusBarHeight + 'px'}">
       <uni-icons type="back" style="font-size: 48rpx" @click="getBack" />
       <text class="title">积分抽奖</text>
     </view>
@@ -28,6 +28,8 @@ import { receive } from '@/api/lottery.js'
 export default {
   data() {
     return {
+      // 状态栏高度
+      statusBarHeight: 0,
       // 用户信息
       userInfo: {},
       // 表单
@@ -37,6 +39,7 @@ export default {
     }
   },
   onLoad(e) {
+    this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
     this.form = {
       resultGoodId: e.resultGoodId,
       lotteryCode: e.lotteryCode

+ 5 - 3
src/pages/lottery/index.vue

@@ -1,6 +1,6 @@
 <template>
   <view class="app-container">
-    <view class="nav" :style="{'margin-top': '44rpx'}">
+    <view class="nav" :style="{'margin-top': statusBarHeight + 'px'}">
       <uni-icons type="back" style="font-size: 48rpx" @click="close" />
       <text class="title">积分抽奖</text>
     </view>
@@ -48,7 +48,7 @@ export default {
     return {
       // 用户信息
       userInfo: {},
-      // 
+      // 状态栏高度
       statusBarHeight: 0,
       // 转盘
       prizes: [],
@@ -80,7 +80,7 @@ export default {
     }
   },
   onLoad() {
-    this.statusBarHeight = ''
+    this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
     // 获取App方法
     getUserInfo.postMessage('获取用户信息')
     // 暴露setUserInfo方法给APP
@@ -88,6 +88,8 @@ export default {
       this.userInfo = res
       this.setUserInfo()
     }
+
+
   },
   methods: {
     setUserInfo() {