This commit is contained in:
parent
51c286f4a1
commit
7917139bd3
|
|
@ -40,6 +40,7 @@
|
||||||
|
|
||||||
.password-book-item {
|
.password-book-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
margin: 8px 0;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
|
|
@ -54,13 +55,19 @@
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.password-book-title {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="layui-container" style="width: 100%;height: 100%;padding: 10px">
|
<div class="layui-container" style="width: 100%;height: 100%;padding: 10px">
|
||||||
<form id="baseForm" class="layui-form" method="POST" onsubmit="return false;">
|
<form id="baseForm" class="layui-form" method="POST" onsubmit="return false;">
|
||||||
<div>人员密码本:</div>
|
<div class="password-book-title">人员密码本</div>
|
||||||
<div class="password-book-list">
|
<div class="password-book-list">
|
||||||
<!-- <div class="password-book-item">
|
<!-- <div class="password-book-item">
|
||||||
<span>密码1</span>
|
<span>密码1</span>
|
||||||
|
|
@ -80,6 +87,7 @@
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
let layer, laydate, table;
|
let layer, laydate, table;
|
||||||
let obj = {};
|
let obj = {};
|
||||||
|
let fileList = []
|
||||||
$(function () {
|
$(function () {
|
||||||
// layui.use(['layer', 'laydate', 'table'], function () {
|
// layui.use(['layer', 'laydate', 'table'], function () {
|
||||||
// layer = layui.layer;
|
// layer = layui.layer;
|
||||||
|
|
@ -89,6 +97,11 @@
|
||||||
// });
|
// });
|
||||||
|
|
||||||
layui.use('upload', function () {
|
layui.use('upload', function () {
|
||||||
|
|
||||||
|
if (fileList.length === 3) {
|
||||||
|
layer.msg('最多只能上传3个文件')
|
||||||
|
return
|
||||||
|
}
|
||||||
var upload = layui.upload;
|
var upload = layui.upload;
|
||||||
// 执行上传功能
|
// 执行上传功能
|
||||||
var uploadInst = upload.render({
|
var uploadInst = upload.render({
|
||||||
|
|
@ -98,20 +111,8 @@
|
||||||
multiple: false,
|
multiple: false,
|
||||||
done: function (res) {
|
done: function (res) {
|
||||||
// 上传完毕回调
|
// 上传完毕回调
|
||||||
console.log(res, '上传成功')
|
|
||||||
debugger
|
|
||||||
if (res.code === 0) { // 假设返回数据中有code字段,0表示成功
|
if (res.code === 0) { // 假设返回数据中有code字段,0表示成功
|
||||||
|
|
||||||
|
|
||||||
console.log(res, 'res.message')
|
|
||||||
|
|
||||||
// $('.password-book-list').append(
|
|
||||||
// '<div class="password-book-item">' +
|
|
||||||
// '<span>' + res.message + '</span>' +
|
|
||||||
// '<span>删除</span>' +
|
|
||||||
// '</div>'
|
|
||||||
// );
|
|
||||||
|
|
||||||
getUploadFile()
|
getUploadFile()
|
||||||
layer.msg('上传成功');
|
layer.msg('上传成功');
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -132,14 +133,13 @@
|
||||||
url: ctxPath + '/upload/getFile',
|
url: ctxPath + '/upload/getFile',
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
console.log(res, 'res文件列表')
|
fileList = res.obj
|
||||||
|
|
||||||
if (res.obj && res.obj.length > 0) {
|
if (res.obj && res.obj.length > 0) {
|
||||||
res.obj.forEach(item => {
|
res.obj.forEach(item => {
|
||||||
$('.password-book-list').append(
|
$('.password-book-list').append(
|
||||||
'<div class="password-book-item">' +
|
'<div class="password-book-item">' +
|
||||||
'<span>' + item.fileName + '</span>' +
|
'<span>' + item.fileName + '</span>' +
|
||||||
'<span data-id="' + item.id + '">删除</span>' +
|
'<span data-id="' + item.id + '" onclick="deleteFile()">删除</span>' +
|
||||||
'</div>'
|
'</div>'
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
@ -150,7 +150,7 @@
|
||||||
|
|
||||||
// 删除文件
|
// 删除文件
|
||||||
function deleteFile() {
|
function deleteFile() {
|
||||||
console.log('this')
|
console.log('删除', $(this).data('id'))
|
||||||
}
|
}
|
||||||
|
|
||||||
getUploadFile()
|
getUploadFile()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue