添加后台代理代码
This commit is contained in:
135
codes/agent/game/dlweb/api/web2/gift.html
Normal file
135
codes/agent/game/dlweb/api/web2/gift.html
Normal file
@@ -0,0 +1,135 @@
|
||||
<!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="./libs/font-awesome.min.css?__HTML_VERSION__=3">
|
||||
<link rel="stylesheet" href="./css/common.css?__HTML_VERSION__=7">
|
||||
<style>
|
||||
body {
|
||||
max-width: 640px;
|
||||
background: url("images/gift.jpg") no-repeat #9B1B00 fixed top;
|
||||
background-size: contain;
|
||||
}
|
||||
.text-ok {
|
||||
color: #fff;
|
||||
font-size: 20px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container" id="app" style="display: none;" v-show="!isLoading">
|
||||
|
||||
<div class="row text-center" style="padding-top: 60%;">
|
||||
<div style="padding-top: 45%;" v-if="!giftInfo.amount">
|
||||
<button class="btn btn-lg" @click="getGift()" style="width: 70%;">领取</button>
|
||||
</div>
|
||||
<p v-if="giftInfo.amount" class="text-ok">恭喜成功领取{{giftInfo.amount}}{{productToName}}</p>
|
||||
</div>
|
||||
</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="./js/function.js?__HTML_VERSION__=18"></script>
|
||||
<script src="./components/agent-nav.js?__HTML_VERSION__=8"></script>
|
||||
<script src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
|
||||
<script src="./components/user-info.js?__HTML_VERSION__=4"></script>
|
||||
<script src="./libs/layer_mobile/layer.js?__HTML_VERSION__=3"></script>
|
||||
<script src="./components/beta-header.js?__HTML_VERSION__=3"></script>
|
||||
<script src="./lang/lang.js?__HTML_VERSION__=14"></script>
|
||||
|
||||
<script>
|
||||
new Vue(
|
||||
{
|
||||
el: "#app",
|
||||
components: {
|
||||
'agent-nav': agentNav,
|
||||
'user-info': userInfo,
|
||||
'beta-header': betaHeader
|
||||
},
|
||||
data: {
|
||||
isLoading: true,
|
||||
params: {},
|
||||
playerInfo: {},
|
||||
lang: {},
|
||||
giftInfo: {},
|
||||
giftNumber: ''
|
||||
},
|
||||
computed: {
|
||||
productToName: function () {
|
||||
if(this.giftInfo.product_type == 1) {
|
||||
return '张房卡';
|
||||
} else {
|
||||
return '个'+this.lang.starName;
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getGift: function () {
|
||||
var that = this;
|
||||
try {
|
||||
if (!this.params.giftid) throw "未获取到礼包ID,请确认连接是否正确";
|
||||
if (!this.playerInfo.play_playerid) throw "未获取到玩家ID";
|
||||
|
||||
$.api(
|
||||
'agent.gift.receivegift',
|
||||
{
|
||||
agentid: that.params.agentid,
|
||||
channelid: that.params.channelid,
|
||||
playerid: that.playerInfo.play_playerid,
|
||||
giftid: that.params.giftid
|
||||
},
|
||||
function (res) {
|
||||
that.giftInfo = res;
|
||||
}, 1
|
||||
);
|
||||
} catch (e) {
|
||||
$.alert(e);
|
||||
}
|
||||
}
|
||||
},
|
||||
created: function () {
|
||||
this.params = $.getQueryObj();
|
||||
this.lang = lang[this.params.agentid] ? lang[this.params.agentid] : lang.default;
|
||||
var that = this;
|
||||
|
||||
$.getWxInfo(function (wxInfo) {
|
||||
that.isLoading = false;
|
||||
$.apiv2(
|
||||
'agent.user.getPlayer',
|
||||
{
|
||||
agentid: that.params.agentid,
|
||||
channelid: that.params.channelid,
|
||||
unionid: wxInfo.unionid,
|
||||
openid: wxInfo.openid
|
||||
},
|
||||
function (playerInfo) {
|
||||
that.playerInfo = playerInfo;
|
||||
//$.alert('用户须知');
|
||||
},
|
||||
function (code, info) {
|
||||
if(code === 4247) {
|
||||
layer.open({
|
||||
content: '未获取到你的玩家信息。如果你是新玩家,请下载游戏完成注册后再尝试',
|
||||
btn: '去下载',
|
||||
shadeClose: false,
|
||||
yes: function (i) {
|
||||
window.location.href='index.html?agentid='+that.params.agentid+'&channelid='+that.params.channelid;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$.alert(info);
|
||||
}
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
}
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user