// packageH/schoolCompany/schoolCompanyDetails/schoolCompanyDetails.js
var app = getApp();
Page({
  /**
   * 页面的初始数据
   */
  data: {
    userInfo: {},
    has_one_school: {},
    has_one_roles: {},
    school_id: 0,
    roles_id: 0,
  },

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

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

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

        this.setData({
          userInfo: res.data,
          has_one_school: res.data.member_school.has_one_school,
          has_one_roles: res.data.member_school.has_one_roles,
        });
      },
    });
  },

  gotoRecord() {
    wx.navigateTo({
      url: "/packageH/schoolCompany/schoolCompanyRecord/schoolCompanyRecord?school_id=" + this.data.school_id,
    });
  },

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

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

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

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

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

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