You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

951 lines
36 KiB
HTML

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<extend name="Public/promote_base"/>
<block name="css">
<link href="__CSS__/20180207/data.css" rel="stylesheet">
<link href="__CSS__/20180207/game.css" rel="stylesheet">
<link href="__CSS__/game_detailed.css?v=1.3" rel="stylesheet">
<link href="__CSS__/my_game.css" rel="stylesheet">
<link href="__STATIC__/icons_alibaba/iconfont.css" rel="stylesheet">
<link href="__STATIC__/jqueryselect/css/layui.css" rel="stylesheet">
<script src="__STATIC__/jqueryselect/js/MySearch.js" type="text/javascript" charset="utf-8"></script>
<style>
.btn-role-border {
border-left: 0;
}
.clipboard-btn {
width: 60px;
height: 28px;
border: 0;
border-radius: 3px;
color: #fff;
background-color: #3A97FF;
}
</style>
</block>
<block name="body">
<div class="page-list normal_list apply-my_game-list jssearch">
<div class="trunk-title">
<div class="location">
<div class="location-container">当前位置:<span>游戏管理></span><span>{$position}</span></div>
</div>
<img src="__IMG__/20180207/icon_normal_game.png"><span class="title_main">我的游戏</span>
</div>
<div class="trunk-content article">
<div class="trunk-search clearfix">
<div class="tab">
<a href="{:U($game)}" class="">全部游戏</a>
<a href="{:U($game, array('type' => 10))}" class="">Android+ios游戏</a>
<a href="{:U($game, array('type' => 2))}" class="">IOS游戏</a>
<a href="{:U($game, array('type' => 1))}" class="">Android游戏</a>
<a href="javascript:;" class="current">我的游戏</a>
</div>
<div class="clearfix"></div>
<div class="tab marg_top20" style="clear:both;display: flex;">
<div style="display: flex;">
<if condition="$promoteRole eq 1">
<div class="btn btn-role highlight" promote-role="1">
<p>本账号</p>
</div>
<else/>
<div class="btn btn-role" promote-role="1">
<p>本账号</p>
</div>
</if>
<if condition="$loginPromote['level'] eq 1">
<if condition="$promoteRole eq 2">
<div class="btn btn-role highlight btn-role-border" promote-role="2">
<p>部长</p>
</div>
<else/>
<div class="btn btn-role btn-role-border" promote-role="2">
<p>部长</p>
</div>
</if>
</if>
<if condition="$loginPromote['level'] elt 2">
<if condition="$promoteRole eq 3">
<div class="btn btn-role highlight btn-role-border" promote-role="3">
<p>组长</p>
</div>
<else/>
<div class="btn btn-role btn-role-border" promote-role="3">
<p>组长</p>
</div>
</if>
</if>
<if condition="$loginPromote['level'] elt 3">
<if condition="$promoteRole eq 4">
<div class="btn btn-role highlight btn-role-border" promote-role="4">
<p>推广员</p>
</div>
<else/>
<div class="btn btn-role btn-role-border" promote-role="4">
<p>推广员</p>
</div>
</if>
</if>
</div>
</div>
<div class="form-group normal_space fr">
<input type="submit" class="submit" id='submit' url="{:U($myGame,array('model'=>$model['name'],'type'=>$type),false)}"
value="查询">
</div>
<div class="form-group normal_space fr">
<select id="game_id" name="game_id" class="reselect select_gallery" style="min-width:200px;width: 175px;">
<option value="">请选择游戏</option>
<volist name=":get_promote_serach_game()" id="vo">
<option value="{$vo.id}" title="{$vo.relation_game_name}"
<if condition="I('game_id') eq $vo['id']">selected</if>
>{$vo.relation_game_name} </option>
</volist>
</select>
</div>
<div class="form-group normal_space fr">
<select id="promote_id" name="promote_id" class="reselect select_gallery" style="min-width:200px;width: 175px;">
<empty name="promoteData">
<option value="" selected="selected">请选择渠道</option>
<else/>
<option value="">请选择渠道</option>
<volist name="promoteData" id="vo">
<if condition="$vo.id eq $promoteId">
<option value="{$vo.id}" title="{$vo.account}({$vo.real_name})" selected="selected">
{$vo.account}({$vo.real_name})
</option>
<else/>
<option value="{$vo.id}" title="{$vo.account}({$vo.real_name})">
{$vo.account}({$vo.real_name})
</option>
</if>
</volist>
</empty>
</select>
</div>
<div class="form-group normal_space fr" style="display: none;">
<input id="promote_role" name="promote_role">
</div>
<!-- </form>-->
</div>
<div class="trunk-list zwm_trunklist">
<div class="mygame_bgtable">
<empty name="list_data">
<if condition="get_parent_id(PID) eq 0">
<ul class="game-ul">
<li class="game-li" style="text-align: center;">
<img src="__IMG__/20180207/icon_wushujv2.png"/>
<p style="line-height: 40px;color: #A5A5A5;">暂无数据</p>
</li>
</ul>
<else/>
<ul class="game-ul">
<li class="game-li" style="text-align: center;">
<img src="__IMG__/20180207/icon_wushujv2.png"/>
<p style="line-height: 40px;color: #A5A5A5;">暂无数据</p>
</li>
</ul>
</if>
<else/>
<ul class="game-ul">
<volist name="list_data" id="vo">
<li class="game-li">
<div class="media">
<div class="img-box" onclick="viewGameDetailed({$vo.id})" style="cursor: pointer;">
<img src="__ROOT__{$vo.icon|get_cover='path'}"/>
</div>
<div class="game-msg" style="width: calc(65% - 90px);" onclick="viewGameDetailed({$vo.id})">
<h5 class="game-title">{$vo.game_name}</h5>
<p><span>{$vo.features}</span></p>
<p>
<span>平台:<span>{:getSDKTypeName($vo['sdk_version'])}</span>&nbsp;&nbsp;</span>
<span>版本:<span>{$vo.version}</span>&nbsp;&nbsp;</span>
<span>大小:<span>{$vo.game_size}</span>&nbsp;&nbsp;</span>
<span>游戏类型:<span>{$vo.game_type_name}</span>&nbsp;&nbsp;</span>
</p>
</div>
<div class="game-operating" data-url="{$qrcodes}" style="width: 35%;">
<if condition="$promoteRole == 1">
<if condition="$loginPromote['level'] eq 1">
<span class="add-game" game-id="{$vo.id}" promote-type="2" style="cursor: pointer;margin-right: 10px;"><u>添加部长游戏</u></span>
</if>
<if condition="$loginPromote['level'] elt 2">
<span class="add-game" game-id="{$vo.id}" promote-type="3" style="cursor: pointer;margin-right: 10px;"><u>添加组长游戏</u></span>
</if>
<if condition="$loginPromote['level'] elt 3">
<span class="add-game" game-id="{$vo.id}" promote-type="4" style="cursor: pointer;margin-right: 10px;"><u>添加推广员游戏</u></span>
</if>
</if>
<span class="game-link" data-type="download" data-game-id="{$vo.id}" style="cursor: pointer;margin-right: 10px;"><u>复制下载链接</u></span>
<span class="game-link" data-type="landing-page" data-game-id="{$vo.id}" style="cursor: pointer;margin-right: 10px;"><u>落地页链接</u></span>
<span class="down-game-btn" data-id="{$vo.id}" style="cursor: pointer;margin-right: 10px;color: #999"><u>下架</u></span>
</div>
</div>
</li>
</volist>
</ul>
</empty>
<input type="hidden" class="accc" value="{:PROMOTE_ACCOUNT}">
<div class="pagenation clearfix">
{$_page}
</div>
</div>
</div>
<div class="page-explain promote-mychlid-explain pos_relat">
<div class="trunk-content article border_normal">
<table class="desccontent">
<tbody>
<tr>
<td class="title" style="width: 100px;display: inline-block;">温馨提示:</td>
<td class="det"><p>1.在您传输渠道包时请勿使用QQ等即时通讯工具以免渠道号丢失。推荐使用邮箱传输或分享下载链接。</p>
<p>2.游戏审核需要1个工作日如需加速审核请联系商务》联系我们</p></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="game-window-box" id="add_game">
<div class="game-window-title">
<p style="width: calc(80% - 20px)">添加下级游戏</p>
<p class="add-game-close" style="width: calc(20% - 20px);text-align: right;"><i class="iconfont iconguanbi"></i></p>
</div>
<div class="game-window-content">
<div class="game-window-content-eveyone">
<label>添加游戏:</label>
<span name="add_game_name" id="add_game_name">11111</span>
<input name="add_game_id" id="add_game_id" style="display: none;">
</div>
</div>
<div class="game-window-content" style="width: auto;">
<div class="game-window-content-eveyone">
<label>游戏介绍:</label>
<span name="add_features" id="add_game_features" style="width: 330px;"></span>
</div>
</div>
<div class="game-window-content">
<div class="game-window-content-eveyone" style="align-items: center;">
<label>设备类型:</label>
<span name="add_sdk_version" id="add_sdk_version" class="font-add"></span>
</div>
</div>
<div class="game-window-content">
<div class="game-window-content-eveyone">
<label id="add_promote_title">添加组长:</label>
<div class="">
<div id="add_promote_data">
</div>
</div>
</div>
</div>
<div class="game-window-btns" style="margin-top: 10px;">
<div class="game-window-btn-box">
<button class="game-window-btn btn-blue" id="add_game_save_btn" style="margin-right: 20px;">保存</button>
<button class="game-window-btn btn-gray" id="add_game_close_btn">取消</button>
</div>
</div>
</div>
<div class="game-window-box" id="game_link">
<div class="game-window-title">
<p style="width: calc(80% - 20px)">复制结果</p>
<p class="add-game-close" style="width: calc(20% - 20px);text-align: right;"><i class="iconfont iconguanbi"></i></p>
</div>
<div class="game-window-content" style="text-align: center;width: auto;padding-bottom: 0px;">
<div class="game-window-content-eveyone" style="display: block;color: #3A97FF;font-size: 1.1rem;">
<label style="margin-right: 20px;">下载地址:</label>
<span id="game_link_address" style="word-wrap: break-word;white-space: normal;"></span>
</div>
</div>
<div class="game-window-content" style="text-align: center;width: auto;padding-top: 5px;">
<div class="game-window-content-eveyone" style="display: block;color: #999;font-size: 1.1rem;">
<span id="copy_msg">复制成功,ctrl+v粘贴即可</span>
<button class="clipboard-btn" id="clipboard-btn" style="display: none;" data-text="">复制</button>
</div>
</div>
<div class="game-window-content" style="text-align: center;width: auto;padding-bottom: 5px;">
<div id="game_link_ercode" class="game-window-content-eveyone" style="display: block;color: #999;font-size: 1.1rem;">
<!-- <img id="game_link_ercode" style="width: 200px;height: 200px;"> -->
</div>
</div>
<div class="game-window-content" style="text-align: center;width: auto;padding-top: 5px;">
<div class="game-window-content-eveyone" style="display: block;color: #999;font-size: 1.1rem;">
<span>下载地址二维码</span>
</div>
</div>
</div>
<div class="game-window-bg"></div>
</div>
<div class="detail-body" style="display: none;">
<div class="detail-box">
<a href="javascript:;" class="game-detail-close jq-detail-close"><i class="iconfont iconguanbi" style="font-size: 40px;"></i></a>
<div class="game-detail-inner">
<div class="detail-list">
<dl>
<dt>
<img src="" id="game_icon">
</dt>
<dd class="game-title" id="game_name"></dd>
<dd class="game-word">
<span><b>版本:</b><span id="version"></span></span>
<span><b>类型:</b><span id="game_type_name"></span></span>
<span><b>大小:</b><span id="game_size"></span></span>
<span><b>更新时间:</b><span id="create_time"></span></span>
<span><b>下载:</b><span id="dow_num"></span></span>
</dd>
<dd class="game-tab">
<i>西游</i>
<i>回合</i>
<i>回合</i>
</dd>
</dl>
</div>
<div class="game-detail-outer">
<div class="game-detail-left fl">
<div class="detail-con game-synopsis panel panel-bordered">
<div class="panel-heading"><h3 class="panel-title">游戏简介</h3></div>
<p id="features"></p>
</div>
<div class="detail-con game-pic panel panel-bordered">
<div class="panel-heading"><h3 class="panel-title">游戏截图</h3></div>
<div class="pic-box">
<div class="game-slides">
<ul style="width: 1400px;" class="game-slide-li">
</ul>
</div>
<a href="javascript:;" class="pic-prev" style="left: 10px;">
<i class="iconfont iconfanhui" style="font-size: 30px;margin-left: 4px;color: #fff;"></i>
</a>
<a href="javascript:;" class="pic-next down-img" style="right: 10px;">
<i class="iconfont icongengduo" style="font-size: 30px;margin-left: -7px;color: #fff;"></i>
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</block>
<block name='script'>
<script src="__STATIC__/clipboard.min.js"></script>
<script src="__STATIC__/layer/layer.js"></script>
<script type="text/javascript" src="__JS__/20170831/select2.min.js"></script>
<script type="text/javascript" src="__JS__/jquery.qrcode.min.js"></script>
<script type="text/javascript">
highlight_subnav("{:U('Apply/'.$game)}");
setValue('type', {$Think.request.type |default = '""'});
setValue('sdk_version', {$Think.request.sdk_version |default = '""'});
setValue('promote_id', {$Think.request.promote_id |default = '""'});
setValue('promote_role', {$Think.request.promote_role |default = 1});
setValue('row', '{:I("get.row",10)}');
function p_click(v, q) {
var username = $('.accc').val();
layer.open({
type: 2,
title: '游戏推广',
shadeClose: true,
shade: 0.8,
area: ['80%', '90%'],
// content: 'http://192.168.0.206/union/commissioner/login?game_ids='+v+'&username='+username+(q == 1 ? '&quick=1' : '') //iframe的url
content: 'http://union.biekeng.com/union/commissioner/login?game_ids=' + v + '&username=' + username + (q == 1 ? '&quick=1' : '') //iframe的url
});
}
$('.btn-role').on('click', function () {
var thisElement = $(this);
if (!thisElement.hasClass('highlight')) {
var promoteRole = thisElement.attr('promote-role');
setValue('promote_role', promoteRole);
$('.btn-role').removeClass('highlight');
thisElement.addClass('highlight');
if (promoteRole == 1) {
location.href = "{:U($myGame)}";
} else {
getPromoteListByRole(promoteRole);
}
}
});
function getPromoteListByRole(promoteRole)
{
$.ajax({
type: "post",
url: "__URL__/getPromoteListByRole",
dataType: "json",
data: {'promote_role': promoteRole},
success: function (data) {
var html = '<option value="">请选择渠道</option>';
if (data.length > 0) {
$.each(data, function (index, item) {
var promoteTitle = item['account'] + '(' + item['real_name'] + ')';
html += '<option value="' + item['id'] + '" title="' + promoteTitle + '">';
html += promoteTitle;
html += '</option>';
});
}
$('#promote_id').empty();
$('#promote_id').html(html);
$('#promote_id').select2();
},
error: function (result) {
layer.msg('网络异常', {icon: 5});
}
});
}
$(function () {
$('.spread').click(function () {
var username = $('.accc').val();
layer.open({
type: 2,
title: '游戏大全推广',
shadeClose: true,
shade: 0.8,
area: ['80%', '90%'],
content: 'http://union.biekeng.com/union/commissioner/login?username=' + username //iframe的url
});
});
if (navigator.userAgent.indexOf('Firefox') >= 0) {
$(".btn_erwei").text("右击保存图片");
}
var row = '{$row|default=10 }'; //获取后台传来的分页条数
$('.jslooklaunch').on('click', function () {
var that = $(this);
var gamename = $.trim(that.attr('data-game'));
var launch = $.trim(that.attr('data-launch'));
var url = $.trim(that.attr('data-url'));
if (url) {
layer.open({
type: 2,
title: "【" + gamename + "】" + launch,
shadeClose: true,
shade: 0.8,
area: ['1062px', '80%'],
content: url,//iframe的url
});
}
return false;
});
//打包失败提示
$(".js_sc").click(function () {
var applyid = $(this).attr('data-url');
$.ajax({
url: "{:U('Package/package')}",
type: 'post',
dataType: 'json',
data: {applyid: applyid},
success: function (data) {
if (data.status == 1) {
layer.msg('打包中!', {
icon: 6,
time: 2000 //2秒关闭如果不配置默认是3秒
});
setTimeout(function () {
window.location.reload();
}, 1500);
} else {
layer.msg('<p class="zwm_tit">打包失败!</p><p class="zwm_detation">暂无渠道包</p>', {
icon: 5,
time: 2000 //2秒关闭如果不配置默认是3秒
});
}
}
})
});
$(".js_ioscopy").click(function () {
var en = $(this).attr('enable_status');
if (en != '1') {
layer.msg("暂无下载内容", {icon: 2});
}
});
//下载二维码
$(".btn_erwei").click(function () {
var img_url = "http://{$_SERVER['HTTP_HOST']}" + $(this).siblings("img").attr("src");
var $a = $("<a></a>").attr("href", img_url).attr("download", "img.png");
$a[0].click();
});
$(".js_androidcopy").click(function () {
var en = $(this).attr('enable_status');
if (en != '1') {
layer.msg("暂无下载内容", {icon: 2});
}
});
$('.down-game-btn').on({
click: function() {
var id = $(this).attr('data-id')
layer.confirm('确定要下架游戏?', {icon: 3, title:'提示'}, function(index){
$.ajax({
url: "{:U('Promote/downGame')}",
data: {game_id: id, promote_id:{$promoteId}},
type: 'post',
dataType: 'json',
success: function(response) {
layer.msg(response.msg, {time: 1000}, function() {
window.location.href = window.location.href
})
}
})
})
}
})
//打包失败提示
$(".js_xz").click(function () {
var xz = $(this).attr('href');
if (xz == '#' || xz == '') {
layer.msg('暂无素材', {
icon: 7,
time: 2000 //2秒关闭如果不配置默认是3秒
});
}
});
//打包失败提示
$(".js_xzb").click(function () {
var xz = $(this).attr('href');
var en = $(this).attr('enable_status');
if (xz == '#' || xz == '' || en != '1') {
$(this).attr('href', '#');
layer.msg('暂无渠道包', {
icon: 7,
time: 2000 //2秒关闭如果不配置默认是3秒
});
}
});
//打包成功提示
$(".js_cxsc").click(function () {
var applyid = $(this).attr('data-url');
layer.msg('打包申请正在提交', {
icon: 16,
shade: [.3, '#000'],
time: 315360000000
});
$.ajax({
url: "{:U('Package/package')}",
type: 'post',
dataType: 'json',
data: {applyid: applyid},
success: function (data) {
if (data.status == 1) {
layer.msg('打包中!', {
icon: 6,
time: 2000 //2秒关闭如果不配置默认是3秒
});
setTimeout(function () {
window.location.reload();
}, 1500);
} else {
layer.msg('<p class="zwm_tit">打包失败!</p><p class="zwm_detation">暂无渠道包</p>', {
icon: 5,
time: 2000 //2秒关闭如果不配置默认是3秒
});
}
}
})
});
//打包失败提示
$(".js_ewm").click(function () {
layer.msg('暂无下载', {
icon: 7,
time: 2000 //2秒关闭如果不配置默认是3秒
});
});
//点击小图标二维码显示大图片二维码
$(".js_erwei").click(function () {
var en = $(this).attr('enable_status');
if (en != '1') {
layer.msg('暂无下载', {
icon: 7,
time: 2000 //2秒关闭如果不配置默认是3秒
});
return;
}
var that = $(this);
that.closest('table').find('.js_erwei').removeClass('active');
that.closest('table').find('.imgbig_erwei').hide();
var imgb = that.siblings('.imgbig_erwei');
if (that.hasClass('active')) {
that.removeClass('active');
imgb.hide();
} else {
that.addClass('active');
imgb.show();
}
//判断但是最后两条信息时,点击小的二维码,大的二维码在上面显示
var index = that.closest('tr').index();
if (parseInt(row) - parseInt(index + 1) < 2) {
that.next().css({
top: 'auto',
bottom: '22px'
});
}
$(document).on('click', function (event) {
var event = event || window.event;
var target = $(event.target);
if (target.hasClass('erwei_span') || target.closest('.erwei_span').length > 0) {
} else {
imgb.hide();
}
});
});
$(".select_gallery").select2();
$('.download').click(function () {
var href = $(this).attr('href');
var text = $(this).text();
if (text == '下载') {
if (href == '#' || href == 'javascript:;') {
layer.msg("暂无下载内容", {icon: 2});
return false;
}
}
});
});
$('.add-game').on('click', function () {
var thisElement = $(this);
var gameId = thisElement.attr('game-id');
var promoteType = parseInt(thisElement.attr('promote-type'));
$.ajax({
type: "post",
url: "__URL__/getGameInfo",
dataType: "json",
data: {'game_id': gameId,'promote_type':promoteType},
success: function (data) {
$('#add_game_name').text(data.game_data.game_name);
$('#add_game_id').val(data.game_data.id);
$('#add_game_features').text(data.game_data.features);
$('#add_sdk_version').text(data.game_data.sdk_name);
var tagData = [];
if (data.promote_data.length > 0) {
var html ='';
$.each(data.promote_data, function (index, item) {
var promoteName = item.account + '(' + (item.real_name ? item.real_name : '') +')';
var jsonData = {};
jsonData.name = promoteName;
jsonData.id = item.id;
tagData.push(jsonData);
});
}
switch (promoteType) {
case 2:
$('#add_promote_title').text('添加部长:');
break;
case 3:
$('#add_promote_title').text('添加组长:');
break;
case 4:
$('#add_promote_title').text('添加推广员:');
break;
}
$.myMethod("#add_promote_data",tagData,"add_promote_ids");
$(".sumbit").on("click",function(){
console.log($("form").serialize())
});
$('#add_game').show();
$('.game-window-bg').show();
},
error: function (result) {
layer.msg('网络异常', {icon: 5});
}
});
});
$('.add-game-close').on('click', function () {
$(this).parent().parent('.game-window-box').hide();
$('.game-window-bg').hide();
delMyMethod();
});
$('#add_game_close_btn').on('click', function () {
$(this).parent().parent().parent('.game-window-box').hide();
$('.game-window-bg').hide();
delMyMethod();
});
function delMyMethod()
{
$('#add_promote_data').html('');
}
$('#add_game_save_btn').on('click', function () {
var gameId = $('#add_game_id').val();
var promoteIds = [];
$('input[name=add_promote_ids]').each(function (e) {
promoteIds.push($(this).val());
});
$.ajax({
type: "post",
url: "__URL__/addGameToPromote",
dataType: "json",
data: {'game_id': gameId,'promote_ids':promoteIds},
success: function (data) {
if (data.status == 0) {
layer.msg(data.msg, {icon: 1});
setTimeout(function () {
location.reload();
}, 2000);
} else {
layer.msg(data.msg, {icon: 5});
}
},
error: function (result) {
layer.msg('网络异常', {icon: 5});
}
});
});
//查看游戏详情
function viewGameDetailed(id) {
$.ajax({
type: "post",
url: "__URL__/viewGameDetailed",
dataType: "json",
data: {'id': id},
success: function (data) {
$('#game_icon').attr('src', data.icon ? data.icon : '');
$('#game_name').text(data.game_name ? data.game_name : '');
$('#version').text(data.version ? data.version : '无');
$('#game_type_name').text(data.game_type_name ? data.game_type_name : '无');
$('#game_size').text(data.game_size ? data.game_size : 0);
$('#create_time').text(data.create_time ? data.create_time : '无');
$('#dow_num').text(data.dow_num ? data.dow_num : 0);
$('#features').text(data.features ? data.features : '无');
gameScreenshotCount = data.screenshot.length; //游戏截图数量
if (gameScreenshotCount > 0) {
var html = '';
$.each(data.screenshot_url, function (index, item) {
html += '<li>';
html += '<img src="' + item + '">';
html += '</li>';
});
$('.game-slide-li').html(html);
}
$('.detail-body').show();
},
error: function (result) {
layer.msg('网络异常', {icon: 5});
}
});
}
$('.game-detail-close').on('click', function () {
$('.detail-body').hide();
$('.game-slides').children('ul').css('left', 0);
});
$('.pic-prev').on('click', function () {
var element = $('.game-slides').children('ul');
var oldLeft = element.position().left;
var newLeft = oldLeft + 280;
if (newLeft <= 0 && newLeft % 1 === 0) {
element.css('left', newLeft);
}
});
$('.pic-next').on('click', function () {
var element = $('.game-slides').children('ul');
var oldLeft = element.position().left;
var newLeft = oldLeft - 280;
var minLeft = -(gameScreenshotCount * 280 -560);
if (newLeft >= minLeft && newLeft % 1 === 0) {
element.css('left', newLeft);
}
});
$('.pack-inner').hover(function () {
var element = $(this);
$('.pack-inner').children('.pack-word').hide();
element.children('.pack-word').show();
});
$('.game-link').on('click', function () {
var linkTag = this
var gameId = parseInt($(this).attr('data-game-id'))
var type = $(this).attr('data-type')
var promoteId = "{:I('promote_id', 0)}";
var url = ''
if (type == 'download') {
url = "__URL__/getDownloadUrl"
} else if (type == 'landing-page') {
url = "__URL__/getLandingPageUrl"
}
$.ajax({
url: url,
type: 'post',
dataType: "json",
data: {game_id: gameId, promote_id: promoteId},
success: function (response) {
if (response.status == 1) {
var qrcodeWidth = 200
var qrcodeHeight = 200
var logoWidth = qrcodeWidth/4
var logoHeight = qrcodeHeight/4
var options = {
render: 'canvas',
ecLevel: 'H',//识别度
fill: '#000',//二维码颜色
background: '#ffffff',//背景颜色
quiet: 2,//边距
width: 200,//宽度
height: 200,
text: response.data.url,//二维码内容
label: 'jQuery.qrcode',
fontname: 'Ubuntu',
fontcolor: '#ff9818',
};
var logo = null;
var logoSrc = $(linkTag).parents('.game-li').eq(0).find('.img-box').children('img').attr('src');
console.log(isImg(logoSrc));
if (isImg(logoSrc)) {
logo = $(linkTag).parents('.game-li').eq(0).find('.img-box').children('img')[0]
} else {
var img = document.createElement('img');
img.src = '__IMG__/game_icon.png';
logo = img;
}
$('#game_link_ercode').empty().qrcode(options);
$("#game_link_ercode canvas")[0].getContext('2d').drawImage(logo, (qrcodeWidth - logoWidth) / 2, (qrcodeHeight - logoHeight) / 2, logoWidth, logoHeight);
$('#clipboard-btn').attr('data-text', response.data.url)
$('#clipboard-btn').click()
$('#game_link_address').text(response.data.url);
$('#game_link').show();
$('.game-window-bg').show();
} else {
layer.alert(response.message, {icon: 7});
}
},
error: function (result) {
layer.msg('网络异常', {icon: 5});
}
});
});
function isImg(src) {
var img = new Image();
img.src = src;
if (img.width > 0 || img.height > 0) {
return true;
}
return false;
}
var clipboard = new ClipboardJS('#clipboard-btn', {
text: function(trigger) {
return trigger.getAttribute('data-text');
}
})
clipboard.on('success', function (e) {
$('#copy_msg').text('复制成功,ctrl+v粘贴即可');
$('#clipboard-btn').hide();
});
clipboard.on('error', function (e) {
$('#copy_msg').text('自动复制失败,请点击复制按钮');
$('#clipboard-btn').show();
});
$('#submit').click(function () {
var url = $(this).attr('url');
var query = $('.jssearch').find('input').serialize();
query += "&" + $('.jssearch').find('select').serialize();
query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
query = query.replace(/^&/g, '');
if (url.indexOf('?') > 0) {
url += '&' + query;
} else {
url += '?' + query;
}
window.location.href = url;
});
</script>
</block>