import { doNavigateWithUser } from '../../../utils/helper';
import { postUrl } from '../../../utils/util';
import waterApiArr from '../../../api/water_filter';

const __staticUrl = require('../../../config/env.js').static_url
Page({

  /**
   * 页面的初始数据
   */
  data: {
    functional_List: [
      {
        "image": (__staticUrl + '/User/_assets/Group_25.png'),
        "name": "推广海报",
        "url": "/packages/user/share/index",
        "type": "h5"
      },
      {
        "image": (__staticUrl + '/User/_assets/Group_26.png'),
        "name": "我的下级",
        "url": "",
        "type": "h5"
      },
      {
        "image": (__staticUrl + '/User/_assets/Group_35.png'),
        "name": "下级订单",
        "url": "",
        "type": "h5"
      },
      {
        "image": (__staticUrl + '/User/_assets/Group_30.png'),
        "name": "联系平台",
        "url": "",
        "type": "h5"
      },
    ],
    userInfo: {},
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    this.init();
  },
  init() {
    postUrl(waterApiArr.loginInfo,{},res=>{
      console.log('loginInfo 接口结果', res);
      this.setData({
        userInfo: res
      })
    })
  },


  /**
   * 点击跳转账户详情页
  */
  handleUserInfoClick() {
    doNavigateWithUser({ url: '/packages/user/userInfo/index' });
  },
  handleShareClick() {
    doNavigateWithUser({ url: '/packages/user/share/index' });
  },

  headerOrderClick(event) {
    console.log('11111', event)
    const { url } = event.currentTarget.dataset;
    if (!url) {
      wx.showModal({
        title: '提示',
        content: '此功能暂未开通！',
        showCancel: false,
      })
    }
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})