<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%; } .tabcon1711 input[type=text], .tabcon1711 input[type=password] { width: auto; } </style> <style> .data_list table td { line-height:0px; } .tabcon1711 input~.notice-text { width: unset; } .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 style="display: flex;"> <form method="post" action="{:U('store')}" 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="gameid" name="game_id" type="text" value="" style="display:none" > <input id="serverid" name="server_id" type="text" value="" style="display:none"> <div class="input-list search-title-box"> <label>工单类型:</label> </div> <div class="input-list input-list-game search_label_rehab"> <select id="type" name="type" class="select_gallery" style="width:120px;"> <option value="1">资源</option> <option value="2">反馈</option> </select> </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="0" game-id='0'>游戏名称</option> <volist name=":get_game_list()" id="vo"> <option game-id="{$vo.id}" value="{$vo.game_name}">{$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="0" server-id='0'>区服名称</option> <if condition="$_GET['server_name'] neq ''"><option value="{$_GET['server_name']}">{$_GET['server_name']}</option></if> </select> </div> <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"> </div> <input type="hidden" id="file_url" name="attachment_url" value="{$data['attachment_url']}"/> </div> </div> </div> </div> <div class="data_list"> <div class="tab-content tabcon1711" id='resource-form' > <table class="table"> <!-- 表头 --> <thead> <tr> <th>测试账号</th> <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='user_accounts[]'></div> </td> <td class="r"> <div class="from-element from-input"> <input type="text" title="密码" placeholder="密码" class="my_text" name='user_passwords[]'></div> </td> <td class="r"> <div class="from-element from-input"> <input type="text" title="角色名称" placeholder="角色名称" class="my_text" name='role_names[]'></div> </td> <td class="r"> <div class="from-element from-input"> <input type="text" title="申请元宝或钻石数量" placeholder="申请元宝或钻石数量" class="my_text" name='apply_resources[]' onkeyup="value=value.replace(/[^\d]/g,'')"></div> </td> <td class="r"> <div class="from-element from-input"> <input type="text" title="备注" placeholder="备注" class="my_text" name='remarks[]'></div> </td> <td class="r"> <div style="display: flex;"> <a href="#" class="add-act bnt_add">✚</a> <a href="#" class="del-act bnt_remove">✖</a> </div> </td> </tr> </tbody> </table> </div> </div> <div class="tab-content tabcon1711 tabcon17112" style="margin-top: 10px;" id='feedback-form' hidden > <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td class="l noticeinfo">玩家账号</td> <td class="r table_radio"> <input type="text" class="" name="user_account" value="" placeholder="请输入玩家账号"> </td> </tr> <tr> <td class="l noticeinfo">角色名称</td> <td class="r table_radio"> <input type="text" class="" name="role_name" value="" placeholder="请输入角色名称"> </td> </tr> <tr> <td class="l noticeinfo">反馈原因</td> <td class="r table_radio"> <textarea name="feedback" maxlength="500"></textarea> </td> </tr> <tr> <td class="l noticeinfo">创单人员</td> <td class="r table_radio"> <label>{:get_admin_name(is_login())}</label> </td> </tr> <tr> <td class="l noticeinfo">备注</td> <td class="r table_radio"> <textarea name="remark"></textarea> </td> </tr> </tbody> </table> </div> <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> <button class="submit_btn " onclick="javascript:history.back(-1);return false;">返 回</button> </div> </form> <span style="width: 0.5px;background-color: gray; margin-left: 50px;margin-right: 50px;" hidden></span> <div hidden> <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;"> <p>工单内容</p> </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); }); $("#game_id").change(function(){ var addData = ''; $.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='0' server-id='0'>请选择区服</option>"; for (var i in data){ 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); console.log(g_game_id); $("#server_id").empty(); $("#server_id").append(str); $("#server_id").select2(); } }) }); $('#type').on('change', function(){ var seleted = $(this).val(); if (seleted == 1) { $('#feedback-form').hide(); $('#resource-form').show(); $('#feedback-form input').disable(true); $('#resource-form input').disable(false); } else { $('#feedback-form').show(); $('#resource-form').hide(); $('#feedback-form input').disable(false); $('#resource-form input').disable(true); } }); 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; // } //$.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>