var app = getApp();
var $ = require('../../../../js/util.js');
Page({
  data: {
    data: [],
    hasMore: false,//无更多数据提示
    dataNull: true//未获取到数据提示
  },
  onLoad: function (options) {//接收上个页面传的参数
    if (options.invite_key) {
      app.globalData.invite_key = options.invite_key;
    }
  },
  onShow: function () {
    //初始化数据
    var self = this;
    self.getIndex();
  },
  onPullDownRefresh: function () {
    this.setData({
      list: [],
      page: 1,
      hasMore: false,
      dataNull: true
    });
    this.getIndex();
  },
  getIndex: function () {
    var self = this;
    var action = 'c=ProLevel&a=info';
    app.showLoading('加载中...');
    app.ajaxRequest(action, 'GET', '', function (ret) {
      if (ret.status == 1) {
        if (ret.data.content){
          ret.data.content = ret.data.content.replace(/\<img/gi, '<img style="max-width:100%;height:auto" ')
        }
        self.setData({
          data: ret.data.content
        });
      } else {
        app.HCerror(ret.msg);
      }
    });
  },
})