const app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    datum: [],  //头部信息
    headurl: [],    //个人头像
    authenticationnum: [],    //认证信息
    memberstatus:'', //会员状态


  },

  /**
   * 生命周期函数--监听页面加载
   */
  onShow: function (options) {

    var that =this;


              //  头部信息
    let datum_url = 'my/personaldata/datum';
    let datum_data = {
            };
    app.postRequest(datum_url, datum_data, function (res) {
            if (res.code == 201) {
              // console.log(res.data);
              that.setData({
                datum: res.data
              })
            }
      })


    //  个人头像
    let headurl_url = 'my/images/headurl';
    let headurl_data = {
    };
    app.postRequest(headurl_url, headurl_data, function (res) {
      if (res.code == 201) {
        // console.log(res.data);
        that.setData({
          headurl: res.data
        })
      }
    })

    //  认证信息
    let authenticationnum_url = 'my/authentication/authenticationnum';
    let authenticationnum_data = {
    };
    app.postRequest(authenticationnum_url, authenticationnum_data, function (res) {
      if (res.code == 201) {
        that.setData({
          authenticationnum: res.data
        })
      }
    })




    //  会员状态
    let memberstatus_url = 'pay/recharge/memberstatus';
    let memberstatus_data = {
    };
    app.postRequest(memberstatus_url, memberstatus_data, function (res) {
      if (res.code == 201) {
        console.log(res.data,6666);
        that.setData({
          memberstatus: res.data.messages
        })
      }
    })


  },


  // 分享

  onShareAppMessage: function (res) {

    var that = this;
    var code = '';
    // getApp().showLoading();   //提示加载中
    //  头部信息
    let datum_url = 'my/other/share';
    let datum_data = {
    };
    app.postRequest(datum_url, datum_data, function (res) {
      if (res.code == 201) {
        console.log(res.data.code);
        that.setData({
          code: res.data.code,
        })
      }
    })


    if (res.from === 'button') {
      console.log("来自页面内转发按钮");
      console.log(res.target);

    }
    else {
      console.log("来自右上角转发菜单")
    }
    return {
      title: 'jia',
      // path: '/pages/share/share?code=' + _that.data.code + '',
      success: (res) => {
        console.log("转发成功", res);
      },
      fail: (res) => {
        console.log("转发失败", res);
      }
    }

  }






})