// packageH/schoolCompany/schoolCompanyIndex/schoolCompanyIndex.js
var app = getApp();
Page({
  /**
   * 页面的初始数据
   */
  data: {
    listData: [],
    userInfo: {},
    networkLoading: false,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.getData();
  },

  getData() {
    let urlStr = app.getNetAddresss("plugin.school-company.api.school-center");
    app._postNetWork({
      url: urlStr,
      success: (resdata) => {
        var res = resdata.data;
        if (res.result != 1) return app.tips(res.msg);

        this.setData({
          listData: res.data.member_school,
          userInfo: res.data,
          networkLoading: true,
        });
      },
    });
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {},

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

  gotoSchoolCompanyDetails(evt) {
    let { school_id, roles_id } = evt.currentTarget.dataset.item;
    wx.navigateTo({
      url: "/packageH/schoolCompany/schoolCompanyDetails/schoolCompanyDetails?school_id=" + school_id + "&roles_id=" + roles_id,
    });
  },

  gotoSchoolCompanyExtend() {
    wx.navigateTo({
      url: "/packageH/schoolCompany/schoolCompanyExtend/schoolCompanyExtend",
    });
  },

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

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

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

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

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {},
});
