编辑游戏-》上传视频

master
liuweiwen 5 years ago
parent fb5d9afded
commit b0748243b9

@ -215,7 +215,7 @@
<textarea name="introduction" class="txt_area">{$data['introduction']}</textarea>
</td>
</tr>
<tr>
<td class="l">游戏资料中心:</td>
<td class="r">
@ -355,6 +355,37 @@
<span class="notice-text">横版游戏建议尺寸1691280*720px及以上竖版游戏建议尺寸916720*1280px及以上用于游戏详情页内展示</span>
</td>
</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>
<video src="{$data['flooring_page_video']}" controls width="150px"></video>
</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>
<notempty name="data.accredit_img">
<tr class="picbox">
<td class="l noticeinfo">知识产权</td>
@ -1092,6 +1123,92 @@
}
});
//上传落地页视屏
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;
$('#'+file.id).find('h4.info').after("<video src="+url+" controls width=\"150px\"></video>");
$("#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({
// 选完文件后,是否自动上传。
auto: true,
@ -1179,7 +1296,7 @@
uploaderFile.on( 'uploadComplete', function(file) {
$( '#'+file.id ).find('.progress').fadeOut();
});
//游戏截图
var uploaderImg = WebUploader.create({
// 选完文件后,是否自动上传。
@ -1215,7 +1332,7 @@
});
var imgListData = [];
@ -1392,7 +1509,7 @@
);
}
</script>
<script type="text/javascript">
var uploaderImgScreen = WebUploader.create({
// 选完文件后,是否自动上传。
@ -1425,8 +1542,8 @@
formData: function(){return $.extend(true, {}, userInfo);},
chunked:false,
duplicate: true
});
});
var imgListScreenData = [];
<?php if (!empty($data['screenshot_data'])) :?>
var html = '';
@ -1434,7 +1551,7 @@
<?php foreach ($data['screenshot_data'] as $value1) { ?>
<?php $value1 = (int)$value1; ?>
imgListScreenData.push(<?=$value1?>);
html += '<div id="' + <?=$value1?> + '" class="item flooring_page_img_box" style="margin-right: 10px;">';
html += '<a href="javascript:;"><img src="<?=get_cover($value1,"path")?>" style="width: 100px;height: 100px;cursor: move;"></a>';
html += '<h4 class="info" style="text-align: center;">';
@ -1446,7 +1563,7 @@
html += '</div>';
<?php }?>
$('#screenshot_thelist').html(html);
$('#screenshot_thelist').children().children('h4').children('.jsdelzip').on('click', function() {
var thisId = $(this).attr('img-id');
$(this).parent().parent().remove();
@ -1460,7 +1577,7 @@
setScreenshotVal();
});
<?php endif ;?>
<?php endif ;?>
var thisIndex1 = 0;
var imgScreenList = $("#screenshot_thelist");
uploaderImgScreen.on( 'fileQueued', function( file ) {
@ -1525,7 +1642,7 @@
return false;
});
});
function setScreenshotVal()
{
var screen_shot = '';
@ -1537,8 +1654,8 @@
}
</script>
<script>
<script>
var uploaderImgCover = WebUploader.create({
// 选完文件后,是否自动上传。
auto: true,
@ -1570,8 +1687,8 @@
formData: function(){return $.extend(true, {}, userInfo);},
chunked:false,
duplicate: true
});
});
var imgListCoverData = [];
<?php if (!empty($data['cover_data'])) :?>
var html = '';
@ -1579,7 +1696,7 @@
<?php foreach ($data['cover_data'] as $value2) { ?>
<?php $value2 = (int)$value2; ?>
imgListCoverData.push(<?=$value2?>);
html += '<div id="' + <?=$value2?> + '" class="item flooring_page_img_box" style="margin-right: 10px;">';
html += '<a href="javascript:;"><img src="<?=get_cover($value2,"path")?>" style="width: 100px;height: 100px;cursor: move;"></a>';
html += '<h4 class="info" style="text-align: center;">';
@ -1591,7 +1708,7 @@
html += '</div>';
<?php }?>
$('#cover_thelist').html(html);
$('#cover_thelist').children().children('h4').children('.jsdelzip').on('click', function() {
var thisId = $(this).attr('img-id');
$(this).parent().parent().remove();
@ -1605,7 +1722,7 @@
setCoverVal();
});
<?php endif ;?>
<?php endif ;?>
var thisIndex2 = 0;
var imgCoverList = $("#cover_thelist");
uploaderImgCover.on( 'fileQueued', function( file ) {
@ -1666,7 +1783,7 @@
return false;
});
});
function setCoverVal()
{
var cover = '';
@ -1676,7 +1793,7 @@
cover = cover.substring(0, cover.length - 1);
$('input[name=cover]').val(cover);
}
</script>
<script>
var iconInfo = {userId:"kazaff", md5:"",icon:1}; //用户会话信息
@ -1711,8 +1828,8 @@
formData: function(){return $.extend(true, {}, iconInfo);},
chunked:false,
duplicate: true
});
});
var imgListIconData = [];
<?php if (!empty($data['icon_data'])) :?>
var html = '';
@ -1720,7 +1837,7 @@
<?php foreach ($data['icon_data'] as $value3) { ?>
<?php $value3 = (int)$value3; ?>
imgListIconData.push(<?=$value3?>);
html += '<div id="' + <?=$value3?> + '" class="item flooring_page_img_box" style="margin-right: 10px;">';
html += '<a href="javascript:;"><img src="<?=get_cover($value3,"path")?>" style="width: 100px;height: 100px;cursor: move;"></a>';
html += '<h4 class="info" style="text-align: center;">';
@ -1732,7 +1849,7 @@
html += '</div>';
<?php }?>
$('#icon_thelist').html(html);
$('#icon_thelist').children().children('h4').children('.jsdelzip').on('click', function() {
var thisId = $(this).attr('img-id');
$(this).parent().parent().remove();
@ -1746,7 +1863,7 @@
setIconVal();
});
<?php endif ;?>
<?php endif ;?>
var thisIndex2 = 0;
var imgIconList = $("#icon_thelist");
uploaderImgIcon.on( 'fileQueued', function( file ) {
@ -1816,7 +1933,7 @@
}
});
function setIconVal()
{
var icon = '';
@ -1826,6 +1943,6 @@
icon = icon.substring(0, icon.length - 1);
$('input[name=icon]').val(icon);
}
</script>
</block>

Loading…
Cancel
Save