|
|
<!DOCTYPE html>
|
|
|
<html>
|
|
|
|
|
|
<head>
|
|
|
<meta charset="UTF-8">
|
|
|
<title>导入excel</title>
|
|
|
<meta name="renderer" content="webkit">
|
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
|
<meta name="viewport"
|
|
|
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
|
<link rel="stylesheet" href="../../static/css/font.css">
|
|
|
<link rel="stylesheet" href="../../static/css/weadmin.css">
|
|
|
<link rel="stylesheet" href="../../lib/layui/css/layui.css">
|
|
|
<!-- 让IE8/9支持媒体查询,从而兼容栅格 -->
|
|
|
<!--[if lt IE 9]>
|
|
|
<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
|
|
|
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
|
|
|
<![endif]-->
|
|
|
</head>
|
|
|
|
|
|
<body>
|
|
|
<div class="weadmin-body">
|
|
|
<div class="layui-form-item template">
|
|
|
<button type="button" class="layui-btn layui-btn-normal" id="test8">选择文件</button>
|
|
|
<button type="button" class="layui-btn layui-btn-danger" id="test10" style="display: none;margin-left:12px">
|
|
|
下载错误模板
|
|
|
</button>
|
|
|
<div style="color: red;font-size:13px;margin-top: 50px;">温馨提示:导入<font class="import_module">课程</font>需要严格按照导入模板编辑<font
|
|
|
class="import_module">课程</font>信息,<a style="text-decoration:underline;cursor: pointer;"
|
|
|
onclick="importTemplate()">请点此下载</a>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="layui-form-item" style="margin-top: 68px">
|
|
|
<button type="button" class="layui-btn" id="test9">上传</button>
|
|
|
<button class="layui-btn" id="closeDialog">关闭</button>
|
|
|
</div>
|
|
|
</div>
|
|
|
<script src="../../lib/layui/layui.js"></script>
|
|
|
|
|
|
|
|
|
<script>
|
|
|
// 下载模板
|
|
|
function importTemplate() {
|
|
|
window.location.href = '/baseService/teachbase/getImportTemplate';
|
|
|
}
|
|
|
|
|
|
layui.extend({
|
|
|
admin: '{/}../../static/js/admin'
|
|
|
});
|
|
|
layui.use(['jquery', 'admin', 'upload', 'layer'], function () {
|
|
|
var $ = layui.jquery,
|
|
|
admin = layui.admin,
|
|
|
layer = layui.layer,
|
|
|
upload = layui.upload;
|
|
|
|
|
|
//选完文件后不自动上传
|
|
|
upload.render({
|
|
|
elem: '#test8'
|
|
|
, url: '/baseService/teachbase/UploadToImportCourse'
|
|
|
, auto: false
|
|
|
, accept: 'file' //普通文件
|
|
|
, bindAction: '#test9'
|
|
|
, before: function (obj) { //obj参数包含的信息,跟 choose回调完全一致,可参见上文。
|
|
|
layer.load(); //上传loading
|
|
|
}
|
|
|
, done: function (res, index, upload) {
|
|
|
layer.closeAll('loading'); //关闭loading
|
|
|
if (res.success) {
|
|
|
layer.msg("导入成功", {icon: 1}, function () {
|
|
|
var index = parent.layer.getFrameIndex(window.name);
|
|
|
parent.layer.close(index);
|
|
|
window.parent.location.reload();
|
|
|
window.parent.document.getElementById("click_id").value = GetQueryString("org_id");
|
|
|
})
|
|
|
} else {
|
|
|
layer.alert(res.message, function (index) {
|
|
|
layer.close(index);
|
|
|
if (res.message !== "检查发现是一个空的表格,不能上传!") {
|
|
|
document.getElementById('test10').style.display = "inline-block";//下载错误模板
|
|
|
$("#test10").click(function () {
|
|
|
window.location.href = '/baseService/teachbase/downloadErrorXls?uuidString=' + res.uuid;
|
|
|
})
|
|
|
}
|
|
|
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
, error: function (index, upload) {
|
|
|
layer.closeAll('loading'); //关闭loading
|
|
|
}
|
|
|
});
|
|
|
// 关闭页面
|
|
|
$("#closeDialog").click(function () {
|
|
|
var index = parent.layer.getFrameIndex(window.name);
|
|
|
parent.layer.close(index);
|
|
|
})
|
|
|
})
|
|
|
</script>
|
|
|
</body>
|
|
|
|
|
|
</html> |