优化游戏管理
parent
dae2dd5fd9
commit
b434d2eacc
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,815 @@
|
||||
<extend name="Public/promote_base"/>
|
||||
<block name="css">
|
||||
<link rel="stylesheet" href="__CSS__/20170831/select2.min.css" type="text/css"/>
|
||||
<link href="__CSS__/20180207/data.css" rel="stylesheet">
|
||||
<link href="__CSS__/20180207/game.css" rel="stylesheet">
|
||||
<link href="__CSS__/20180207/finance.css" rel="stylesheet">
|
||||
<link href="__CSS__/game_detailed.css?v=1.3" rel="stylesheet">
|
||||
<link href="__STATIC__/icons_alibaba/iconfont.css" rel="stylesheet">
|
||||
<link href="https://cdn.bootcss.com/twitter-bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" type="text/css" href="https://cdn.bootcss.com/font-awesome/4.6.0/css/font-awesome.min.css">
|
||||
<link href="__CSS__/transfer.css" rel="stylesheet" >
|
||||
|
||||
<style type="text/css">
|
||||
.trunk-list {
|
||||
position: relative;
|
||||
min-height: 66vh;
|
||||
}
|
||||
|
||||
.pagenation {
|
||||
text-align: center;
|
||||
line-height: 5vh;
|
||||
}
|
||||
|
||||
.lwx_dialog_prompt .layui-layer-content {
|
||||
padding-top: 15px;
|
||||
}
|
||||
|
||||
.lwx_dialog_title {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.launch_platform_prompt .layui-layer-input, .lwx_dialog_input, .lwx_dialog_select, .lwx_dialog_textarea {
|
||||
display: block;
|
||||
width: 220px;
|
||||
height: 32px;
|
||||
margin: 0 auto;
|
||||
line-height: 32px;
|
||||
padding: 0 5px;
|
||||
border: 1px solid #ccc;
|
||||
box-shadow: 1px 1px 5px rgba(0, 0, 0, .1) inset;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.lwx_dialog_select {
|
||||
width: 272px;
|
||||
}
|
||||
|
||||
.lwx_dialog_textarea {
|
||||
height: 64px;
|
||||
width: 260px;
|
||||
margin-top: 10px;
|
||||
resize: none;
|
||||
}
|
||||
|
||||
.lwx_dialog_input {
|
||||
width: 260px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.launch_platform_prompt .layui-layer-btn, .lwx_dialog_prompt .layui-layer-btn {
|
||||
text-align: center;
|
||||
padding-bottom: 25px;
|
||||
}
|
||||
|
||||
.launch_platform_prompt .layui-layer-btn .layui-layer-btn0, .lwx_dialog_prompt .layui-layer-btn .layui-layer-btn0 {
|
||||
width: 81%;
|
||||
line-height: 32px;
|
||||
height: 32px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.lwx_dialog_notice {
|
||||
position: absolute;
|
||||
bottom: 6px;
|
||||
left: 20px;
|
||||
font-size: 12px;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.lwx_dialog_prompt .select2-container, .select2-container--default .select2-selection--single {
|
||||
width: 272px !important;
|
||||
}
|
||||
|
||||
.applycbtn {
|
||||
display: block;
|
||||
color: #50B370;
|
||||
}
|
||||
|
||||
textarea {
|
||||
font-family: inherit;
|
||||
}
|
||||
|
||||
.trunk-content {
|
||||
margin: 0 2%;
|
||||
}
|
||||
|
||||
.add-disable {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.btn-role-border {
|
||||
border-left: 0!important;
|
||||
}
|
||||
.game-msg p {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
</style>
|
||||
</block>
|
||||
<block name="body">
|
||||
<?php
|
||||
$promoteLevel = I('promote_level', 0);
|
||||
$isMine = I('is_mine', 0);
|
||||
$promoteId = I('promote_id', 0);
|
||||
$gameId = I('game_id', 0);
|
||||
$curUri = $serverType == 2 ? 'Game/mix' : 'Game/index';
|
||||
?>
|
||||
<div class="page-list normal_list apply-index-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 class="tab-item <?php if($isMine == 0):?>current<?php endif;?>" href="{:U($curUri)}">全部游戏</a>
|
||||
<a class="tab-item <?php if($isMine == 1):?>current<?php endif;?>" href="{:U($curUri, ['is_mine' => 1])}">我的游戏</a>
|
||||
</div>
|
||||
|
||||
<div class="tab marg_top20" style="clear:both;display: flex;">
|
||||
<div style="display: flex;">
|
||||
<a class="inline-btn btn-role <?php if($promoteLevel==0):?>highlight<?php endif;?>"
|
||||
href="{:U($curUri, ['is_mine' => $isMine, 'promote_level' => 0])}">
|
||||
<p>本账号</p>
|
||||
</a>
|
||||
|
||||
<if condition="$loginer['level'] eq 1">
|
||||
<a class="inline-btn btn-role btn-role-border <?php if($promoteLevel==2):?>highlight<?php endif;?>"
|
||||
href="{:U($curUri, ['is_mine' => $isMine, 'promote_level' => 2])}">
|
||||
<p>部长</p>
|
||||
</a>
|
||||
</if>
|
||||
|
||||
<if condition="$loginer['level'] elt 2">
|
||||
<a class="inline-btn btn-role btn-role-border <?php if($promoteLevel==3):?>highlight<?php endif;?>"
|
||||
href="{:U($curUri, ['is_mine' => $isMine, 'promote_level' => 3])}">
|
||||
<p>组长</p>
|
||||
</a>
|
||||
</if>
|
||||
|
||||
<if condition="$loginer['level'] elt 3">
|
||||
<a class="inline-btn btn-role btn-role-border <?php if($promoteLevel==4):?>highlight<?php endif;?>"
|
||||
href="{:U($curUri, ['is_mine' => $isMine, 'promote_level' => 4])}">
|
||||
<p>推广员</p>
|
||||
</a>
|
||||
</if>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" name="promote_level" value="<?=$promoteLevel?>">
|
||||
<input type="hidden" name="is_mine" value="<?=$isMine?>">
|
||||
<div class="form-group normal_space fr">
|
||||
<input type="submit" class="submit" id='submit' url="{:U($game,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="" selected>请选择游戏</option>
|
||||
</select>
|
||||
</div>
|
||||
<div id="promote-select-wrap" class="form-group normal_space fr">
|
||||
<select id="promote_id" name="promote_id" class="reselect select_gallery" style="min-width:200px;width: 175px;">
|
||||
<option value="" selected>请选择渠道</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group normal_space fr" style="display: none;">
|
||||
<input id="promote_role" name="promote_role">
|
||||
</div>
|
||||
</div>
|
||||
<div class="trunk-list">
|
||||
<div class="div_bgtab">
|
||||
<ul class="game-ul">
|
||||
<empty name="records">
|
||||
<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;">
|
||||
<?php if($promoteLevel != 0 && $promoteId == 0):?>
|
||||
请选择渠道搜索
|
||||
<?php else:?>
|
||||
暂无数据
|
||||
<?php endif;?>
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
<else/>
|
||||
<volist name="records" id="game">
|
||||
<li class="game-li" data-game-id="{$game.id}">
|
||||
<div class="media">
|
||||
<div class="img-box" style="cursor: pointer;">
|
||||
<img src="__ROOT__{$game.icon|get_cover='path'}" />
|
||||
</div>
|
||||
<div class="game-msg" style="width: calc(92% - 90px);">
|
||||
<h5 class="game-title">
|
||||
{$game.game_name}
|
||||
</h5>
|
||||
<p><span class="game-desc">{$game.features}</span><a class="show-detail" href="javascript:;" style="margin-left: 10px;">详情</a></p>
|
||||
<p class="details">
|
||||
<span class="game-platform el-tag el-tag-plain el-tag-success el-tag-mini">平台:{:getSDKTypeName($game['sdk_version'])}</span>
|
||||
<span class="game-version el-tag el-tag-plain el-tag-success el-tag-mini">版本:{$game.version}</span>
|
||||
<span class="game-size el-tag el-tag-plain el-tag-success el-tag-mini">大小:{$game.game_size}</span>
|
||||
<span class="game-type el-tag el-tag-plain el-tag-success el-tag-mini">游戏类型:{$game.game_type_name}</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class="game-operating" style="width: 500px;">
|
||||
<!-- <button class="el-button el-button-primary el-button-mini">游戏详情</button> -->
|
||||
<!-- <span class="game-link" data-type="landing-page" data-game-id="{$game.id}" style="cursor: pointer;margin-right: 10px;"><u>游戏详情</u></span> -->
|
||||
<?php if($isMine == 1):?>
|
||||
<?php if($promoteLevel == 0):?>
|
||||
<button class="apply-child-btn el-button el-button-success el-button-mini">添加下级游戏</button>
|
||||
<?php endif;?>
|
||||
<button class="game-link-btn el-button el-button-primary el-button-mini" data-type="download">下载链接</button>
|
||||
<button class="game-link-btn el-button el-button-primary el-button-mini" data-type="landing-page">落地页链接</button>
|
||||
<button class="offline-game-btn el-button el-button-info el-button-mini">下架</button>
|
||||
<!-- <span class="add-game" game-id="{$game.id}" promote-type="2" style="cursor: pointer;margin-right: 10px;"><u>添加下级游戏</u></span> -->
|
||||
<!-- <span class="game-link" data-type="download" data-game-id="{$game.id}" style="cursor: pointer;margin-right: 10px;"><u>复制下载链接</u></span> -->
|
||||
<!-- <span class="game-link" data-type="landing-page" data-game-id="{$game.id}" style="cursor: pointer;margin-right: 10px;"><u>落地页链接</u></span> -->
|
||||
<?php else:?>
|
||||
<?php if($game['offline_status'] == 0):?>
|
||||
<button class="el-button el-button-primary el-button-mini is-disabled">已添加</button>
|
||||
<!-- <span class="add-disable" style="cursor: pointer;">已添加</span> -->
|
||||
<?php else:?>
|
||||
<button class="apply-btn el-button el-button-primary el-button-mini">添加</button>
|
||||
<!-- <span onclick="commonApply({$game.id},this,0,10)" style="cursor: pointer;"><u>添加</u></span> -->
|
||||
<?php endif;?>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</volist>
|
||||
</empty>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="pagenation clearfix">
|
||||
{$pagination}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="platform_list" style="display:none;">
|
||||
<select>
|
||||
<option value="">选择投放平台</option>
|
||||
<volist name=":get_launch_platform_list(0)" id="vo">
|
||||
<option value="{$vo.id}">{$vo.name}</option>
|
||||
</volist>
|
||||
</select>
|
||||
</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: 2800px;" 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>
|
||||
|
||||
<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 id="apply-child-box" class="layer-box" style="display: none;">
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
<div class="form-group">
|
||||
<label>添加游戏</label>
|
||||
<div class="form-item">
|
||||
<p class="static-input show-game-name"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>设备类型</label>
|
||||
<div class="form-item">
|
||||
<p class="static-input show-game-platform"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>人员类型</label>
|
||||
<div class="form-item">
|
||||
<label class="radio-item"><input type="radio" name="level" value="2" checked> 部门长</label>
|
||||
<label class="radio-item"><input type="radio" name="level" value="3"> 组长</label>
|
||||
<label class="radio-item"><input type="radio" name="level" value="4"> 组员</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" class="form-group" style="display: block;">
|
||||
<include file="Public/transfer" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label></label>
|
||||
<a id="batch-apply-submit" href="javascript:;" class="btn">确定</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</block>
|
||||
<block name="script">
|
||||
<script src="__STATIC__/zeroclipboard/jquery.zclip.min.js"></script>
|
||||
<script type="text/javascript" src="__JS__/20170831/select2.min.js"></script>
|
||||
<script src="__STATIC__/clipboard.min.js"></script>
|
||||
<script type="text/javascript" src="__JS__/jquery.qrcode.min.js"></script>
|
||||
<script src="__STATIC__/vue.js"></script>
|
||||
<script src="__JS__/transfer.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
var gameScreenshotCount = 0;
|
||||
|
||||
var curPromoteLevel = parseInt('{$promoteLevel}')
|
||||
var curIsMine = parseInt('{$isMine}')
|
||||
var curPromoteId = parseInt('{$promoteId}')
|
||||
var curGameId = parseInt('{$gameId}')
|
||||
|
||||
$(function() {
|
||||
$('#promote_id').select2();
|
||||
$('#game_id').select2();
|
||||
|
||||
if (curPromoteLevel == 0) {
|
||||
$('#promote-select-wrap').hide();
|
||||
} else {
|
||||
getPromotesByLevel(curPromoteLevel);
|
||||
$('#promote-select-wrap').show();
|
||||
$('#promote_id').select2();
|
||||
}
|
||||
getMineBaseGames();
|
||||
|
||||
$('.apply-btn').on({
|
||||
click: function() {
|
||||
var gameId = $(this).parents('li').eq(0).attr('data-game-id');
|
||||
apply(gameId, curPromoteId, this);
|
||||
}
|
||||
})
|
||||
|
||||
$('.game-link-btn').on('click', function () {
|
||||
var gameId = $(this).parents('li').eq(0).attr('data-game-id');
|
||||
var type = $(this).attr('data-type')
|
||||
getLink(type, gameId, curPromoteId, this)
|
||||
})
|
||||
|
||||
$('.offline-game-btn').on({
|
||||
click: function() {
|
||||
var gameId = $(this).parents('li').eq(0).attr('data-game-id');
|
||||
layer.confirm('确定要下架游戏?', {icon: 3, title:'提示'}, function(index){
|
||||
offlineGame(gameId, curPromoteId)
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
$('.show-detail').on({
|
||||
click: function() {
|
||||
var gameId = $(this).parents('li').eq(0).attr('data-game-id');
|
||||
viewGameDetailed(gameId)
|
||||
}
|
||||
})
|
||||
|
||||
var boxGameId = 0
|
||||
$('[name=level]').on({
|
||||
click: function () {
|
||||
var box = $('#apply-child-box')
|
||||
var level = box.find('[name=level]:checked').val()
|
||||
getUnApplyPromotes({game_id: boxGameId, level: level}, function (response) {
|
||||
var list = new Array()
|
||||
for (var i in response.data.promotes) {
|
||||
var promote = response.data.promotes[i]
|
||||
list.push({id: promote.id, name: promote.account + '(' + promote.real_name + ')', type:false, isSearch:true, number:6})
|
||||
}
|
||||
vm.initList = list
|
||||
vm.targetList = []
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
$('.apply-child-btn').on({
|
||||
click: function() {
|
||||
var box = $('#apply-child-box')
|
||||
var liTag = $(this).parents('li').eq(0);
|
||||
boxGameId = liTag.attr('data-game-id');
|
||||
box.find('.show-game-name').html(liTag.find('.game-title').html())
|
||||
box.find('.show-game-platform').html(liTag.find('.game-platform').html())
|
||||
var level = box.find('[name=level]:checked').val()
|
||||
|
||||
getUnApplyPromotes({game_id: boxGameId, level: level}, function (response) {
|
||||
vm.init()
|
||||
vm.leftTitle = '未添加人员'
|
||||
vm.rightTitle = '选中人员'
|
||||
var list = new Array()
|
||||
for (var i in response.data.promotes) {
|
||||
var promote = response.data.promotes[i]
|
||||
list.push({id: promote.id, name: promote.account + '(' + promote.real_name + ')', type:false, isSearch:true, number:6})
|
||||
}
|
||||
vm.initList = list
|
||||
vm.targetList = []
|
||||
})
|
||||
layer.open({
|
||||
title: '添加下级游戏',
|
||||
type: 1,
|
||||
content: box,
|
||||
area: ['600px', '650px'],
|
||||
zIndex: 250,
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
$('#batch-apply-submit').on({
|
||||
click: function() {
|
||||
promoteIds = vm.getTargetIds()
|
||||
if (promoteIds.length == 0) {
|
||||
return layer.msg('请选择要添加该游戏的人员')
|
||||
}
|
||||
batchApplyGame(boxGameId, promoteIds)
|
||||
}
|
||||
})
|
||||
|
||||
$('.add-game-close').on('click', function () {
|
||||
$(this).parent().parent('.game-window-box').hide();
|
||||
$('.game-window-bg').hide();
|
||||
});
|
||||
|
||||
highlight_subnav('{:U($curUri)}');
|
||||
})
|
||||
|
||||
function apply(gameId, promoteId, obj) {
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: '{:U("apply")}',
|
||||
dataType: 'json',
|
||||
data: { game_id: gameId, promote_id: promoteId },
|
||||
success: function (response) {
|
||||
if (response.status) {
|
||||
disableApplyBtn(obj)
|
||||
layer.msg(response.message, {icon: 1, time: 1500});
|
||||
} else {
|
||||
layer.msg(response.message, {icon: 2, time: 1500});
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
layer.msg('服务器故障', {icon: 5});
|
||||
that.removeClass('no_submit');
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function disableApplyBtn(obj) {
|
||||
$(obj).removeClass('apply-btn');
|
||||
$(obj).addClass('is-disabled');
|
||||
$(obj).html('已添加');
|
||||
$(obj).off('click')
|
||||
}
|
||||
|
||||
function batchApply(gameId, promoteIds) {
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: '{:U("batchApply")}',
|
||||
dataType: 'json',
|
||||
data: { game_id: gameId, promote_ids: promoteIds },
|
||||
success: function (response) {
|
||||
if (response.status) {
|
||||
layer.msg(response.message, {icon: 1, time: 1500});
|
||||
} else {
|
||||
layer.msg(response.message, {icon: 2, time: 1500});
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
layer.msg('服务器故障', {icon: 5});
|
||||
that.removeClass('no_submit');
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function getUnApplyPromotes(data, successCallback) {
|
||||
$.ajax({
|
||||
url: "{:U('Game/getUnApplyPromotes')}",
|
||||
data: data,
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
successCallback(response)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function getLink(type, gameId, promoteId, obj) {
|
||||
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 logo = getGameLogo(obj)
|
||||
drawQrcode(response.data.url, logo)
|
||||
showLinkDialog(response.data.url)
|
||||
} 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;
|
||||
}
|
||||
|
||||
function getGameLogo(obj) {
|
||||
var logo = null;
|
||||
var logoSrc = $(obj).parents('.game-li').eq(0).find('.img-box').children('img').attr('src');
|
||||
if (isImg(logoSrc)) {
|
||||
logo = $(obj).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;
|
||||
}
|
||||
return logo;
|
||||
}
|
||||
|
||||
function offlineGame(gameId, promoteId) {
|
||||
$.ajax({
|
||||
url: "{:U('Game/offline')}",
|
||||
data: { game_id: gameId, promote_id: promoteId },
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
layer.msg(response.msg, {time: 1000}, function() {
|
||||
window.location.href = window.location.href
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function drawQrcode(url, logo) {
|
||||
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: url,//二维码内容
|
||||
label: 'jQuery.qrcode',
|
||||
fontname: 'Ubuntu',
|
||||
fontcolor: '#ff9818',
|
||||
};
|
||||
$('#game_link_ercode').empty().qrcode(options);
|
||||
$("#game_link_ercode canvas")[0].getContext('2d').drawImage(logo, (qrcodeWidth - logoWidth) / 2, (qrcodeHeight - logoHeight) / 2, logoWidth, logoHeight);
|
||||
}
|
||||
|
||||
function showLinkDialog(url) {
|
||||
$('#clipboard-btn').attr('data-text', url)
|
||||
$('#clipboard-btn').click()
|
||||
|
||||
$('#game_link_address').text(url);
|
||||
$('#game_link').show();
|
||||
$('.game-window-bg').show();
|
||||
}
|
||||
|
||||
function batchApplyGame(gameId, promoteIds, successCallback) {
|
||||
$.ajax({
|
||||
url: "{:U('Game/batchApply')}",
|
||||
data: { game_id: gameId, promote_ids: promoteIds },
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
successCallback(response)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function getMineBaseGames() {
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: "{:U('Game/getMineBaseGames')}",
|
||||
dataType: "json",
|
||||
success: function (response) {
|
||||
var games = response.data.games;
|
||||
var html = '<option value="">请选择游戏</option>';
|
||||
if (games.length > 0) {
|
||||
$.each(promotes, function (index, item) {
|
||||
var selected = ''
|
||||
if (curGameId == item.id) {
|
||||
selected = 'selected'
|
||||
}
|
||||
html += '<option value="' + item.id + '" title="' + item.name + '"' + selected + '>';
|
||||
html += promoteTitle;
|
||||
html += '</option>';
|
||||
});
|
||||
}
|
||||
$('#game_id').html(html);
|
||||
$('#game_id').select2();
|
||||
},
|
||||
error: function (result) {
|
||||
layer.msg('网络异常', {icon: 5});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getPromotesByLevel(level) {
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: "{:U('Promote/getSubPromotes')}",
|
||||
dataType: "json",
|
||||
data: {'level': level},
|
||||
success: function (response) {
|
||||
var promotes = response.data.promotes;
|
||||
var html = '<option value="">请选择渠道</option>';
|
||||
if (promotes.length > 0) {
|
||||
$.each(promotes, function (index, item) {
|
||||
var promoteTitle = item['account'] + '(' + item['real_name'] + ')';
|
||||
var selected = ''
|
||||
if (curPromoteId == item.id) {
|
||||
selected = 'selected'
|
||||
}
|
||||
html += '<option value="' + item['id'] + '" title="' + promoteTitle + '"' + selected + '>';
|
||||
html += promoteTitle;
|
||||
html += '</option>';
|
||||
});
|
||||
}
|
||||
$('#promote_id').empty();
|
||||
$('#promote_id').html(html);
|
||||
$('#promote_id').select2();
|
||||
},
|
||||
error: function (result) {
|
||||
layer.msg('网络异常', {icon: 5});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//查看游戏详情
|
||||
function viewGameDetailed(id) {
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "__URL__/getDetail",
|
||||
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);
|
||||
$('.game-slide-li').css('left', '0px');
|
||||
}
|
||||
|
||||
$('.detail-body').show();
|
||||
},
|
||||
error: function (result) {
|
||||
layer.msg('网络异常', {icon: 5});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$('.game-detail-close').on('click', function () {
|
||||
$('.detail-body').hide();
|
||||
});
|
||||
|
||||
$('.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();
|
||||
});
|
||||
|
||||
$('#submit').click(function () {
|
||||
var url = $(this).attr('url');
|
||||
console.log(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>
|
Loading…
Reference in New Issue