diff --git a/package.json b/package.json index a38eb2a..2eea27b 100644 --- a/package.json +++ b/package.json @@ -10,11 +10,13 @@ "preview": "vite preview" }, "dependencies": { + "axios": "^1.3.2", "mobx": "^6.6.2", "react": "^18.2.0", "react-dom": "^18.2.0", "react-router-dom": "^6.4.2", - "sass": "^1.58.0" + "sass": "^1.58.0", + "spark-md5": "^3.0.2" }, "devDependencies": { "@types/react": "^18.0.27", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b4ccd12..b4df603 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,19 +4,23 @@ specifiers: '@types/react': ^18.0.27 '@types/react-dom': ^18.0.10 '@vitejs/plugin-react': ^3.1.0 + axios: ^1.3.2 mobx: ^6.6.2 react: ^18.2.0 react-dom: ^18.2.0 react-router-dom: ^6.4.2 sass: ^1.58.0 + spark-md5: ^3.0.2 vite: ^4.1.0 dependencies: + axios: registry.npmmirror.com/axios/1.3.2 mobx: 6.7.0 react: 18.2.0 react-dom: 18.2.0_react@18.2.0 react-router-dom: 6.8.0_biqbaboplfbrettd7655fr4n2y sass: 1.58.0 + spark-md5: registry.npmmirror.com/spark-md5/3.0.2 devDependencies: '@types/react': 18.0.27 @@ -253,204 +257,6 @@ packages: to-fast-properties: 2.0.0 dev: true - /@esbuild/android-arm/0.16.17: - resolution: {integrity: sha512-N9x1CMXVhtWEAMS7pNNONyA14f71VPQN9Cnavj1XQh6T7bskqiLLrSca4O0Vr8Wdcga943eThxnVp3JLnBMYtw==} - engines: {node: '>=12'} - cpu: [arm] - os: [android] - requiresBuild: true - dev: true - optional: true - - /@esbuild/android-arm64/0.16.17: - resolution: {integrity: sha512-MIGl6p5sc3RDTLLkYL1MyL8BMRN4tLMRCn+yRJJmEDvYZ2M7tmAf80hx1kbNEUX2KJ50RRtxZ4JHLvCfuB6kBg==} - engines: {node: '>=12'} - cpu: [arm64] - os: [android] - requiresBuild: true - dev: true - optional: true - - /@esbuild/android-x64/0.16.17: - resolution: {integrity: sha512-a3kTv3m0Ghh4z1DaFEuEDfz3OLONKuFvI4Xqczqx4BqLyuFaFkuaG4j2MtA6fuWEFeC5x9IvqnX7drmRq/fyAQ==} - engines: {node: '>=12'} - cpu: [x64] - os: [android] - requiresBuild: true - dev: true - optional: true - - /@esbuild/darwin-arm64/0.16.17: - resolution: {integrity: sha512-/2agbUEfmxWHi9ARTX6OQ/KgXnOWfsNlTeLcoV7HSuSTv63E4DqtAc+2XqGw1KHxKMHGZgbVCZge7HXWX9Vn+w==} - engines: {node: '>=12'} - cpu: [arm64] - os: [darwin] - requiresBuild: true - dev: true - optional: true - - /@esbuild/darwin-x64/0.16.17: - resolution: {integrity: sha512-2By45OBHulkd9Svy5IOCZt376Aa2oOkiE9QWUK9fe6Tb+WDr8hXL3dpqi+DeLiMed8tVXspzsTAvd0jUl96wmg==} - engines: {node: '>=12'} - cpu: [x64] - os: [darwin] - requiresBuild: true - dev: true - optional: true - - /@esbuild/freebsd-arm64/0.16.17: - resolution: {integrity: sha512-mt+cxZe1tVx489VTb4mBAOo2aKSnJ33L9fr25JXpqQqzbUIw/yzIzi+NHwAXK2qYV1lEFp4OoVeThGjUbmWmdw==} - engines: {node: '>=12'} - cpu: [arm64] - os: [freebsd] - requiresBuild: true - dev: true - optional: true - - /@esbuild/freebsd-x64/0.16.17: - resolution: {integrity: sha512-8ScTdNJl5idAKjH8zGAsN7RuWcyHG3BAvMNpKOBaqqR7EbUhhVHOqXRdL7oZvz8WNHL2pr5+eIT5c65kA6NHug==} - engines: {node: '>=12'} - cpu: [x64] - os: [freebsd] - requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-arm/0.16.17: - resolution: {integrity: sha512-iihzrWbD4gIT7j3caMzKb/RsFFHCwqqbrbH9SqUSRrdXkXaygSZCZg1FybsZz57Ju7N/SHEgPyaR0LZ8Zbe9gQ==} - engines: {node: '>=12'} - cpu: [arm] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-arm64/0.16.17: - resolution: {integrity: sha512-7S8gJnSlqKGVJunnMCrXHU9Q8Q/tQIxk/xL8BqAP64wchPCTzuM6W3Ra8cIa1HIflAvDnNOt2jaL17vaW+1V0g==} - engines: {node: '>=12'} - cpu: [arm64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-ia32/0.16.17: - resolution: {integrity: sha512-kiX69+wcPAdgl3Lonh1VI7MBr16nktEvOfViszBSxygRQqSpzv7BffMKRPMFwzeJGPxcio0pdD3kYQGpqQ2SSg==} - engines: {node: '>=12'} - cpu: [ia32] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-loong64/0.16.17: - resolution: {integrity: sha512-dTzNnQwembNDhd654cA4QhbS9uDdXC3TKqMJjgOWsC0yNCbpzfWoXdZvp0mY7HU6nzk5E0zpRGGx3qoQg8T2DQ==} - engines: {node: '>=12'} - cpu: [loong64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-mips64el/0.16.17: - resolution: {integrity: sha512-ezbDkp2nDl0PfIUn0CsQ30kxfcLTlcx4Foz2kYv8qdC6ia2oX5Q3E/8m6lq84Dj/6b0FrkgD582fJMIfHhJfSw==} - engines: {node: '>=12'} - cpu: [mips64el] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-ppc64/0.16.17: - resolution: {integrity: sha512-dzS678gYD1lJsW73zrFhDApLVdM3cUF2MvAa1D8K8KtcSKdLBPP4zZSLy6LFZ0jYqQdQ29bjAHJDgz0rVbLB3g==} - engines: {node: '>=12'} - cpu: [ppc64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-riscv64/0.16.17: - resolution: {integrity: sha512-ylNlVsxuFjZK8DQtNUwiMskh6nT0vI7kYl/4fZgV1llP5d6+HIeL/vmmm3jpuoo8+NuXjQVZxmKuhDApK0/cKw==} - engines: {node: '>=12'} - cpu: [riscv64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-s390x/0.16.17: - resolution: {integrity: sha512-gzy7nUTO4UA4oZ2wAMXPNBGTzZFP7mss3aKR2hH+/4UUkCOyqmjXiKpzGrY2TlEUhbbejzXVKKGazYcQTZWA/w==} - engines: {node: '>=12'} - cpu: [s390x] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-x64/0.16.17: - resolution: {integrity: sha512-mdPjPxfnmoqhgpiEArqi4egmBAMYvaObgn4poorpUaqmvzzbvqbowRllQ+ZgzGVMGKaPkqUmPDOOFQRUFDmeUw==} - engines: {node: '>=12'} - cpu: [x64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/netbsd-x64/0.16.17: - resolution: {integrity: sha512-/PzmzD/zyAeTUsduZa32bn0ORug+Jd1EGGAUJvqfeixoEISYpGnAezN6lnJoskauoai0Jrs+XSyvDhppCPoKOA==} - engines: {node: '>=12'} - cpu: [x64] - os: [netbsd] - requiresBuild: true - dev: true - optional: true - - /@esbuild/openbsd-x64/0.16.17: - resolution: {integrity: sha512-2yaWJhvxGEz2RiftSk0UObqJa/b+rIAjnODJgv2GbGGpRwAfpgzyrg1WLK8rqA24mfZa9GvpjLcBBg8JHkoodg==} - engines: {node: '>=12'} - cpu: [x64] - os: [openbsd] - requiresBuild: true - dev: true - optional: true - - /@esbuild/sunos-x64/0.16.17: - resolution: {integrity: sha512-xtVUiev38tN0R3g8VhRfN7Zl42YCJvyBhRKw1RJjwE1d2emWTVToPLNEQj/5Qxc6lVFATDiy6LjVHYhIPrLxzw==} - engines: {node: '>=12'} - cpu: [x64] - os: [sunos] - requiresBuild: true - dev: true - optional: true - - /@esbuild/win32-arm64/0.16.17: - resolution: {integrity: sha512-ga8+JqBDHY4b6fQAmOgtJJue36scANy4l/rL97W+0wYmijhxKetzZdKOJI7olaBaMhWt8Pac2McJdZLxXWUEQw==} - engines: {node: '>=12'} - cpu: [arm64] - os: [win32] - requiresBuild: true - dev: true - optional: true - - /@esbuild/win32-ia32/0.16.17: - resolution: {integrity: sha512-WnsKaf46uSSF/sZhwnqE4L/F89AYNMiD4YtEcYekBt9Q7nj0DiId2XH2Ng2PHM54qi5oPrQ8luuzGszqi/veig==} - engines: {node: '>=12'} - cpu: [ia32] - os: [win32] - requiresBuild: true - dev: true - optional: true - - /@esbuild/win32-x64/0.16.17: - resolution: {integrity: sha512-y+EHuSchhL7FjHgvQL/0fnnFmO4T1bhvWANX6gcnqTjtnKWbTvUMCpGnv2+t+31d7RzyEAYAd4u2fnIhHL6N/Q==} - engines: {node: '>=12'} - cpu: [x64] - os: [win32] - requiresBuild: true - dev: true - optional: true - /@jridgewell/gen-mapping/0.1.1: resolution: {integrity: sha512-sQXCasFk+U8lWYEe66WxRDOE9PjVz4vSM51fTu3Hw+ClTpUSQb718772vH3pyS5pShp6lvQM7SxgIDXXXmOX7w==} engines: {node: '>=6.0.0'} @@ -592,7 +398,7 @@ packages: normalize-path: 3.0.0 readdirp: 3.6.0 optionalDependencies: - fsevents: 2.3.2 + fsevents: registry.npmmirror.com/fsevents/2.3.2 /color-convert/1.9.3: resolution: {integrity: sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==} @@ -634,28 +440,28 @@ packages: hasBin: true requiresBuild: true optionalDependencies: - '@esbuild/android-arm': 0.16.17 - '@esbuild/android-arm64': 0.16.17 - '@esbuild/android-x64': 0.16.17 - '@esbuild/darwin-arm64': 0.16.17 - '@esbuild/darwin-x64': 0.16.17 - '@esbuild/freebsd-arm64': 0.16.17 - '@esbuild/freebsd-x64': 0.16.17 - '@esbuild/linux-arm': 0.16.17 - '@esbuild/linux-arm64': 0.16.17 - '@esbuild/linux-ia32': 0.16.17 - '@esbuild/linux-loong64': 0.16.17 - '@esbuild/linux-mips64el': 0.16.17 - '@esbuild/linux-ppc64': 0.16.17 - '@esbuild/linux-riscv64': 0.16.17 - '@esbuild/linux-s390x': 0.16.17 - '@esbuild/linux-x64': 0.16.17 - '@esbuild/netbsd-x64': 0.16.17 - '@esbuild/openbsd-x64': 0.16.17 - '@esbuild/sunos-x64': 0.16.17 - '@esbuild/win32-arm64': 0.16.17 - '@esbuild/win32-ia32': 0.16.17 - '@esbuild/win32-x64': 0.16.17 + '@esbuild/android-arm': registry.npmmirror.com/@esbuild/android-arm/0.16.17 + '@esbuild/android-arm64': registry.npmmirror.com/@esbuild/android-arm64/0.16.17 + '@esbuild/android-x64': registry.npmmirror.com/@esbuild/android-x64/0.16.17 + '@esbuild/darwin-arm64': registry.npmmirror.com/@esbuild/darwin-arm64/0.16.17 + '@esbuild/darwin-x64': registry.npmmirror.com/@esbuild/darwin-x64/0.16.17 + '@esbuild/freebsd-arm64': registry.npmmirror.com/@esbuild/freebsd-arm64/0.16.17 + '@esbuild/freebsd-x64': registry.npmmirror.com/@esbuild/freebsd-x64/0.16.17 + '@esbuild/linux-arm': registry.npmmirror.com/@esbuild/linux-arm/0.16.17 + '@esbuild/linux-arm64': registry.npmmirror.com/@esbuild/linux-arm64/0.16.17 + '@esbuild/linux-ia32': registry.npmmirror.com/@esbuild/linux-ia32/0.16.17 + '@esbuild/linux-loong64': registry.npmmirror.com/@esbuild/linux-loong64/0.16.17 + '@esbuild/linux-mips64el': registry.npmmirror.com/@esbuild/linux-mips64el/0.16.17 + '@esbuild/linux-ppc64': registry.npmmirror.com/@esbuild/linux-ppc64/0.16.17 + '@esbuild/linux-riscv64': registry.npmmirror.com/@esbuild/linux-riscv64/0.16.17 + '@esbuild/linux-s390x': registry.npmmirror.com/@esbuild/linux-s390x/0.16.17 + '@esbuild/linux-x64': registry.npmmirror.com/@esbuild/linux-x64/0.16.17 + '@esbuild/netbsd-x64': registry.npmmirror.com/@esbuild/netbsd-x64/0.16.17 + '@esbuild/openbsd-x64': registry.npmmirror.com/@esbuild/openbsd-x64/0.16.17 + '@esbuild/sunos-x64': registry.npmmirror.com/@esbuild/sunos-x64/0.16.17 + '@esbuild/win32-arm64': registry.npmmirror.com/@esbuild/win32-arm64/0.16.17 + '@esbuild/win32-ia32': registry.npmmirror.com/@esbuild/win32-ia32/0.16.17 + '@esbuild/win32-x64': registry.npmmirror.com/@esbuild/win32-x64/0.16.17 dev: true /escalade/3.1.1: @@ -674,13 +480,6 @@ packages: dependencies: to-regex-range: 5.0.1 - /fsevents/2.3.2: - resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==} - engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} - os: [darwin] - requiresBuild: true - optional: true - /function-bind/1.1.1: resolution: {integrity: sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==} dev: true @@ -885,7 +684,7 @@ packages: engines: {node: '>=14.18.0', npm: '>=8.0.0'} hasBin: true optionalDependencies: - fsevents: 2.3.2 + fsevents: registry.npmmirror.com/fsevents/2.3.2 dev: true /sass/1.58.0: @@ -977,9 +776,345 @@ packages: rollup: 3.14.0 sass: 1.58.0 optionalDependencies: - fsevents: 2.3.2 + fsevents: registry.npmmirror.com/fsevents/2.3.2 dev: true /yallist/3.1.1: resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==} dev: true + + registry.npmmirror.com/@esbuild/android-arm/0.16.17: + resolution: {integrity: sha512-N9x1CMXVhtWEAMS7pNNONyA14f71VPQN9Cnavj1XQh6T7bskqiLLrSca4O0Vr8Wdcga943eThxnVp3JLnBMYtw==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@esbuild/android-arm/-/android-arm-0.16.17.tgz} + name: '@esbuild/android-arm' + version: 0.16.17 + engines: {node: '>=12'} + cpu: [arm] + os: [android] + requiresBuild: true + dev: true + optional: true + + registry.npmmirror.com/@esbuild/android-arm64/0.16.17: + resolution: {integrity: sha512-MIGl6p5sc3RDTLLkYL1MyL8BMRN4tLMRCn+yRJJmEDvYZ2M7tmAf80hx1kbNEUX2KJ50RRtxZ4JHLvCfuB6kBg==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@esbuild/android-arm64/-/android-arm64-0.16.17.tgz} + name: '@esbuild/android-arm64' + version: 0.16.17 + engines: {node: '>=12'} + cpu: [arm64] + os: [android] + requiresBuild: true + dev: true + optional: true + + registry.npmmirror.com/@esbuild/android-x64/0.16.17: + resolution: {integrity: sha512-a3kTv3m0Ghh4z1DaFEuEDfz3OLONKuFvI4Xqczqx4BqLyuFaFkuaG4j2MtA6fuWEFeC5x9IvqnX7drmRq/fyAQ==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@esbuild/android-x64/-/android-x64-0.16.17.tgz} + name: '@esbuild/android-x64' + version: 0.16.17 + engines: {node: '>=12'} + cpu: [x64] + os: [android] + requiresBuild: true + dev: true + optional: true + + registry.npmmirror.com/@esbuild/darwin-arm64/0.16.17: + resolution: {integrity: sha512-/2agbUEfmxWHi9ARTX6OQ/KgXnOWfsNlTeLcoV7HSuSTv63E4DqtAc+2XqGw1KHxKMHGZgbVCZge7HXWX9Vn+w==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@esbuild/darwin-arm64/-/darwin-arm64-0.16.17.tgz} + name: '@esbuild/darwin-arm64' + version: 0.16.17 + engines: {node: '>=12'} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + registry.npmmirror.com/@esbuild/darwin-x64/0.16.17: + resolution: {integrity: sha512-2By45OBHulkd9Svy5IOCZt376Aa2oOkiE9QWUK9fe6Tb+WDr8hXL3dpqi+DeLiMed8tVXspzsTAvd0jUl96wmg==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@esbuild/darwin-x64/-/darwin-x64-0.16.17.tgz} + name: '@esbuild/darwin-x64' + version: 0.16.17 + engines: {node: '>=12'} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + registry.npmmirror.com/@esbuild/freebsd-arm64/0.16.17: + resolution: {integrity: sha512-mt+cxZe1tVx489VTb4mBAOo2aKSnJ33L9fr25JXpqQqzbUIw/yzIzi+NHwAXK2qYV1lEFp4OoVeThGjUbmWmdw==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.16.17.tgz} + name: '@esbuild/freebsd-arm64' + version: 0.16.17 + engines: {node: '>=12'} + cpu: [arm64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + + registry.npmmirror.com/@esbuild/freebsd-x64/0.16.17: + resolution: {integrity: sha512-8ScTdNJl5idAKjH8zGAsN7RuWcyHG3BAvMNpKOBaqqR7EbUhhVHOqXRdL7oZvz8WNHL2pr5+eIT5c65kA6NHug==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@esbuild/freebsd-x64/-/freebsd-x64-0.16.17.tgz} + name: '@esbuild/freebsd-x64' + version: 0.16.17 + engines: {node: '>=12'} + cpu: [x64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + + registry.npmmirror.com/@esbuild/linux-arm/0.16.17: + resolution: {integrity: sha512-iihzrWbD4gIT7j3caMzKb/RsFFHCwqqbrbH9SqUSRrdXkXaygSZCZg1FybsZz57Ju7N/SHEgPyaR0LZ8Zbe9gQ==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@esbuild/linux-arm/-/linux-arm-0.16.17.tgz} + name: '@esbuild/linux-arm' + version: 0.16.17 + engines: {node: '>=12'} + cpu: [arm] + os: [linux] + requiresBuild: true + dev: true + optional: true + + registry.npmmirror.com/@esbuild/linux-arm64/0.16.17: + resolution: {integrity: sha512-7S8gJnSlqKGVJunnMCrXHU9Q8Q/tQIxk/xL8BqAP64wchPCTzuM6W3Ra8cIa1HIflAvDnNOt2jaL17vaW+1V0g==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@esbuild/linux-arm64/-/linux-arm64-0.16.17.tgz} + name: '@esbuild/linux-arm64' + version: 0.16.17 + engines: {node: '>=12'} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + registry.npmmirror.com/@esbuild/linux-ia32/0.16.17: + resolution: {integrity: sha512-kiX69+wcPAdgl3Lonh1VI7MBr16nktEvOfViszBSxygRQqSpzv7BffMKRPMFwzeJGPxcio0pdD3kYQGpqQ2SSg==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@esbuild/linux-ia32/-/linux-ia32-0.16.17.tgz} + name: '@esbuild/linux-ia32' + version: 0.16.17 + engines: {node: '>=12'} + cpu: [ia32] + os: [linux] + requiresBuild: true + dev: true + optional: true + + registry.npmmirror.com/@esbuild/linux-loong64/0.16.17: + resolution: {integrity: sha512-dTzNnQwembNDhd654cA4QhbS9uDdXC3TKqMJjgOWsC0yNCbpzfWoXdZvp0mY7HU6nzk5E0zpRGGx3qoQg8T2DQ==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@esbuild/linux-loong64/-/linux-loong64-0.16.17.tgz} + name: '@esbuild/linux-loong64' + version: 0.16.17 + engines: {node: '>=12'} + cpu: [loong64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + registry.npmmirror.com/@esbuild/linux-mips64el/0.16.17: + resolution: {integrity: sha512-ezbDkp2nDl0PfIUn0CsQ30kxfcLTlcx4Foz2kYv8qdC6ia2oX5Q3E/8m6lq84Dj/6b0FrkgD582fJMIfHhJfSw==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@esbuild/linux-mips64el/-/linux-mips64el-0.16.17.tgz} + name: '@esbuild/linux-mips64el' + version: 0.16.17 + engines: {node: '>=12'} + cpu: [mips64el] + os: [linux] + requiresBuild: true + dev: true + optional: true + + registry.npmmirror.com/@esbuild/linux-ppc64/0.16.17: + resolution: {integrity: sha512-dzS678gYD1lJsW73zrFhDApLVdM3cUF2MvAa1D8K8KtcSKdLBPP4zZSLy6LFZ0jYqQdQ29bjAHJDgz0rVbLB3g==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@esbuild/linux-ppc64/-/linux-ppc64-0.16.17.tgz} + name: '@esbuild/linux-ppc64' + version: 0.16.17 + engines: {node: '>=12'} + cpu: [ppc64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + registry.npmmirror.com/@esbuild/linux-riscv64/0.16.17: + resolution: {integrity: sha512-ylNlVsxuFjZK8DQtNUwiMskh6nT0vI7kYl/4fZgV1llP5d6+HIeL/vmmm3jpuoo8+NuXjQVZxmKuhDApK0/cKw==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@esbuild/linux-riscv64/-/linux-riscv64-0.16.17.tgz} + name: '@esbuild/linux-riscv64' + version: 0.16.17 + engines: {node: '>=12'} + cpu: [riscv64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + registry.npmmirror.com/@esbuild/linux-s390x/0.16.17: + resolution: {integrity: sha512-gzy7nUTO4UA4oZ2wAMXPNBGTzZFP7mss3aKR2hH+/4UUkCOyqmjXiKpzGrY2TlEUhbbejzXVKKGazYcQTZWA/w==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@esbuild/linux-s390x/-/linux-s390x-0.16.17.tgz} + name: '@esbuild/linux-s390x' + version: 0.16.17 + engines: {node: '>=12'} + cpu: [s390x] + os: [linux] + requiresBuild: true + dev: true + optional: true + + registry.npmmirror.com/@esbuild/linux-x64/0.16.17: + resolution: {integrity: sha512-mdPjPxfnmoqhgpiEArqi4egmBAMYvaObgn4poorpUaqmvzzbvqbowRllQ+ZgzGVMGKaPkqUmPDOOFQRUFDmeUw==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@esbuild/linux-x64/-/linux-x64-0.16.17.tgz} + name: '@esbuild/linux-x64' + version: 0.16.17 + engines: {node: '>=12'} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + registry.npmmirror.com/@esbuild/netbsd-x64/0.16.17: + resolution: {integrity: sha512-/PzmzD/zyAeTUsduZa32bn0ORug+Jd1EGGAUJvqfeixoEISYpGnAezN6lnJoskauoai0Jrs+XSyvDhppCPoKOA==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@esbuild/netbsd-x64/-/netbsd-x64-0.16.17.tgz} + name: '@esbuild/netbsd-x64' + version: 0.16.17 + engines: {node: '>=12'} + cpu: [x64] + os: [netbsd] + requiresBuild: true + dev: true + optional: true + + registry.npmmirror.com/@esbuild/openbsd-x64/0.16.17: + resolution: {integrity: sha512-2yaWJhvxGEz2RiftSk0UObqJa/b+rIAjnODJgv2GbGGpRwAfpgzyrg1WLK8rqA24mfZa9GvpjLcBBg8JHkoodg==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@esbuild/openbsd-x64/-/openbsd-x64-0.16.17.tgz} + name: '@esbuild/openbsd-x64' + version: 0.16.17 + engines: {node: '>=12'} + cpu: [x64] + os: [openbsd] + requiresBuild: true + dev: true + optional: true + + registry.npmmirror.com/@esbuild/sunos-x64/0.16.17: + resolution: {integrity: sha512-xtVUiev38tN0R3g8VhRfN7Zl42YCJvyBhRKw1RJjwE1d2emWTVToPLNEQj/5Qxc6lVFATDiy6LjVHYhIPrLxzw==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@esbuild/sunos-x64/-/sunos-x64-0.16.17.tgz} + name: '@esbuild/sunos-x64' + version: 0.16.17 + engines: {node: '>=12'} + cpu: [x64] + os: [sunos] + requiresBuild: true + dev: true + optional: true + + registry.npmmirror.com/@esbuild/win32-arm64/0.16.17: + resolution: {integrity: sha512-ga8+JqBDHY4b6fQAmOgtJJue36scANy4l/rL97W+0wYmijhxKetzZdKOJI7olaBaMhWt8Pac2McJdZLxXWUEQw==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@esbuild/win32-arm64/-/win32-arm64-0.16.17.tgz} + name: '@esbuild/win32-arm64' + version: 0.16.17 + engines: {node: '>=12'} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + registry.npmmirror.com/@esbuild/win32-ia32/0.16.17: + resolution: {integrity: sha512-WnsKaf46uSSF/sZhwnqE4L/F89AYNMiD4YtEcYekBt9Q7nj0DiId2XH2Ng2PHM54qi5oPrQ8luuzGszqi/veig==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@esbuild/win32-ia32/-/win32-ia32-0.16.17.tgz} + name: '@esbuild/win32-ia32' + version: 0.16.17 + engines: {node: '>=12'} + cpu: [ia32] + os: [win32] + requiresBuild: true + dev: true + optional: true + + registry.npmmirror.com/@esbuild/win32-x64/0.16.17: + resolution: {integrity: sha512-y+EHuSchhL7FjHgvQL/0fnnFmO4T1bhvWANX6gcnqTjtnKWbTvUMCpGnv2+t+31d7RzyEAYAd4u2fnIhHL6N/Q==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@esbuild/win32-x64/-/win32-x64-0.16.17.tgz} + name: '@esbuild/win32-x64' + version: 0.16.17 + engines: {node: '>=12'} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + registry.npmmirror.com/asynckit/0.4.0: + resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/asynckit/-/asynckit-0.4.0.tgz} + name: asynckit + version: 0.4.0 + dev: false + + registry.npmmirror.com/axios/1.3.2: + resolution: {integrity: sha512-1M3O703bYqYuPhbHeya5bnhpYVsDDRyQSabNja04mZtboLNSuZ4YrltestrLXfHgmzua4TpUqRiVKbiQuo2epw==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/axios/-/axios-1.3.2.tgz} + name: axios + version: 1.3.2 + dependencies: + follow-redirects: registry.npmmirror.com/follow-redirects/1.15.2 + form-data: registry.npmmirror.com/form-data/4.0.0 + proxy-from-env: registry.npmmirror.com/proxy-from-env/1.1.0 + transitivePeerDependencies: + - debug + dev: false + + registry.npmmirror.com/combined-stream/1.0.8: + resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/combined-stream/-/combined-stream-1.0.8.tgz} + name: combined-stream + version: 1.0.8 + engines: {node: '>= 0.8'} + dependencies: + delayed-stream: registry.npmmirror.com/delayed-stream/1.0.0 + dev: false + + registry.npmmirror.com/delayed-stream/1.0.0: + resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/delayed-stream/-/delayed-stream-1.0.0.tgz} + name: delayed-stream + version: 1.0.0 + engines: {node: '>=0.4.0'} + dev: false + + registry.npmmirror.com/follow-redirects/1.15.2: + resolution: {integrity: sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/follow-redirects/-/follow-redirects-1.15.2.tgz} + name: follow-redirects + version: 1.15.2 + engines: {node: '>=4.0'} + peerDependencies: + debug: '*' + peerDependenciesMeta: + debug: + optional: true + dev: false + + registry.npmmirror.com/form-data/4.0.0: + resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/form-data/-/form-data-4.0.0.tgz} + name: form-data + version: 4.0.0 + engines: {node: '>= 6'} + dependencies: + asynckit: registry.npmmirror.com/asynckit/0.4.0 + combined-stream: registry.npmmirror.com/combined-stream/1.0.8 + mime-types: registry.npmmirror.com/mime-types/2.1.35 + dev: false + + registry.npmmirror.com/fsevents/2.3.2: + resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/fsevents/-/fsevents-2.3.2.tgz} + name: fsevents + version: 2.3.2 + engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} + os: [darwin] + requiresBuild: true + optional: true + + registry.npmmirror.com/mime-db/1.52.0: + resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/mime-db/-/mime-db-1.52.0.tgz} + name: mime-db + version: 1.52.0 + engines: {node: '>= 0.6'} + dev: false + + registry.npmmirror.com/mime-types/2.1.35: + resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/mime-types/-/mime-types-2.1.35.tgz} + name: mime-types + version: 2.1.35 + engines: {node: '>= 0.6'} + dependencies: + mime-db: registry.npmmirror.com/mime-db/1.52.0 + dev: false + + registry.npmmirror.com/proxy-from-env/1.1.0: + resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz} + name: proxy-from-env + version: 1.1.0 + dev: false + + registry.npmmirror.com/spark-md5/3.0.2: + resolution: {integrity: sha512-wcFzz9cDfbuqe0FZzfi2or1sgyIrsDwmPwfZC4hiNidPdPINjeUwNfv5kldczoEAcjl9Y1L3SM7Uz2PUEQzxQw==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/spark-md5/-/spark-md5-3.0.2.tgz} + name: spark-md5 + version: 3.0.2 + dev: false diff --git a/src/assets/save.svg b/src/assets/save.svg new file mode 100644 index 0000000..f79cf6c --- /dev/null +++ b/src/assets/save.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/components/Modal/index.jsx b/src/components/Modal/index.jsx index e75fad3..43c81ab 100644 --- a/src/components/Modal/index.jsx +++ b/src/components/Modal/index.jsx @@ -33,7 +33,7 @@ export default function Dialog(props){ modalRoot.style.display = 'none' settemCloseAnimation(BPEMR.temModalShow) } - }) + }, [state, width]) useEffect(() => { modalRoot.style.animation = 'modalRootHide ease-in-out 500ms forwards' diff --git a/src/components/StyleControl/index.jsx b/src/components/StyleControl/index.jsx index 48f2a39..e054d56 100644 --- a/src/components/StyleControl/index.jsx +++ b/src/components/StyleControl/index.jsx @@ -1,55 +1,84 @@ import css from './index.module.scss' import {useState} from "react"; +import {defaultStore} from "@/store/index.js"; +import {getMD5} from "@/tools/index.js"; +import api from '@/request/api' export default function StyleControl(props) { - - if (!props.node) return undefined; + if (!props.node) return null; const styleArr = props.node.config.style; - - const [styleReal, setStyleReal] = useState({ - 'background-img': undefined, - 'background-color': undefined, - 'background-other': undefined, - 'position': 'absolute', - 'width': undefined, + let styleRealTem = { + 'background-img': '', + 'background-color': '', + 'background-other': '', + 'position': 'relative', + 'width': '', 'width-mx':'px', - 'height': undefined, + 'height': '', 'height-mx': 'px', - 'backdrop-filter': undefined, - 'top': undefined, - 'right': undefined, - 'bottom': undefined, - 'left': undefined, + 'backdrop-filter': '', + 'top': '', + 'right': '', + 'bottom': '', + 'left': '', 'top-mx': 'px', 'right-mx': 'px', 'bottom-mx': 'px', 'left-mx': 'px', - 'margin': undefined, - 'padding': undefined, - 'border-radius': undefined, + 'margin': '', + 'padding': '', + 'border-radius': '', 'border-radius-mx': 'px', - 'border': undefined, - 'href': undefined, + 'border': '', + 'href': '', 'overflow': 'auto', - 'color': undefined, - 'font-size': undefined, + 'color': '', + 'font-size': '', 'font-size-mx': 'em', - 'font-weight': undefined, - 'line-height': undefined, + 'font-weight': '', + 'line-height': '', 'line-height-mx': 'px', 'text-align': 'left', - 'white-space': undefined, - 'text-indent': undefined, + 'white-space': '', + 'text-indent': '', 'text-indent-mx': 'px', - }) + } + if(props.node.config.styleReal){ + styleRealTem = JSON.parse(JSON.stringify(props.node.config.styleReal)) + } - function handleStyleCHange(e, caseText) { - if(caseText == "background-img"){ + const [styleReal, setStyleReal] = useState(styleRealTem) + async function handleStyleCHange(e, caseText) { + if(caseText == "background-img"){ + const file = e.target.files[0]; + const md5 = await getMD5(file) + const data = { + md5, + file + } + const response = await api.putFile(data) + if(!response.data.state){ + alert(response.data.data.message) + return + } + styleReal.img = response.data.data.filename }else{ styleReal[caseText] = e.target.value; } setStyleReal({...styleReal}) + if(defaultStore.styleTimeout){ + clearTimeout(defaultStore.styleTimeout) + defaultStore.setStyleTimeout(setTimeout(() => { + defaultStore.setStyle(Math.random(), styleReal) + defaultStore.setStyleTimeout(null) + },1000)) + }else{ + defaultStore.setStyleTimeout(setTimeout(() => { + defaultStore.setStyle(Math.random(), styleReal) + defaultStore.setStyleTimeout(null) + },1000)) + } } diff --git a/src/request/api.js b/src/request/api.js new file mode 100644 index 0000000..053cc06 --- /dev/null +++ b/src/request/api.js @@ -0,0 +1,33 @@ +import instance from './index' + +export default { + getContainerList(data){ + return instance.get('/container',{ + params:data + }) + }, + createContainer(data){ + const formData = new FormData() + Object.keys(data).map(item => { + formData.append(item, data[item]) + }) + return instance.post('/container/createContainer',formData) + }, + updateContainer(data){ + const formData = new FormData() + Object.keys(data).map(item => { + formData.append(item, data[item]) + }) + return instance.put('/container/',formData) + }, + deleteContainer(data){ + return instance.delete('/container/',{params:data}) + }, + putFile(data){ + const formData = new FormData() + Object.keys(data).map(item => { + formData.append(item, data[item]) + }) + return instance.post('/fileStorage/putfile/',formData) + } +} \ No newline at end of file diff --git a/src/request/index.js b/src/request/index.js new file mode 100644 index 0000000..a1aa259 --- /dev/null +++ b/src/request/index.js @@ -0,0 +1,13 @@ +import axios from "axios"; +// 使用库提供的默认配置创建实例 +// 此时超时配置的默认值是 `0` +const instance = axios.create(); + +// 重写库的超时默认值 +// 现在,所有使用此实例的请求都将等待2.5秒,然后才会超时 +instance.defaults.timeout = 25000; +instance.defaults.baseURL = '/api' +instance.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'; + +// 重写此请求的超时时间,因为该请求需要很长时间 +export default instance \ No newline at end of file diff --git a/src/store/defaultStore.js b/src/store/defaultStore.js index 8261f68..55805e3 100644 --- a/src/store/defaultStore.js +++ b/src/store/defaultStore.js @@ -1,6 +1,9 @@ -import {observable, action, computed, makeObservable} from "mobx"; +import {observable, action, computed, makeObservable, runInAction} from "mobx"; import {config} from "@/config/sys22"; import {NE} from "@/tools/index.js"; +import api from "@/request/api.js"; +import {defaultStore} from "@/store/index.js"; +import {act} from "react-dom/test-utils"; class DefaultStore { // 系统配置 @@ -31,7 +34,16 @@ class DefaultStore { // 选择的元素节点 chooseNodeId = null; // 删除节点元素 - deleteChooseNodeId = null + deleteChooseNodeId = null; + + // 容器列表 + thumbnailList = []; + // 当前MenuId + menuId = 10; + // 修改样式参数 + styleRealRand = null; + styleReal = null; + styleTimeout = null; constructor() { // mobx6 和以前版本这是最大的区别 @@ -42,23 +54,32 @@ class DefaultStore { chooseNodeId: observable, deleteChooseNodeId: observable, newElementIdentify: observable, + thumbnailList: observable, + menuId: observable, + styleRealRand: observable, + styleReal: observable, + styleTimeout: observable, + containerList: computed, setNewElementIdentify: action, - setName: action, setChooseNodeId: action, - deleteChooseNode:action, - titleName: computed - }); - } + deleteChooseNode: action, + setStyle: action, - setName(v) { - console.log('触发action'); - this.name = v; + getContainerList: action, + createConatiner: action, + updateContainer: action, + deleteContainer: action + }); } - get titleName() { - return this.name + '___111'; + get containerList() { + const containerList = {} + this.thumbnailList.map(item => { + containerList[item.id] = JSON.parse(JSON.stringify(item.body)) + }) + return containerList } // 在页面添加新元素 @@ -70,10 +91,48 @@ class DefaultStore { setChooseNodeId(id) { this.chooseNodeId = id } + // 删除节点元素 - deleteChooseNode(id){ + deleteChooseNode(id) { this.deleteChooseNodeId = id } + + // 修改央视参数 + setStyle(random, style) { + this.styleReal = style; + this.styleRealRand = random; + } + setStyleTimeout(a){ + this.styleTimeout = a + } + + // 获取内容列表 + async getContainerList(menuId) { + const data = await api.getContainerList({menuId}) + runInAction(() => { + const thumbnailList = data.data.data + this.thumbnailList = thumbnailList.map(item => { + item.choose = false; + item.body = JSON.parse(item.body); + item.config = JSON.parse(item.config) + return item + }) + }) + } + + async createConatiner(data) { + const response = await api.createContainer(data) + this.getContainerList(this.menuId) + } + + async updateContainer(data) { + const response = await api.updateContainer(data) + this.getContainerList(this.menuId) + } + async deleteContainer(data) { + const response = await api.deleteContainer(data) + this.getContainerList(this.menuId) + } } export default DefaultStore \ No newline at end of file diff --git a/src/tools/index.js b/src/tools/index.js index a701c51..e21d5fa 100644 --- a/src/tools/index.js +++ b/src/tools/index.js @@ -1,3 +1,5 @@ +import SparkMD5 from 'spark-md5' + // 从元素模板中获取指定元素 export function getTargetElement(identify, AtomTemplate){ let element = null; @@ -43,13 +45,13 @@ export function getTargetNode(id, node){ export function deleteTargetNode(id, node){ if(Array.isArray(node)){ const newList = node.filter((item, index) => { + if(item.id!=id)return true if(item.childElement && item.childElement.length > 0){ - const node = deleteTargetNode(id, item.childElement) - if(node){ - item.childElement = node + const nodeSS = deleteTargetNode(id, item.childElement) + if(nodeSS != null){ + item.childElement = nodeSS } } - if(item.id!=id)return true }) if(newList.length != node){ return newList @@ -62,13 +64,29 @@ export function deleteTargetNode(id, node){ return node }else{ if(node.childElement.length > 0){ - deleteTargetNode(id, node.childElement) + const nodeSS = deleteTargetNode(id, node.childElement) + if(nodeSS != null){ + node.childElement = nodeSS + } } } } return node } +export function getMD5(file){ + return new Promise((resolve, reject) => { + let fileReader = new FileReader() + + fileReader.onload = function (event) { + let fileMd5 = SparkMD5.ArrayBuffer.hash(event.target.result) + resolve(fileMd5) + } + + fileReader.readAsArrayBuffer(file) + }) +} + // 框架基础属性 const style1 = [ diff --git a/src/view/EditPageNew/index.jsx b/src/view/EditPageNew/index.jsx index f3132e2..d359955 100644 --- a/src/view/EditPageNew/index.jsx +++ b/src/view/EditPageNew/index.jsx @@ -12,6 +12,7 @@ import css from './index.module.scss' import svgLolipop from '@/assets/lolipop.svg' import svgHelp from '@/assets/help.svg' import svgArrow from '@/assets/arrow.svg' +import svgSave from '@/assets/save.svg' import {autorun} from "mobx"; export default function EditPageNew() { @@ -23,7 +24,6 @@ export default function EditPageNew() { const [newThumbnailName, setNewThumbnailName] = useState(''); // 选择大纲的box样式 const moleculeBoxChoose = [css.moleculeBoxChoose, css.moleculeBox].join(' '); - // 当下页面列表 const [nowContentList, setNowContentList] = useState({}); // 当下的页面内容 @@ -37,99 +37,157 @@ export default function EditPageNew() { const [attrLabelPosition, setAttrLabelPosition] = useState(0); - useEffect(() => { - // console.log(thumbnailList) - // console.log(defaultStore.Atom) + console.log('生命周期开始,发送请求!') + defaultStore.getContainerList(10) + }, [0]) + // 获取容器列表 + useEffect(() => { + const q = autorun(() => { + if(defaultStore.thumbnailList != thumbnailList){ + setThumbnailList(defaultStore.thumbnailList) + } + if(defaultStore.containerList != nowContentList){ + setNowContentList(defaultStore.containerList) + } + }) + return () => { + q() + } }, [thumbnailList]) - // 添加新元素 useEffect(() => { const handleNewElementChange = autorun(() => { // 判断子元素是否为空 - if(!defaultStore.newElementIdentify)return; + if (!defaultStore.newElementIdentify) return; // 判断是否允许添加子元素 // 判断是否有选中元素 - if(!nowElement){ + if (!nowElement) { alert('未选中元素,无法添加。') defaultStore.setNewElementIdentify(null); return; } // 判断元素是否支持添加Element子元素 - if(nowElement.config.childrenType != 'element'){ + if (nowElement.config.childrenType != 'element') { alert('此元素不支持添加子元素。'); defaultStore.setNewElementIdentify(null); return; } // 判断是否能容纳新元素 - if(nowElement.config.childrenLength == 1 && nowElement.childElement.length != 0){ + if (nowElement.config.childrenLength == 1 && nowElement.childElement.length != 0) { alert('此元素无法容纳更多元素'); defaultStore.setNewElementIdentify(null); return; } const newElement = getTargetElement(defaultStore.newElementIdentify, new NE()) - newElement.id= Math.random() + newElement.id = Math.random() nowElement.childElement.push(newElement); setNowElement(nowElement) setNowContent({...nowContent}) + for (let i in nowContentList) { + if (nowContentList[i].id == nowContent.id) { + nowContentList[i] = nowContent; + break + } + } + setNowContentList({...nowContentList}) defaultStore.setNewElementIdentify(null); }) return () => { handleNewElementChange() } }, [nowElement, nowContent]) - // 选择元素 useEffect(() => { const handleNowElementChange = autorun(() => { - if(!defaultStore.chooseNodeId) return; + if (!defaultStore.chooseNodeId) return; const node = getTargetNode(defaultStore.chooseNodeId, nowContent) - if(!node){ + if (!node) { alert('未找到节点元素。') - }else{ + } else { setNowElement(node) } }) return () => { handleNowElementChange() } - },[nowElement, nowContent]) + }, [nowElement, nowContent]) // 删除元素 useEffect(() => { const handleNowElementDelete = autorun(() => { - if(!defaultStore.deleteChooseNodeId) return; - console.log('Click Del------------------------------------------------------------') - console.log('ID', defaultStore.deleteChooseNodeId) - console.log('NowCOntent', nowContent) - console.log('+++++++++++++++++++++++++++++++++++++++++++++++') + if (!defaultStore.deleteChooseNodeId) return; deleteTargetNode(defaultStore.deleteChooseNodeId, nowContent) setNowContent({...nowContent}) + for (let i in nowContentList) { + if (nowContentList[i].id == nowContent.id) { + nowContentList[i] = nowContent; + break + } + } defaultStore.deleteChooseNode(null) }) return () => { handleNowElementDelete() } - },[nowContent]) + }, [nowContent, nowContentList]) + // 修改样式 + useEffect(() => { + const a = autorun(() => { + if(!defaultStore.styleRealRand)return + // console.log(nowElement) + nowElement.config.styleReal = defaultStore.styleReal + setNowElement({...nowElement}) + setNowContent({...nowContent}) + for (let i in nowContentList) { + if (nowContentList[i].id == nowContent.id) { + nowContentList[i] = nowContent; + break + } + } + defaultStore.setStyle(null,'') + }) + return () => { + a() + } + }, [nowContent, nowContentList, nowElement]) // 关闭大纲添加的页面 function closeThumbnailModal() { setNewThumbnailName('') setAddThumbnailState(false) } + // 确认添加新的大纲元素 function addThumbnail() { - const newThumbnail = {name: newThumbnailName, id:Math.random(), choose:false} - // 大纲页面添加新元素 - thumbnailList.push(newThumbnail); - // 内容列表添加新元素(同时生成根元素) - const newElement = getTargetElement('singleFrame' ,new NE()); + const newElement = getTargetElement('singleFrame', new NE()); newElement.id = Math.random(); - nowContentList[newThumbnail.id] = newElement - setNowContentList({...nowContentList}) + const data = { + name: newThumbnailName, + menuId: defaultStore.menuId, + config: JSON.stringify({}), + rank: thumbnailList.length, + body: JSON.stringify(newElement) + } + defaultStore.createConatiner(data) + // 刷新大纲 setThumbnailList(thumbnailList) + // 关闭弹窗 closeThumbnailModal() } + // 保存页面 + function save(e, item) { + e.stopPropagation(); + const data = { + id: item.id, + rank: item.rank, + config: JSON.stringify(item.config), + body: JSON.stringify(nowContentList[item.id]), + name:item.name + } + defaultStore.updateContainer(data) + } + // 选择大纲作为编辑项 function chooseThumbnail(index) { thumbnailList.forEach(item => { @@ -138,30 +196,23 @@ export default function EditPageNew() { thumbnailList[index].choose = true; setThumbnailList([...thumbnailList]) setNowContent(nowContentList[thumbnailList[index].id]); - if(nowContent.identify = 'singleFrame' && nowContentList[thumbnailList[index].id].childElement.length == 0){ - setNowElement(nowContentList[thumbnailList[index].id]); - } + console.log(nowContentList[thumbnailList[index].id]) defaultStore.setChooseNodeId(null) setNowElement(null) } + // 删除缩略图-大纲 - function deleteThumbnail(e, index){ + function deleteThumbnail(e, index) { e.stopPropagation(); - delete nowContentList[thumbnailList[index].id] - if(thumbnailList[index].choose){ - setNowElement(null) - setNowContent({}) - } - thumbnailList.splice(index, 1) - setThumbnailList([...thumbnailList]) + defaultStore.deleteContainer({id:thumbnailList[index].id}) } + // 切换属性标签 function handleChangeAttrLabelPosition(index) { setAttrLabelPosition(index) } - return
@@ -205,12 +256,19 @@ export default function EditPageNew() { key={index} onClick={() => chooseThumbnail(index)}>
-
序列{index}
-
ID{item.id}
-
名称:{item.name}
+
序列: {index}
+
ID: {item.id}
+
名称: {item.name}
-
deleteThumbnail(e, index)}>-
+
deleteThumbnail(e, index)}>- +
+ {JSON.stringify(item.body) != JSON.stringify(nowContentList[item.id]) && +
save(e, item)} + className={css.save}>
} +
}) @@ -231,7 +289,7 @@ export default function EditPageNew() { setNewThumbnailName(event.target.value) }}/>
-
+
确认
diff --git a/src/view/EditPageNew/index.module.scss b/src/view/EditPageNew/index.module.scss index ced0b5c..a02de3a 100644 --- a/src/view/EditPageNew/index.module.scss +++ b/src/view/EditPageNew/index.module.scss @@ -275,6 +275,14 @@ font-size: 30px; background: #3EC1D3; border-radius: 30px; + margin-bottom: 0.5rem; + } + & > div.save{ + width: 25px; + height: 25px; + & > img{ + width: 25px; + } } } } diff --git a/vite.config.js b/vite.config.js index 1b658ae..93d1c4a 100644 --- a/vite.config.js +++ b/vite.config.js @@ -21,7 +21,7 @@ export default defineConfig({ // secure: true, // 是否https接口 // ws: true, // 是否代理websockets // rewrite target目标地址 + '/abc',如果接口是这样的,那么不用重写 - // rewrite: (path) => path.replace(/^\/snow/, '') // 路径重写,本项目不需要重写 + rewrite: (path) => path.replace(/^\/api/, '') // 路径重写,本项目不需要重写 } } },