This commit is contained in:
张成
2025-10-08 22:13:36 +08:00
parent 453414f647
commit 7371313d39
4 changed files with 886 additions and 104 deletions

376
package-lock.json generated
View File

@@ -11,10 +11,15 @@
"dependencies": { "dependencies": {
"@vue/babel-preset-jsx": "^1.4.0", "@vue/babel-preset-jsx": "^1.4.0",
"brace": "^0.11.1", "brace": "^0.11.1",
"codemirror": "^6.0.2",
"cropperjs": "^2.0.1",
"dayjs": "^1.10.0", "dayjs": "^1.10.0",
"js-cookie": "^2.2.1", "js-cookie": "^2.2.1",
"simplemde": "^1.11.2",
"uuid": "^13.0.0",
"vue2-ace-editor": "^0.0.15", "vue2-ace-editor": "^0.0.15",
"vuex-persistedstate": "^4.0.0" "vuex-persistedstate": "^4.0.0",
"wangeditor": "^4.7.15"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.12.0", "@babel/core": "^7.12.0",
@@ -1507,6 +1512,27 @@
"@babel/core": "^7.0.0-0 || ^8.0.0-0 <8.0.0" "@babel/core": "^7.0.0-0 || ^8.0.0-0 <8.0.0"
} }
}, },
"node_modules/@babel/runtime": {
"version": "7.28.4",
"resolved": "https://registry.npmmirror.com/@babel/runtime/-/runtime-7.28.4.tgz",
"integrity": "sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ==",
"license": "MIT",
"engines": {
"node": ">=6.9.0"
}
},
"node_modules/@babel/runtime-corejs3": {
"version": "7.28.4",
"resolved": "https://registry.npmmirror.com/@babel/runtime-corejs3/-/runtime-corejs3-7.28.4.tgz",
"integrity": "sha512-h7iEYiW4HebClDEhtvFObtPmIvrd1SSfpI9EhOeKk4CtIK/ngBWFpuhCzhdmRKtg71ylcue+9I6dv54XYO1epQ==",
"license": "MIT",
"dependencies": {
"core-js-pure": "^3.43.0"
},
"engines": {
"node": ">=6.9.0"
}
},
"node_modules/@babel/template": { "node_modules/@babel/template": {
"version": "7.27.2", "version": "7.27.2",
"resolved": "https://registry.npmmirror.com/@babel/template/-/template-7.27.2.tgz", "resolved": "https://registry.npmmirror.com/@babel/template/-/template-7.27.2.tgz",
@@ -1552,6 +1578,207 @@
"node": ">=6.9.0" "node": ">=6.9.0"
} }
}, },
"node_modules/@codemirror/autocomplete": {
"version": "6.19.0",
"resolved": "https://registry.npmmirror.com/@codemirror/autocomplete/-/autocomplete-6.19.0.tgz",
"integrity": "sha512-61Hfv3cF07XvUxNeC3E7jhG8XNi1Yom1G0lRC936oLnlF+jrbrv8rc/J98XlYzcsAoTVupfsf5fLej1aI8kyIg==",
"license": "MIT",
"dependencies": {
"@codemirror/language": "^6.0.0",
"@codemirror/state": "^6.0.0",
"@codemirror/view": "^6.17.0",
"@lezer/common": "^1.0.0"
}
},
"node_modules/@codemirror/commands": {
"version": "6.9.0",
"resolved": "https://registry.npmmirror.com/@codemirror/commands/-/commands-6.9.0.tgz",
"integrity": "sha512-454TVgjhO6cMufsyyGN70rGIfJxJEjcqjBG2x2Y03Y/+Fm99d3O/Kv1QDYWuG6hvxsgmjXmBuATikIIYvERX+w==",
"license": "MIT",
"dependencies": {
"@codemirror/language": "^6.0.0",
"@codemirror/state": "^6.4.0",
"@codemirror/view": "^6.27.0",
"@lezer/common": "^1.1.0"
}
},
"node_modules/@codemirror/language": {
"version": "6.11.3",
"resolved": "https://registry.npmmirror.com/@codemirror/language/-/language-6.11.3.tgz",
"integrity": "sha512-9HBM2XnwDj7fnu0551HkGdrUrrqmYq/WC5iv6nbY2WdicXdGbhR/gfbZOH73Aqj4351alY1+aoG9rCNfiwS1RA==",
"license": "MIT",
"dependencies": {
"@codemirror/state": "^6.0.0",
"@codemirror/view": "^6.23.0",
"@lezer/common": "^1.1.0",
"@lezer/highlight": "^1.0.0",
"@lezer/lr": "^1.0.0",
"style-mod": "^4.0.0"
}
},
"node_modules/@codemirror/lint": {
"version": "6.9.0",
"resolved": "https://registry.npmmirror.com/@codemirror/lint/-/lint-6.9.0.tgz",
"integrity": "sha512-wZxW+9XDytH3SKvS8cQzMyQCaaazH8XL1EMHleHe00wVzsv7NBQKVW2yzEHrRhmM7ZOhVdItPbvlRBvMp9ej7A==",
"license": "MIT",
"dependencies": {
"@codemirror/state": "^6.0.0",
"@codemirror/view": "^6.35.0",
"crelt": "^1.0.5"
}
},
"node_modules/@codemirror/search": {
"version": "6.5.11",
"resolved": "https://registry.npmmirror.com/@codemirror/search/-/search-6.5.11.tgz",
"integrity": "sha512-KmWepDE6jUdL6n8cAAqIpRmLPBZ5ZKnicE8oGU/s3QrAVID+0VhLFrzUucVKHG5035/BSykhExDL/Xm7dHthiA==",
"license": "MIT",
"dependencies": {
"@codemirror/state": "^6.0.0",
"@codemirror/view": "^6.0.0",
"crelt": "^1.0.5"
}
},
"node_modules/@codemirror/state": {
"version": "6.5.2",
"resolved": "https://registry.npmmirror.com/@codemirror/state/-/state-6.5.2.tgz",
"integrity": "sha512-FVqsPqtPWKVVL3dPSxy8wEF/ymIEuVzF1PK3VbUgrxXpJUSHQWWZz4JMToquRxnkw+36LTamCZG2iua2Ptq0fA==",
"license": "MIT",
"dependencies": {
"@marijn/find-cluster-break": "^1.0.0"
}
},
"node_modules/@codemirror/view": {
"version": "6.38.5",
"resolved": "https://registry.npmmirror.com/@codemirror/view/-/view-6.38.5.tgz",
"integrity": "sha512-SFVsNAgsAoou+BjRewMqN+m9jaztB9wCWN9RSRgePqUbq8UVlvJfku5zB2KVhLPgH/h0RLk38tvd4tGeAhygnw==",
"license": "MIT",
"dependencies": {
"@codemirror/state": "^6.5.0",
"crelt": "^1.0.6",
"style-mod": "^4.1.0",
"w3c-keyname": "^2.2.4"
}
},
"node_modules/@cropper/element": {
"version": "2.0.1",
"resolved": "https://registry.npmmirror.com/@cropper/element/-/element-2.0.1.tgz",
"integrity": "sha512-Jn1hR7XWzWQM/QfXRGMGzdkJ2gG/UcLdQPZQ7OKs0JiFfRzKpzu4u/nYrXHeH3MM2iOslLqh2kqYju6mjZLMJQ==",
"license": "MIT",
"dependencies": {
"@cropper/utils": "^2.0.1"
}
},
"node_modules/@cropper/element-canvas": {
"version": "2.0.1",
"resolved": "https://registry.npmmirror.com/@cropper/element-canvas/-/element-canvas-2.0.1.tgz",
"integrity": "sha512-OKxq/O0HL9W2JegOsc2zh1NRpERZcLM5+M8aQ/eXdmMcfi1lzosPftag3Irp6pTsVpwV6B6ypIxKESzJ4ci9Fw==",
"license": "MIT",
"dependencies": {
"@cropper/element": "^2.0.1",
"@cropper/utils": "^2.0.1"
}
},
"node_modules/@cropper/element-crosshair": {
"version": "2.0.1",
"resolved": "https://registry.npmmirror.com/@cropper/element-crosshair/-/element-crosshair-2.0.1.tgz",
"integrity": "sha512-bS5msU9cTU/jf1/kDw+QJmEM9/rw8IgOdpolR85iMVUCR8sRcLa0wgom42MBHcpBYB6hvL5YfiOeXZ7lHIYMpw==",
"license": "MIT",
"dependencies": {
"@cropper/element": "^2.0.1",
"@cropper/utils": "^2.0.1"
}
},
"node_modules/@cropper/element-grid": {
"version": "2.0.1",
"resolved": "https://registry.npmmirror.com/@cropper/element-grid/-/element-grid-2.0.1.tgz",
"integrity": "sha512-ayqCvYQJ+GVT31HhFpttzHabW1T/LsIwLJY5PLTMG0cEZLw/E8ihg8mxctjZbo852D7oEePbz6/2SeuCb1018Q==",
"license": "MIT",
"dependencies": {
"@cropper/element": "^2.0.1",
"@cropper/utils": "^2.0.1"
}
},
"node_modules/@cropper/element-handle": {
"version": "2.0.1",
"resolved": "https://registry.npmmirror.com/@cropper/element-handle/-/element-handle-2.0.1.tgz",
"integrity": "sha512-fdifyyPIaR9S2eQ7qPHuM8fX8uToAfBsi8vQlR9EM+oJkDNil0uO4rWyArLWEtlr0/q7U0OvsufcuJ7ffqfmpg==",
"license": "MIT",
"dependencies": {
"@cropper/element": "^2.0.1",
"@cropper/utils": "^2.0.1"
}
},
"node_modules/@cropper/element-image": {
"version": "2.0.1",
"resolved": "https://registry.npmmirror.com/@cropper/element-image/-/element-image-2.0.1.tgz",
"integrity": "sha512-gPj5Sl2T8Cno198Cz3F3TDfcYoALW3yJ3fV6PHXmhMnX8sBkL7J441do7Vwkg0mEd2CogCtTLAf+p7ljdV0kgA==",
"license": "MIT",
"dependencies": {
"@cropper/element": "^2.0.1",
"@cropper/element-canvas": "^2.0.1",
"@cropper/utils": "^2.0.1"
}
},
"node_modules/@cropper/element-selection": {
"version": "2.0.1",
"resolved": "https://registry.npmmirror.com/@cropper/element-selection/-/element-selection-2.0.1.tgz",
"integrity": "sha512-atv+Aeq2N2eWawelIRPGh1kYFdNrpb0QkUPPheGxz1ImfxpLdcHO9gb9T5noQijizUW2G0pNvts4ZaITQ0I71Q==",
"license": "MIT",
"dependencies": {
"@cropper/element": "^2.0.1",
"@cropper/element-canvas": "^2.0.1",
"@cropper/element-image": "^2.0.1",
"@cropper/utils": "^2.0.1"
}
},
"node_modules/@cropper/element-shade": {
"version": "2.0.1",
"resolved": "https://registry.npmmirror.com/@cropper/element-shade/-/element-shade-2.0.1.tgz",
"integrity": "sha512-YIYgJ690NdFQ6wJLRFh/EySNVxGFKArncQ4FrsJ3yHU+ShgtOKz4FpjFLpqJRJB9swoVbD3WKTimGyzXrwjZrQ==",
"license": "MIT",
"dependencies": {
"@cropper/element": "^2.0.1",
"@cropper/element-canvas": "^2.0.1",
"@cropper/element-selection": "^2.0.1",
"@cropper/utils": "^2.0.1"
}
},
"node_modules/@cropper/element-viewer": {
"version": "2.0.1",
"resolved": "https://registry.npmmirror.com/@cropper/element-viewer/-/element-viewer-2.0.1.tgz",
"integrity": "sha512-HDj25l08pWi/AO6El/OqfQHBpBC4Lh5NEnQN1SOldsmxEwt27Ubv6ndDsF8LkTK7XPwjjZRpyQPyfig4w8L2JQ==",
"license": "MIT",
"dependencies": {
"@cropper/element": "^2.0.1",
"@cropper/element-canvas": "^2.0.1",
"@cropper/element-image": "^2.0.1",
"@cropper/element-selection": "^2.0.1",
"@cropper/utils": "^2.0.1"
}
},
"node_modules/@cropper/elements": {
"version": "2.0.1",
"resolved": "https://registry.npmmirror.com/@cropper/elements/-/elements-2.0.1.tgz",
"integrity": "sha512-paFbBLXTKXNngn1yDi2ZIf+FO1pIEQXyBntmqOjuxqtG73KuEKv633wsJPFpj958bgcfSakgBbF80j+3nHbPug==",
"license": "MIT",
"dependencies": {
"@cropper/element": "^2.0.1",
"@cropper/element-canvas": "^2.0.1",
"@cropper/element-crosshair": "^2.0.1",
"@cropper/element-grid": "^2.0.1",
"@cropper/element-handle": "^2.0.1",
"@cropper/element-image": "^2.0.1",
"@cropper/element-selection": "^2.0.1",
"@cropper/element-shade": "^2.0.1",
"@cropper/element-viewer": "^2.0.1"
}
},
"node_modules/@cropper/utils": {
"version": "2.0.1",
"resolved": "https://registry.npmmirror.com/@cropper/utils/-/utils-2.0.1.tgz",
"integrity": "sha512-A9RnAFmgNF5aZk5q2VZnFnHtXWu1kPyEN0LVsX8wJ2LBRu2nyETKwz+ZXVsVWliktToCaYojHKrS+6/HODyEZA==",
"license": "MIT"
},
"node_modules/@discoveryjs/json-ext": { "node_modules/@discoveryjs/json-ext": {
"version": "0.5.7", "version": "0.5.7",
"resolved": "https://registry.npmmirror.com/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz", "resolved": "https://registry.npmmirror.com/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz",
@@ -1618,6 +1845,36 @@
"@jridgewell/sourcemap-codec": "^1.4.14" "@jridgewell/sourcemap-codec": "^1.4.14"
} }
}, },
"node_modules/@lezer/common": {
"version": "1.2.3",
"resolved": "https://registry.npmmirror.com/@lezer/common/-/common-1.2.3.tgz",
"integrity": "sha512-w7ojc8ejBqr2REPsWxJjrMFsA/ysDCFICn8zEOR9mrqzOu2amhITYuLD8ag6XZf0CFXDrhKqw7+tW8cX66NaDA==",
"license": "MIT"
},
"node_modules/@lezer/highlight": {
"version": "1.2.1",
"resolved": "https://registry.npmmirror.com/@lezer/highlight/-/highlight-1.2.1.tgz",
"integrity": "sha512-Z5duk4RN/3zuVO7Jq0pGLJ3qynpxUVsh7IbUbGj88+uV2ApSAn6kWg2au3iJb+0Zi7kKtqffIESgNcRXWZWmSA==",
"license": "MIT",
"dependencies": {
"@lezer/common": "^1.0.0"
}
},
"node_modules/@lezer/lr": {
"version": "1.4.2",
"resolved": "https://registry.npmmirror.com/@lezer/lr/-/lr-1.4.2.tgz",
"integrity": "sha512-pu0K1jCIdnQ12aWNaAVU5bzi7Bd1w54J3ECgANPmYLtQKP0HBj2cE/5coBD66MT10xbtIuUr7tg0Shbsvk0mDA==",
"license": "MIT",
"dependencies": {
"@lezer/common": "^1.0.0"
}
},
"node_modules/@marijn/find-cluster-break": {
"version": "1.0.2",
"resolved": "https://registry.npmmirror.com/@marijn/find-cluster-break/-/find-cluster-break-1.0.2.tgz",
"integrity": "sha512-l0h88YhZFyKdXIFNfSWpyjStDjGHwZ/U7iobcK1cQQD8sejsONdQtTVU+1wVN1PBw40PiiHB1vA5S7VTfQiP9g==",
"license": "MIT"
},
"node_modules/@types/eslint": { "node_modules/@types/eslint": {
"version": "9.6.1", "version": "9.6.1",
"resolved": "https://registry.npmmirror.com/@types/eslint/-/eslint-9.6.1.tgz", "resolved": "https://registry.npmmirror.com/@types/eslint/-/eslint-9.6.1.tgz",
@@ -2403,6 +2660,30 @@
"node": ">=6" "node": ">=6"
} }
}, },
"node_modules/codemirror": {
"version": "6.0.2",
"resolved": "https://registry.npmmirror.com/codemirror/-/codemirror-6.0.2.tgz",
"integrity": "sha512-VhydHotNW5w1UGK0Qj96BwSk/Zqbp9WbnyK2W/eVMv4QyF41INRGpjUhFJY7/uDNuudSc33a/PKr4iDqRduvHw==",
"license": "MIT",
"dependencies": {
"@codemirror/autocomplete": "^6.0.0",
"@codemirror/commands": "^6.0.0",
"@codemirror/language": "^6.0.0",
"@codemirror/lint": "^6.0.0",
"@codemirror/search": "^6.0.0",
"@codemirror/state": "^6.0.0",
"@codemirror/view": "^6.0.0"
}
},
"node_modules/codemirror-spell-checker": {
"version": "1.1.2",
"resolved": "https://registry.npmmirror.com/codemirror-spell-checker/-/codemirror-spell-checker-1.1.2.tgz",
"integrity": "sha512-2Tl6n0v+GJRsC9K3MLCdLaMOmvWL0uukajNJseorZJsslaxZyZMgENocPU8R0DyoTAiKsyqiemSOZo7kjGV0LQ==",
"license": "MIT",
"dependencies": {
"typo-js": "*"
}
},
"node_modules/colorette": { "node_modules/colorette": {
"version": "2.0.20", "version": "2.0.20",
"resolved": "https://registry.npmmirror.com/colorette/-/colorette-2.0.20.tgz", "resolved": "https://registry.npmmirror.com/colorette/-/colorette-2.0.20.tgz",
@@ -2471,6 +2752,33 @@
"url": "https://opencollective.com/core-js" "url": "https://opencollective.com/core-js"
} }
}, },
"node_modules/core-js-pure": {
"version": "3.45.1",
"resolved": "https://registry.npmmirror.com/core-js-pure/-/core-js-pure-3.45.1.tgz",
"integrity": "sha512-OHnWFKgTUshEU8MK+lOs1H8kC8GkTi9Z1tvNkxrCcw9wl3MJIO7q2ld77wjWn4/xuGrVu2X+nME1iIIPBSdyEQ==",
"hasInstallScript": true,
"license": "MIT",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/core-js"
}
},
"node_modules/crelt": {
"version": "1.0.6",
"resolved": "https://registry.npmmirror.com/crelt/-/crelt-1.0.6.tgz",
"integrity": "sha512-VQ2MBenTq1fWZUH9DJNGti7kKv6EeAuYr3cLwxUWhIu1baTaXh4Ib5W2CqHVqib4/MqbYGJqiL3Zb8GJZr3l4g==",
"license": "MIT"
},
"node_modules/cropperjs": {
"version": "2.0.1",
"resolved": "https://registry.npmmirror.com/cropperjs/-/cropperjs-2.0.1.tgz",
"integrity": "sha512-hiJwk2SCPZqxMA7aR3byzLpYUqOrQo+ihMk8k/WRm/xe/LX8wNzAIzMwEB/NEGJYA6sbewxW9TUlrRUYi/2Ipg==",
"license": "MIT",
"dependencies": {
"@cropper/elements": "^2.0.1",
"@cropper/utils": "^2.0.1"
}
},
"node_modules/cross-spawn": { "node_modules/cross-spawn": {
"version": "7.0.6", "version": "7.0.6",
"resolved": "https://registry.npmmirror.com/cross-spawn/-/cross-spawn-7.0.6.tgz", "resolved": "https://registry.npmmirror.com/cross-spawn/-/cross-spawn-7.0.6.tgz",
@@ -3377,6 +3685,18 @@
"url": "https://github.com/sponsors/sindresorhus" "url": "https://github.com/sponsors/sindresorhus"
} }
}, },
"node_modules/marked": {
"version": "16.4.0",
"resolved": "https://registry.npmmirror.com/marked/-/marked-16.4.0.tgz",
"integrity": "sha512-CTPAcRBq57cn3R8n3hwc2REddc28hjR7RzDXQ+lXLmMJYqn20BaI2cGw6QjgZGIgVfp2Wdfw4aMzgNteQ6qJgQ==",
"license": "MIT",
"bin": {
"marked": "bin/marked.js"
},
"engines": {
"node": ">= 20"
}
},
"node_modules/merge-source-map": { "node_modules/merge-source-map": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmmirror.com/merge-source-map/-/merge-source-map-1.1.0.tgz", "resolved": "https://registry.npmmirror.com/merge-source-map/-/merge-source-map-1.1.0.tgz",
@@ -4020,6 +4340,17 @@
"deprecated": "older versions vulnerable to prototype pollution", "deprecated": "older versions vulnerable to prototype pollution",
"license": "MIT" "license": "MIT"
}, },
"node_modules/simplemde": {
"version": "1.11.2",
"resolved": "https://registry.npmmirror.com/simplemde/-/simplemde-1.11.2.tgz",
"integrity": "sha512-AUXuHJ/tEEDEcN/MTitHIw3AuBcheizJt7SVwtyn00B0UK5RKZ3GB+JndmRcJ5wfYGCIL0O2yJm/uz0sJOFSLg==",
"license": "MIT",
"dependencies": {
"codemirror": "*",
"codemirror-spell-checker": "*",
"marked": "*"
}
},
"node_modules/source-map": { "node_modules/source-map": {
"version": "0.6.1", "version": "0.6.1",
"resolved": "https://registry.npmmirror.com/source-map/-/source-map-0.6.1.tgz", "resolved": "https://registry.npmmirror.com/source-map/-/source-map-0.6.1.tgz",
@@ -4089,6 +4420,12 @@
"url": "https://opencollective.com/webpack" "url": "https://opencollective.com/webpack"
} }
}, },
"node_modules/style-mod": {
"version": "4.1.2",
"resolved": "https://registry.npmmirror.com/style-mod/-/style-mod-4.1.2.tgz",
"integrity": "sha512-wnD1HyVqpJUI2+eKZ+eo1UwghftP6yuFheBqqe+bWCotBjC2K1YnteJILRMs3SM4V/0dLEW1SC27MWP5y+mwmw==",
"license": "MIT"
},
"node_modules/supports-color": { "node_modules/supports-color": {
"version": "8.1.1", "version": "8.1.1",
"resolved": "https://registry.npmmirror.com/supports-color/-/supports-color-8.1.1.tgz", "resolved": "https://registry.npmmirror.com/supports-color/-/supports-color-8.1.1.tgz",
@@ -4259,9 +4596,14 @@
"version": "2.8.1", "version": "2.8.1",
"resolved": "https://registry.npmmirror.com/tslib/-/tslib-2.8.1.tgz", "resolved": "https://registry.npmmirror.com/tslib/-/tslib-2.8.1.tgz",
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
"dev": true,
"license": "0BSD" "license": "0BSD"
}, },
"node_modules/typo-js": {
"version": "1.3.1",
"resolved": "https://registry.npmmirror.com/typo-js/-/typo-js-1.3.1.tgz",
"integrity": "sha512-elJkpCL6Z77Ghw0Lv0lGnhBAjSTOQ5FhiVOCfOuxhaoTT2xtLVbqikYItK5HHchzPbHEUFAcjOH669T2ZzeCbg==",
"license": "BSD-3-Clause"
},
"node_modules/undici-types": { "node_modules/undici-types": {
"version": "7.14.0", "version": "7.14.0",
"resolved": "https://registry.npmmirror.com/undici-types/-/undici-types-7.14.0.tgz", "resolved": "https://registry.npmmirror.com/undici-types/-/undici-types-7.14.0.tgz",
@@ -4407,6 +4749,19 @@
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/uuid": {
"version": "13.0.0",
"resolved": "https://registry.npmmirror.com/uuid/-/uuid-13.0.0.tgz",
"integrity": "sha512-XQegIaBTVUjSHliKqcnFqYypAd4S+WCYt5NIeRs6w/UAry7z8Y9j5ZwRRL4kzq9U3sD6v+85er9FvkEaBpji2w==",
"funding": [
"https://github.com/sponsors/broofa",
"https://github.com/sponsors/ctavan"
],
"license": "MIT",
"bin": {
"uuid": "dist-node/bin/uuid"
}
},
"node_modules/v-click-outside-x": { "node_modules/v-click-outside-x": {
"version": "3.7.1", "version": "3.7.1",
"resolved": "https://registry.npmmirror.com/v-click-outside-x/-/v-click-outside-x-3.7.1.tgz", "resolved": "https://registry.npmmirror.com/v-click-outside-x/-/v-click-outside-x-3.7.1.tgz",
@@ -4625,6 +4980,23 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/w3c-keyname": {
"version": "2.2.8",
"resolved": "https://registry.npmmirror.com/w3c-keyname/-/w3c-keyname-2.2.8.tgz",
"integrity": "sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==",
"license": "MIT"
},
"node_modules/wangeditor": {
"version": "4.7.15",
"resolved": "https://registry.npmmirror.com/wangeditor/-/wangeditor-4.7.15.tgz",
"integrity": "sha512-aPTdREd8BxXVyJ5MI+LU83FQ7u1EPd341iXIorRNYSOvoimNoZ4nPg+yn3FGbB93/owEa6buLw8wdhYnMCJQLg==",
"license": "MIT",
"dependencies": {
"@babel/runtime": "^7.11.2",
"@babel/runtime-corejs3": "^7.11.2",
"tslib": "^2.1.0"
}
},
"node_modules/watchpack": { "node_modules/watchpack": {
"version": "2.4.4", "version": "2.4.4",
"resolved": "https://registry.npmmirror.com/watchpack/-/watchpack-2.4.4.tgz", "resolved": "https://registry.npmmirror.com/watchpack/-/watchpack-2.4.4.tgz",

View File

@@ -25,10 +25,15 @@
"dependencies": { "dependencies": {
"@vue/babel-preset-jsx": "^1.4.0", "@vue/babel-preset-jsx": "^1.4.0",
"brace": "^0.11.1", "brace": "^0.11.1",
"codemirror": "^6.0.2",
"cropperjs": "^2.0.1",
"dayjs": "^1.10.0", "dayjs": "^1.10.0",
"js-cookie": "^2.2.1", "js-cookie": "^2.2.1",
"simplemde": "^1.11.2",
"uuid": "^13.0.0",
"vue2-ace-editor": "^0.0.15", "vue2-ace-editor": "^0.0.15",
"vuex-persistedstate": "^4.0.0" "vuex-persistedstate": "^4.0.0",
"wangeditor": "^4.7.15"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.12.0", "@babel/core": "^7.12.0",

View File

@@ -1,66 +1,75 @@
/** /**
* Admin Framework - 通用后台管理系统框架 * Admin Framework - 閫氱敤鍚庡彴绠$悊绯荤粺妗嗘灦
* 版本: 1.0.0 * 鐗堟湰: 1.0.0
* *
* 功能包含: * 鍔熻兘鍖呭惈:
* - 系统管理功能 (sys_*) * - 绯荤粺绠$悊鍔熻兘 (sys_*)
* - 用户登录和权限管理 * - 鐢ㄦ埛鐧诲綍鍜屾潈闄愮鐞? * - 鍔ㄦ€佽矾鐢辩鐞? * - 涓诲竷灞€鍜岄〉闈㈠竷灞€
* - 动态路由管理 * - 鍏ㄥ眬缁勪欢
* - 主布局和页面布局 * - 宸ュ叿搴? * - Vuex 鐘舵€佺鐞? */
* - 全局组件
* - 工具库
* - Vuex 状态管理
*/
// ==================== 样式文件 ==================== // ==================== 鏍峰紡鏂囦欢 ====================
import './assets/css/animate.css' import './assets/css/animate.css'
import './assets/css/base.less' import './assets/css/base.less'
import './assets/css/ivewExpand.less' import './assets/css/ivewExpand.less'
import './assets/icons/iconfont.css' import './assets/icons/iconfont.css'
// ==================== 工具库 ==================== // ==================== 宸ュ叿搴?====================
import uiTool from './utils/uiTool' import uiTool from './utils/uiTool'
import http from './utils/http' import http from './utils/http'
import * as tools from './utils/tools' import * as tools from './utils/tools'
// ==================== Store 模块 ==================== // ==================== Store 妯″潡 ====================
import storeModules, { userModule, appModule } from './store' import storeModules, { userModule, appModule } from './store'
// ==================== 路由配置 ==================== // ==================== 璺敱閰嶇疆 ====================
import routerConfig, { createBaseRoutes, setupRouterGuards } from './router' import routerConfig, { createBaseRoutes, setupRouterGuards } from './router'
// ==================== 系统页面 ==================== // ==================== 绯荤粺椤甸潰 ====================
// 主页 // 涓婚〉
import HomePage from './views/home/index.vue' import HomePage from './views/home/index.vue'
// system 页面 // system 椤甸潰
import SysLog from './views/system/sys_log.vue' import SysLog from './views/system/sys_log.vue'
import SysParamSetup from './views/system/sys_param_setup.vue' import SysParamSetup from './views/system/sys_param_setup.vue'
import SysRole from './views/system/sys_role.vue' import SysRole from './views/system/sys_role.vue'
import SysUser from './views/system/sys_user.vue' import SysUser from './views/system/sys_user.vue'
// system_high 页面 // system_high 椤甸潰
import SysControl from './views/system_high/sys_control.vue' import SysControl from './views/system_high/sys_control.vue'
import SysMenu from './views/system_high/sys_menu.vue' import SysMenu from './views/system_high/sys_menu.vue'
import SysTitle from './views/system_high/sys_title.vue' import SysTitle from './views/system_high/sys_title.vue'
// 登录和错误页面 // 鐧诲綍鍜岄敊璇〉闈?import LoginPage from './views/login/login.vue'
import LoginPage from './views/login/login.vue'
import Page401 from './views/error-page/401.vue' import Page401 from './views/error-page/401.vue'
import Page404 from './views/error-page/404.vue' import Page404 from './views/error-page/404.vue'
import Page500 from './views/error-page/500.vue' import Page500 from './views/error-page/500.vue'
// 布局组件 // 甯冨眬缁勪欢
import Main from './components/main' import Main from './components/main'
import ParentView from './components/parent-view' import ParentView from './components/parent-view'
// ==================== 系统 API ====================
// ==================== 鍏ㄥ眬缁勪欢 ====================
import Tables from './components/tables'
import UploadSingle from './components/upload/Single.vue'
import UploadMultiple from './components/upload/Multiple.vue'
import TreeGrid from './components/treeGrid'
import AsyncModal from './components/asyncModal'
import InfoCard from './components/info-card'
import LoadFlower from './components/load-flower'
import SplitPane from './components/split-pane'
import TextArea from './components/text-area'
import CommonIcon from './components/common-icon'
// ==================== 绯荤粺 API ====================
// system API // system API
import * as systemApi from './api/system' import * as systemApi from './api/system'
// system_high API // system_high API
import * as systemHighApi from './api/system_high' import * as systemHighApi from './api/system_high'
// ==================== 框架类 ==================== // ==================== 妗嗘灦绫?====================
class AdminFramework { class AdminFramework {
constructor() { constructor() {
this.version = '1.0.0' this.version = '1.0.0'
@@ -69,21 +78,21 @@ class AdminFramework {
this.store = null this.store = null
this.router = null this.router = null
// 导出工具 // 瀵煎嚭宸ュ叿
this.tools = tools this.tools = tools
this.uiTool = uiTool this.uiTool = uiTool
this.http = http this.http = http
// 导出 Store 模块 // 瀵煎嚭 Store 妯″潡
this.storeModules = storeModules this.storeModules = storeModules
this.userModule = userModule this.userModule = userModule
this.appModule = appModule this.appModule = appModule
// 导出路由配置 // 瀵煎嚭璺敱閰嶇疆
this.createBaseRoutes = createBaseRoutes this.createBaseRoutes = createBaseRoutes
this.setupRouterGuards = setupRouterGuards this.setupRouterGuards = setupRouterGuards
// 导出组件 // 瀵煎嚭缁勪欢
this.Main = Main this.Main = Main
this.ParentView = ParentView this.ParentView = ParentView
this.LoginPage = LoginPage this.LoginPage = LoginPage
@@ -91,7 +100,7 @@ class AdminFramework {
this.Page404 = Page404 this.Page404 = Page404
this.Page500 = Page500 this.Page500 = Page500
// 导出系统页面 // 瀵煎嚭绯荤粺椤甸潰
this.HomePage = HomePage this.HomePage = HomePage
this.SysLog = SysLog this.SysLog = SysLog
this.SysParamSetup = SysParamSetup this.SysParamSetup = SysParamSetup
@@ -101,21 +110,21 @@ class AdminFramework {
this.SysMenu = SysMenu this.SysMenu = SysMenu
this.SysTitle = SysTitle this.SysTitle = SysTitle
// 导出 API // 瀵煎嚭 API
this.systemApi = systemApi this.systemApi = systemApi
this.systemHighApi = systemHighApi this.systemHighApi = systemHighApi
} }
/** /**
* Vue 插件安装方法 - 自动完成所有初始化 * Vue 鎻掍欢瀹夎鏂规硶 - 鑷姩瀹屾垚鎵€鏈夊垵濮嬪寲
* @param {Object} Vue - Vue 实例 * @param {Object} Vue - Vue 瀹炰緥
* @param {Object} options - 配置选项 * @param {Object} options - 閰嶇疆閫夐」
* @param {Object} options.config - 应用配置 * @param {Object} options.config - 搴旂敤閰嶇疆
* @param {Object} options.ViewUI - ViewUI 实例(可选,框架会自动处理) * @param {Object} options.ViewUI - ViewUI 瀹炰緥锛堝彲閫夛紝妗嗘灦浼氳嚜鍔ㄥ鐞嗭級
* @param {Object} options.VueRouter - VueRouter 实例(可选) * @param {Object} options.VueRouter - VueRouter 瀹炰緥锛堝彲閫夛級
* @param {Object} options.Vuex - Vuex 实例(可选) * @param {Object} options.Vuex - Vuex 瀹炰緥锛堝彲閫夛級
* @param {Function} options.createPersistedState - vuex-persistedstate(可选) * @param {Function} options.createPersistedState - vuex-persistedstate锛堝彲閫夛級
* @param {Object} options.componentMap - 自定义组件映射表(可选) * @param {Object} options.componentMap - 鑷畾涔夌粍浠舵槧灏勮〃锛堝彲閫夛級
*/ */
install(Vue, options = {}) { install(Vue, options = {}) {
if (this.installed) return if (this.installed) return
@@ -124,43 +133,42 @@ class AdminFramework {
const { config = {}, ViewUI, VueRouter, Vuex, createPersistedState, componentMap } = options const { config = {}, ViewUI, VueRouter, Vuex, createPersistedState, componentMap } = options
this.config = config this.config = config
// 自动注册 ViewUI // 鑷姩娉ㄥ唽 ViewUI
if (ViewUI) { if (ViewUI) {
Vue.use(ViewUI) Vue.use(ViewUI)
} }
// 自动注册 VueRouter // 鑷姩娉ㄥ唽 VueRouter
if (VueRouter) { if (VueRouter) {
Vue.use(VueRouter) Vue.use(VueRouter)
} }
// 自动注册 Vuex // 鑷姩娉ㄥ唽 Vuex
if (Vuex) { if (Vuex) {
Vue.use(Vuex) Vue.use(Vuex)
} }
// 挂载全局配置和工具 // 鎸傝浇鍏ㄥ眬閰嶇疆鍜屽伐鍏? Vue.prototype.$config = config
Vue.prototype.$config = config
Vue.prototype.$http = http Vue.prototype.$http = http
Vue.prototype.$tools = tools Vue.prototype.$tools = tools
Vue.prototype.$uiTool = uiTool Vue.prototype.$uiTool = uiTool
// 自动注册全局组件 // 鑷姩娉ㄥ唽鍏ㄥ眬缁勪欢
this.registerGlobalComponents(Vue) this.registerGlobalComponents(Vue)
// 自动设置组件映射表(包含外部传入的映射) // 鑷姩璁剧疆缁勪欢鏄犲皠琛紙鍖呭惈澶栭儴浼犲叆鐨勬槧灏勶級
this.setupComponentMap(componentMap) this.setupComponentMap(componentMap)
// 如果提供了 Vuex自动创建 Store // 濡傛灉鎻愪緵浜?Vuex锛岃嚜鍔ㄥ垱寤?Store
if (Vuex && !this.store) { if (Vuex && !this.store) {
this.store = this.createStore(Vuex, {}, createPersistedState) this.store = this.createStore(Vuex, {}, createPersistedState)
// 自动初始化 HTTP // 鑷姩鍒濆鍖?HTTP
http.init(config, this.store) http.init(config, this.store)
} }
// 如果提供了 VueRouter,自动创建 Router // 濡傛灉鎻愪緵浜?VueRouter锛岃嚜鍔ㄥ垱寤?Router
if (VueRouter && !this.router) { if (VueRouter && !this.router) {
// 获取主路由配置(从后端权限菜单生成) // 鑾峰彇涓昏矾鐢遍厤缃紙浠庡悗绔潈闄愯彍鍗曠敓鎴愶級
const mainRoute = this.getRoutes({ Main, ParentView, Page404 }) const mainRoute = this.getRoutes({ Main, ParentView, Page404 })
this.router = this.createRouter(VueRouter, { this.router = this.createRouter(VueRouter, {
@@ -175,28 +183,58 @@ class AdminFramework {
} }
/** /**
* 自动注册全局组件 * 鑷姩娉ㄥ唽鍏ㄥ眬缁勪欢
*/ */
registerGlobalComponents(Vue) { registerGlobalComponents(Vue) {
// 注册布局组件 // 娉ㄥ唽甯冨眬缁勪欢
Vue.component('Main', Main) Vue.component('Main', Main)
Vue.component('ParentView', ParentView) Vue.component('ParentView', ParentView)
// 注册错误页面 // 娉ㄥ唽閿欒椤甸潰
Vue.component('Page401', Page401) Vue.component('Page401', Page401)
Vue.component('Page404', Page404) Vue.component('Page404', Page404)
Vue.component('Page500', Page500) Vue.component('Page500', Page500)
// 注册登录页面 // 娉ㄥ唽鐧诲綍椤甸潰
Vue.component('LoginPage', LoginPage) Vue.component('LoginPage', LoginPage)
// ==================== 娉ㄥ唽鍏ㄥ眬涓氬姟缁勪欢 ====================
Vue.component('Tables', Tables)
Vue.component('UploadSingle', UploadSingle)
Vue.component('UploadMultiple', UploadMultiple)
Vue.component('TreeGrid', TreeGrid)
Vue.component('AsyncModal', AsyncModal)
Vue.component('InfoCard', InfoCard)
Vue.component('LoadFlower', LoadFlower)
Vue.component('SplitPane', SplitPane)
Vue.component('TextArea', TextArea)
Vue.component('CommonIcon', CommonIcon)
// ==================== 娉ㄥ唽鍏ㄥ眬涓氬姟缁勪欢 ====================
Vue.component('Tables', Tables)
Vue.component('Editor', Editor)
Vue.component('UploadSingle', UploadSingle)
Vue.component('UploadMultiple', UploadMultiple)
Vue.component('TreeGrid', TreeGrid)
Vue.component('AsyncModal', AsyncModal)
Vue.component('CronInput', CronInput)
Vue.component('Cropper', Cropper)
Vue.component('InfoCard', InfoCard)
Vue.component('LoadFlower', LoadFlower)
Vue.component('Markdown', Markdown)
Vue.component('MdIcons', MdIcons)
Vue.component('PasteEditor', PasteEditor)
Vue.component('SplitPane', SplitPane)
Vue.component('TextArea', TextArea)
Vue.component('CommonIcon', CommonIcon)
} }
/** /**
* 设置组件映射表(将后端返回的路径映射到实际组件) * 璁剧疆缁勪欢鏄犲皠琛紙灏嗗悗绔繑鍥炵殑璺緞鏄犲皠鍒板疄闄呯粍浠讹級
* @param {Object} customMap - 外部传入的自定义组件映射 * @param {Object} customMap - 澶栭儴浼犲叆鐨勮嚜瀹氫箟缁勪欢鏄犲皠
*/ */
setupComponentMap(customMap = {}) { setupComponentMap(customMap = {}) {
// 框架内置组件列表:路径 => 组件 // 妗嗘灦鍐呯疆缁勪欢鍒楄〃锛氳矾寰?=> 缁勪欢
const components = { const components = {
'home/index': HomePage, 'home/index': HomePage,
'system/sys_log': SysLog, 'system/sys_log': SysLog,
@@ -206,12 +244,10 @@ class AdminFramework {
'system_high/sys_control': SysControl, 'system_high/sys_control': SysControl,
'system_high/sys_menu': SysMenu, 'system_high/sys_menu': SysMenu,
'system_high/sys_title': SysTitle, 'system_high/sys_title': SysTitle,
// 合并外部传入的组件映射 // 鍚堝苟澶栭儴浼犲叆鐨勭粍浠舵槧灏? ...customMap
...customMap
} }
// 自动生成带 .vue 和不带 .vue 的映射 // 鑷姩鐢熸垚甯?.vue 鍜屼笉甯?.vue 鐨勬槧灏? const map = {}
const map = {}
Object.keys(components).forEach(path => { Object.keys(components).forEach(path => {
const cleanPath = path.replace(/\.vue$/, '') const cleanPath = path.replace(/\.vue$/, '')
map[cleanPath] = components[path] map[cleanPath] = components[path]
@@ -222,9 +258,7 @@ class AdminFramework {
} }
/** /**
* 添加自定义组件映射 * 娣诲姞鑷畾涔夌粍浠舵槧灏? * @param {Object} customMap - 鑷畾涔夌粍浠舵槧灏勫璞? * @example
* @param {Object} customMap - 自定义组件映射对象
* @example
* AdminFramework.addComponentMap({ * AdminFramework.addComponentMap({
* 'ball/games.vue': GamesComponent, * 'ball/games.vue': GamesComponent,
* 'order/pay_orders.vue': PayOrdersComponent * 'order/pay_orders.vue': PayOrdersComponent
@@ -235,9 +269,9 @@ class AdminFramework {
} }
/** /**
* 初始化 HTTP 配置 * 鍒濆鍖?HTTP 閰嶇疆
* @param {Object} config - HTTP 配置 * @param {Object} config - HTTP 閰嶇疆
* @param {Object} store - Vuex Store 实例 * @param {Object} store - Vuex Store 瀹炰緥
*/ */
initHttp(config, store) { initHttp(config, store) {
http.init(config, store) http.init(config, store)
@@ -245,13 +279,11 @@ class AdminFramework {
} }
/** /**
* 创建路由实例 * 鍒涘缓璺敱瀹炰緥
* @param {Object} Router - VueRouter * @param {Object} Router - VueRouter 绫? * @param {Object} components - 缁勪欢瀵硅薄
* @param {Object} components - 组件对象 * @param {Array} customRoutes - 鑷畾涔夎矾鐢? * @param {Object} ViewUI - ViewUI 瀹炰緥
* @param {Array} customRoutes - 自定义路由 * @param {String} homeName - 棣栭〉鍚嶇О
* @param {Object} ViewUI - ViewUI 实例 * @returns {Object} router 瀹炰緥
* @param {String} homeName - 首页名称
* @returns {Object} router 实例
*/ */
createRouter(Router, components = {}, customRoutes = [], ViewUI, homeName = 'home') { createRouter(Router, components = {}, customRoutes = [], ViewUI, homeName = 'home') {
const { LoginPage, Page401, Page404, Page500 } = components const { LoginPage, Page401, Page404, Page500 } = components
@@ -276,11 +308,9 @@ class AdminFramework {
} }
/** /**
* 创建 Store 实例 * 鍒涘缓 Store 瀹炰緥
* @param {Object} Vuex - Vuex * @param {Object} Vuex - Vuex 绫? * @param {Object} customModules - 鑷畾涔夋ā鍧? * @param {Object} createPersistedState - vuex-persistedstate 鎻掍欢
* @param {Object} customModules - 自定义模块 * @returns {Object} store 瀹炰緥
* @param {Object} createPersistedState - vuex-persistedstate 插件
* @returns {Object} store 实例
*/ */
createStore(Vuex, customModules = {}, createPersistedState) { createStore(Vuex, customModules = {}, createPersistedState) {
const store = new Vuex.Store({ const store = new Vuex.Store({
@@ -301,10 +331,8 @@ class AdminFramework {
} }
/** /**
* 获取动态路由 * 鑾峰彇鍔ㄦ€佽矾鐢? * @param {Object} components - 缁勪欢瀵硅薄
* @param {Object} components - 组件对象 * @returns {Object} 涓昏矾鐢遍厤缃? */
* @returns {Object} 主路由配置
*/
getRoutes(components = {}) { getRoutes(components = {}) {
const { Main, ParentView, Page404 } = components const { Main, ParentView, Page404 } = components
@@ -317,9 +345,9 @@ class AdminFramework {
} }
/** /**
* 注册全局组件 * 娉ㄥ唽鍏ㄥ眬缁勪欢
* @param {Object} Vue - Vue 实例 * @param {Object} Vue - Vue 瀹炰緥
* @param {Object} components - 组件对象 * @param {Object} components - 缁勪欢瀵硅薄
*/ */
registerComponents(Vue, components = {}) { registerComponents(Vue, components = {}) {
Object.keys(components).forEach(name => { Object.keys(components).forEach(name => {
@@ -328,29 +356,28 @@ class AdminFramework {
} }
} }
// ==================== 创建实例并导出 ==================== // ==================== 鍒涘缓瀹炰緥骞跺鍑?====================
const framework = new AdminFramework() const framework = new AdminFramework()
// 默认导出框架实例 // 榛樿瀵煎嚭妗嗘灦瀹炰緥
export default framework export default framework
// 按需导出 // 鎸夐渶瀵煎嚭
export { export {
// 工具库 // 宸ュ叿搴? tools,
tools,
uiTool, uiTool,
http, http,
// Store 模块 // Store 妯″潡
storeModules, storeModules,
userModule, userModule,
appModule, appModule,
// 路由配置 // 璺敱閰嶇疆
createBaseRoutes, createBaseRoutes,
setupRouterGuards, setupRouterGuards,
// 系统页面 // 绯荤粺椤甸潰
HomePage, HomePage,
SysLog, SysLog,
SysParamSetup, SysParamSetup,
@@ -360,21 +387,19 @@ export {
SysMenu, SysMenu,
SysTitle, SysTitle,
// 登录和错误页面 // 鐧诲綍鍜岄敊璇〉闈? LoginPage,
LoginPage,
Page401, Page401,
Page404, Page404,
Page500, Page500,
// 布局组件 // 甯冨眬缁勪欢
Main, Main,
ParentView, ParentView,
// 系统 API // 绯荤粺 API
systemApi, systemApi,
systemHighApi, systemHighApi,
// 框架类 // 妗嗘灦绫? AdminFramework
AdminFramework
} }

380
src/index.js.new Normal file
View File

@@ -0,0 +1,380 @@
/**
* Admin Framework - 閫氱敤鍚庡彴绠$悊绯荤粺妗嗘灦
* 鐗堟湰: 1.0.0
*
* 鍔熻兘鍖呭惈:
* - 绯荤粺绠$悊鍔熻兘 (sys_*)
* - 鐢ㄦ埛鐧诲綍鍜屾潈闄愮鐞? * - 鍔ㄦ€佽矾鐢辩鐞? * - 涓诲竷灞€鍜岄〉闈㈠竷灞€
* - 鍏ㄥ眬缁勪欢
* - 宸ュ叿搴? * - Vuex 鐘舵€佺鐞? */
// ==================== 鏍峰紡鏂囦欢 ====================
import './assets/css/animate.css'
import './assets/css/base.less'
import './assets/css/ivewExpand.less'
import './assets/icons/iconfont.css'
// ==================== 宸ュ叿搴?====================
import uiTool from './utils/uiTool'
import http from './utils/http'
import * as tools from './utils/tools'
// ==================== Store 妯″潡 ====================
import storeModules, { userModule, appModule } from './store'
// ==================== 璺敱閰嶇疆 ====================
import routerConfig, { createBaseRoutes, setupRouterGuards } from './router'
// ==================== 绯荤粺椤甸潰 ====================
// 涓婚〉
import HomePage from './views/home/index.vue'
// system 椤甸潰
import SysLog from './views/system/sys_log.vue'
import SysParamSetup from './views/system/sys_param_setup.vue'
import SysRole from './views/system/sys_role.vue'
import SysUser from './views/system/sys_user.vue'
// system_high 椤甸潰
import SysControl from './views/system_high/sys_control.vue'
import SysMenu from './views/system_high/sys_menu.vue'
import SysTitle from './views/system_high/sys_title.vue'
// 鐧诲綍鍜岄敊璇〉闈?import LoginPage from './views/login/login.vue'
import Page401 from './views/error-page/401.vue'
import Page404 from './views/error-page/404.vue'
import Page500 from './views/error-page/500.vue'
// 甯冨眬缁勪欢
import Main from './components/main'
import ParentView from './components/parent-view'
// ==================== 全局组件 ====================
import Tables from './components/tables'
import Editor from './components/editor'
import UploadSingle from './components/upload/Single.vue'
import UploadMultiple from './components/upload/Multiple.vue'
import UploadCustom from './components/upload/Custom.vue'
import TreeGrid from './components/treeGrid'
import AsyncModal from './components/asyncModal'
import CronInput from './components/cron-input'
import Cropper from './components/cropper'
import InfoCard from './components/info-card'
import LoadFlower from './components/load-flower'
import Markdown from './components/markdown'
import MdIcons from './components/md-icons'
import PasteEditor from './components/paste-editor'
import SplitPane from './components/split-pane'
import TextArea from './components/text-area'
import CommonIcon from './components/common-icon'
// ==================== 绯荤粺 API ====================
// system API
import * as systemApi from './api/system'
// system_high API
import * as systemHighApi from './api/system_high'
// ==================== 妗嗘灦绫?====================
class AdminFramework {
constructor() {
this.version = '1.0.0'
this.installed = false
this.config = {}
this.store = null
this.router = null
// 瀵煎嚭宸ュ叿
this.tools = tools
this.uiTool = uiTool
this.http = http
// 瀵煎嚭 Store 妯″潡
this.storeModules = storeModules
this.userModule = userModule
this.appModule = appModule
// 瀵煎嚭璺敱閰嶇疆
this.createBaseRoutes = createBaseRoutes
this.setupRouterGuards = setupRouterGuards
// 瀵煎嚭缁勪欢
this.Main = Main
this.ParentView = ParentView
this.LoginPage = LoginPage
this.Page401 = Page401
this.Page404 = Page404
this.Page500 = Page500
// 瀵煎嚭绯荤粺椤甸潰
this.HomePage = HomePage
this.SysLog = SysLog
this.SysParamSetup = SysParamSetup
this.SysRole = SysRole
this.SysUser = SysUser
this.SysControl = SysControl
this.SysMenu = SysMenu
this.SysTitle = SysTitle
// 瀵煎嚭 API
this.systemApi = systemApi
this.systemHighApi = systemHighApi
}
/**
* Vue 鎻掍欢瀹夎鏂规硶 - 鑷姩瀹屾垚鎵€鏈夊垵濮嬪寲
* @param {Object} Vue - Vue 瀹炰緥
* @param {Object} options - 閰嶇疆閫夐」
* @param {Object} options.config - 搴旂敤閰嶇疆
* @param {Object} options.ViewUI - ViewUI 瀹炰緥锛堝彲閫夛紝妗嗘灦浼氳嚜鍔ㄥ鐞嗭級
* @param {Object} options.VueRouter - VueRouter 瀹炰緥锛堝彲閫夛級
* @param {Object} options.Vuex - Vuex 瀹炰緥锛堝彲閫夛級
* @param {Function} options.createPersistedState - vuex-persistedstate锛堝彲閫夛級
* @param {Object} options.componentMap - 鑷畾涔夌粍浠舵槧灏勮〃锛堝彲閫夛級
*/
install(Vue, options = {}) {
if (this.installed) return
this.installed = true
const { config = {}, ViewUI, VueRouter, Vuex, createPersistedState, componentMap } = options
this.config = config
// 鑷姩娉ㄥ唽 ViewUI
if (ViewUI) {
Vue.use(ViewUI)
}
// 鑷姩娉ㄥ唽 VueRouter
if (VueRouter) {
Vue.use(VueRouter)
}
// 鑷姩娉ㄥ唽 Vuex
if (Vuex) {
Vue.use(Vuex)
}
// 鎸傝浇鍏ㄥ眬閰嶇疆鍜屽伐鍏? Vue.prototype.$config = config
Vue.prototype.$http = http
Vue.prototype.$tools = tools
Vue.prototype.$uiTool = uiTool
// 鑷姩娉ㄥ唽鍏ㄥ眬缁勪欢
this.registerGlobalComponents(Vue)
// 鑷姩璁剧疆缁勪欢鏄犲皠琛紙鍖呭惈澶栭儴浼犲叆鐨勬槧灏勶級
this.setupComponentMap(componentMap)
// 濡傛灉鎻愪緵浜?Vuex锛岃嚜鍔ㄥ垱寤?Store
if (Vuex && !this.store) {
this.store = this.createStore(Vuex, {}, createPersistedState)
// 鑷姩鍒濆鍖?HTTP
http.init(config, this.store)
}
// 濡傛灉鎻愪緵浜?VueRouter锛岃嚜鍔ㄥ垱寤?Router
if (VueRouter && !this.router) {
// 鑾峰彇涓昏矾鐢遍厤缃紙浠庡悗绔潈闄愯彍鍗曠敓鎴愶級
const mainRoute = this.getRoutes({ Main, ParentView, Page404 })
this.router = this.createRouter(VueRouter, {
Main,
ParentView,
LoginPage,
Page401,
Page404,
Page500
}, mainRoute ? [mainRoute] : [], ViewUI)
}
}
/**
* 鑷姩娉ㄥ唽鍏ㄥ眬缁勪欢
*/
registerGlobalComponents(Vue) {
// 娉ㄥ唽甯冨眬缁勪欢
Vue.component('Main', Main)
Vue.component('ParentView', ParentView)
// 娉ㄥ唽閿欒椤甸潰
Vue.component('Page401', Page401)
Vue.component('Page404', Page404)
Vue.component('Page500', Page500)
// 娉ㄥ唽鐧诲綍椤甸潰
Vue.component('LoginPage', LoginPage)
}
/**
* 璁剧疆缁勪欢鏄犲皠琛紙灏嗗悗绔繑鍥炵殑璺緞鏄犲皠鍒板疄闄呯粍浠讹級
* @param {Object} customMap - 澶栭儴浼犲叆鐨勮嚜瀹氫箟缁勪欢鏄犲皠
*/
setupComponentMap(customMap = {}) {
// 妗嗘灦鍐呯疆缁勪欢鍒楄〃锛氳矾寰?=> 缁勪欢
const components = {
'home/index': HomePage,
'system/sys_log': SysLog,
'system/sys_param_setup': SysParamSetup,
'system/sys_role': SysRole,
'system/sys_user': SysUser,
'system_high/sys_control': SysControl,
'system_high/sys_menu': SysMenu,
'system_high/sys_title': SysTitle,
// 鍚堝苟澶栭儴浼犲叆鐨勭粍浠舵槧灏? ...customMap
}
// 鑷姩鐢熸垚甯?.vue 鍜屼笉甯?.vue 鐨勬槧灏? const map = {}
Object.keys(components).forEach(path => {
const cleanPath = path.replace(/\.vue$/, '')
map[cleanPath] = components[path]
map[cleanPath + '.vue'] = components[path]
})
uiTool.setComponentMap(map)
}
/**
* 娣诲姞鑷畾涔夌粍浠舵槧灏? * @param {Object} customMap - 鑷畾涔夌粍浠舵槧灏勫璞? * @example
* AdminFramework.addComponentMap({
* 'ball/games.vue': GamesComponent,
* 'order/pay_orders.vue': PayOrdersComponent
* })
*/
addComponentMap(customMap) {
uiTool.setComponentMap(customMap)
}
/**
* 鍒濆鍖?HTTP 閰嶇疆
* @param {Object} config - HTTP 閰嶇疆
* @param {Object} store - Vuex Store 瀹炰緥
*/
initHttp(config, store) {
http.init(config, store)
this.store = store
}
/**
* 鍒涘缓璺敱瀹炰緥
* @param {Object} Router - VueRouter 绫? * @param {Object} components - 缁勪欢瀵硅薄
* @param {Array} customRoutes - 鑷畾涔夎矾鐢? * @param {Object} ViewUI - ViewUI 瀹炰緥
* @param {String} homeName - 棣栭〉鍚嶇О
* @returns {Object} router 瀹炰緥
*/
createRouter(Router, components = {}, customRoutes = [], ViewUI, homeName = 'home') {
const { LoginPage, Page401, Page404, Page500 } = components
if (!LoginPage || !Page401 || !Page404 || !Page500) {
console.error('Missing required page components')
return null
}
const baseRoutes = createBaseRoutes(LoginPage, Page401, Page404, Page500)
const router = new Router({
routes: [...baseRoutes, ...customRoutes],
mode: 'hash'
})
if (ViewUI) {
setupRouterGuards(router, ViewUI, homeName)
}
return router
}
/**
* 鍒涘缓 Store 瀹炰緥
* @param {Object} Vuex - Vuex 绫? * @param {Object} customModules - 鑷畾涔夋ā鍧? * @param {Object} createPersistedState - vuex-persistedstate 鎻掍欢
* @returns {Object} store 瀹炰緥
*/
createStore(Vuex, customModules = {}, createPersistedState) {
const store = new Vuex.Store({
modules: {
user: userModule,
app: appModule,
...customModules
},
plugins: createPersistedState ? [
createPersistedState({
storage: window.localStorage
})
] : []
})
this.store = store
return store
}
/**
* 鑾峰彇鍔ㄦ€佽矾鐢? * @param {Object} components - 缁勪欢瀵硅薄
* @returns {Object} 涓昏矾鐢遍厤缃? */
getRoutes(components = {}) {
const { Main, ParentView, Page404 } = components
if (!Main || !ParentView || !Page404) {
console.error('Missing required layout components')
return null
}
return uiTool.getRoutes(Main, ParentView, Page404)
}
/**
* 娉ㄥ唽鍏ㄥ眬缁勪欢
* @param {Object} Vue - Vue 瀹炰緥
* @param {Object} components - 缁勪欢瀵硅薄
*/
registerComponents(Vue, components = {}) {
Object.keys(components).forEach(name => {
Vue.component(name, components[name])
})
}
}
// ==================== 鍒涘缓瀹炰緥骞跺鍑?====================
const framework = new AdminFramework()
// 榛樿瀵煎嚭妗嗘灦瀹炰緥
export default framework
// 鎸夐渶瀵煎嚭
export {
// 宸ュ叿搴? tools,
uiTool,
http,
// Store 妯″潡
storeModules,
userModule,
appModule,
// 璺敱閰嶇疆
createBaseRoutes,
setupRouterGuards,
// 绯荤粺椤甸潰
HomePage,
SysLog,
SysParamSetup,
SysRole,
SysUser,
SysControl,
SysMenu,
SysTitle,
// 鐧诲綍鍜岄敊璇〉闈? LoginPage,
Page401,
Page404,
Page500,
// 甯冨眬缁勪欢
Main,
ParentView,
// 绯荤粺 API
systemApi,
systemHighApi,
// 妗嗘灦绫? AdminFramework
}