Files
youlegames/codes/agent/game/dlweb/api/web2/bind_player.html
2026-03-15 01:27:05 +08:00

192 lines
6.3 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="en">
<head>
<title>邀请 · 玩家</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link rel="stylesheet" href="./libs/bootstrap/bootstrap.min.css?__HTML_VERSION__=3">
<link rel="stylesheet" href="./css/common.css?__HTML_VERSION__=7">
</head>
<body class="color-dark">
<div class="container pt15" id="app" v-show="!isLoading" style="display: none">
<ul class="sales-info" v-if="hasParentSales">
<li><img :src="salesInfo.avatar" alt="avatar" class="avatar"></li>
<li>
<div class="pd8">
<p>&emsp;称:{{salesInfo.name}}</p>
<p>用户ID{{salesInfo.salesid}}</p>
</div>
</li>
<li>
<div>
<img :src="agentInfo.agentlogo" alt="logo" class="logo">
</div>
</li>
</ul>
<div class="text-center circle-box" v-if="hasParentSales">
<button class="btn btn-primary w60" @click="bindSales">和好友一起玩</button>
</div>
<section v-if="parentInfo.parentid || parentInfo.salesid">
<h4 class="text-center">你的好友信息如下</h4>
<ul class="sales-info">
<li><img :src="parentInfo.avatar" alt="avatar" class="avatar"></li>
<li>
<div class="pd8">
<p>&emsp;称:{{parentInfo.name || parentInfo.nickname}}</p>
<p>用户ID{{parentInfo.parentid || parentInfo.salesid}}</p>
</div>
</li>
<li>
<div>
<img :src="agentInfo.agentlogo" alt="logo" class="logo">
</div>
</li>
</ul>
</section>
<!--<div v-show="parentInfo.parentid || parentInfo.salesid">-->
<download-game></download-game>
<!--</div>-->
<!--<section v-html="agentInfo.share_text"></section>-->
</div>
<script src="./libs/jquery.min.js?__HTML_VERSION__=3"></script>
<script src="./libs/bootstrap/bootstrap.min.js?__HTML_VERSION__=3"></script>
<script src="./libs/vue.min.js?__HTML_VERSION__=3"></script>
<script src="./libs/layer_mobile/layer.js?__HTML_VERSION__=3"></script>
<script src="./js/function.js?__HTML_VERSION__=18"></script>
<script src="./components/download-game.js?__HTML_VERSION__=4"></script>
<script>
new Vue(
{
el: "#app",
data: {
isLoading: true,
isWeiXin: false,
params: {},
agentInfo: {},
wxInfo: {}, // 用户的微信信息
userInfo: {}, // 用户本身的信息
salesInfo: {}, // url中salesid的用户信息
parentInfo: {} // 实际绑定的用户信息
},
components: {
'download-game': downloadGame
},
computed: {
hasParentSales: function () {
if (!this.parentInfo.salesid && this.salesInfo.salesid)
return true;
return false;
}
},
methods: {
bindSales: function () {
if (this.params.sale) {
var that = this;
$.confirm(function () {
$.api(
'agent.agent.bindSales',
{
agentid: that.params.agentid,
channelid: that.params.channelid,
openid: that.wxInfo.openid,
unionid: that.wxInfo.unionid,
salesid: that.params.sale
},
function (res) {
that.parentInfo = res;
//$.alert('绑定成功');
}, true
)
})
}
}
},
created: function () {
//sessionStorage.clear();
try {
this.isWeiXin = $.isWeiXin();
var p = $.getQueryObj();
if (!p.agentid) throw '没有传入agentid';
if (!p.channelid) throw '没有传入channelid';
if (!p.sale) throw '没有传入salesid';
if (this.isWeiXin) {
this.params = p;
var that = this;
$.getAgentInfo(function (agentInfo) {
that.agentInfo = agentInfo;
$.getWxInfo(function (wxInfo) {
that.wxInfo = wxInfo;
$.getUserInfoFirst(function (userInfo) {
// 我绑定的上级用户信息
$.apiv2(
'agent.agent.myRecommend',
{
agentid: that.params.agentid,
channelid: that.params.channelid,
openid: wxInfo.openid,
unionid: wxInfo.unionid,
playerid: '',
type: 1
},
function (parentInfo) {
that.parentInfo = parentInfo;
if (!parentInfo.parentid) {
// 查询对应的用户信息
$.api(
'agent.agent.recommend',
{
agentid: that.params.agentid,
channelid: that.params.channelid,
salesid: that.params.sale
},
function (res) {
that.salesInfo = res;
that.isLoading = false;
}
)
} else
that.isLoading = false;
},
function (code, info) {
console.log('err',code, info);
if(code === 4247) {
layer.open(
{
content: '没有你的玩家信息,请先下载游戏并登录后,再确认邀请',
btn: ['下载', '取消'],
yes: function (i) {
window.location.href = './index.html?agentid='+p.agentid+'&channelid='+p.channelid;
},
no: function () { layer.closeAll() }
}
);
} else
$.alert(info);
}
)
})
})
})
} else {
window.location.href = './index.html?agentid=' + p.agentid + '&channelid=' + p.channelid;
}
} catch (e) {
$.alert(e);
}
}
})
</script>
</body>
</html>