Skip to content

Commit

Permalink
Merge pull request 'fix:修复文件过多报错问题' (#45) from dev into main
Browse files Browse the repository at this point in the history
  • Loading branch information
FleyX committed Jun 15, 2023
2 parents ea859cc + f25e5d7 commit 3f8b659
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 20 deletions.
35 changes: 18 additions & 17 deletions openRenamerBackend/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,24 @@ import * as path from 'path';
const rootPath = path.resolve(__dirname, '..');

let config = {
rootPath,
port: process.env.PORT ? parseInt(process.env.PORT) : 8089,
token: process.env.TOKEN ? process.env.TOKEN : null,
urlPrefix: '/openRenamer/api',
//是否为windows平台
isWindows: process.platform.toLocaleLowerCase().includes("win"),
bodyLimit: {
formLimit: '2mb',
urlencoded: true,
multipart: true,
formidable: {
uploadDir: path.join(rootPath, 'files', 'temp', 'uploads'),
keepExtenstions: true,
maxFieldsSize: 1024 * 1024
}
},
publicPath: new Set(["POST/public/checkToken"])
rootPath,
port: process.env.PORT ? parseInt(process.env.PORT) : 8089,
token: process.env.TOKEN ? process.env.TOKEN : null,
urlPrefix: '/openRenamer/api',
//是否为windows平台
isWindows: process.platform.toLocaleLowerCase().includes("win"),
bodyLimit: {
formLimit: '200mb',
jsonLimit: '200mb',
urlencoded: true,
multipart: true,
formidable: {
uploadDir: path.join(rootPath, 'files', 'temp', 'uploads'),
keepExtenstions: true,
maxFieldsSize: 1024 * 1024 * 200
}
},
publicPath: new Set(["POST/public/checkToken"])
};

export default config;
2 changes: 1 addition & 1 deletion openRenamerFront/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default {
name: "Home",
data() {
return {
version: "1.6.1",
version: "1.6.2",
latestVersion: null,
activeIndex: location.pathname,
showNewVersion: false
Expand Down
13 changes: 11 additions & 2 deletions openRenamerFront/src/views/home/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<div class="fileBlock">
<!-- 左侧原始文件名 -->
<div style="width:50%;">
<div v-for="(item, index) in fileList" :key="index" class="oneLine">
<div v-for="(item, index) in showFileList" :key="index" class="oneLine">
<el-checkbox class="oneLineText" style="width: 95%" v-model="item.checked">
<el-tooltip show-after="300" style="color:white" effect="dark" :content="item.name" placement="top">
<span class="oneLineText" style="width: 100%;display: inline-block">{{ item.name }}</span>
Expand All @@ -70,7 +70,7 @@
</div>
<!-- 右边的预览文件名 -->
<div style="width:50%">
<div v-for="(item, index) in changedFileList" :key="index" class="oneLine">
<div v-for="(item, index) in showChangedFileList" :key="index" class="oneLine">
<div style="display:inline-block;width:72%;" class="oneLineText">
<el-tooltip show-after="300" style="color:white" effect="dark" :content="item.name" placement="top">
<span class="oneLineText" style="width: 100%;display: inline-block">{{ item.name }}</span>
Expand Down Expand Up @@ -131,6 +131,12 @@ export default {
computed: {
allChecked() {
return this.fileList.length > 0 && this.fileList.filter(item => item.checked).length === this.fileList.length;
},
showFileList() {
return this.fileList.length > 500 ? this.fileList.slice(0, 500) : this.fileList;
},
showChangedFileList() {
return this.changedFileList && this.changedFileList.length > 500 ? this.changedFileList.slice(0, 500) : this.changedFileList;
}
},
async created() {
Expand All @@ -155,6 +161,9 @@ export default {
},
//预览结果
async showResult() {
if (this.fileList.length > 500) {
this.$message.info("文件数过多,仅展示前500个(不影响重命名)");
}
this.changedFileList = [];
if (!this.checkRuleAndFile()) {
return;
Expand Down

0 comments on commit 3f8b659

Please sign in to comment.