var app = getApp();
var $ = require('../../../js/util.js');
Page({
  data: {
    list:[],
    is_show: 0,
    param:{
      page:1,
    },
    page: 1,
    hasMore: false,
    dataNull: true,
    zb_appid:'',
  },
  onLoad: function () {
  },
  onReady: function () {
    //初始化数据
    var self = this;
    app.getUserInfo(function (ret) {
      self.getIndex();
    });
  },
  getIndex: function () {
    var self = this;
    var action = 'c=Live&a=myfollow_list';
    var param = self.data.param;
    app.showLoading('加载中...');
    app.ajaxRequest(action, 'POST', param, function (ret) {
      self.zb_appid = ret.wx_zb_appid;
      if (ret && ret.status == 1) {
        $.init_page_list(self, ret.data);
      } else {
        $.init_page_empty_list(self, ret.msg);
      }
    }, true);
  },
  onReachBottom: function () {
    var self = this;
    self.data.page++;
    self.setData({
      param: {
        page: self.data.page,
      }
    });
    self.getIndex();
  },
  //移除我的关注
  del_colect:function(e){
    var self = this;
    var dataset = e.currentTarget.dataset;
    var action = 'c=Live&a=delete_collect';
    var bodyparam = new Object;
    bodyparam.user_id = dataset.uid;
    bodyparam.id = dataset.id;
    app.showLoading('加载中...');
    app.ajaxRequest(action, 'POST', bodyparam, function (ret) {
      if(ret.status==1){
        app.HCtoast(ret.msg);
      }else{
        app.HCerror('提示',ret.msg);
      }
    }, true);
    self.getIndex();
  },
  goTomyzhub: function(event){
    var info = event.currentTarget.dataset;
    // var ym_url = '../../../livepages/pages/live/anchor/anchor?room_id=' + info.rid + '&uid'+ info.id;
    // app.HCnavigateTo(ym_url);
    // app.HCredirectToNewSmall(this.zb_appid, ym_url);
  },
})