瀏覽代碼

[index][修改]:[将获得手机信息的接口放在index页面]

tags/C.7.1.0
meo 6 年之前
父節點
當前提交
f244eaa1f1
共有 2 個檔案被更改,包括 20 行新增19 行删除
  1. +19
    -1
      pages/index/index.js
  2. +1
    -18
      pages/user/index.js

+ 19
- 1
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({


+ 1
- 18
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
*/


Loading…
取消
儲存