//遮罩模态框 var promptBlock = document.getElementsByClassName("promptBlock"); var model = mui.createMask(modelClose);//创建遮罩 function modelClose(){ for(var i=0;i 位好友,为您带来了 " + $data * 50 + " 奖励积分。" } ($info.hasHeadImage == 1) ? img = baseUrl + "/images/head/" + $info.id + "_l.jpg": img = "../images/default-photo.jpg"; var li = document.createElement("li"); li.setAttribute("id",$info.id); li.setAttribute("authType",$info.authType); li.setAttribute("authentication",$info.authentication); li.className = "mui-table-view-cell"; var oString = '
' oString += '
'; oString += '' oString += '
' oString += '
' oString += '

' + $info.name + '

' oString += '

' + $info.orgName + '

' oString += '

' + inviNum + '

' oString += '
' oString += '
' li.innerHTML = oString; document.getElementById("friendsList").appendChild(li); } }, error: function() { plus.nativeUI.toast("服务器链接超时", toastStyle); return; } }); } }, error: function() { plus.nativeUI.toast("服务器链接超时", toastStyle); return; } }); }) }, /*好友邀请好友得总数*/ frinedInviteFriends: function() { mui.plusReady(function() { var userId = plus.storage.getItem('userid'); mui.ajax(baseUrl + "/ajax/growth/countByInviter", { dataType: 'json', //数据格式类型 type: 'GET', //http请求类型 data: { "professorId": userId }, timeout: 10000, //超时设置 success: function(data) { if(data.success) { var $info = data.data; document.getElementById("friendInviteFriend").innerHTML = $info + "位"; } }, error: function() { plus.nativeUI.toast("服务器链接超时", toastStyle); return; } }); }) }, } mui.ready(function() { mui.plusReady(function() { var userId = plus.storage.getItem('userid'); person.inviteIntegral(); person.inviteFriendsTotal(); person.invitefriendsList(); person.frinedInviteFriends(); var inviteBtnLink = document.getElementById("inviteBtnLink"); var inviteShow = document.getElementById("inviteShow"); var promptBtn = document.getElementsByClassName("promptBtn"); inviteBtnLink.addEventListener("tap", function() { inviteShow.setAttribute("style", "display:block"); model.show(); //显示遮罩 }) promptBtn[0].addEventListener("tap", function() { model.close(); //关闭遮罩 }) /*点击进入浏览页面*/ mui("#friendsList").on("tap","li",function(){ var oProfessorId=this.getAttribute("id"); var oAuthType=this.getAttribute("authType"); var oAuthentication=this.getAttribute("authentication"); mui.openWindow({ url: '../html/userInforShow.html', id: 'userInforShow.html', show: { autoShow: false, aniShow: "slide-in-left" }, extras: { proid: oProfessorId }, }); }) var invite = document.getElementById("invite"); /*微信及微信朋友圈分享专家*/ var auths, shares; invite.addEventListener("tap", function() { shareShow() }); plus.oauth.getServices(function(services) { auths = {}; for(var i in services) { var t = services[i]; auths[t.id] = t; } }, function(e) { alert("获取登录服务列表失败:" + e.message + " - " + e.code); }); plus.share.getServices(function(services) { shares = {}; for(var i in services) { var t = services[i]; shares[t.id] = t; } }, function(e) { alert("获取分享服务列表失败:" + e.message + " - " + e.code); }) function shareShow() { var shareBts = []; // 更新分享列表 var ss = shares['weixin']; if(navigator.userAgent.indexOf('StreamApp') < 0 && navigator.userAgent.indexOf('qihoo') < 0) { //在360流应用中微信不支持分享图片 ss && ss.nativeClient && (shareBts.push({ title: '微信好友', s: ss, x: 'WXSceneSession' }), shareBts.push({ title: '微信朋友圈', s: ss, x: 'WXSceneTimeline' })); } // // 弹出分享列表 shareBts.length > 0 ? plus.nativeUI.actionSheet({ title: '分享', cancel: '取消', buttons: shareBts }, function(e) { if(e.index == 1) { var share = buildShareService(); if(share) { shareMessage(share, "WXSceneSession", { content: "科袖网,搭建企业与专家的桥梁。", title: professorName + "邀请您加入【科袖】", href: baseUrl + "/ekexiu/Invitation.html?professorId=" + userId + "&professorName=" + encodeURI(professorName), thumbs: [baseUrl + "/images/logo180.png"] }); } } else if(e.index == 2) { var share = buildShareService(); if(share) { shareMessage(share, "WXSceneTimeline", { content: professorName, title: "【科袖名片", href: baseUrl + "/ekexiu/Invitation.html?professorId=" + userId + "&professorName=" + encodeURI(professorName), thumbs: [baseUrl + "/images/logo180.png"] }); } } }) : plus.nativeUI.alert('当前环境无法支持分享操作!'); } function buildShareService() { var share = shares["weixin"]; if(share) { if(share.authenticated) { console.log("---已授权---"); } else { console.log("---未授权---"); share.authorize(function() { console.log('授权成功...') }, function(e) { alert("认证授权失败:" + e.code + " - " + e.message); return null; }); } return share; } else { alert("没有获取微信分享服务"); return null; } } function shareMessage(share, ex, msg) { msg.extra = { scene: ex }; share.send(msg, function() { plus.nativeUI.closeWaiting(); var strtmp = "分享到\"" + share.description + "\"成功! "; console.log(strtmp); plus.nativeUI.toast(strtmp, { verticalAlign: 'center' }); }, function(e) { plus.nativeUI.closeWaiting(); if(e.code == -2) { plus.nativeUI.toast('已取消分享', { verticalAlign: 'center' }); } }); } }); })