|
@@ -56,7 +56,6 @@ Page({
|
|
|
*/
|
|
|
onLoad: function (options) {
|
|
|
this.init()
|
|
|
-
|
|
|
var userInfoValue = wx.getStorageSync('userInfo')
|
|
|
try {
|
|
|
if (userInfoValue) {
|
|
@@ -106,7 +105,6 @@ Page({
|
|
|
}).then(res => { // handle success
|
|
|
// console.log(res.data);
|
|
|
// res.data.length
|
|
|
- console.log(res)
|
|
|
if (res.retCode == 0) {
|
|
|
var gasArr = [];
|
|
|
for (let i = 0; i < res.data.length; i++) {
|
|
@@ -439,18 +437,37 @@ Page({
|
|
|
|
|
|
getUserInfo: function (e) {
|
|
|
let that = this;
|
|
|
+ wx.getUserProfile({
|
|
|
+ lang: "zh_CN",
|
|
|
+ desc: "测试一下",
|
|
|
+ success(res) {
|
|
|
+ app.globalData.userInfo = res.userInfo;
|
|
|
+ wx.setStorage({
|
|
|
+ data: res.userInfo,
|
|
|
+ key: 'userInfo',
|
|
|
+ })
|
|
|
+ that.showDialogPhone(); //调用一键获取手机号弹窗
|
|
|
+ that.setData({
|
|
|
+ userInfo: res.userInfo,
|
|
|
+ hasUserInfo: true
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ fail(err) {
|
|
|
+ wx.showToast({
|
|
|
+ title: '您拒绝了授权',
|
|
|
+ icon: 'error',
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
|
|
|
// 获取用户信息
|
|
|
wx.getSetting({
|
|
|
success(res) {
|
|
|
- console.log(res)
|
|
|
- // console.log("res", res)
|
|
|
if (res.authSetting['scope.userInfo']) {
|
|
|
- // console.log("已授权=====")
|
|
|
- // 已经授权,可以直接调用 getUserInfo 获取头像昵称
|
|
|
wx.getUserInfo({
|
|
|
success(res) {
|
|
|
- // console.log("获取用户信息成功", res.userInfo);
|
|
|
app.globalData.userInfo = res.userInfo;
|
|
|
wx.setStorage({
|
|
|
data: res.userInfo,
|
|
@@ -606,5 +623,21 @@ Page({
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
+ },
|
|
|
+ test() {
|
|
|
+ wx.login({
|
|
|
+ success(res) {
|
|
|
+ console.log(res)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ console.log(111111)
|
|
|
+ wx.getUserProfile({
|
|
|
+ lang: "zh_CN",
|
|
|
+ desc: "测试一下",
|
|
|
+ success(res) {
|
|
|
+ console.log(res)
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
+
|
|
|
})
|