From cacba43d65e6249e52d4a20ad8aa73f2d56941ed Mon Sep 17 00:00:00 2001 From: Cp0204 Date: Tue, 2 Apr 2024 02:20:26 +0800 Subject: [PATCH] =?UTF-8?q?WebUI=20=E5=A2=9E=E5=8A=A0=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/run.py | 2 +- app/templates/index.html | 173 +++++++++++++++++++++++---------------- 2 files changed, 105 insertions(+), 70 deletions(-) diff --git a/app/run.py b/app/run.py index b6229c2..d387174 100644 --- a/app/run.py +++ b/app/run.py @@ -25,7 +25,7 @@ script_path = os.environ.get("SCRIPT_PATH", "./quark_auto_save.py") config_path = os.environ.get("CONFIG_PATH", "./config/quark_config.json") app = Flask(__name__) -app.config["APP_VERSION"] = "0.2.5.1" +app.config["APP_VERSION"] = "0.2.6" app.secret_key = "ca943f6db6dd34823d36ab08d8d6f65d" app.json.ensure_ascii = False app.json.sort_keys = False diff --git a/app/templates/index.html b/app/templates/index.html index 9f59861..fc34bf5 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -103,68 +103,84 @@

任务列表

+
+ +
+ +
+
+
+ +
+ +
+
-
-
-
-

任务#

-
-
- -
-
- -
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
-
- - +
@@ -228,7 +244,20 @@ }, tasklist: [] }, - run_log: "" + newTask: { + taskname: "", + shareurl: "", + savepath: "", + pattern: "", + replace: "", + enddate: "", + emby_id: "", + runweek: [1, 2, 3, 4, 5, 6, 7] + }, + run_log: "", + taskDirs: [""], + taskDirSelected: "", + taskNameFilter: "" }, watch: { 'formData.push_config': { @@ -263,6 +292,12 @@ } return task; }); + // 存所有任务父目录 + response.data.tasklist.forEach(item => { + parentDir = this.getParentDirectory(item.savepath) + if (!this.taskDirs.includes(parentDir)) + this.taskDirs.push(parentDir); + }); this.formData = response.data; }) .catch(error => { @@ -296,16 +331,10 @@ this.$delete(this.formData.push_config, key); }, addTask() { - this.formData.tasklist.push({ - taskname: "", - shareurl: "", - savepath: "", - pattern: "", - replace: "", - enddate: "", - emby_id: "", - runweek: [1, 2, 3, 4, 5, 6, 7] - }); + newTask = { ...this.newTask } + newTask.taskname = this.taskNameFilter + newTask.savepath = this.taskDirSelected + "/" + newTask.taskname + this.formData.tasklist.push(newTask); }, removeTask(index) { if (confirm("确认删除吗?")) @@ -325,6 +354,12 @@ this.run_log = "错误:\n" + error console.error('Error:', error); }); + }, + getParentDirectory(path) { + parentDir = path.substring(0, path.lastIndexOf('/')) + if (parentDir == "") + parentDir = "/" + return parentDir; } } });