DESKTOP-O04BTUJ\muzen il y a 3 ans
Parent
commit
133093dd3d
2 fichiers modifiés avec 13 ajouts et 29 suppressions
  1. 3 6
      src/pages/lottery/detail.vue
  2. 10 23
      src/pages/lottery/index.vue

+ 3 - 6
src/pages/lottery/detail.vue

@@ -28,10 +28,8 @@ import { receive } from '@/api/lottery.js'
 export default {
   data() {
     return {
-      // 状态栏高度
-      statusBarHeight: 20,
-      // 用户信息
-      userInfo: {},
+      // 状态栏
+      statusBarHeight: getApp().globalData.statusBarHeight,
       // 表单
       form: {},
       // 防重复点击
@@ -43,7 +41,6 @@ export default {
       resultGoodId: e.resultGoodId,
       lotteryCode: e.lotteryCode
     }
-    this.userInfo = JSON.parse(e.userInfo)
   },
   methods: {
     // 返回
@@ -72,7 +69,7 @@ export default {
         })
       } else {
         this.disabled = true
-        receive(this.userInfo, this.form).then(res => {
+        receive(getApp().globalData.userInfo, this.form).then(res => {
           if (res.data.code === 0) {
             uni.showToast({
               title: '提交成功!',

+ 10 - 23
src/pages/lottery/index.vue

@@ -46,10 +46,8 @@ export default {
   },
   data() {
     return {
-      // 用户信息
-      userInfo: {},
-      // 状态栏高度
-      statusBarHeight: 20,
+      // 状态栏
+      statusBarHeight: getApp().globalData.statusBarHeight,
       // 转盘
       prizes: [],
       buttons: [{
@@ -80,25 +78,13 @@ export default {
     }
   },
   onLoad() {
-    // 获取App方法
-    getUserInfo.postMessage('获取用户信息')
-    getDeviceInfo.postMessage('获取设备信息')
-
-    // 暴露setUserInfo方法给APP
-    window['setUserInfo'] = res => {
-      console.log(res);
-      this.userInfo = res
-      this.setUserInfo()
-    }
-    window['setDeviceInfo'] = res => {
-      this.statusBarHeight = JSON.parse(res).statusHeight
-    }
+    this.getList()
   },
   methods: {
     // 获取页面信息
-    setUserInfo() {
+    getList() {
       this.prizes = []
-      page(JSON.parse(this.userInfo)).then(res => {
+      page(getApp().globalData.userInfo).then(res => {
         if (res.data.code === 0) {
           const j = res.data.data
           // 可用积分
@@ -141,7 +127,7 @@ export default {
           if (this.disabled) {
             this.$refs.lucky.play()
             this.disabled = false
-            result(JSON.parse(this.userInfo)).then(res => {
+            result(getApp().globalData.userInfo).then(res => {
               if (res.data.code === 0) {
                 setTimeout(() => {
                   this.$refs.lucky.stop(res.data.data.resultGoodSort - 1)
@@ -174,7 +160,7 @@ export default {
       this.$nextTick(() => {
         this.$refs.popup.open()
         this.disabled = true
-        this.setUserInfo()
+        this.getList()
       })
     },
 
@@ -188,7 +174,7 @@ export default {
     getSubmit() {
       if (this.disabled) {
         this.disabled = false
-        receive(JSON.parse(this.userInfo), {
+        receive(getApp().globalData.userInfo, {
           prizeId: this.form.resultGoodId,
           lotteryCode: this.form.lotteryCode
         }).then(res => {
@@ -208,7 +194,7 @@ export default {
     // 填写收货信息
     getDetail() {
       uni.navigateTo({
-        url: `/pages/lottery/detail?userInfo=${this.userInfo}&prizeId=${this.form.resultGoodId}&lotteryCode=${this.form.lotteryCode}`
+        url: `/pages/lottery/detail?prizeId=${this.form.resultGoodId}&lotteryCode=${this.form.lotteryCode}`
       })
     }
   }
@@ -223,6 +209,7 @@ export default {
   background-repeat: no-repeat;
   width: 100%;
   height: 1880rpx;
+  padding: 0 20rpx 20rpx 20rpx;
 
   .nav {
     height: 88rpx;