1
0
mirror of https://gitee.com/bookshelfplus/bookshelfplus synced 2025-09-16 23:22:20 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

添加文件修改日期字段;前端列表小调整

This commit is contained in:
2022-04-15 23:33:31 +08:00
parent 3b29820f2c
commit 3dac60ced6
10 changed files with 80 additions and 20 deletions

View File

@@ -43,7 +43,7 @@
console.log(element);
renderData.push({
编号: `${element.id}`,
关联书籍: `<span class="overflow-omit" style="margin: 0 auto;">
关联书籍: element.bookId === 0 ? "未关联书籍" : `<span class="overflow-omit" style="margin: 0 auto;">
ID: ${element.bookId}
<a href="/book?id=${element.bookId}">查看</a>
<a href="/dashboard/admin/book-manage/detail?id=${element.bookId}">修改</a>

View File

@@ -1,7 +1,7 @@
<style>
/* 限制 哈希 列的宽度 */
tr>*:nth-child(7),
td>*:nth-child(7) {
tr>*:nth-child(8),
td>*:nth-child(8) {
max-width: 100px;
}
</style>
@@ -33,18 +33,23 @@
编号: `${element.id}`,
关联文件: `<span class="overflow-omit" style="margin: 0 auto;">
ID: ${element.fileId}
<a href="<%= pageUrl %>../detail?id=${element.bookId}">查看</a>
<a href="<%= pageUrl %>../detail?id=${element.fileId}">查看</a>
</span>`,
文件名: `${element.fileName}`,
格式: `${element.fileType}`,
修改日期: element.lastModified === 0 ? "未知" : `<span class="overflow-omit" style="font-size: 12px; line-height: 1.2em; display: block;"><nobr>
${new Date(element.lastModified).toISOString().replace(/T/, ' ').replace(/\..+/, '')}
</nobr></span>`,
格式: `<span class="overflow-omit" style="font-size: 12px; line-height: 1.2em; display: block;"><nobr>
${element.fileType ? element.fileType : "未知"}
</nobr></span>`,
密码: `<span class="overflow-omit" style="font-size: 12px; line-height: 1.2em; display: block;"><nobr>
文件密码: ${element.filePwd}<br>
提取码: ${element.fileShareCode}
</nobr></span>`,
// 文件密码: `${element.filePwd}`,
// 提取码: `${element.fileShareCode}`,
存储介质: `${element.storageMediumType}`,
"哈希(双击全选)": `<span class="overflow-omit" style="font-size: 10px;">${element.fileSha1}</span>`,
存储介质: `<span class="overflow-omit" style="font-size: 12px; line-height: 1.2em; display: block;"><nobr>
${element.storageMediumType}
</nobr></span>`,
"哈希(双击全选)": `<span class="overflow-omit" style="font-size: 10px;">${element.fileSha1 ? element.fileSha1 : "未知"}</span>`,
状态: `${(element.uploadStatus ? element.uploadStatus : "<span style='color: grey; font-weight: bold;'>未知</span>")
.replace("SUCCESS", "<span style='color: green; font-weight: bold;'>成功</span>")
.replace("UPLOADING", "<span style='color: orange; font-weight: bold;'>正在上传</span>")

View File

@@ -104,6 +104,7 @@
文件扩展名:<span id="file-ext"></span><br>
文件名(不含扩展名):<span id="file-name-no-ext"></span><br>
文件大小: <span id="file-size"></span><br>
修改日期: <span id="file-lastModified"></span><br>
文件SHA1: <span id="file-sha1"></span><br>
</p>
<p>计算文件哈希进度</p>
@@ -135,6 +136,7 @@
fileName: "",
fileSize: 0,
fileType: "",
lastModified: "",
fileSha1: "",
fileExt: "",
fileNameWithoutExt: "",
@@ -196,6 +198,7 @@
fileInfo.fileName = file.name;
fileInfo.fileSize = file.size;
fileInfo.fileType = file.type;
fileInfo.lastModified = file.lastModified;
// 获取文件扩展名:首先按照 . 拆分,然后删掉第一个元素(考虑无扩展名文件),再取出最后一个元素
let fileNameSplit = file.name.split(".");
fileNameSplit.shift();
@@ -208,6 +211,7 @@
document.getElementById("file-ext").innerHTML = fileInfo.fileExt;
document.getElementById("file-name-no-ext").innerHTML = fileInfo.fileNameWithoutExt;
document.getElementById("file-size").innerHTML = sOutput;
document.getElementById("file-lastModified").innerHTML = new Date(fileInfo.lastModified).toISOString().replace(/T/, ' ').replace(/\..+/, '');
// 计算文件哈希
let sha1 = await sha1File(file, (file) => {
@@ -354,6 +358,7 @@
fileName: fileInfo.fileNameWithoutExt,
fileSize: fileInfo.fileSize,
// fileType: fileInfo.fileType,
lastModified: fileInfo.lastModified,
fileSha1: fileInfo.fileSha1,
fileExt: fileInfo.fileExt,
fileId: $("#fileAssociator").val() // 关联的文件ID创建新文件则为0