feat: 添加monaco编辑器

master
绝弹 2023-10-19 21:27:42 +08:00
parent 399ee75183
commit 62026cedd2
9 changed files with 3215 additions and 1874 deletions

View File

@ -27,6 +27,7 @@
"ejs": "^3.1.9",
"less": "^4.2.0",
"lodash-es": "^4.17.21",
"monaco-editor": "^0.44.0",
"nprogress": "^0.2.0",
"numeral": "^2.0.6",
"pinia": "^2.1.6",

View File

@ -3,7 +3,7 @@ lockfileVersion: '6.0'
devDependencies:
'@apidevtools/swagger-parser':
specifier: ^10.1.0
version: 10.1.0(openapi-types@12.1.3)
version: 10.1.0
'@arco-design/web-vue':
specifier: ^2.51.1
version: 2.51.1(vue@3.3.4)
@ -46,6 +46,9 @@ devDependencies:
lodash-es:
specifier: ^4.17.21
version: 4.17.21
monaco-editor:
specifier: ^0.44.0
version: 0.44.0
nprogress:
specifier: ^0.2.0
version: 0.2.0
@ -90,7 +93,7 @@ devDependencies:
version: 4.4.9(less@4.2.0)
vite-plugin-mock:
specifier: ^3.0.0
version: 3.0.0(esbuild@0.19.2)(mockjs@1.1.0)(vite@4.4.9)
version: 3.0.0(vite@4.4.9)
vite-plugin-pages:
specifier: ^0.28.0
version: 0.28.0(vite@4.4.9)
@ -148,7 +151,7 @@ packages:
resolution: {integrity: sha512-QAkD5kK2b1WfjDS/UQn/qQkbwF31uqRjPTrsCs5ZG9BQGAkjwvqGFjjPqAuzac/IYzpPtRzjCP1WrTuAIjMrXg==}
dev: true
/@apidevtools/swagger-parser@10.1.0(openapi-types@12.1.3):
/@apidevtools/swagger-parser@10.1.0:
resolution: {integrity: sha512-9Kt7EuS/7WbMAUv2gSziqjvxwDbFSg3Xeyfuj5laUODX8o/k/CpsAKiQ8W7/R88eXFTMbJYg6+7uAmOWNKmwnw==}
peerDependencies:
openapi-types: '>=7'
@ -160,7 +163,6 @@ packages:
ajv: 8.12.0
ajv-draft-04: 1.0.0(ajv@8.12.0)
call-me-maybe: 1.0.2
openapi-types: 12.1.3
dev: true
/@arco-design/color@0.4.0:
@ -507,15 +509,6 @@ packages:
dev: true
optional: true
/@esbuild/android-arm64@0.19.2:
resolution: {integrity: sha512-lsB65vAbe90I/Qe10OjkmrdxSX4UJDjosDgb8sZUKcg3oefEuW2OT2Vozz8ef7wrJbMcmhvCC+hciF8jY/uAkw==}
engines: {node: '>=12'}
cpu: [arm64]
os: [android]
requiresBuild: true
dev: true
optional: true
/@esbuild/android-arm@0.18.20:
resolution: {integrity: sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw==}
engines: {node: '>=12'}
@ -525,15 +518,6 @@ packages:
dev: true
optional: true
/@esbuild/android-arm@0.19.2:
resolution: {integrity: sha512-tM8yLeYVe7pRyAu9VMi/Q7aunpLwD139EY1S99xbQkT4/q2qa6eA4ige/WJQYdJ8GBL1K33pPFhPfPdJ/WzT8Q==}
engines: {node: '>=12'}
cpu: [arm]
os: [android]
requiresBuild: true
dev: true
optional: true
/@esbuild/android-x64@0.18.20:
resolution: {integrity: sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg==}
engines: {node: '>=12'}
@ -543,15 +527,6 @@ packages:
dev: true
optional: true
/@esbuild/android-x64@0.19.2:
resolution: {integrity: sha512-qK/TpmHt2M/Hg82WXHRc/W/2SGo/l1thtDHZWqFq7oi24AjZ4O/CpPSu6ZuYKFkEgmZlFoa7CooAyYmuvnaG8w==}
engines: {node: '>=12'}
cpu: [x64]
os: [android]
requiresBuild: true
dev: true
optional: true
/@esbuild/darwin-arm64@0.18.20:
resolution: {integrity: sha512-bxRHW5kHU38zS2lPTPOyuyTm+S+eobPUnTNkdJEfAddYgEcll4xkT8DB9d2008DtTbl7uJag2HuE5NZAZgnNEA==}
engines: {node: '>=12'}
@ -561,15 +536,6 @@ packages:
dev: true
optional: true
/@esbuild/darwin-arm64@0.19.2:
resolution: {integrity: sha512-Ora8JokrvrzEPEpZO18ZYXkH4asCdc1DLdcVy8TGf5eWtPO1Ie4WroEJzwI52ZGtpODy3+m0a2yEX9l+KUn0tA==}
engines: {node: '>=12'}
cpu: [arm64]
os: [darwin]
requiresBuild: true
dev: true
optional: true
/@esbuild/darwin-x64@0.18.20:
resolution: {integrity: sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ==}
engines: {node: '>=12'}
@ -579,15 +545,6 @@ packages:
dev: true
optional: true
/@esbuild/darwin-x64@0.19.2:
resolution: {integrity: sha512-tP+B5UuIbbFMj2hQaUr6EALlHOIOmlLM2FK7jeFBobPy2ERdohI4Ka6ZFjZ1ZYsrHE/hZimGuU90jusRE0pwDw==}
engines: {node: '>=12'}
cpu: [x64]
os: [darwin]
requiresBuild: true
dev: true
optional: true
/@esbuild/freebsd-arm64@0.18.20:
resolution: {integrity: sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw==}
engines: {node: '>=12'}
@ -597,15 +554,6 @@ packages:
dev: true
optional: true
/@esbuild/freebsd-arm64@0.19.2:
resolution: {integrity: sha512-YbPY2kc0acfzL1VPVK6EnAlig4f+l8xmq36OZkU0jzBVHcOTyQDhnKQaLzZudNJQyymd9OqQezeaBgkTGdTGeQ==}
engines: {node: '>=12'}
cpu: [arm64]
os: [freebsd]
requiresBuild: true
dev: true
optional: true
/@esbuild/freebsd-x64@0.18.20:
resolution: {integrity: sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ==}
engines: {node: '>=12'}
@ -615,15 +563,6 @@ packages:
dev: true
optional: true
/@esbuild/freebsd-x64@0.19.2:
resolution: {integrity: sha512-nSO5uZT2clM6hosjWHAsS15hLrwCvIWx+b2e3lZ3MwbYSaXwvfO528OF+dLjas1g3bZonciivI8qKR/Hm7IWGw==}
engines: {node: '>=12'}
cpu: [x64]
os: [freebsd]
requiresBuild: true
dev: true
optional: true
/@esbuild/linux-arm64@0.18.20:
resolution: {integrity: sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA==}
engines: {node: '>=12'}
@ -633,15 +572,6 @@ packages:
dev: true
optional: true
/@esbuild/linux-arm64@0.19.2:
resolution: {integrity: sha512-ig2P7GeG//zWlU0AggA3pV1h5gdix0MA3wgB+NsnBXViwiGgY77fuN9Wr5uoCrs2YzaYfogXgsWZbm+HGr09xg==}
engines: {node: '>=12'}
cpu: [arm64]
os: [linux]
requiresBuild: true
dev: true
optional: true
/@esbuild/linux-arm@0.18.20:
resolution: {integrity: sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg==}
engines: {node: '>=12'}
@ -651,15 +581,6 @@ packages:
dev: true
optional: true
/@esbuild/linux-arm@0.19.2:
resolution: {integrity: sha512-Odalh8hICg7SOD7XCj0YLpYCEc+6mkoq63UnExDCiRA2wXEmGlK5JVrW50vZR9Qz4qkvqnHcpH+OFEggO3PgTg==}
engines: {node: '>=12'}
cpu: [arm]
os: [linux]
requiresBuild: true
dev: true
optional: true
/@esbuild/linux-ia32@0.18.20:
resolution: {integrity: sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA==}
engines: {node: '>=12'}
@ -669,15 +590,6 @@ packages:
dev: true
optional: true
/@esbuild/linux-ia32@0.19.2:
resolution: {integrity: sha512-mLfp0ziRPOLSTek0Gd9T5B8AtzKAkoZE70fneiiyPlSnUKKI4lp+mGEnQXcQEHLJAcIYDPSyBvsUbKUG2ri/XQ==}
engines: {node: '>=12'}
cpu: [ia32]
os: [linux]
requiresBuild: true
dev: true
optional: true
/@esbuild/linux-loong64@0.18.20:
resolution: {integrity: sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg==}
engines: {node: '>=12'}
@ -687,15 +599,6 @@ packages:
dev: true
optional: true
/@esbuild/linux-loong64@0.19.2:
resolution: {integrity: sha512-hn28+JNDTxxCpnYjdDYVMNTR3SKavyLlCHHkufHV91fkewpIyQchS1d8wSbmXhs1fiYDpNww8KTFlJ1dHsxeSw==}
engines: {node: '>=12'}
cpu: [loong64]
os: [linux]
requiresBuild: true
dev: true
optional: true
/@esbuild/linux-mips64el@0.18.20:
resolution: {integrity: sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ==}
engines: {node: '>=12'}
@ -705,15 +608,6 @@ packages:
dev: true
optional: true
/@esbuild/linux-mips64el@0.19.2:
resolution: {integrity: sha512-KbXaC0Sejt7vD2fEgPoIKb6nxkfYW9OmFUK9XQE4//PvGIxNIfPk1NmlHmMg6f25x57rpmEFrn1OotASYIAaTg==}
engines: {node: '>=12'}
cpu: [mips64el]
os: [linux]
requiresBuild: true
dev: true
optional: true
/@esbuild/linux-ppc64@0.18.20:
resolution: {integrity: sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA==}
engines: {node: '>=12'}
@ -723,15 +617,6 @@ packages:
dev: true
optional: true
/@esbuild/linux-ppc64@0.19.2:
resolution: {integrity: sha512-dJ0kE8KTqbiHtA3Fc/zn7lCd7pqVr4JcT0JqOnbj4LLzYnp+7h8Qi4yjfq42ZlHfhOCM42rBh0EwHYLL6LEzcw==}
engines: {node: '>=12'}
cpu: [ppc64]
os: [linux]
requiresBuild: true
dev: true
optional: true
/@esbuild/linux-riscv64@0.18.20:
resolution: {integrity: sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A==}
engines: {node: '>=12'}
@ -741,15 +626,6 @@ packages:
dev: true
optional: true
/@esbuild/linux-riscv64@0.19.2:
resolution: {integrity: sha512-7Z/jKNFufZ/bbu4INqqCN6DDlrmOTmdw6D0gH+6Y7auok2r02Ur661qPuXidPOJ+FSgbEeQnnAGgsVynfLuOEw==}
engines: {node: '>=12'}
cpu: [riscv64]
os: [linux]
requiresBuild: true
dev: true
optional: true
/@esbuild/linux-s390x@0.18.20:
resolution: {integrity: sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ==}
engines: {node: '>=12'}
@ -759,15 +635,6 @@ packages:
dev: true
optional: true
/@esbuild/linux-s390x@0.19.2:
resolution: {integrity: sha512-U+RinR6aXXABFCcAY4gSlv4CL1oOVvSSCdseQmGO66H+XyuQGZIUdhG56SZaDJQcLmrSfRmx5XZOWyCJPRqS7g==}
engines: {node: '>=12'}
cpu: [s390x]
os: [linux]
requiresBuild: true
dev: true
optional: true
/@esbuild/linux-x64@0.18.20:
resolution: {integrity: sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w==}
engines: {node: '>=12'}
@ -777,15 +644,6 @@ packages:
dev: true
optional: true
/@esbuild/linux-x64@0.19.2:
resolution: {integrity: sha512-oxzHTEv6VPm3XXNaHPyUTTte+3wGv7qVQtqaZCrgstI16gCuhNOtBXLEBkBREP57YTd68P0VgDgG73jSD8bwXQ==}
engines: {node: '>=12'}
cpu: [x64]
os: [linux]
requiresBuild: true
dev: true
optional: true
/@esbuild/netbsd-x64@0.18.20:
resolution: {integrity: sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A==}
engines: {node: '>=12'}
@ -795,15 +653,6 @@ packages:
dev: true
optional: true
/@esbuild/netbsd-x64@0.19.2:
resolution: {integrity: sha512-WNa5zZk1XpTTwMDompZmvQLHszDDDN7lYjEHCUmAGB83Bgs20EMs7ICD+oKeT6xt4phV4NDdSi/8OfjPbSbZfQ==}
engines: {node: '>=12'}
cpu: [x64]
os: [netbsd]
requiresBuild: true
dev: true
optional: true
/@esbuild/openbsd-x64@0.18.20:
resolution: {integrity: sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg==}
engines: {node: '>=12'}
@ -813,15 +662,6 @@ packages:
dev: true
optional: true
/@esbuild/openbsd-x64@0.19.2:
resolution: {integrity: sha512-S6kI1aT3S++Dedb7vxIuUOb3oAxqxk2Rh5rOXOTYnzN8JzW1VzBd+IqPiSpgitu45042SYD3HCoEyhLKQcDFDw==}
engines: {node: '>=12'}
cpu: [x64]
os: [openbsd]
requiresBuild: true
dev: true
optional: true
/@esbuild/sunos-x64@0.18.20:
resolution: {integrity: sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ==}
engines: {node: '>=12'}
@ -831,15 +671,6 @@ packages:
dev: true
optional: true
/@esbuild/sunos-x64@0.19.2:
resolution: {integrity: sha512-VXSSMsmb+Z8LbsQGcBMiM+fYObDNRm8p7tkUDMPG/g4fhFX5DEFmjxIEa3N8Zr96SjsJ1woAhF0DUnS3MF3ARw==}
engines: {node: '>=12'}
cpu: [x64]
os: [sunos]
requiresBuild: true
dev: true
optional: true
/@esbuild/win32-arm64@0.18.20:
resolution: {integrity: sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg==}
engines: {node: '>=12'}
@ -849,15 +680,6 @@ packages:
dev: true
optional: true
/@esbuild/win32-arm64@0.19.2:
resolution: {integrity: sha512-5NayUlSAyb5PQYFAU9x3bHdsqB88RC3aM9lKDAz4X1mo/EchMIT1Q+pSeBXNgkfNmRecLXA0O8xP+x8V+g/LKg==}
engines: {node: '>=12'}
cpu: [arm64]
os: [win32]
requiresBuild: true
dev: true
optional: true
/@esbuild/win32-ia32@0.18.20:
resolution: {integrity: sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g==}
engines: {node: '>=12'}
@ -867,15 +689,6 @@ packages:
dev: true
optional: true
/@esbuild/win32-ia32@0.19.2:
resolution: {integrity: sha512-47gL/ek1v36iN0wL9L4Q2MFdujR0poLZMJwhO2/N3gA89jgHp4MR8DKCmwYtGNksbfJb9JoTtbkoe6sDhg2QTA==}
engines: {node: '>=12'}
cpu: [ia32]
os: [win32]
requiresBuild: true
dev: true
optional: true
/@esbuild/win32-x64@0.18.20:
resolution: {integrity: sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ==}
engines: {node: '>=12'}
@ -885,15 +698,6 @@ packages:
dev: true
optional: true
/@esbuild/win32-x64@0.19.2:
resolution: {integrity: sha512-tcuhV7ncXBqbt/Ybf0IyrMcwVOAPDckMK9rXNHtF17UTK18OKLpg08glminN06pt2WCoALhXdLfSPbVvK/6fxw==}
engines: {node: '>=12'}
cpu: [x64]
os: [win32]
requiresBuild: true
dev: true
optional: true
/@exodus/schemasafe@1.3.0:
resolution: {integrity: sha512-5Aap/GaRupgNx/feGBwLLTVv8OQFfv3pq2lPRzPg9R+IOBnDgghTGW7l7EuVXOvg5cc/xSAlRW8rBrjIC3Nvqw==}
dev: true
@ -2088,13 +1892,12 @@ packages:
run-applescript: 5.0.0
dev: true
/bundle-require@4.0.1(esbuild@0.19.2):
/bundle-require@4.0.1:
resolution: {integrity: sha512-9NQkRHlNdNpDBGmLpngF3EFDcwodhMUuLz9PaWYciVcQF9SE4LFjM2DB/xV1Li5JiuDMv7ZUWuC3rGbqR0MAXQ==}
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
peerDependencies:
esbuild: '>=0.17'
dependencies:
esbuild: 0.19.2
load-tsconfig: 0.2.5
dev: true
@ -2378,11 +2181,6 @@ packages:
delayed-stream: 1.0.0
dev: true
/commander@11.0.0:
resolution: {integrity: sha512-9HMlXtt/BNoYr8ooyjjNRdIilOTkVJXB+GhxMTtOKwk0R4j4lS4NpjuqmRxroBfnfTSHQIHQB7wryHhXarNjmQ==}
engines: {node: '>=16'}
dev: true
/compare-func@2.0.0:
resolution: {integrity: sha512-zHig5N+tPWARooBnb0Zx1MFcdfpyJrfTJ3Y5L+IFvUm8rM74hHz66z0gw0x4tijh5CorKkKUCnW82R2vmpeCRA==}
dependencies:
@ -3100,36 +2898,6 @@ packages:
'@esbuild/win32-x64': 0.18.20
dev: true
/esbuild@0.19.2:
resolution: {integrity: sha512-G6hPax8UbFakEj3hWO0Vs52LQ8k3lnBhxZWomUJDxfz3rZTLqF5k/FCzuNdLx2RbpBiQQF9H9onlDDH1lZsnjg==}
engines: {node: '>=12'}
hasBin: true
requiresBuild: true
optionalDependencies:
'@esbuild/android-arm': 0.19.2
'@esbuild/android-arm64': 0.19.2
'@esbuild/android-x64': 0.19.2
'@esbuild/darwin-arm64': 0.19.2
'@esbuild/darwin-x64': 0.19.2
'@esbuild/freebsd-arm64': 0.19.2
'@esbuild/freebsd-x64': 0.19.2
'@esbuild/linux-arm': 0.19.2
'@esbuild/linux-arm64': 0.19.2
'@esbuild/linux-ia32': 0.19.2
'@esbuild/linux-loong64': 0.19.2
'@esbuild/linux-mips64el': 0.19.2
'@esbuild/linux-ppc64': 0.19.2
'@esbuild/linux-riscv64': 0.19.2
'@esbuild/linux-s390x': 0.19.2
'@esbuild/linux-x64': 0.19.2
'@esbuild/netbsd-x64': 0.19.2
'@esbuild/openbsd-x64': 0.19.2
'@esbuild/sunos-x64': 0.19.2
'@esbuild/win32-arm64': 0.19.2
'@esbuild/win32-ia32': 0.19.2
'@esbuild/win32-x64': 0.19.2
dev: true
/escalade@3.1.1:
resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==}
engines: {node: '>=6'}
@ -4949,18 +4717,15 @@ packages:
ufo: 1.3.0
dev: true
/mockjs@1.1.0:
resolution: {integrity: sha512-eQsKcWzIaZzEZ07NuEyO4Nw65g0hdWAyurVol1IPl1gahRwY+svqzfgfey8U8dahLwG44d6/RwEzuK52rSa/JQ==}
hasBin: true
dependencies:
commander: 11.0.0
dev: true
/modify-values@1.0.1:
resolution: {integrity: sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw==}
engines: {node: '>=0.10.0'}
dev: true
/monaco-editor@0.44.0:
resolution: {integrity: sha512-5SmjNStN6bSuSE5WPT2ZV+iYn1/yI9sd4Igtk23ChvqB7kDk9lZbB9F5frsuvpB+2njdIeGGFf2G4gbE6rCC9Q==}
dev: true
/mri@1.2.0:
resolution: {integrity: sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==}
engines: {node: '>=4'}
@ -5325,10 +5090,6 @@ packages:
is-wsl: 2.2.0
dev: true
/openapi-types@12.1.3:
resolution: {integrity: sha512-N4YtSYJqghVu4iek2ZUvcN/0aqH1kRDuNqzcycDxhOUpg7GdvLa2F3DgS6yBNhInhv2r/6I0Flkn7CqL8+nIcw==}
dev: true
/optionator@0.8.3:
resolution: {integrity: sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==}
engines: {node: '>= 0.8.0'}
@ -7105,7 +6866,7 @@ packages:
spdx-expression-parse: 3.0.1
dev: true
/vite-plugin-mock@3.0.0(esbuild@0.19.2)(mockjs@1.1.0)(vite@4.4.9):
/vite-plugin-mock@3.0.0(vite@4.4.9):
resolution: {integrity: sha512-Ibwlga2CSgkoFHFtPW3T/l0fwsGVz9Ss5i7HauBQDyDFfMKgbQXh9wKDLksLZHyai9rkDanxJtIcxbD0bUHCfw==}
engines: {node: '>=16.0.0'}
peerDependencies:
@ -7113,12 +6874,11 @@ packages:
vite: '>=4.0.0'
dependencies:
'@types/mockjs': 1.0.7
bundle-require: 4.0.1(esbuild@0.19.2)
bundle-require: 4.0.1
chokidar: 3.5.3
connect: 3.7.0
debug: 4.3.4
fast-glob: 3.3.1
mockjs: 1.1.0
path-to-regexp: 6.2.1
picocolors: 1.0.0
vite: 4.4.9(less@4.2.0)

File diff suppressed because it is too large Load Diff

View File

@ -1,18 +1,42 @@
import fs from 'fs'
import doc from './openapi1.json';
import fs from "fs";
import doc from "./openapi1.json";
interface Param {
interface BaseParam {
name: string;
required: boolean;
description: string;
example: string;
schema: {
type: string;
[key: string]: any;
}
}
interface JsonParam {
interface NumberParam {
type: "number";
min?: number;
max?: number;
}
interface StringParam {
type: "string";
pattern?: string;
}
interface BooleanParam {
type: "boolean";
}
interface ObjectParam {
type: "object";
properties: {
[key: string]: Param;
};
}
interface ArrayParam {
type: "array";
items: Param;
}
type Param = BaseParam & (NumberParam | StringParam | BooleanParam | ObjectParam | ArrayParam);
interface BodyParam {
name: string;
type: string;
required: boolean;
@ -20,56 +44,98 @@ interface JsonParam {
example: string;
}
const run = () => {
const { paths } = doc
const routes: any[] = []
for(const [path, obj] of Object.entries(paths)) {
for(const [method, obj1] of Object.entries(obj)) {
const { tags, summary, operationId, description, parameters, requestBody, responses } = obj1
interface Route {
method: string;
path: string;
tag: string;
operationId: string;
description: string;
pathParams: Param[];
quryParams: Param[];
bodyParams: any;
bodyReturn: any;
}
const { content = {} } = requestBody || {}
const { schema = {} } = content['application/json'] || {}
const { properties = {}, required: requireds = [] } = schema
const bodyParams = {}
for(const [id, obj2 = {}] of Object.entries(properties)) {
const { type, description, example } = obj2 as any;
const required = requireds.includes(id)
const param: JsonParam = {
...(obj2 as any),
interface Tag {
name: string;
description: string;
}
const run = () => {
const routes: Route[] = [];
const tags: Tag[] = doc.tags;
for (const [path, obj] of Object.entries(doc.paths)) {
for (const [method, obj1] of Object.entries(obj)) {
const { tags, operationId, description, parameters, responses } = obj1;
const tag = tags?.[0];
const { content = {} } = obj1.requestBody || {};
const { schema = {} } = content["application/json"] || {};
const { properties = {}, required: requireds = [] } = schema;
const bodyParams: any = [];
for (const [id, obj2 = {}] of Object.entries(properties)) {
const { type, description } = obj2 as any;
const required = requireds.includes(id);
const param: Param = {
name: id,
type,
required,
description,
example,
};
bodyParams.push(param);
}
const { content: content1 = {} } = responses["200"] || responses["201"] || {};
const { schema: schema1 = {} } = content1["application/json"] || {};
let bodyReturn = {};
if (schema1.type === "object") {
bodyReturn = schema1.properties?.data;
}
const pathParams: Param[] = [];
const quryParams: Param[] = [];
for (const param of parameters) {
const { name, schema, description, required, items, properties } = param;
const type = schema.type;
const item: Param = {
name,
type,
description,
required,
};
if (type === "array") {
(item as unknown as ArrayParam).items = items;
}
if (type === "object") {
(item as unknown as ObjectParam).properties = properties;
}
if (param.in === "path") {
pathParams.push(item);
}
if (param.in === "query") {
quryParams.push(item);
}
bodyParams[id] = param
}
const { content: content1 = {} } = responses['200'] || {}
const { schema: schema1 = {} } = content1['application/json'] || {}
let resBody = {}
if(schema1.type === 'object') {
resBody = schema1.properties?.data;
}
const pathParams = parameters.filter((i: any) => i.in === 'path')
const queryParams = parameters.filter((i: any) => i.in === 'query')
const route = {
routes.push({
method,
path,
tag: tags?.[0],
summary,
tag,
operationId,
description,
pathParams,
queryParams,
quryParams,
bodyParams,
resBody,
}
routes.push(route)
bodyReturn,
});
}
}
fs.writeFileSync('12.json', JSON.stringify(routes, null, 2));
}
run();
const obj = { routes, tags };
const pat = '../../src/dd.json'
fs.writeFileSync(pat, JSON.stringify(obj, null, 2));
};
run();

1530
src/dd.json Normal file

File diff suppressed because it is too large Load Diff

88
src/pages/my/dev.vue Normal file
View File

@ -0,0 +1,88 @@
<template>
<bread-page>
<a-input v-model="name" placeholder="中文名称"></a-input>
<a-button @click="editorRef?.open()"></a-button>
<a-tabs type="capsule" @change="onChange">
<a-tab-pane v-for="tag in tags" :key="tag.name" :title="tag.description">
<a-form :model="{}" layout="vertical">
<a-form-item label="新增接口">
<a-radio-group type="button" v-model="type.create">
<a-radio
v-for="route in routes.filter((i) => i.tag === tag.name)"
:value="route.operationId"
:key="route.path"
>
{{ route.description }}
</a-radio>
</a-radio-group>
</a-form-item>
<a-form-item label="修改接口">
<a-radio-group type="button" v-model="type.modify">
<a-radio
v-for="route in routes.filter((i) => i.tag === tag.name)"
:value="route.operationId"
:key="route.path"
>
{{ route.description }}
</a-radio>
</a-radio-group>
</a-form-item>
<a-form-item label="查询接口">
<a-radio-group type="button" v-model="type.select">
<a-radio
v-for="route in routes.filter((i) => i.tag === tag.name)"
:value="route.operationId"
:key="route.path"
>
{{ route.description }}
</a-radio>
</a-radio-group>
</a-form-item>
<a-form-item label="删除接口">
<a-radio-group type="button" v-model="type.delete">
<a-radio
v-for="route in routes.filter((i) => i.tag === tag.name)"
:value="route.operationId"
:key="route.path"
>
{{ route.description }}
</a-radio>
</a-radio-group>
</a-form-item>
</a-form>
</a-tab-pane>
</a-tabs>
<editor-modal ref="editorRef"></editor-modal>
</bread-page>
</template>
<script setup lang="ts">
import doc from "@/dd.json";
import editorModal from "./editor.vue";
const editorRef = ref<InstanceType<typeof editorModal>>();
const { tags, routes } = doc;
const type = ref({
create: undefined,
select: undefined,
modify: undefined,
delete: undefined,
});
const name = ref('')
const onChange = (value: string | number) => {
console.log(value);
};
</script>
<style lang="less" scoped></style>
<route lang="json">
{
"meta": {
"sort": 20010,
"title": "接口生成",
"icon": "icon-park-outline-code"
}
}
</route>

59
src/pages/my/editor.vue Normal file
View File

@ -0,0 +1,59 @@
<template>
<a-modal v-model:visible="visible" :width="1280" title="编辑代码" title-align="start" @close="onClose">
<div class="h-[700px]">
<div id="editor1" class="w-full h-full"></div>
</div>
</a-modal>
</template>
<script setup lang="ts">
import ejs from "ejs";
import * as monaco from "monaco-editor";
import editorWorker from "monaco-editor/esm/vs/editor/editor.worker?worker";
import cssWorker from "monaco-editor/esm/vs/language/css/css.worker?worker";
import htmlWorker from "monaco-editor/esm/vs/language/html/html.worker?worker";
import jsonWorker from "monaco-editor/esm/vs/language/json/json.worker?worker";
import tsWorker from "monaco-editor/esm/vs/language/typescript/ts.worker?worker";
import pageStr from "./page.ejs?raw";
self.MonacoEnvironment = {
getWorker(_, label) {
if (label === "json") {
return new jsonWorker();
}
if (label === "css" || label === "scss" || label === "less") {
return new cssWorker();
}
if (label === "html" || label === "handlebars" || label === "razor") {
return new htmlWorker();
}
if (label === "typescript" || label === "javascript") {
return new tsWorker();
}
return new editorWorker();
},
};
const visible = ref(false);
let editor: monaco.editor.IStandaloneCodeEditor | undefined;
const onClose = () => {
editor?.dispose();
};
defineExpose({
async open() {
visible.value = true;
await nextTick();
const box = document.getElementById("editor1")!;
const code = ejs.render(pageStr, {
tag: "user",
operationId: "addUser",
});
editor = monaco.editor.create(box, {
value: code,
language: "html",
});
},
});
</script>
<style lang="less" scoped></style>

101
src/pages/my/page.ejs Normal file
View File

@ -0,0 +1,101 @@
<template>
<BreadPage>
<ani-table> </ani-table>
</BreadPage>
</template>
<script setup lang="tsx">
import { api } from "@/api";
import { createColumn, updateColumn, useAniTable } from "@/components";
const [aniTable, aniCtx] = useAniTable({
data: async (model, paging) => {
return api.<%= tag %>.<%= operationId %>({ ...model, ...paging });
},
columns: [
{
title: "用户描述",
dataIndex: "description",
},
createColumn,
updateColumn,
{
title: "操作",
type: "button",
width: 180,
buttons: [
{
type: "modify",
text: "修改",
},
{
type: "delete",
text: "删除",
onClick: async ({ record }) => {
return api.<%= tag %>.<%= operationId %>(record.id);
},
},
],
},
],
search: {
items: [
{
extend: "nickname",
required: false,
type: 'search',
enableLoad: true,
itemProps: {
hideLabel: true,
},
nodeProps: {
placeholder: "用户昵称",
},
},
],
},
create: {
title: "新建用户",
modalProps: {
width: 732,
maskClosable: false,
},
formProps: {
layout: "vertical",
class: "!grid grid-cols-2 gap-x-6",
},
items: [
{
field: "username",
label: "登录账号",
type: "input",
required: true,
},
],
submit: ({ model }) => {
return api.<%= tag %>.<%= operationId %>(model);
},
},
modify: {
extend: true,
title: "修改用户",
submit: ({ model }) => {
return api.<%= tag %>.<%= operationId %>(model.id, model);
},
},
});
</script>
<style scoped></style>
<%_ if(false) { _%>
<route lang="json">
{
"meta": {
"sort": 10301,
"title": "用户管理",
"icon": "icon-park-outline-user"
}
}
</route>
<%_ } _%>

View File

@ -47,6 +47,8 @@ declare module 'vue-router/auto/routes' {
'/home/home': RouteRecordInfo<'/home/home', '/home/home', Record<never, never>, Record<never, never>>,
'/home/test': RouteRecordInfo<'/home/test', '/home/test', Record<never, never>, Record<never, never>>,
'/my/': RouteRecordInfo<'/my/', '/my', Record<never, never>, Record<never, never>>,
'/my/dev': RouteRecordInfo<'/my/dev', '/my/dev', Record<never, never>, Record<never, never>>,
'/my/editor': RouteRecordInfo<'/my/editor', '/my/editor', Record<never, never>, Record<never, never>>,
'/post/': RouteRecordInfo<'/post/', '/post', Record<never, never>, Record<never, never>>,
'/post/category/': RouteRecordInfo<'/post/category/', '/post/category', Record<never, never>, Record<never, never>>,
'/post/comment/': RouteRecordInfo<'/post/comment/', '/post/comment', Record<never, never>, Record<never, never>>,