var M = {
  ver : 1,
  os : 5,
  channel : "web",
  domain : "http://test.ms-api.duowan.com",
  //获取搜索列表
  getSearchList : function(key){
      var url = M.domain+"/home/search.do";
      var data = {
        channel: M.channel,
        ver: M.ver,
        os: M.os,
        keyword : key
      };

      $.ajax({
        url: url,
        dataType: 'jsonp',
        data: data,
        success: function(ret){
          ret.data.role = "all";
          V.renderGameList(ret.data,key);
        },
        error: function(ret){
          M.getSearchList();
        }
      });
  }
}

var V = {
  init : function(){
    M.os = commonUtil.checkPlatform();
    M.getSearchList(commonUtil.getParam("key"));
  },
  renderGameList : function(data,key){
    var bannerTpl = __inline('../../tpl/simulatorGameList.tmpl');
    var dom = bannerTpl({
      data : data
    });

    key = key?key:"";
    $("#gameWrap").html(dom);
    $("#searchKey").html("搜索 “<span>"+key+"</span>” 结果");
    $("[name=key]").val(key);

    var PageTurn = new commonUtil.PageTurn({
      element : '[data-role='+data.role+']',
      showNum : 18
    });
  }
}

var C = {
  init : function(){
    
  }
}

V.init();
C.init();
  