|
|
|
|
<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('modify')}" enctype="multipart/form-data" id="form1" action="javascript:;" class="form-horizontal">
|
|
|
|
|
<div class="cf top_nav_list">
|
|
|
|
|
|
|
|
|
|
<!-- 高级搜索 -->
|
|
|
|
|
<div class="jssearch fl cf search_list" style="margin-bottom:15px">
|
|
|
|
|
<input id="id" name="id" type="text" value="{$data['id']}" style="display:none" >
|
|
|
|
|
<input id="gameid" name="game_id" type="text" value="{$data['game_id']}" style="display:none" >
|
|
|
|
|
<input id="serverid" name="server_id" type="text" value="{$data['server_id']}" style="display:none">
|
|
|
|
|
<div class="input-list search-title-box">
|
|
|
|
|
<label>工单类型:</label>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="input-list input-list-game search_label_rehab">
|
|
|
|
|
<label><?php if ($data['type'] == 1):?>资源<?php else:?>反馈<?php endif;?></label>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="input-list search-title-box">
|
|
|
|
|
<label>区服选择:</label>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="input-list input-list-game search_label_rehab">
|
|
|
|
|
<select id="game_id" name="game_name" class="select_gallery" style="width:120px;">
|
|
|
|
|
<option value="">游戏名称</option>
|
|
|
|
|
<volist name=":get_game_list()" id="vo">
|
|
|
|
|
<option game-id="{$vo.id}" value="{$vo.game_name}" <?php if ($data['game_id'] == $vo['id']):?>selected<?php endif;?> >{$vo.game_name}</option>
|
|
|
|
|
</volist>
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="input-list input-list-server search_label_rehab">
|
|
|
|
|
<select id="server_id" name="server_name" class="select_gallery" style="width:120px;">
|
|
|
|
|
<option value="">区服名称</option>
|
|
|
|
|
<if condition="$data['server_name'] neq ''"><option value="{$data['server_name']}">{$data['server_name']}</option></if>
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
<?php if (!empty($data['attachment_url']) || $data['type'] == 2):?>
|
|
|
|
|
<div class="input-list">
|
|
|
|
|
<div id="uploader" class="wu-example">
|
|
|
|
|
<div class="btns">
|
|
|
|
|
<div id="picker" style="height:30px;">附件</div>
|
|
|
|
|
</div>
|
|
|
|
|
<!--用来存放文件信息-->
|
|
|
|
|
<div id="thelist" class="uploader-list">
|
|
|
|
|
<?php if (!empty($data['attachment_url'])):?>
|
|
|
|
|
<div id="beforeupload" class="item">
|
|
|
|
|
<h4 class="info">已有附件<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" style="float:none;display:inline-block;margin-left:10px;">下载</a></h4>
|
|
|
|
|
</div>
|
|
|
|
|
<?php endif;?>
|
|
|
|
|
</div>
|
|
|
|
|
<input type="hidden" id="file_url" name="attachment_url" value="{$data['attachment_url']}"/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<?php endif;?>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="tab-content tabcon1711" id='resource-form' <?php if ($data['type'] == 2 || ($data['type']==1 && !empty($data['attachment_url']))):?>hidden<?php endif;?>>
|
|
|
|
|
<table class="table">
|
|
|
|
|
<!-- 表头 -->
|
|
|
|
|
<thead>
|
|
|
|
|
<tr>
|
|
|
|
|
<th>测试账号</th>
|
|
|
|
|
<th>密码</th>
|
|
|
|
|
<th>角色名称</th>
|
|
|
|
|
<th>资源数量</th>
|
|
|
|
|
<th>备注</th>
|
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
|
|
|
|
|
<!-- 列表 -->
|
|
|
|
|
<tbody>
|
|
|
|
|
<tr>
|
|
|
|
|
<td class="r" style="line-height: 0px;">
|
|
|
|
|
<div class="from-element from-input">
|
|
|
|
|
<input type="text" title="账号" placeholder="账号" class="my_text"
|
|
|
|
|
name='resource[user_account]' value="{$data.user_account}"></div>
|
|
|
|
|
</td>
|
|
|
|
|
<td class="r">
|
|
|
|
|
<div class="from-element from-input">
|
|
|
|
|
<input type="text" title="密码" placeholder="密码" class="my_text"
|
|
|
|
|
name='resource[user_password]' ></div>
|
|
|
|
|
</td>
|
|
|
|
|
<td class="r">
|
|
|
|
|
<div class="from-element from-input">
|
|
|
|
|
<input type="text" title="角色名称" placeholder="角色名称" class="my_text"
|
|
|
|
|
name='resource[role_name]' value="{$data.role_name}"></div>
|
|
|
|
|
</td>
|
|
|
|
|
<td class="r">
|
|
|
|
|
<div class="from-element from-input">
|
|
|
|
|
<input type="text" title="申请元宝或钻石数量" placeholder="申请元宝或钻石数量" class="my_text"
|
|
|
|
|
name='resource[apply_resource]' onkeyup="value=value.replace(/[^\d]/g,'')" value="{$data.resource_num}"></div>
|
|
|
|
|
</td>
|
|
|
|
|
<td class="r">
|
|
|
|
|
<div class="from-element from-input">
|
|
|
|
|
<input type="text" title="备注" placeholder="备注" class="my_text"
|
|
|
|
|
name='resource[remark]' value="{$data.remark}"></div>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
<ul class="form_info" style="margin-top: 10px;" id='feedback-form' <?php if ($data['type'] == 1):?>hidden<?php endif;?> >
|
|
|
|
|
<li>
|
|
|
|
|
<label>玩家账号</label>
|
|
|
|
|
<input type="text" name='feedback[user_account]' value="{$data.user_account}">
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<label>角色名称</label>
|
|
|
|
|
<input type="text" name='feedback[role_name]' value="{$data.role_name}">
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<label>反馈原因</label>
|
|
|
|
|
<textarea name="feedback[feedback]" class="" placeholder="" >{$data.feedback}</textarea>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<label>状态</label>
|
|
|
|
|
<select id="status" name="feedback[status]" class="select_gallery">
|
|
|
|
|
<option value="3" <?php if($data['status'] == 3):?>selected<?php endif;?> >处理中</option>
|
|
|
|
|
<option value="1" <?php if($data['status'] == 1):?>selected<?php endif;?> >完成</option>
|
|
|
|
|
</select>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<label>创单人员</label>
|
|
|
|
|
<label>{:get_admin_name(is_login())}</label>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<label>处理人</label>
|
|
|
|
|
<select id="handler_id" name="feedback[handler_id]" class="select_gallery">
|
|
|
|
|
<?php foreach ($admin_users as $user):?>
|
|
|
|
|
<option value="{$user['uid']}" <?php if ($user['uid'] == $data['handler_id']):?>selected<?php endif;?> >{$user.nickname}</option>
|
|
|
|
|
<?php endforeach;?>
|
|
|
|
|
</select>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<label>备注</label>
|
|
|
|
|
<textarea name="feedback[remark]" class="" placeholder="" >{$data.remark}</textarea>
|
|
|
|
|
</li>
|
|
|
|
|
</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>
|
|
|
|
|
|
|
|
|
|
<span style="width: 0.5px;background-color: gray; margin-left: 50px;margin-right: 50px;" <?php if (empty($data['process_log']) || $data['type'] == 1):?>hidden<?php endif;?>></span>
|
|
|
|
|
|
|
|
|
|
<div <?php if (empty($data['process_log']) || $data['type'] == 1):?>hidden<?php endif;?> >
|
|
|
|
|
<div style="font-size:large;">工单进度</div>
|
|
|
|
|
<div style="width: 600px;border: 0.5px solid #000;height: 100%;padding-top: 20px;padding-right: 50px;padding-left: 50px;margin-bottom: 50px;">
|
|
|
|
|
<?php foreach($data['process_log'] as $index => $log):?>
|
|
|
|
|
<p style="font-weight: bold;font-size: medium;margin-top: 10px;">{$index+1}. {$log['title']}</p>
|
|
|
|
|
<?php if ($log['type'] == 2):?>
|
|
|
|
|
<?php foreach($log['detail'] as $detail):?>
|
|
|
|
|
<p style="margin-left: 20px;">--<?php echo $detail['key_name'] . " 旧值:".$detail['old']." 新值:".$detail['new'] ?></p>
|
|
|
|
|
<?php endforeach;?>
|
|
|
|
|
<?php elseif($log['type'] == 3):?>
|
|
|
|
|
<p style="margin-left: 20px;"><label>内容:</label><span style="color: gray;">{$log['detail']}</span></p>
|
|
|
|
|
<?php endif;?>
|
|
|
|
|
<?php endforeach;?>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</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();
|
|
|
|
|
});
|
|
|
|
|
$(function(){
|
|
|
|
|
// var pro="{:$data['bank_area']['0']}";
|
|
|
|
|
// alert (pro);
|
|
|
|
|
showTab();
|
|
|
|
|
prov="{:substr($data['bank_area'],0,2)}";
|
|
|
|
|
city="{:substr($data['bank_area'],2,2)}";
|
|
|
|
|
ciarea="{:substr($data['bank_area'],4,2)}";
|
|
|
|
|
//initComplexArea('seachprov', 'seachcity', 'seachdistrict', area_array, sub_array, prov, city, ciarea);
|
|
|
|
|
$('.table').on("click", '.add-act', function (event) {
|
|
|
|
|
$(".table").find("tr:last").find('td:last').find('a:last').css("display", 'none');
|
|
|
|
|
|
|
|
|
|
var rowNum = $(".table tr").size() - 1;
|
|
|
|
|
var html = "<tr class='table_tr' data-val='" + rowNum + "'><td><div class='from-element from-input'><input type='text' class='my_text' title='账号' placeholder='账号' name='user_accounts[]' ></div></td><td><div class='from-element from-input'><input type='text' title='密码' class='my_text' placeholder='密码' name='user_passwords[]'></div></td><td><div class='from-element from-input'><input type='text' title='角色名称' placeholder='角色名称' class='my_text' name='role_names[]'></div></td><td><div class='from-element from-input'><input type='text' maxlength='19' placeholder='申请元宝或钻石数量' title='申请数量' class='my_text' name='apply_resources[]' onkeyup = " + '"' + "value=value.replace(/[^\\d]/g,'')" + '"' + "></div></td><td><div class='from-element from-input'><input type='text' placeholder='备注' class='my_text' maxlength='100' name='remarks[]'></div></td><td><div style='display: flex;'><a class='add-act bnt_add'>✚</a><a class='del-act bnt_remove'>✖</a></div></td></tr>";
|
|
|
|
|
$(".table").append(html);
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
$('.table').on("click", '.del-act', function (event) {
|
|
|
|
|
var rowNum = $(".table tr").size() - 1;
|
|
|
|
|
if (rowNum > 1) {
|
|
|
|
|
$(this).closest("tr").remove();
|
|
|
|
|
$(".table").find("tr:last").find('td:last').find('a:last').css("display", ' inline-block');
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
$("#server_id").change(function () {
|
|
|
|
|
var g_server_id = $("#server_id option:selected").attr('server-id');
|
|
|
|
|
$("#serverid").attr('value',g_server_id);
|
|
|
|
|
});
|
|
|
|
|
var server_id = '{$data.server_id}';
|
|
|
|
|
$("#game_id").change(function(){
|
|
|
|
|
var addData = '';
|
|
|
|
|
$("#gameid").val($(this).val());
|
|
|
|
|
$.ajax({
|
|
|
|
|
url:"{:U('Ajax/getServer')}",
|
|
|
|
|
type:"post",
|
|
|
|
|
data:{game_id:$("#game_id option:selected").attr('game-id')},
|
|
|
|
|
dataType:'json',
|
|
|
|
|
success:function(data){
|
|
|
|
|
str = "<option value=''>请选择区服</option>";
|
|
|
|
|
for (var i in data){
|
|
|
|
|
if (data[i].id == server_id) {
|
|
|
|
|
str += "<option value='"+data[i].server_name+"' server-id='"+data[i].id+"' selected >"+data[i].server_name+"</option>"
|
|
|
|
|
} else {
|
|
|
|
|
str += "<option value='"+data[i].server_name+"' server-id='"+data[i].id+"'>"+data[i].server_name+"</option>"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
var g_game_id = $("#game_id option:selected").attr('game-id');
|
|
|
|
|
$("#gameid").attr('value',g_game_id);
|
|
|
|
|
$("#server_id").empty();
|
|
|
|
|
$("#server_id").append(str);
|
|
|
|
|
$("#server_id").select2();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
$("#game_id").change();
|
|
|
|
|
|
|
|
|
|
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 (true) {
|
|
|
|
|
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 (true) {
|
|
|
|
|
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 (true) {
|
|
|
|
|
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>
|
|
|
|
|
|