From f244eaa1f17f8f1395fc27078a1dc2979b804c96 Mon Sep 17 00:00:00 2001 From: meo <18801474720@163.com> Date: Mon, 24 Jun 2019 17:44:50 +0800 Subject: [PATCH] =?UTF-8?q?[index][=E4=BF=AE=E6=94=B9]:[=E5=B0=86=E8=8E=B7?= =?UTF-8?q?=E5=BE=97=E6=89=8B=E6=9C=BA=E4=BF=A1=E6=81=AF=E7=9A=84=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E6=94=BE=E5=9C=A8index=E9=A1=B5=E9=9D=A2]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/index.js | 20 +++++++++++++++++++- pages/user/index.js | 19 +------------------ 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/pages/index/index.js b/pages/index/index.js index d9da88c..012c41c 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -79,6 +79,7 @@ Page({ wx.setStorageSync('imgurl', imgurl); if (app.globalData.token) { + this.updateUserInfo(); if (options.couponChannelId || options.orderId || options.id) { that.userStatus(options); } else { @@ -88,6 +89,7 @@ Page({ // 由于 token 是网络请求,可能会在 Page.onLoad 之后才返回 // 所以此处加入 callback 以防止这种情况 app.tokenCallback = token => { + this.updateUserInfo(); if (options.couponChannelId || options.orderId || options.id) { that.userStatus(options); } else { @@ -108,7 +110,23 @@ Page({ that.checkuserstatus(); } }, - + /** + * 获取手机信息 + */ + updateUserInfo() { + wx.getSystemInfo({ + success: function (res) { + Http.post({ + url: config.api.updateUserInfo, + data: { + systemInfo: JSON.stringify(res) + } + }).then(res => { + console.log(res) + }) + } + }) + }, checkuserstatus(options) { let that = this; Http.get({ diff --git a/pages/user/index.js b/pages/user/index.js index e4d36a0..c47b3a0 100644 --- a/pages/user/index.js +++ b/pages/user/index.js @@ -71,7 +71,6 @@ Page({ }, onLoad() { this.getLocation(); - this.updateUserInfo(); this.updateScene(); }, /** @@ -100,23 +99,7 @@ Page({ } }) }, - /** - * 获取手机信息 - */ - updateUserInfo() { - wx.getSystemInfo({ - success: function(res) { - Http.post({ - url: config.api.updateUserInfo, - data: { - systemInfo: JSON.stringify(res) - } - }).then(res => { - console.log(res) - }) - } - }) - }, + /** * 用户更新scene */