文件上传任意格式(主页面)
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- Meta, title, CSS, favicons, etc. -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
<link rel="stylesheet" href="../libs/layui/css/layui.css" media="all">
<script src="../js/jquery.min.js"></script>
<script type="text/javascript" src="../js/jquery.cookie.js"></script>
<script src="../libs/layui/layui.all.js"></script>
<script src="../js/bootstrap.min.js"></script>
<script type="text/javascript" src="../js/xadmin.js"></script>
<script type="text/javascript" src="../js/global.js"></script>
<script type="text/javascript" src="../js/jquery.ext.js"></script>
<script src="../js/base.js"></script>
<script src="../js/custom.min.js"></script>
<script src="../libs/layui/lay/modules/laydate.js"></script>
<style>
.table {
text-align: center;
margin: 0px 10px
}
.input {
width: 30%;
float: left
}
.button {
padding: 10px 20px;
}
.search {
margin: 20px 10px
}
#orgUser {
padding: 10px 10px 10px 10px
}
</style>
</head>
<body>
<div class="tablePage">
<div class="search">
<div id="oprationBtn">
<input type="text" name="resourceTitle" id="resourceTitle"
lay-verify="title" autocomplete="off" placeholder="请输入文档名称"
class="layui-input input">
<button type="button" class="layui-btn button" onclick="submitBtn()">搜索</button>
<button type="button" style="float: right" class="layui-btn button"
onclick="addBtn()">上传文档</button>
</div>
</div>
<div class="table">
<table class="layui-hide" id="baomingTable" lay-filter="baomingTable"></table>
</div>
</div>
<script type="text/html" id="barDemo">
<a class="layui-btn layui-btn-xs" href="{
{d.resource_url}}" download="{
{d.file_name}}">下载</a>
<i class="layui-icon" lay-event="del"></i>
</script>
<script src="../js/layui.all.js"></script>
<script type="text/html" id="sex">
{
{
# if(d.sex == 1){
}}
<span>男</span>
{
{
# } else if(d.sex==0){
}}
女
{
{
# } else {
}}
男
{
{
# } }}
</script>
<script>
var classId;
var name = '';
var resourceTitle = '';
$(function() {
classId = $.cookie('class_id');
getData();
})
//新增
function addBtn() {
xinzengpxzn();
}
function getData() {
///"classId":classId,
var data = {
"classId" : classId,
"resourceTitle" : resourceTitle,
"resourceType" : 0
};
layui.use('table',function() {
table = layui.table;
table.render({
elem : '#baomingTable',
id : "jsSelect",
method : "POST",
url : serverUrl.url
+ serverUrl.queryTeacFileByPage,
where : data,
page : true,
limit : 10,
height : 450,
even : true,
loading : true,
cols : [ [
{
field : 'file_name',
align : 'center',
title : '文档名称',
width:'30%'
}
/* ,{field: 'class_name',align:'center', title: '所属班级',width:120} */
, {
field : 'publishDate',
align : 'center',
title : '上传时间',
width:'22%'
},
{
field : 'publishName',
align : 'center',
title : '上传人',
width:'12%'
},{
field : 'remak',
align : 'center',
title : '备注',
width:'18%'
}, {
field : 'right',
title : '操作',
align : 'center',
templet : '#barDemo'
} ] ]
});
});
};
layui.use('table', function() {
var table = layui.table;
//监听表格复选框选择
//监听工具条
table.on('tool(baomingTable)', function(obj) {
var data = obj.data;
$.cookie('resourceTitle', data.resource_title);
$.cookie('resourceUrl', data.resource_url);
$.cookie('fileName', data.file_name);
if (obj.event === 'downLoad') {
var data1 = {
"name" : "ssssasd",
"fileName" : data.resource_url,
}
downLoad(data1);
} else if (obj.event === 'del') {
layer.confirm('确定删除吗?', function(index) {
var data1 = {
"resourceId" : data.resource_id
}
delGuide(data1);
});
}
});
});
function showBigImage(e) {
layer.open({
type : 1,
title : false,
closeBtn : 0,
shadeClose : true,