var userIdentity = 1; mui.ready(function(){ mui.each(document.querySelectorAll('#my-grid-8 .mui-table-view-cell'), function(index, el) { el.addEventListener('tap', function() { switch (index) { case 0: //我的下线 mui.openWindow({url: base_path + '/agentWechat/agentNext'}); break; case 1: //冲奶机宣传片 mui.openWindow({url: base_path + '/agentWechat/goPublicity?userType=' + this.getAttribute("userType") + "&isDrp=" + this.getAttribute("isDrp")}); break; case 2: //奖励任务 mui.alert('正在建设中...'); break; case 3: //我的奖品 mui.openWindow({url: base_path + '/activity/go_prize_log?gameId=1'}); break; case 4: //奶粉信息 mui.alert('正在建设中...'); break; case 5: //售后服务 mui.openWindow({url:'http://www.iamberry.com/iamberry_wechat/after_service.html'}); break; case 6: mui.confirm('4008006692','客服电话',['取消', '拨打'],function(e){ if (e.index == 1) {location.href= 'tel:4008006692';} }) break; case 7: //常见问答 mui.alert('正在建设中...'); break; default: break; } }, false); }); mui.ajax(base_path + '/agent/member?dates=' + new Date().getTime(),{ dataType:'json', type:'post', timeout:15000, success:function(dt){ var data = dt.data; //console.log(dt) if(dt.status){ userIdentity = data.userIdentity; if(data.userHead != null && typeof(data.userHead)!="undefined" && data.userHead != ''){ var imgObj = $(""); $("#headDiv").empty().append(imgObj); } if(data.userNickname != null && typeof(data.userNickname)!="undefined" && data.userNickname != ''){ $("#userNickname").html(decodeURI(data.userNickname)); } $("#userNickname").append(''); document.querySelector('.loading-bg').style.display='none'; }else{ var btnArray = ['否', '是']; mui.confirm(dt.message, '爱贝源-提示', btnArray, function(e) { if (e.index == 1) { location.reload(true); } }); } }, error:function(xhr,type,errorThrown){ //异常处理; errorfn(xhr); } }); });