export const myInit =  (that) => {
  that.setData({
    myData: {
        title: '修改资料',
        concern: '我的关注',
        course: '我的课程',
        read: '我的朗读',
        keep: '我的收藏',
        collage: '我的拼团',
        wallet: '我的钱包',
        address:['北京海淀','中关村','三小'],
        schoolCity: '青岛市',
        schoolName: '黄岛区志贤中学',
        playNum: 31549,
        attentionCount: 10254,
        point: 6317,
        flowerNum: 56245,
        user: {}
    }
  });
  that.toMyEdit = (e) => {
    let title = e.currentTarget.dataset.title;
    wx.navigateTo({
      url: `../user/myEdit/myEdit?title=${title}`
    });
  },
  that.toMyConcern = e => {
    let title = e.currentTarget.dataset.title;
    wx.navigateTo({
      url: `../user/myconcern/myconcern?title=${title}`
    });
  }
  that.toMyWallet = e => {
    let title = e.currentTarget.dataset.title;
    wx.navigateTo({
      url: `../user/myWallet/myWallet?title=${title}`
    });
  },
  that.toMyCourse = e => {
    let title = e.currentTarget.dataset.title;
    wx.navigateTo({
      url: `../user/mycourse/mycourse?title=${title}`
    });
  },
  that.toMyRead = e => {
    let title = e.currentTarget.dataset.title;
    wx.navigateTo({
      url: `../user/myread/myread?title=${title}`
    });
  },
  that.toMyKeep = e => {
    let title = e.currentTarget.dataset.title;
    wx.navigateTo({
      url: `../user/mycollection/mycollection?title=${title}`
    });
  },
  that.toMyCollage = e => {
    let title = e.currentTarget.dataset.title;
    wx.navigateTo({
      url: `../../pages/groupPage/my-group/my-group?title=${title}`
    });
      debugger
      APIClient.myWallet().success(res => {
          debugger
          console.log(res.data.data.data);
      });
  },
  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对象。
    //   that.setData({
    //     myData: that.data.myData
    //   },() => {
    //     console.log(that.data.myData)
    //   });
    // });
  }()
}