dongyuan0658 6 years ago
parent
commit
91f7b59cb4
3 changed files with 32 additions and 17 deletions
  1. 17 17
      component/my/my.js
  2. 7 0
      pages/index/index.js
  3. 8 0
      pages/user/myEdit/myEdit.wxss

+ 17 - 17
component/my/my.js

@@ -1,4 +1,4 @@
-import APIClient from '../../utils/httpUtil.js'
+// import APIClient from '../../utils/httpUtil.js'
 export const myInit =  (that) => {
   that.setData({
     myData: {
@@ -33,23 +33,23 @@ export const myInit =  (that) => {
   }
 
   that.userInfo = function () {
-      // const userInfo = wx.getStorageSync('user');
-      // console.log(userInfo.data.data.data);
-      // that.data.myData.user = userInfo.data.data.data;//直接赋值 给 myData的user对象。
-      // that.setData({
-      //     myData: that.data.myData,
-      // },()=>{
-      //     console.log('myData的user对象,赋值成功')
-      //     console.log(that.data.myData);
-      // });
-    APIClient.getOpenidSessionKey(res => {
-      console.log(res.data.data.data);
-      that.data.myData.user = res.data.data.data;//挂载user对象。
+      const userInfo = wx.getStorageSync('user');
+      console.log(userInfo.data.data.data);
+      that.data.myData.user = userInfo.data.data.data;//直接赋值 给 myData的user对象。
       that.setData({
-        myData: that.data.myData
-      },() => {
-        console.log(that.data.myData)
+          myData: that.data.myData,
+      },()=>{
+          console.log('myData的user对象,赋值成功')
+          console.log(that.data.myData);
       });
-    });
+    // APIClient.getOpenidSessionKey(res => {
+    //   console.log(res.data.data.data);
+    //   that.data.myData.user = res.data.data.data;//挂载user对象。
+    //   that.setData({
+    //     myData: that.data.myData
+    //   },() => {
+    //     console.log(that.data.myData)
+    //   });
+    // });
   }()
 }

+ 7 - 0
pages/index/index.js

@@ -85,6 +85,13 @@ Page({
     }
     if (myIndex == 3) {
       myInit(this);
+      getOpenidSessionKey( res => {
+        console.log(res);
+      }, (error) => {
+        this.setData({
+          hide: !this.data.hide
+        });
+      });
     }
   },
   onLoad: function (options) {

+ 8 - 0
pages/user/myEdit/myEdit.wxss

@@ -25,6 +25,14 @@ page{
   border-radius: 12rpx;
 }
 
+.user-action{
+  width: 100rpx;
+}
+
+.nickname{
+  width: 100%;
+}
+
 .setting-title{
   display: inline-block;
   width: 94rpx;