DESKTOP-O04BTUJ\muzen %!s(int64=3) %!d(string=hai) anos
pai
achega
1ba3648c3d
Modificáronse 1 ficheiros con 17 adicións e 31 borrados
  1. 17 31
      src/pages/lottery/index.vue

+ 17 - 31
src/pages/lottery/index.vue

@@ -1,6 +1,6 @@
 <template>
   <view class="app-container">
-    <view class="nav" :style="{'margin-top': statusBarHeight}">
+    <view class="nav" :style="{'margin-top': '44rpx'}">
       <uni-icons type="back" style="font-size: 48rpx" @click="close" />
       <text class="title">积分抽奖</text>
     </view>
@@ -8,9 +8,6 @@
     <!-- 每次消耗多少积分 -->
     <view class="every">{{lotteryConsumePoint}}积分/次</view>
 
-    <button @click="getUser">获取信息</button>
-    <view>{{ data }}</view>
-
     <!-- 转盘 -->
     <LuckyWheel class="lucky" ref="lucky" width="568rpx" height="568rpx" :prizes="prizes" :buttons="buttons"
       :defaultStyle="defaultStyle" @start="startCallBack" @end="endCallBack" />
@@ -49,8 +46,9 @@ export default {
   },
   data() {
     return {
-      // 用户id
-      userId: '',
+      // 用户信息
+      userInfo: {},
+      // 
       statusBarHeight: 0,
       // 转盘
       prizes: [],
@@ -78,40 +76,24 @@ export default {
       // 表单
       form: {},
       // 防止连点
-      disabled: true,
-      data: null
+      disabled: true
     }
   },
-  onLoad(e) {
-    // this.userId = e.userId
-    // this.statusBarHeight = uni.getWindowInfo().statusBarHeight + 'px'
-    this.statusBarHeight = '44rpx'
-    this.getList()
-    this.setUserInfo()
+  onLoad() {
+    this.statusBarHeight = ''
+    // 获取App方法
+    getUserInfo.postMessage('获取用户信息')
+    // 暴露setUserInfo方法给APP
     window['setUserInfo'] = res => {
       this.setUserInfo(res)
     }
   },
   methods: {
-    getUser(){
-      getUserInfo.postMessage('获取信息')
-    },
-
-    setUserInfo(e){
+    setUserInfo(e) {
       console.log(e);
-      this.data = e
-    },
-
-    close() {
-      closePage.postMessage('关闭页面')
-    },
-
-    // 获取页面信息
-    getList() {
       this.prizes = []
-      page({
-        userId: this.userId
-      }).then(res => {
+      page(e).then(res => {
+        console.log(res);
         if (res.data.code === 0) {
           const j = res.data.data
           // 可用积分
@@ -143,6 +125,10 @@ export default {
       })
     },
 
+    close() {
+      closePage.postMessage('关闭页面')
+    },
+
     // 点击抽奖按钮触发回调
     startCallBack() {
       if (this.hasLotteryCount > 0) {