diff --git a/.umirc.ts b/.umirc.ts
index 023fcb6c..e8c58209 100644
--- a/.umirc.ts
+++ b/.umirc.ts
@@ -9,10 +9,6 @@ export default defineConfig({
type: 'none',
},
fastRefresh: {},
- // antd: {
- // dark: true,
- // },
- mfsu: {},
esbuild: {},
webpack5: {},
dynamicImport: {
diff --git a/back/app.ts b/back/app.ts
index e689b541..067d7b19 100644
--- a/back/app.ts
+++ b/back/app.ts
@@ -9,12 +9,12 @@ import Logger from './loaders/logger';
async function startServer() {
const app = express();
+ await require('./loaders/db').default();
+
await require('./loaders/initFile').default();
await require('./loaders/sentry').default({ expressApp: app });
- await require('./loaders/db').default();
-
await require('./loaders/app').default({ expressApp: app });
const server = app
diff --git a/back/config/util.ts b/back/config/util.ts
index ef4d3798..e135b98a 100644
--- a/back/config/util.ts
+++ b/back/config/util.ts
@@ -293,7 +293,6 @@ export function readDirs(
if (stats.isDirectory()) {
return {
title: file,
- value: file,
key,
type: 'directory',
disabled: true,
@@ -303,7 +302,6 @@ export function readDirs(
}
return {
title: file,
- value: file,
type: 'file',
key,
parent: relativePath,
@@ -327,7 +325,6 @@ export function readDir(
const key = path.join(relativePath, file);
return {
title: file,
- value: file,
type: stats.isDirectory() ? 'directory' : 'file',
key,
parent: relativePath,
diff --git a/back/loaders/db.ts b/back/loaders/db.ts
index 05583362..e100abcf 100644
--- a/back/loaders/db.ts
+++ b/back/loaders/db.ts
@@ -18,9 +18,7 @@ export default async () => {
await AppModel.sync();
await AuthModel.sync();
await EnvModel.sync();
- await SubscriptionModel.sync({ alter: true });
-
- await sequelize.sync();
+ await SubscriptionModel.sync();
// try {
// const queryInterface = sequelize.getQueryInterface();
diff --git a/src/pages/script/editNameModal.tsx b/src/pages/script/editNameModal.tsx
index 58c8687e..3165e195 100644
--- a/src/pages/script/editNameModal.tsx
+++ b/src/pages/script/editNameModal.tsx
@@ -1,5 +1,14 @@
import React, { useEffect, useState } from 'react';
-import { Modal, message, Input, Form, Select, Upload, Radio } from 'antd';
+import {
+ Modal,
+ message,
+ Input,
+ Form,
+ Select,
+ Upload,
+ Radio,
+ TreeSelect,
+} from 'antd';
import { request } from '@/utils/http';
import config from '@/utils/config';
import { UploadOutlined } from '@ant-design/icons';
@@ -40,7 +49,7 @@ const EditScriptNameModal = ({
.then(({ code, data }) => {
if (code === 200) {
message.success('保存文件成功');
- const key = values.path ? `${values.path}-` : '';
+ const key = values.path ? `${values.path}/` : '';
const filename = file ? file.name : values.filename;
handleCancel({
filename,
@@ -64,15 +73,33 @@ const EditScriptNameModal = ({
setType(e.target.value);
};
+ const getDirs = (data) => {
+ for (const item of data) {
+ if (item.children && item.children.length > 0) {
+ item.children = item.children
+ .filter((x) => x.type === 'directory')
+ .map((x) => ({ ...x, disabled: false }));
+ getDirs(item.children);
+ }
+ }
+ return data;
+ };
+
+ useEffect(() => {
+ const originDirs = treeData
+ .filter((x) => x.type === 'directory')
+ .map((x) => ({ ...x, disabled: false }));
+ const dirs = getDirs(originDirs);
+ setDirs(dirs);
+ }, [treeData]);
+
useEffect(() => {
form.resetFields();
- const originDirs = treeData.filter((x) => x.disabled);
- setDirs([{ key: '' }, ...originDirs]);
}, [visible]);
return (