|
|
<extend name="Public/base" />
|
|
|
|
|
|
<block name="body">
|
|
|
<link rel="stylesheet" type="text/css" href="__CSS__/admin_table.css" media="all">
|
|
|
<script type="text/javascript" src="__STATIC__/layer/layer.js"></script>
|
|
|
<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
|
|
|
<!-- <link rel="stylesheet" type="text/css" href="__CSS__/admin_table.css" media="all"> -->
|
|
|
<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
|
|
|
<script type="text/javascript" src="__STATIC__/provincecityarea/area1.js"></script>
|
|
|
<script type="text/javascript" src="__STATIC__/provincecityarea/AreaData_min.js"></script>
|
|
|
<script type="text/javascript" src="__STATIC__/provincecityarea/jquery-1.7.min.js"></script>
|
|
|
<script type="text/javascript" src="__JS__/jquery.mousewheel.js"></script>
|
|
|
|
|
|
<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
|
|
|
<link rel="stylesheet" type="text/css" href="__STATIC__/webuploader/webuploader.css" media="all">
|
|
|
<script src="__STATIC__/md5.js" type="text/javascript" charset="utf-8"></script>
|
|
|
<script type="text/javascript" src="__STATIC__/webuploader/webuploader.js"></script>
|
|
|
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
|
|
|
<script type="text/javascript" src="__STATIC__/layer/extend/layer.ext.js"></script>
|
|
|
<style>
|
|
|
.tabcon1711 td {
|
|
|
text-decoration: none;
|
|
|
text-align: center!important;
|
|
|
padding-left: 55px;
|
|
|
padding-right: 55px;
|
|
|
width: 0;
|
|
|
}
|
|
|
.tabcon1711 td:first-child {
|
|
|
padding-left: 55px;
|
|
|
margin-right: 55px;
|
|
|
width: 0;
|
|
|
}
|
|
|
.tabcon1711 input {
|
|
|
width: 100%;
|
|
|
}
|
|
|
</style>
|
|
|
|
|
|
<style>
|
|
|
.data_list table td {
|
|
|
line-height:0px;
|
|
|
}
|
|
|
|
|
|
.bnt_add,.bnt_remove,.bnt_save{
|
|
|
height: 30px;
|
|
|
width: 20px;
|
|
|
font-size: 20px;
|
|
|
line-height: 10px;
|
|
|
color: #3399ff;
|
|
|
background: none;
|
|
|
border: none;
|
|
|
margin-left: 20px;
|
|
|
cursor: pointer;
|
|
|
}
|
|
|
.bnt_remove{
|
|
|
color: #F70909;
|
|
|
}
|
|
|
.bnt_save{
|
|
|
color: #4DB361;
|
|
|
}
|
|
|
</style>
|
|
|
|
|
|
<div class="cf main-place top_nav_list navtab_list">
|
|
|
<h3 class="page_title">工单申请</h3>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
<!-- 标签页导航 -->
|
|
|
<div class="data_list">
|
|
|
<div style="display: flex;">
|
|
|
<form method="post" action="{:U('resourceApply')}" enctype="multipart/form-data" id="form1" action="javascript:;" class="form-horizontal" style="width: 600px;">
|
|
|
<ul class="form_info" style="margin-top: 10px;" id='feedback-form' >
|
|
|
<li>
|
|
|
<label>工单号</label>
|
|
|
<label>{$data.order_no}</label>
|
|
|
</li>
|
|
|
<li>
|
|
|
<label>游戏名称</label>
|
|
|
<label>{$data.game_name}</label>
|
|
|
</li>
|
|
|
<li>
|
|
|
<label>游戏区服</label>
|
|
|
<label>{$data.server_name}</label>
|
|
|
</li>
|
|
|
<li>
|
|
|
<label>游戏账号</label>
|
|
|
<label>{$data.user_account}</label>
|
|
|
</li>
|
|
|
<li>
|
|
|
<label>游戏角色</label>
|
|
|
<label>{$data.role_name}</label>
|
|
|
</li>
|
|
|
|
|
|
<?php if (empty($data['attachment_url'])):?>
|
|
|
<li>
|
|
|
<label>测试资源数量</label>
|
|
|
<input type="text" name='resource_num' value="0">
|
|
|
</li>
|
|
|
<li>
|
|
|
<label>备注</label>
|
|
|
<textarea name="remark" class="" placeholder="" maxlength="500" ></textarea>
|
|
|
</li>
|
|
|
<?php else:?>
|
|
|
<li>
|
|
|
<label>附件</label>
|
|
|
<label>
|
|
|
<div id="uploader" class="wu-example">
|
|
|
<div class="btns">
|
|
|
<div id="picker" style="height:30px;">附件</div>
|
|
|
</div>
|
|
|
<!--用来存放文件信息-->
|
|
|
<div id="thelist" class="uploader-list">
|
|
|
<div id="beforeupload" class="item">
|
|
|
<h4 class="info" style="width: max-content;">已有附件<a href="javascript:;" class="jsdelzip table_click" style="float:none;display:inline-block;margin-left:10px;" onclick="$('#file_url').val('');$(this).parents('#beforeupload').remove()">删除</a><a href="{$data.attachment_url}" target="_blank" download="" style="float:none;display:inline-block;margin-left:10px;">下载</a></h4>
|
|
|
</div>
|
|
|
</div>
|
|
|
<input type="hidden" id="file_url" name="attachment_url" value="{$data['attachment_url']}"/>
|
|
|
</div>
|
|
|
</label>
|
|
|
</li>
|
|
|
<?php endif;?>
|
|
|
|
|
|
|
|
|
<input type="hidden" name="id" value="{$data.id}">
|
|
|
</ul>
|
|
|
|
|
|
<div class="form-item cf" style="margin-top: 10px;">
|
|
|
<button class="submit_btn ajax-post " id="submit" type="submit" target-form="form-horizontal" style="margin-left:10px;">
|
|
|
保存
|
|
|
</button>
|
|
|
</div>
|
|
|
</form>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="common_settings">
|
|
|
<span class="plus_icon"><span><img src="__IMG__/zwmimages/icon_jia.png"></span></span>
|
|
|
<form class="addShortcutIcon">
|
|
|
<input type="hidden" name="title" value="{$m_title}">
|
|
|
<input type="hidden" name="url" value="Promote/lists/type/1">
|
|
|
</form>
|
|
|
<a class="ajax-post add-butn <notempty name='commonset'>addSIsetted</notempty>" href="javascript:;" target-form="addShortcutIcon" url="{:U('Think/addShortcutIcon')}"><img src="__IMG__/zwmimages/icon_jia.png"><span><notempty name='commonset'>已添加<else />添加至常用设置</notempty></span></a>
|
|
|
</div>
|
|
|
|
|
|
</block>
|
|
|
|
|
|
<block name="script">
|
|
|
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
|
|
|
<script type="text/javascript">
|
|
|
//导航高亮
|
|
|
highlight_subnav('{:U('WorkOrder/list')}');
|
|
|
Think.setValue("game_type_id", {$data.game_type_id|default = 0});
|
|
|
Think.setValue("category", {$data.category|default = 0});
|
|
|
Think.setValue("ba_id", {$data.ba_id|default = 0});
|
|
|
$('#submit').click(function(){
|
|
|
$('#form').submit();
|
|
|
});
|
|
|
|
|
|
var userInfo = {userId:"kazaff", md5:""}; //用户会话信息
|
|
|
var chunkSize = 5000 * 1024; //分块大小
|
|
|
var uniqueFileName = null; //文件唯一标识符
|
|
|
var md5Mark = null;
|
|
|
var backEndUrl = "{:U('File/shard_upload',array('type'=>1,'session_id'=>session_id()))}";
|
|
|
WebUploader.Uploader.register({
|
|
|
"before-send-file" : "beforeSendFile",
|
|
|
"before-send" : "beforeSend",
|
|
|
"after-send-file" : "afterSendFile"
|
|
|
}, {
|
|
|
beforeSendFile: function(file){
|
|
|
//秒传验证
|
|
|
if (file['source']['ext'] === 'zip' || file['source']['ext'] === 'rar') {
|
|
|
var task = new $.Deferred();
|
|
|
var start = new Date().getTime();
|
|
|
(new WebUploader.Uploader()).md5File(file, 0, 10*1024*1024).progress(function(percentage){
|
|
|
//console.log(percentage);
|
|
|
}).then(function(val){
|
|
|
//console.log("总耗时: "+((new Date().getTime()) - start)/1000);
|
|
|
md5Mark = val;
|
|
|
userInfo.md5 = val;
|
|
|
$.ajax({
|
|
|
type: "POST"
|
|
|
, url: backEndUrl
|
|
|
, data: {status: "md5Check", md5: val}
|
|
|
, cache: false
|
|
|
, timeout: 1000 //todo 超时的话,只能认为该文件不曾上传过
|
|
|
, dataType: "json"
|
|
|
}).then(function(data, textStatus, jqXHR){
|
|
|
//console.log(data);
|
|
|
if(data != null && data.ifExist){ //若存在,这返回失败给WebUploader,表明该文件不需要上传
|
|
|
task.reject();
|
|
|
uploader.skipFile(file);
|
|
|
file.path = data.path;
|
|
|
}else{
|
|
|
task.resolve();
|
|
|
//拿到上传文件的唯一名称,用于断点续传
|
|
|
uniqueFileName = md5(''+userInfo.userId+file.name+file.type+file.lastModifiedDate+file.size);
|
|
|
}
|
|
|
}, function(jqXHR, textStatus, errorThrown){ //任何形式的验证失败,都触发重新上传
|
|
|
task.resolve();
|
|
|
//拿到上传文件的唯一名称,用于断点续传
|
|
|
uniqueFileName = md5(''+userInfo.userId+file.name+file.type+file.lastModifiedDate+file.size);
|
|
|
});
|
|
|
});
|
|
|
return $.when(task);
|
|
|
}
|
|
|
}
|
|
|
, beforeSend: function(block){
|
|
|
//分片验证是否已传过,用于断点续传
|
|
|
if (block['file']['source']['ext'] === 'zip' || block['file']['source']['ext'] === 'rar') {
|
|
|
var task = new $.Deferred();
|
|
|
$.ajax({
|
|
|
type: "POST"
|
|
|
, url: backEndUrl
|
|
|
, data: {
|
|
|
status: "chunkCheck"
|
|
|
, name: uniqueFileName
|
|
|
, chunkIndex: block.chunk
|
|
|
, size: block.end - block.start
|
|
|
}
|
|
|
, cache: false
|
|
|
, timeout: 1000 //todo 超时的话,只能认为该分片未上传过
|
|
|
, dataType: "json"
|
|
|
}).then(function(data, textStatus, jqXHR){
|
|
|
if(data.ifExist){ //若存在,返回失败给WebUploader,表明该分块不需要上传
|
|
|
task.reject();
|
|
|
}else{
|
|
|
task.resolve();
|
|
|
}
|
|
|
}, function(jqXHR, textStatus, errorThrown){ //任何形式的验证失败,都触发重新上传
|
|
|
task.resolve();
|
|
|
});
|
|
|
return $.when(task);
|
|
|
}
|
|
|
}
|
|
|
, afterSendFile: function(file){
|
|
|
if (file['source']['ext'] === 'zip' || file['source']['ext'] === 'rar') {
|
|
|
var chunksTotal = 0;
|
|
|
if((chunksTotal = Math.ceil(file.size/chunkSize)) > 1){
|
|
|
//合并请求
|
|
|
var task = new $.Deferred();
|
|
|
$.ajax({
|
|
|
type: "POST"
|
|
|
, url: backEndUrl
|
|
|
, data: {
|
|
|
status: "chunksMerge"
|
|
|
, name: uniqueFileName
|
|
|
, chunks: chunksTotal
|
|
|
, ext: file.ext
|
|
|
, md5: md5Mark
|
|
|
}
|
|
|
, cache: false
|
|
|
, dataType: "json"
|
|
|
}).then(function(data, textStatus, jqXHR){
|
|
|
//todo 检查响应是否正常
|
|
|
task.resolve();
|
|
|
file.path = data.path;
|
|
|
$("#file_name").val(data.name);
|
|
|
$("#file_url").val(data.path+'/'+data.name);
|
|
|
$("#file_size").val(file.size);
|
|
|
}, function(jqXHR, textStatus, errorThrown){
|
|
|
task.reject();
|
|
|
});
|
|
|
return $.when(task);
|
|
|
}else{
|
|
|
//UploadComlate(file);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
var uploaderFile = WebUploader.create({
|
|
|
// 选完文件后,是否自动上传。
|
|
|
auto: true,
|
|
|
// swf文件路径
|
|
|
swf: '__STATIC__/webuploader/Uploader.swf',
|
|
|
// 文件接收服务端。
|
|
|
server: backEndUrl,
|
|
|
// 选择文件的按钮。可选。
|
|
|
// 内部根据当前运行是创建,可能是input元素,也可能是flash.
|
|
|
pick: {id:'#picker'},
|
|
|
//dnd: "#theList",
|
|
|
paste: document.body,
|
|
|
// 不压缩image, 默认如果是jpeg,文件上传前会压缩一把再上传!
|
|
|
resize: false,
|
|
|
disableGlobalDnd: true,
|
|
|
fileNumLimit:1,
|
|
|
threads:3,
|
|
|
compress: false,
|
|
|
prepareNextFile: true,
|
|
|
formData: function(){return $.extend(true, {}, userInfo);},
|
|
|
chunked:true,
|
|
|
chunkSize: 5*1000*1024,
|
|
|
duplicate: true
|
|
|
});
|
|
|
|
|
|
uploaderFile.on('beforeFileQueued',function(file){
|
|
|
// var mycars=new Array("zip","rar","tar","jar");
|
|
|
// if($.inArray(file.ext,mycars) == -1){
|
|
|
// updateAlert('上传文件非法','tip_error');
|
|
|
// setTimeout(function(){
|
|
|
// $('#tip').find('.tipclose').click();
|
|
|
// },1500);
|
|
|
// return false;
|
|
|
// }
|
|
|
if ($('#file_url').val()) {
|
|
|
layer.msg('请先删除原文件后,再上传');
|
|
|
return false;
|
|
|
}
|
|
|
//$.each(mycars,function(index,value){});
|
|
|
})
|
|
|
// 当有文件被添加进队列的时候
|
|
|
uploaderFile.on( 'fileQueued', function( file ) {
|
|
|
$("#thelist").append( '<div id="' + file.id + '" class="item">' +
|
|
|
'<h4 class="info">' + file.name + '</h4>' +
|
|
|
'<p class="state">等待上传...</p>' +
|
|
|
'</div>' );
|
|
|
});
|
|
|
|
|
|
// 文件上传过程中创建进度条实时显示。
|
|
|
uploaderFile.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) + '%' );
|
|
|
});
|
|
|
|
|
|
uploaderFile.on( 'uploadSuccess', function( file , response) {
|
|
|
$( '#'+file.id ).find('p.state').text('已上传').fadeOut(800);
|
|
|
$('#'+file.id).find('h4.info').append('<a href="javascript:;" class="jsdelzip table_click" style="float:none;display:inline-block;margin-left:10px;">删除</a>');
|
|
|
$('#'+file.id).find('.jsdelzip').on('click',function() {
|
|
|
$("#file_url").val('');
|
|
|
uploaderFile.removeFile( file.id );
|
|
|
$('#'+file.id).remove();
|
|
|
return false;
|
|
|
});
|
|
|
if(!response.chunk){
|
|
|
var url = response.path + "/" +response.name;
|
|
|
$("#file_url").val(url);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
uploaderFile.on( 'uploadError', function( file ) {
|
|
|
$( '#'+file.id ).find('p.state').text('上传出错');
|
|
|
});
|
|
|
|
|
|
uploaderFile.on( 'uploadComplete', function(file) {
|
|
|
$( '#'+file.id ).find('.progress').fadeOut();
|
|
|
});
|
|
|
</script>
|
|
|
</block>
|
|
|
|