Skip to content

Commit

Permalink
2.1.0 版本发布
Browse files Browse the repository at this point in the history
### 2.1.0 版本发布

- 修正新建文件时,文章编辑器自动生成名称不合法的问题
- 修正新建文件时,保存文章会失败的问题
- 增加了文件上传时的信息展示
- 修改了文件管理列表中的背景动画效果(降低速度)
  • Loading branch information
BeardedManZhao committed Sep 2, 2024
1 parent 538ef83 commit 99d8513
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 18 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ const indexConfig = {

## 更新记录

### 2.1.0 版本发布

- 修正新建文件时,文章编辑器自动生成名称不合法的问题
- 修正新建文件时,保存文章会失败的问题
- 增加了文件上传时的信息展示
- 修改了文件管理列表中的背景动画效果(降低速度)

### 2.0.0 版本 发布

- 适用服务器版本:2024-08-31 以后的版本
Expand Down
2 changes: 1 addition & 1 deletion web/FileExplorer.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
style="text-align: center"
title="diskMirror-front 版本:点击查看前端界面历史包">
<div onclick="window.open('https://github.com/BeardedManZhao/diskMirror-front/releases')"><span
class="load-icon-2"></span> <span>2.0.0</span></div>
class="load-icon-2"></span> <span>2.1.0</span></div>
</div>
<div class="button_list1">
<button class="item_Button" onclick="window.open('index.html')">新界面</button>
Expand Down
6 changes: 3 additions & 3 deletions web/FileWriter.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
if (isUpdate) {
fileName_str = searchParams0[searchParams0.length - 1];
} else {
const s1 = prompt("请您为文件起个名字吧!", "/xxx/xxx/Untitled_" + DiskMirrorFront.getDate(new Date()));
const s1 = prompt("请您为文件起个名字吧!", "/xxx/xxx/Untitled_" + Date.now() + ".md");
fileName_str = s1 ? s1 : '未命名文件_' + DiskMirrorFront.getDate(new Date()) + '.md';
}
const jokerBoxPopUp = new JokerBox_popUp(document.getElementById("joker"));
Expand Down Expand Up @@ -92,7 +92,7 @@
userId: userId,
type: type1,
fileName: fileName_str
}, editor.getMarkdown(), (r) => jokerBoxPopUp.show(r.fileName + " 保存成功!"), (error) => jokerBoxPopUp.show("保存操作出现了问题!请稍后再试吧!" + error));
}, new Blob([editor.getMarkdown()], {type: 'text/plain'}), (r) => jokerBoxPopUp.show(r.fileName + " 保存成功!"), (error) => jokerBoxPopUp.show("保存操作出现了问题!请稍后再试吧!" + error));
},
(error) => jokerBoxPopUp.show("覆写操作出现了问题!请稍后再试吧!" + error)
)
Expand All @@ -101,7 +101,7 @@
userId: userId,
type: type,
fileName: fileName_str
}, editor.getMarkdown(), (r) => {
}, new Blob([editor.getMarkdown()], {type: 'text/plain'}), (r) => {
jokerBoxPopUp.show(r.fileName + " 保存成功!稍后自动跳转到文件管理器!");
setTimeout(() => {
window.location.href = `FileExplorer.html?server_id=${userId}&path=/`
Expand Down
4 changes: 2 additions & 2 deletions web/css/backEnd.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ body {
rgb(181, 190, 255)
);
background-size: 400% 400%;
animation: gradientBG 15s ease infinite;
animation: gradientBG 35s ease infinite;
}

body.errorBody {
Expand All @@ -32,7 +32,7 @@ body.errorBody {
rgb(255, 181, 181)
);
background-size: 400% 400%;
animation: gradientBG 15s ease infinite;
animation: gradientBG 35s ease infinite;
}


Expand Down
2 changes: 1 addition & 1 deletion web/css/index.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

body {
animation: gradientBG 15s ease forwards;
animation: gradientBG 15s;
}

@keyframes show_parent {
Expand Down
64 changes: 53 additions & 11 deletions web/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,52 @@ const versionShowDiv = document.querySelector("#versionShowDiv");

/**
* 使用内置的弹窗展示文字!
* @param showText
* @param showMs
* @param showText 被展示的文字
* @param showMs 自动隐藏的秒数
* @param autoHidden 是否需要自动隐藏
*/
function showMessage(showText, showMs = 5000) {
function showMessage(showText, showMs = 5000, autoHidden = true) {
versionShow.innerText = showText;
// 显示信息
versionShowDiv.hidden = false;
// 5秒钟之后隐藏信息
setTimeout(() => versionShowDiv.hidden = true, 5000);
// showMs钟之后隐藏信息
if (autoHidden) {
setTimeout(() => versionShowDiv.hidden = true, showMs);
}
}

const uploadFiles = {};

/**
* 上传任务开始之前要进行的操作 如果此函数返回 true 则代表可以上传 如果是 false 则代表不能上传
* @param params 上传操作要用的参数
* @param file 被上传的文件
*/
function uploadBefore(params, file) {
uploadFiles[params.fileName] = 0;
let str = " ";
for (const fileName in uploadFiles) {
str += `《${fileName}》`
}
showMessage(str + " 正在上传中....", 0, false);
return file !== null;
}

/**
* 上传任务结束之后要进行的操作
* @param fileName 上传操作结束的文件名字
*/
function uploadAfter(fileName) {
delete uploadFiles[fileName];
if (uploadFiles.length === 0) {
showMessage(" 所有文件上传结束!");
} else {
let str = " ";
for (const fileName in uploadFiles) {
str += `《${fileName}》`
}
showMessage(str + " 正在继续上传中....", 0, false);
}
}

showMessage(" 正在获取服务器连接中...")
Expand Down Expand Up @@ -359,7 +396,7 @@ window.onload = function () {
let noWarCount = 0;
for (const file of files) {
if (file.name.endsWith(".war")) {
jokerBoxPopUp.show(`检测到 war 文件,正在将 《${file.name}》 自动解析为一个同名的目录!`)
jokerBoxPopUp.show(`检测到 war 文件,正在将 《${file.name}》 自动解析为一个同名的目录!`);
// 代表是 war 文件 需要被解析一下
Utils_io.unzipFile(file, (c, f, path, backOk) => {
diskMirror.upload({
Expand All @@ -370,11 +407,13 @@ window.onload = function () {
res.lastModified = new Date().getTime()
jokerBoxPopUp.show(`${file.name} 文件中:批量上传了 ${c} 个文件。`);
backOk[0] = true;
uploadAfter(file.name);
}, e => {
backOk[0] = true;
jokerBoxPopUp.show(`${file.name} 中 有文件解压失败!!! ${JSON.stringify(e)}`);
console.error(e)
})
console.error(e);
uploadAfter(file.name);
}, uploadBefore)
}, () => {
jokerBoxPopUp.show(`${file.name} 解压完毕!!!`);
if (++noWarCount === files.length) {
Expand All @@ -391,10 +430,11 @@ window.onload = function () {
}, file, (res) => {
res.lastModified = new Date().getTime()
jokerBoxPopUp.show(`共${files.length} 个文件!目前批量上传了 ${++noWarCount} 个文件。`);
uploadAfter(res.fileName);
if (noWarCount === files.length) {
reloadFsPath(element);
}
}, undefined)
}, undefined, uploadBefore)
}
})
} catch (e) {
Expand Down Expand Up @@ -423,7 +463,8 @@ window.onload = function () {
type: 'Binary'
}, file, (res) => {
jokerBoxPopUp.show(res.fileName + " 上传成功!!! 刷新可见");
}, undefined, undefined);
uploadAfter(file.name);
}, undefined, uploadBefore);
},
// 文本数据不需要进行任何操作
(_) => {
Expand Down Expand Up @@ -457,6 +498,7 @@ window.onload = function () {
type: 'Binary'
}, file, (res) => {
jokerBoxPopUp.show(res.fileName + " 上传成功!!! 刷新可见");
}, undefined, undefined);
uploadAfter(fileName);
}, undefined, uploadBefore);
}, undefined, undefined, false)
}

0 comments on commit 99d8513

Please sign in to comment.