This commit is contained in:
fanxb 2021-12-02 09:06:11 +08:00
parent ee649ee5e0
commit 4e17b86554
8 changed files with 209 additions and 277 deletions

211
.gitignore vendored
View File

@ -1,105 +1,106 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
.env.test
# parcel-bundler cache (https://parceljs.org/)
.cache
# Next.js build output
.next
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
openRenamerBackend/database.db
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
.env.test
# parcel-bundler cache (https://parceljs.org/)
.cache
# Next.js build output
.next
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
openRenamerBackend/database.db
openRenamerBackend/database.db

View File

@ -1,13 +0,0 @@
{ "name": "nas_backup", "script": "./dist/index.js",
"cwd": "./",
"env": {
"PORT": 8082,
"MYSQL_HOST":"localhost",
"MYSQL_PORT":3306,
"MYSQL_USER":"root",
"MYSQL_PASS":"123456"
},
"log_file": "./log/combined.log",
"out_file": "./log/out.log",
"error_file": "./error.log"
}

View File

@ -1,29 +1,30 @@
{
"name": "nas_backup",
"version": "1.0.0",
"description": "文件备份用",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "fxb",
"license": "ISC",
"dependencies": {
"@types/fs-extra": "^5.0.4",
"@types/koa": "^2.0.47",
"@types/node": "^11.13.4",
"axios": "^0.21.1",
"fs-extra": "^7.0.0",
"koa": "^2.5.3",
"koa-body": "^4.0.4",
"koa-router": "^7.4.0",
"koa-static": "^5.0.0",
"koa2-cors": "^2.0.6",
"log4js": "^6.3.0",
"moment": "^2.22.2",
"mysql2": "^2.2.5",
"sqlite": "^4.0.23",
"uuid": "^3.3.2",
"winston": "^3.1.0"
}
}
{
"name": "nas_backup",
"version": "1.0.0",
"description": "文件备份用",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "fxb",
"license": "ISC",
"dependencies": {
"@types/fs-extra": "^5.0.4",
"@types/koa": "^2.0.47",
"@types/node": "^11.13.4",
"axios": "^0.21.1",
"fs-extra": "^7.0.0",
"koa": "^2.5.3",
"koa-body": "^4.0.4",
"koa-router": "^7.4.0",
"koa-static": "^5.0.0",
"koa2-cors": "^2.0.6",
"log4js": "^6.3.0",
"moment": "^2.22.2",
"mysql2": "^2.2.5",
"sqlite": "^4.0.23",
"sqlite3": "^5.0.2",
"uuid": "^3.3.2",
"winston": "^3.1.0"
}
}

View File

@ -1,14 +0,0 @@
module.exports = {
root: true,
env: {
node: true,
},
extends: ["plugin:vue/vue3-essential", "eslint:recommended", "@vue/prettier"],
parserOptions: {
parser: "babel-eslint",
},
rules: {
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
},
};

View File

@ -1,24 +1,24 @@
.DS_Store
node_modules
/dist
package-lock.json
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
.DS_Store
node_modules
/dist
package-lock.json
yarn.lock
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

View File

@ -0,0 +1,4 @@
{
"printWidth": 150,
"tabWidth": 2
}

View File

@ -1,33 +1,28 @@
{
"name": "open-renamer",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"@element-plus/icons": "^0.0.11",
"axios": "^0.21.1",
"core-js": "^3.6.5",
"element-plus": "^1.0.2-beta.48",
"vue": "^3.0.0",
"vue-router": "^4.0.0-0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-plugin-router": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"@vue/compiler-sfc": "^3.0.0",
"@vue/eslint-config-prettier": "^6.0.0",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-vue": "^7.0.0",
"less": "^3.0.4",
"less-loader": "^5.0.0",
"prettier": "^2.2.1"
}
}
{
"name": "open-renamer",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"@element-plus/icons": "^0.0.11",
"axios": "^0.21.1",
"core-js": "^3.6.5",
"element-plus": "^1.0.2-beta.48",
"vue": "^3.0.0",
"vue-router": "^4.0.0-0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-plugin-router": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"@vue/compiler-sfc": "^3.0.0",
"less": "^3.0.4",
"less-loader": "^5.0.0",
"prettier": "^2.2.1"
}
}

View File

@ -1,45 +1,21 @@
<template>
<div v-loading="loading" element-loading-text="后台处理中,请稍候">
<el-button type="primary" @click="dialogVisible = true" size="small"
>1.新增文件</el-button
>
<el-button type="primary" @click="showResult" size="small"
>2.预览</el-button
>
<el-button type="primary" @click="dialogVisible = true" size="small">1.新增文件</el-button>
<el-button type="primary" @click="showResult" size="small">2.预览</el-button>
<el-button type="primary" @click="submit" size="small">3.重命名</el-button>
<!-- 规则列表 -->
<div class="ruleList">
<div class="menu">
<span>应用规则</span>
<el-button type="primary" size="mini" @click="ruleDialogShow = true"
>新增</el-button
>
<el-button
type="primary"
size="mini"
v-if="checkedRules.length == 1"
@click="editClick"
>编辑</el-button
>
<el-button type="warning" size="mini" @click="block"
>禁用/启用</el-button
>
<el-button type="danger" size="mini" @click="deleteRule"
>删除</el-button
>
<el-button type="primary" size="mini" @click="saveOrUpdate"
>保存模板</el-button
>
<el-button type="primary" size="mini" @click="ruleTemplateShow = true"
>选择模板</el-button
>
<el-button type="primary" size="mini" @click="ruleDialogShow = true">新增</el-button>
<el-button type="primary" size="mini" v-if="checkedRules.length == 1" @click="editClick">编辑</el-button>
<el-button type="warning" size="mini" @click="block">禁用/启用</el-button>
<el-button type="danger" size="mini" @click="deleteRule">删除</el-button>
<el-button type="primary" size="mini" @click="saveOrUpdate">保存模板</el-button>
<el-button type="primary" size="mini" @click="ruleTemplateShow = true">选择模板</el-button>
</div>
<div class="ruleBlock">
<el-checkbox
v-model="item.checked"
v-for="(item, index) in ruleList"
:key="index"
>
<el-checkbox v-model="item.checked" v-for="(item, index) in ruleList" :key="index">
<s v-if="item.blocked">{{ item.message }}</s>
<span v-else>{{ item.message }}</span>
</el-checkbox>
@ -50,32 +26,20 @@
<div>
文件列表
<el-button type="primary" size="mini" @click="selectAllFiles"
>反选</el-button
>
<el-button type="danger" size="mini" @click="deleteCheckedFiles"
>删除</el-button
>
<el-button type="primary" size="mini" @click="selectAllFiles">反选</el-button>
<el-button type="danger" size="mini" @click="deleteCheckedFiles">删除</el-button>
</div>
<div class="fileBlock">
<!-- 左侧原始文件名 -->
<el-checkbox
style="display: block"
v-for="(item, index) in fileList"
:key="index"
v-model="item.checked"
><div class="oneFileName">
<el-checkbox style="display: block" v-for="(item, index) in fileList" :key="index" v-model="item.checked">
<div class="oneFileName">
{{ item.name }}
<ArrowDownBold
style="width: 20px; padding-left: 10px"
v-if="index < fileList.length - 1"
@click.stop.prevent="moveIndex(index + 1, index)"
/>
<ArrowUpBold
style="width: 20px; padding-left: 10px"
v-if="index > 0"
@click.stop.prevent="moveIndex(index - 1, index)"
/>
<ArrowUpBold style="width: 20px; padding-left: 10px" v-if="index > 0" @click.stop.prevent="moveIndex(index - 1, index)" />
</div>
</el-checkbox>
</div>
@ -93,7 +57,6 @@
<el-dialog title="新增文件" v-model="dialogVisible" width="70%">
<file-chose @addData="addData" />
</el-dialog>
<el-dialog title="选择规则模板" v-model="ruleTemplateShow" width="70%">
<application-rule-list />
</el-dialog>
@ -142,6 +105,7 @@ export default {
data.forEach((item) => (item.checked = false));
this.fileList.push(...data);
this.dialogVisible = false;
console.log("asdffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
this.needPreview = true;
await this.showResult();
},
@ -163,9 +127,7 @@ export default {
},
///
async block() {
this.ruleList
.filter((item) => item.checked)
.forEach((item) => (item.blocked = !item.blocked));
this.ruleList.filter((item) => item.checked).forEach((item) => (item.blocked = !item.blocked));
this.needPreview = true;
await this.showResult();
},
@ -190,11 +152,7 @@ export default {
fileList: this.fileList,
ruleList: this.ruleList.filter((item) => !item.blocked),
};
this.changedFileList = await HttpUtil.post(
"/renamer/preview",
null,
body
);
this.changedFileList = await HttpUtil.post("/renamer/preview", null, body);
this.needPreview = false;
this.loading = false;
},