后台管理-》编辑游戏-》上传视频

手机端落地页显示视频
master
liuweiwen 5 years ago
parent 522ba58a4d
commit e3fe1cc03f

@ -86,6 +86,9 @@ class FileController extends AdminController
if (I('get.typee') == 1) { if (I('get.typee') == 1) {
$uploader->set('path', './Uploads/Ios/description'); $uploader->set('path', './Uploads/Ios/description');
} }
if (strpos(I('type'),'video') !== false) {
$uploader->set('path', './Uploads/Video');
}
// var_dump($_POST); // var_dump($_POST);
// exit; // exit;
@ -110,6 +113,8 @@ class FileController extends AdminController
} }
if (($path = $uploader->upload('file', $_POST)) !== false) { if (($path = $uploader->upload('file', $_POST)) !== false) {
die($path); die($path);
} else {
die($uploader->getError());
} }
} }

@ -346,7 +346,8 @@ class GameController extends ThinkController
$phone['back_describe'] = $sibling['back_describe']; $phone['back_describe'] = $sibling['back_describe'];
$phone['dow_icon'] = $sibling['dow_icon']; $phone['dow_icon'] = $sibling['dow_icon'];
$phone['back_map'] = $sibling['back_map']; $phone['back_map'] = $sibling['back_map'];
M('Game', 'tab_')->data($phone)->where(array('id' => $another['id']))->save(); $phone['flooring_page_video'] = $sibling['flooring_page_video'];
$saveRes = M('Game', 'tab_')->data($phone)->where(array('id' => $another['id']))->save();
//同时修改代充游戏折扣 //同时修改代充游戏折扣
$set_fidel['status'] = 1; $set_fidel['status'] = 1;
$set_fidel['game_id'] = $id; $set_fidel['game_id'] = $id;

@ -254,6 +254,7 @@
<span class="notice-text">尺寸不得小于125*125px大小不得超过50K</span> <span class="notice-text">尺寸不得小于125*125px大小不得超过50K</span>
</td> </td>
</tr> </tr>
<tr class="picbox"> <tr class="picbox">
<td class="l noticeinfo">游戏素材包</td> <td class="l noticeinfo">游戏素材包</td>
<td class="r"> <td class="r">
@ -280,6 +281,7 @@
<span class="notice-text">此处可上传该游戏的素材包,必须为压缩包形式,用于渠道后台下载推广</span> <span class="notice-text">此处可上传该游戏的素材包,必须为压缩包形式,用于渠道后台下载推广</span>
</td> </td>
</tr> </tr>
<tr class="picbox"> <tr class="picbox">
<td class="l noticeinfo">游戏推荐图</td> <td class="l noticeinfo">游戏推荐图</td>
<td class="r"> <td class="r">
@ -355,6 +357,42 @@
<span class="notice-text">横版游戏建议尺寸1691280*720px及以上竖版游戏建议尺寸916720*1280px及以上用于游戏详情页内展示</span> <span class="notice-text">横版游戏建议尺寸1691280*720px及以上竖版游戏建议尺寸916720*1280px及以上用于游戏详情页内展示</span>
</td> </td>
</tr> </tr>
<tr class="picbox">
<td class="l noticeinfo">落地页视频</td>
<td class="r">
<span class="table_btn table_upload">
<div id="uploaderVideo" class="wu-example">
<div class="btns">
<div id="pickerVideo" style="width: auto;float: left;margin-right: 20px;">上传视频</div>
</div>
<!--用来存放文件信息-->
<div id="video_thelist" class="uploader-list" style="float: left;">
<!-- <span id="up_status">
<notempty name="data.material_url">已上传</notempty>
</span> -->
<notempty name="data.flooring_page_video">
<?php $name = substr($data['flooring_page_video'],strripos($data['flooring_page_video'],'/',0)+1); ?>
<div id="beforeuploadvideo" class="item">
<h4 class="info">{$name}<a href="javascript:;" class="jsdelvideo table_click" style="float:none;display:inline-block;margin-left:10px;">删除</a></h4>
</div>
</notempty>
</div>
</div>
<input type="hidden" id="video_url" name="flooring_page_video" value="{$data['flooring_page_video']}"/>
</span>
<span class="notice-text"></span>
</td>
</tr>
<!-- <tr class="picbox">
<td class="l noticeinfo" >落地页视频</td>
<td class="r">
<input type="file" name="flooring_page_video" id="flooring_page_video" value="">
<input type="hidden" name="flooring_page_video_data" id="flooring_page_video_data" value="">
</td>
</tr>-->
<notempty name="data.accredit_img"> <notempty name="data.accredit_img">
<tr class="picbox"> <tr class="picbox">
<td class="l noticeinfo">知识产权</td> <td class="l noticeinfo">知识产权</td>
@ -362,7 +400,8 @@
<span class="table_btn table_upload"> <span class="table_btn table_upload">
<div class="upload-img-box"> <div class="upload-img-box">
<div class="upload-pre-item"> <div class="upload-pre-item">
<span class="placeholder-graphic placeholder-graphic_ad"><img src="{$data['accredit_img']|get_cover='path'}"/></span> <span class="placeholder-graphic placeholder-graphic_ad">
<img src="{$data['accredit_img']|get_cover='path'}"/></span>
</div> </div>
</div> </div>
</span> </span>
@ -1092,6 +1131,91 @@
} }
}); });
var uploaderVideo = WebUploader.create({
// 选完文件后,是否自动上传。
auto: true,
// swf文件路径
swf: '__STATIC__/webuploader/Uploader.swf',
// 文件接收服务端。
server: backEndUrl,
// 选择文件的按钮。可选。
// 内部根据当前运行是创建可能是input元素也可能是flash.
pick: {id:'#pickerVideo'},
// dnd: true,
paste: document.body,
accept: {
title: '视频',
extensions: 'mp4,3gp,wmv,asf,asx,mov,m4v,avi,flv',
mimeTypes: '.mp4,.3gp,.wmv,.asf,.asx,.mov,.m4v,.avi,.flv',
},
// 不压缩image, 默认如果是jpeg文件上传前会压缩一把再上传
resize: false,
disableGlobalDnd: true,
fileNumLimit:1,
threads:3,
compress: false,
prepareNextFile: true,
formData: function(){return $.extend(true, {}, userInfo);},
duplicate: true
});
// 当有文件被添加进队列的时候
uploaderVideo.on( 'fileQueued', function( file ) {
$("#up_status").remove();
$("#video_thelist").html( '<div id="' + file.id + '" class="item">' +
'<h4 class="info">' + file.name + '</h4>' +
'<p class="state">等待上传...</p>' +
'</div>' );
});
// 文件上传过程中创建进度条实时显示。
uploaderVideo.on( 'uploadProgress', function(file, percentage) {
var $li = $( '#'+file.id ),
$percent = $li.find('.progress .progress-bar');
// 避免重复创建
if ( !$percent.length ) {
$percent = $('<div class="progress progress-striped active">' +
'<div class="progress-bar" role="progressbar" style="width: 0%">' +
'</div>' +
'</div>').appendTo( $li ).find('.progress-bar');
}
$li.find('p.state').text('上传中');
$percent.css( 'width', percentage * 100 + '%' );
$percent.text( (percentage * 100).toFixed(0) + '%' );
});
$('#beforeuploadvideo').children('.info').children('.jsdelvideo').click(function() {
$("#video_url").val('');
$('#beforeuploadvideo').remove();
return false;
});
uploaderVideo.on( 'uploadSuccess', function( file , response) {
console.log(file);
$( '#'+file.id ).find('p.state').text('已上传').fadeOut(800);
//alert(JSON.stringify(response));
$('#'+file.id).find('h4.info').append('<a href="javascript:;" class="jsdelvideo table_click" style="float:none;display:inline-block;margin-left:10px;">删除</a>');
var url = response.path + "/" +response.name;
console.log(url);
$("#video_url").val(url);
$('#'+file.id).find('.jsdelvideo').on('click',function() {
console.log(file);
$("#video_url").val('');
$('#'+file.id).remove();
uploaderVideo.removeFile( file.id );
return false;
});
});
uploaderVideo.on( 'uploadError', function( file ) {
$( '#'+file.id ).find('p.state').text('上传出错');
});
uploaderVideo.on( 'uploadComplete', function(file) {
$( '#'+file.id ).find('.progress').fadeOut();
});
var uploaderFile = WebUploader.create({ var uploaderFile = WebUploader.create({
// 选完文件后,是否自动上传。 // 选完文件后,是否自动上传。
auto: true, auto: true,

@ -177,7 +177,8 @@ class HomeController extends Controller
'game_score', 'game_score',
'recommend_level', 'recommend_level',
'game_size', 'game_size',
'introduction' 'introduction',
'flooring_page_video',
]; ];
$map = ['id' => intval($gameId)]; $map = ['id' => intval($gameId)];
$game = M('game', 'tab_')->field($columns)->where($map)->find(); $game = M('game', 'tab_')->field($columns)->where($map)->find();

@ -42,6 +42,13 @@
<div class="home"> <div class="home">
<?php if (!empty($game['flooring_page_video'])):?>
<div class="home-video">
<video src="{$game['flooring_page_video']}" autoplay controls></video>
</div>
<?php endif;?>
<div class="home-box"> <div class="home-box">
<div class="heard"> <div class="heard">
<div style="height: 2.5rem;width: 2.5rem"> <div style="height: 2.5rem;width: 2.5rem">

@ -1,3 +1,11 @@
.home-video{
width: 100%;
height: 4.22rem;
}
.home-video video{
width: 100%;
height: 100%;
}
.home{ .home{
width: 100%; width: 100%;
font-family:PingFang SC; font-family:PingFang SC;

Loading…
Cancel
Save