Compare commits
1 Commits
thin-v0.10
...
tauri-v0.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
92cabdb5d4 |
10
.env
@@ -10,11 +10,11 @@ VITE_APP_DESC=SoybeanAdmin是一个中后台管理系统模版
|
|||||||
VITE_AUTH_ROUTE_MODE=static
|
VITE_AUTH_ROUTE_MODE=static
|
||||||
|
|
||||||
# 路由首页(根路由重定向), 用于static模式的权限路由,dynamic模式取决于后端返回的路由首页
|
# 路由首页(根路由重定向), 用于static模式的权限路由,dynamic模式取决于后端返回的路由首页
|
||||||
VITE_ROUTE_HOME_PATH=/multi-menu/first/second
|
VITE_ROUTE_HOME_PATH=/dashboard/analysis
|
||||||
|
|
||||||
# iconify图标作为组件的前缀
|
# iconify图标作为组件的前缀
|
||||||
VITE_ICON_PREFIX=icon
|
VITE_ICON_PREFFIX=icon
|
||||||
|
|
||||||
# 本地SVG图标作为组件的前缀, 请注意一定要包含 VITE_ICON_PREFIX
|
# 本地SVG图标作为组件的前缀, 请注意一定要包含 VITE_ICON_PREFFIX
|
||||||
# 格式 {VITE_ICON_PREFIX}-{本地图标集合名称}
|
# 格式 {VITE_ICON_PREFFIX}-{本地图标集合名称}
|
||||||
VITE_ICON_LOCAL_PREFIX=icon-local
|
VITE_ICON_LOCAL_PREFFIX=icon-local
|
||||||
|
|||||||
@@ -1 +1,10 @@
|
|||||||
|
VITE_VISUALIZER=N
|
||||||
|
|
||||||
|
VITE_COMPRESS=N
|
||||||
|
|
||||||
|
# gzip | brotliCompress | deflate | deflateRaw
|
||||||
|
VITE_COMPRESS_TYPE=gzip
|
||||||
|
|
||||||
|
VITE_PWA=N
|
||||||
|
|
||||||
VITE_PROD_MOCK=Y
|
VITE_PROD_MOCK=Y
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
!.env-config.ts
|
!.env-config.ts
|
||||||
|
components.d.ts
|
||||||
router-page.d.ts
|
router-page.d.ts
|
||||||
|
*.svg
|
||||||
|
src-tauri/target
|
||||||
|
|||||||
@@ -10,8 +10,7 @@ module.exports = {
|
|||||||
{
|
{
|
||||||
files: ['*.vue'],
|
files: ['*.vue'],
|
||||||
rules: {
|
rules: {
|
||||||
'no-undef': 'off', // use tsc to check the ts code of the vue
|
'no-undef': 'off' // use tsc to check the ts code of the vue
|
||||||
'vue/no-setup-props-destructure': 'off' // wait to fix this rule
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
1
.gitignore
vendored
@@ -34,4 +34,3 @@ stats.html
|
|||||||
/src/typings/components.d.ts
|
/src/typings/components.d.ts
|
||||||
package-lock.json
|
package-lock.json
|
||||||
yarn.lock
|
yarn.lock
|
||||||
pnpm-lock.yaml
|
|
||||||
|
|||||||
14
.vscode/extensions.json
vendored
@@ -1,19 +1,27 @@
|
|||||||
{
|
{
|
||||||
"recommendations": [
|
"recommendations": [
|
||||||
|
"afzalsayed96.icones",
|
||||||
|
"antfu.iconify",
|
||||||
"antfu.unocss",
|
"antfu.unocss",
|
||||||
|
"christian-kohler.path-intellisense",
|
||||||
"dbaeumer.vscode-eslint",
|
"dbaeumer.vscode-eslint",
|
||||||
|
"eamodio.gitlens",
|
||||||
"editorconfig.editorconfig",
|
"editorconfig.editorconfig",
|
||||||
"esbenp.prettier-vscode",
|
"esbenp.prettier-vscode",
|
||||||
"formulahendry.auto-complete-tag",
|
|
||||||
"formulahendry.auto-close-tag",
|
"formulahendry.auto-close-tag",
|
||||||
|
"formulahendry.auto-complete-tag",
|
||||||
"formulahendry.auto-rename-tag",
|
"formulahendry.auto-rename-tag",
|
||||||
"kisstkondoros.vscode-gutter-preview",
|
"kisstkondoros.vscode-gutter-preview",
|
||||||
"lokalise.i18n-ally",
|
"lokalise.i18n-ally",
|
||||||
"mariusalchimavicius.json-to-ts",
|
"mariusalchimavicius.json-to-ts",
|
||||||
"mhutchie.git-graph",
|
"mhutchie.git-graph",
|
||||||
|
"mikestead.dotenv",
|
||||||
|
"naumovs.color-highlight",
|
||||||
|
"pkief.material-icon-theme",
|
||||||
"sdras.vue-vscode-snippets",
|
"sdras.vue-vscode-snippets",
|
||||||
"streetsidesoftware.code-spell-checker",
|
|
||||||
"vue.volar",
|
"vue.volar",
|
||||||
"vue.vscode-typescript-vue-plugin"
|
"vue.vscode-typescript-vue-plugin",
|
||||||
|
"whtouche.vscode-js-console-utils",
|
||||||
|
"zhuangtongfa.material-theme"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
123
.vscode/settings.json
vendored
@@ -1,76 +1,75 @@
|
|||||||
{
|
{
|
||||||
"cSpell.ignorePaths": [
|
|
||||||
"package.json",
|
|
||||||
"package-lock.json",
|
|
||||||
"yarn.lock",
|
|
||||||
"pnpm-lock.yaml",
|
|
||||||
"node_modules",
|
|
||||||
"vscode-extension",
|
|
||||||
".git/objects",
|
|
||||||
".vscode",
|
|
||||||
".vscode-insiders",
|
|
||||||
"CHANGELOG.md",
|
|
||||||
"dist",
|
|
||||||
"public",
|
|
||||||
"styles"
|
|
||||||
],
|
|
||||||
"cSpell.words": [
|
|
||||||
"AMAP",
|
|
||||||
"antdesign",
|
|
||||||
"antv",
|
|
||||||
"apacheecharts",
|
|
||||||
"areaspline",
|
|
||||||
"bmapgl",
|
|
||||||
"colord",
|
|
||||||
"echarts",
|
|
||||||
"gitee",
|
|
||||||
"gridicons",
|
|
||||||
"iconify",
|
|
||||||
"jsapi",
|
|
||||||
"naiveui",
|
|
||||||
"Popconfirm",
|
|
||||||
"Posva",
|
|
||||||
"Shenzhen",
|
|
||||||
"Sider",
|
|
||||||
"tauri",
|
|
||||||
"unocss",
|
|
||||||
"unplugin",
|
|
||||||
"vditor",
|
|
||||||
"VERCEL",
|
|
||||||
"Vite",
|
|
||||||
"vitejs",
|
|
||||||
"vuedraggable",
|
|
||||||
"vueuse",
|
|
||||||
"wangeditor",
|
|
||||||
"wechat",
|
|
||||||
"xgplayer",
|
|
||||||
"yanbowe",
|
|
||||||
"ភាសាខ្មែរ"
|
|
||||||
],
|
|
||||||
"editor.codeActionsOnSave": {
|
"editor.codeActionsOnSave": {
|
||||||
"source.fixAll.eslint": true
|
"source.fixAll.eslint": true
|
||||||
},
|
},
|
||||||
"editor.fontLigatures": true,
|
"editor.fontLigatures": true,
|
||||||
"editor.formatOnSave": false,
|
"editor.formatOnSave": false,
|
||||||
|
"editor.guides.bracketPairs": "active",
|
||||||
"editor.quickSuggestions": {
|
"editor.quickSuggestions": {
|
||||||
"strings": true
|
"strings": true
|
||||||
},
|
},
|
||||||
"editor.tabSize": 2,
|
"editor.tabSize": 2,
|
||||||
"eslint.validate": ["json"],
|
"eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact", "vue", "json"],
|
||||||
"files.associations": {
|
"files.associations": {
|
||||||
"*.env.*": "dotenv",
|
"*.env.*": "dotenv"
|
||||||
"*.svg": "html"
|
|
||||||
},
|
},
|
||||||
"files.eol": "\n",
|
"files.eol": "\n",
|
||||||
"i18n-ally.displayLanguage": "zh-CN",
|
"git.enableSmartCommit": true,
|
||||||
"i18n-ally.enabledParsers": ["ts"],
|
"gutterpreview.paths": {
|
||||||
"i18n-ally.enabledFrameworks": ["vue"],
|
"@": "/src",
|
||||||
"i18n-ally.editor.preferEditor": true,
|
"~@": "/src"
|
||||||
"i18n-ally.keystyle": "nested",
|
},
|
||||||
"i18n-ally.localesPaths": ["src/locales/lang"],
|
"material-icon-theme.activeIconPack": "angular",
|
||||||
"material-icon-theme.activeIconPack": "vue",
|
"material-icon-theme.files.associations": {},
|
||||||
"[html][css][less][scss][sass][markdown][yaml][yml][jsonc]": {
|
"material-icon-theme.folders.associations": {
|
||||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
"src-tauri": "src",
|
||||||
"editor.formatOnSave": true
|
"enum": "typescript",
|
||||||
}
|
"enums": "typescript",
|
||||||
|
"store": "context",
|
||||||
|
"stores": "context",
|
||||||
|
"composable": "hook",
|
||||||
|
"composables": "hook",
|
||||||
|
"directive": "tools",
|
||||||
|
"directives": "tools",
|
||||||
|
"business": "core",
|
||||||
|
"request": "api",
|
||||||
|
"adapter": "middleware"
|
||||||
|
},
|
||||||
|
"path-intellisense.mappings": {
|
||||||
|
"@": "${workspaceFolder}/src",
|
||||||
|
"~@": "${workspaceFolder}/src"
|
||||||
|
},
|
||||||
|
"terminal.integrated.fontSize": 14,
|
||||||
|
"terminal.integrated.fontWeight": 500,
|
||||||
|
"terminal.integrated.tabs.enabled": true,
|
||||||
|
"workbench.iconTheme": "material-icon-theme",
|
||||||
|
"workbench.colorTheme": "One Dark Pro",
|
||||||
|
"[html]": {
|
||||||
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||||
|
},
|
||||||
|
"[json]": {
|
||||||
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||||
|
},
|
||||||
|
"[jsonc]": {
|
||||||
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||||
|
},
|
||||||
|
"[javascript]": {
|
||||||
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||||
|
},
|
||||||
|
"[javascriptreact]": {
|
||||||
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||||
|
},
|
||||||
|
"[markdown]": {
|
||||||
|
"editor.defaultFormatter": "yzhang.markdown-all-in-one"
|
||||||
|
},
|
||||||
|
"[typescript]": {
|
||||||
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||||
|
},
|
||||||
|
"[typescriptreact]": {
|
||||||
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||||
|
},
|
||||||
|
"[vue]": {
|
||||||
|
"editor.defaultFormatter": "Vue.volar"
|
||||||
|
},
|
||||||
|
"i18n-ally.localesPaths": ["src/locales", "src/locales/lang"]
|
||||||
}
|
}
|
||||||
|
|||||||
80
CHANGELOG.md
@@ -1,86 +1,6 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
|
||||||
## [v0.10.4](https://github.com/honghuangdc/soybean-admin/compare/v0.10.3...v0.10.4) (23-09-20)
|
|
||||||
|
|
||||||
### 🚀 Features
|
|
||||||
|
|
||||||
- **auth**:
|
|
||||||
- 防止多次刷新token - by @eAliwei [<samp>(0eaa3)</samp>](https://github.com/honghuangdc/soybean-admin/commit/0eaa327)
|
|
||||||
- **hooks**:
|
|
||||||
- add useHookTable - by @honghuangdc [<samp>(b3ae7)</samp>](https://github.com/honghuangdc/soybean-admin/commit/b3ae760)
|
|
||||||
- **projects**:
|
|
||||||
- add websocket demo - by @honghuangdc [<samp>(af53e)</samp>](https://github.com/honghuangdc/soybean-admin/commit/af53ec7)
|
|
||||||
- add switch for customize darkmode transition - by @honghuangdc [<samp>(6e0cc)</samp>](https://github.com/honghuangdc/soybean-admin/commit/6e0cce4)
|
|
||||||
- new i18n function $t & login page and setting drawer config i18n - by @honghuangdc [<samp>(854d0)</samp>](https://github.com/honghuangdc/soybean-admin/commit/854d0bc)
|
|
||||||
- add plugin-web-update-notification - by @honghuangdc [<samp>(c9164)</samp>](https://github.com/honghuangdc/soybean-admin/commit/c91644b)
|
|
||||||
|
|
||||||
### 🐞 Bug Fixes
|
|
||||||
|
|
||||||
- **components**:
|
|
||||||
- 修复动态路由主页404 - by @lapislazulisch [<samp>(3ae19)</samp>](https://github.com/honghuangdc/soybean-admin/commit/3ae1952)
|
|
||||||
- 修复动态路由home页404 - by @lapislazulisch [<samp>(ad6ac)</samp>](https://github.com/honghuangdc/soybean-admin/commit/ad6ac72)
|
|
||||||
- **projects**:
|
|
||||||
- fix set tab title (fixed #256) - by @honghuangdc in https://github.com/honghuangdc/soybean-admin/issues/256 [<samp>(13f6c)</samp>](https://github.com/honghuangdc/soybean-admin/commit/13f6cd8)
|
|
||||||
- correct the lang file name & add recommend vscode plugin i18n-ally - by @honghuangdc [<samp>(864ec)</samp>](https://github.com/honghuangdc/soybean-admin/commit/864ec47)
|
|
||||||
- fix reload button animate - by @honghuangdc [<samp>(41f23)</samp>](https://github.com/honghuangdc/soybean-admin/commit/41f2338)
|
|
||||||
- **styles**:
|
|
||||||
- 用户管理页面布局自适应屏幕高度 (fixed #253) - by @honghuangdc in https://github.com/honghuangdc/soybean-admin/issues/253 [<samp>(0f7b9)</samp>](https://github.com/honghuangdc/soybean-admin/commit/0f7b9d5)
|
|
||||||
|
|
||||||
### 🔥 Performance
|
|
||||||
|
|
||||||
- **hooks**:
|
|
||||||
- perf use-table - by @honghuangdc [<samp>(33180)</samp>](https://github.com/honghuangdc/soybean-admin/commit/3318041)
|
|
||||||
- perf useHookTable - by @honghuangdc [<samp>(809fa)</samp>](https://github.com/honghuangdc/soybean-admin/commit/809fa85)
|
|
||||||
- **projects**:
|
|
||||||
- add type declaration for document startViewTransition - by @honghuangdc [<samp>(d3ebe)</samp>](https://github.com/honghuangdc/soybean-admin/commit/d3ebe95)
|
|
||||||
|
|
||||||
### 💅 Refactors
|
|
||||||
|
|
||||||
- **projects**:
|
|
||||||
- 生产环境缓存主题变更为sessionStorage - by @honghuangdc [<samp>(c46a5)</samp>](https://github.com/honghuangdc/soybean-admin/commit/c46a592)
|
|
||||||
- add reCacheRoute method - by @honghuangdc [<samp>(f92ee)</samp>](https://github.com/honghuangdc/soybean-admin/commit/f92ee77)
|
|
||||||
- update soybean domain - by @honghuangdc [<samp>(073fd)</samp>](https://github.com/honghuangdc/soybean-admin/commit/073fd16)
|
|
||||||
|
|
||||||
### 📖 Documentation
|
|
||||||
|
|
||||||
- **projects**:
|
|
||||||
- update README.md logo - by @honghuangdc [<samp>(19141)</samp>](https://github.com/honghuangdc/soybean-admin/commit/19141a7)
|
|
||||||
- update Docker deployment method - by @snowords [<samp>(00da0)</samp>](https://github.com/honghuangdc/soybean-admin/commit/00da000)
|
|
||||||
- update git hooks init command - by @snowords [<samp>(7f35e)</samp>](https://github.com/honghuangdc/soybean-admin/commit/7f35e87)
|
|
||||||
- update README.md - by @eltociear [<samp>(93ed5)</samp>](https://github.com/honghuangdc/soybean-admin/commit/93ed5ad)
|
|
||||||
|
|
||||||
### 🏡 Chore
|
|
||||||
|
|
||||||
- **deps**:
|
|
||||||
- update deps - by @honghuangdc [<samp>(bba68)</samp>](https://github.com/honghuangdc/soybean-admin/commit/bba68bf)
|
|
||||||
- update deps - by @honghuangdc [<samp>(0e6d2)</samp>](https://github.com/honghuangdc/soybean-admin/commit/0e6d289)
|
|
||||||
- update deps - by @honghuangdc [<samp>(135ce)</samp>](https://github.com/honghuangdc/soybean-admin/commit/135ce77)
|
|
||||||
- update deps - by @honghuangdc [<samp>(44ba3)</samp>](https://github.com/honghuangdc/soybean-admin/commit/44ba327)
|
|
||||||
- update deps - by @honghuangdc [<samp>(9296e)</samp>](https://github.com/honghuangdc/soybean-admin/commit/9296e69)
|
|
||||||
- update deps - by @honghuangdc [<samp>(751de)</samp>](https://github.com/honghuangdc/soybean-admin/commit/751ded4)
|
|
||||||
- update deps - by @honghuangdc [<samp>(305d9)</samp>](https://github.com/honghuangdc/soybean-admin/commit/305d956)
|
|
||||||
- **projects**:
|
|
||||||
- update deps and fix swiper - by @honghuangdc [<samp>(9d105)</samp>](https://github.com/honghuangdc/soybean-admin/commit/9d1051b)
|
|
||||||
- update package.json - by @honghuangdc [<samp>(d7aea)</samp>](https://github.com/honghuangdc/soybean-admin/commit/d7aea9d)
|
|
||||||
- update deps & fix eslint code - by @honghuangdc [<samp>(08e0c)</samp>](https://github.com/honghuangdc/soybean-admin/commit/08e0cf5)
|
|
||||||
- update pnpm-lock.yaml - by @honghuangdc [<samp>(94644)</samp>](https://github.com/honghuangdc/soybean-admin/commit/9464473)
|
|
||||||
- update VSCode setting - by @honghuangdc [<samp>(56c77)</samp>](https://github.com/honghuangdc/soybean-admin/commit/56c770c)
|
|
||||||
- correct the word spell - by @honghuangdc [<samp>(458e3)</samp>](https://github.com/honghuangdc/soybean-admin/commit/458e387)
|
|
||||||
- correct word spell & eslint fix code - by @honghuangdc [<samp>(cffc3)</samp>](https://github.com/honghuangdc/soybean-admin/commit/cffc30a)
|
|
||||||
- When tab is switched, keep the page without refreshing - by @linjiangl [<samp>(83f25)</samp>](https://github.com/honghuangdc/soybean-admin/commit/83f2514)
|
|
||||||
|
|
||||||
### 🎨 Styles
|
|
||||||
|
|
||||||
- **projects**:
|
|
||||||
- unify card border radius, 16px to 8px - by @honghuangdc [<samp>(cbda4)</samp>](https://github.com/honghuangdc/soybean-admin/commit/cbda4a3)
|
|
||||||
- update default theme color - by @honghuangdc [<samp>(43ac2)</samp>](https://github.com/honghuangdc/soybean-admin/commit/43ac23f)
|
|
||||||
- prettier format code - by @honghuangdc [<samp>(24cf1)</samp>](https://github.com/honghuangdc/soybean-admin/commit/24cf1d9)
|
|
||||||
|
|
||||||
### ❤️ Contributors
|
|
||||||
|
|
||||||
[](https://github.com/honghuangdc) [](https://github.com/eltociear) [](https://github.com/linjiangl) [](https://github.com/lapislazulisch) [](https://github.com/snowords) [](https://github.com/eAliwei) [](https://github.com/honghuangdc)
|
|
||||||
|
|
||||||
## [v0.10.3](https://github.com/honghuangdc/soybean-admin/compare/v0.10.2...v0.10.3) (23-06-15)
|
## [v0.10.3](https://github.com/honghuangdc/soybean-admin/compare/v0.10.2...v0.10.3) (23-06-15)
|
||||||
|
|
||||||
### 🐞 Bug Fixes
|
### 🐞 Bug Fixes
|
||||||
|
|||||||
16
Makefile
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
ImageTag ?=v0.9.6
|
||||||
|
SoybeanAdminImg ?= soybeanjs/soybean-admin:$(ImageTag)
|
||||||
|
|
||||||
|
VERSION=$(shell git rev-parse --short HEAD)
|
||||||
|
|
||||||
|
soybean-admin: soybean-admin-build soybean-admin-push
|
||||||
|
|
||||||
|
soybean-admin-build:
|
||||||
|
docker build --build-arg version=$(VERSION) -t ${SoybeanAdminImg} -f docker/Dockerfile .
|
||||||
|
|
||||||
|
soybean-admin-push:
|
||||||
|
docker push ${SoybeanAdminImg}
|
||||||
|
|
||||||
|
# run tauri app:
|
||||||
|
run:
|
||||||
|
pnpm tauri dev
|
||||||
15
README.md
@@ -1,5 +1,5 @@
|
|||||||
<div align="center">
|
<div align="center">
|
||||||
<img src="./public/favicon.svg" style="width: 160px;"/>
|
<img src="https://soybeanjs-1300612522.cos.ap-guangzhou.myqcloud.com/uPic/soybean.svg" style="width: 160px;"/>
|
||||||
<h1>Soybean Admin</h1>
|
<h1>Soybean Admin</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -34,17 +34,17 @@
|
|||||||
|
|
||||||
## 在线预览
|
## 在线预览
|
||||||
|
|
||||||
- [Soybean Admin 预览地址](https://admin.soybeanjs.cn/)
|
- [Soybean Admin 预览地址](https://soybean.pro/)
|
||||||
|
|
||||||
## 文档
|
## 文档
|
||||||
|
|
||||||
- [项目文档预览地址](https://admin-docs.soybeanjs.cn/)
|
- [项目文档预览地址](https://docs.soybean.pro)
|
||||||
|
|
||||||
## 代码仓库
|
## 代码仓库
|
||||||
|
|
||||||
| 仓库 | GitHub 地址 | gitee 镜像 | 预览 |
|
| 仓库 | github 地址 | gitee 镜像 | 预览 |
|
||||||
| -------------- | ----------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | --------------------------------------------------------- |
|
| -------------- | ----------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | --------------------------------------------------------- |
|
||||||
| soybean-admin | [GitHub](https://github.com/honghuangdc/soybean-admin) | [gitee](https://gitee.com/honghuangdc/soybean-admin) | [预览](https://admin.soybeanjs.cn/) |
|
| soybean-admin | [github](https://github.com/honghuangdc/soybean-admin) | [gitee](https://gitee.com/honghuangdc/soybean-admin) | [预览](https://soybean.pro/) |
|
||||||
| tauri 版 | [tauri 版](https://github.com/honghuangdc/soybean-admin/tree/tauri) | [tauri 版](https://gitee.com/honghuangdc/soybean-admin/tree/tauri) | |
|
| tauri 版 | [tauri 版](https://github.com/honghuangdc/soybean-admin/tree/tauri) | [tauri 版](https://gitee.com/honghuangdc/soybean-admin/tree/tauri) | |
|
||||||
| 精简版 | [精简版](https://github.com/honghuangdc/soybean-admin/tree/thin) | [精简版](https://gitee.com/honghuangdc/soybean-admin/tree/thin) | |
|
| 精简版 | [精简版](https://github.com/honghuangdc/soybean-admin/tree/thin) | [精简版](https://gitee.com/honghuangdc/soybean-admin/tree/thin) | |
|
||||||
| 集成 fast-crud | [集成 fast-crud](https://github.com/honghuangdc/soybean-admin/tree/fast-crud) | [集成 fast-crud](https://gitee.com/honghuangdc/soybean-admin/tree/fast-crud) | [预览](http://fast-crud.docmirror.cn/soybean/#/crud/demo) |
|
| 集成 fast-crud | [集成 fast-crud](https://github.com/honghuangdc/soybean-admin/tree/fast-crud) | [集成 fast-crud](https://gitee.com/honghuangdc/soybean-admin/tree/fast-crud) | [预览](http://fast-crud.docmirror.cn/soybean/#/crud/demo) |
|
||||||
@@ -123,8 +123,7 @@ pnpm build
|
|||||||
- Docker 部署 Soybean
|
- Docker 部署 Soybean
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker build -t soybean-admin-image -f docker/Dockerfile .
|
docker run --name soybean -p 80:80 -d soybeanjs/soybean-admin:v0.9.6
|
||||||
docker run -d -p 80:80 soybean-admin-image
|
|
||||||
```
|
```
|
||||||
|
|
||||||
- 访问 SoybeanAdmin
|
- 访问 SoybeanAdmin
|
||||||
@@ -139,7 +138,7 @@ docker run -d -p 80:80 soybean-admin-image
|
|||||||
|
|
||||||
项目已经内置 Angular 提交规范,直接执行 commit 命令即可生成符合 Angular 提交规范的 commit。
|
项目已经内置 Angular 提交规范,直接执行 commit 命令即可生成符合 Angular 提交规范的 commit。
|
||||||
|
|
||||||
项目已用 simple-git-hooks 代替了 husky, 旧版本用了 husky,执行 pnpm soy init-simple-git-hooks 进行初始化配置
|
项目已用 simple-git-hooks 代替了 husky, 旧版本用了 husky,执行 pnpm soy init-git-hooks 进行初始化配置
|
||||||
|
|
||||||
## 浏览器支持
|
## 浏览器支持
|
||||||
|
|
||||||
|
|||||||
8
build/config/define.ts
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
|
/** 项目构建时间 */
|
||||||
|
const PROJECT_BUILD_TIME = JSON.stringify(dayjs().format('YYYY-MM-DD HH:mm:ss'));
|
||||||
|
|
||||||
|
export const viteDefine = {
|
||||||
|
PROJECT_BUILD_TIME
|
||||||
|
};
|
||||||
@@ -1 +1,2 @@
|
|||||||
|
export * from './define';
|
||||||
export * from './proxy';
|
export * from './proxy';
|
||||||
|
|||||||
6
build/plugins/compress.ts
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import ViteCompression from 'vite-plugin-compression';
|
||||||
|
|
||||||
|
export default (viteEnv: ImportMetaEnv) => {
|
||||||
|
const { VITE_COMPRESS_TYPE = 'gzip' } = viteEnv;
|
||||||
|
return ViteCompression({ algorithm: VITE_COMPRESS_TYPE });
|
||||||
|
};
|
||||||
@@ -2,10 +2,14 @@ import type { PluginOption } from 'vite';
|
|||||||
import vue from '@vitejs/plugin-vue';
|
import vue from '@vitejs/plugin-vue';
|
||||||
import vueJsx from '@vitejs/plugin-vue-jsx';
|
import vueJsx from '@vitejs/plugin-vue-jsx';
|
||||||
import unocss from '@unocss/vite';
|
import unocss from '@unocss/vite';
|
||||||
|
import progress from 'vite-plugin-progress';
|
||||||
import VueDevtools from 'vite-plugin-vue-devtools';
|
import VueDevtools from 'vite-plugin-vue-devtools';
|
||||||
import pageRoute from '@soybeanjs/vite-plugin-vue-page-route';
|
import pageRoute from '@soybeanjs/vite-plugin-vue-page-route';
|
||||||
import unplugin from './unplugin';
|
import unplugin from './unplugin';
|
||||||
import mock from './mock';
|
import mock from './mock';
|
||||||
|
import visualizer from './visualizer';
|
||||||
|
import compress from './compress';
|
||||||
|
import pwa from './pwa';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* vite插件
|
* vite插件
|
||||||
@@ -22,9 +26,19 @@ export function setupVitePlugins(viteEnv: ImportMetaEnv): (PluginOption | Plugin
|
|||||||
VueDevtools(),
|
VueDevtools(),
|
||||||
...unplugin(viteEnv),
|
...unplugin(viteEnv),
|
||||||
unocss(),
|
unocss(),
|
||||||
mock(viteEnv)
|
mock(viteEnv),
|
||||||
|
progress()
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if (viteEnv.VITE_VISUALIZER === 'Y') {
|
||||||
|
plugins.push(visualizer as PluginOption);
|
||||||
|
}
|
||||||
|
if (viteEnv.VITE_COMPRESS === 'Y') {
|
||||||
|
plugins.push(compress(viteEnv));
|
||||||
|
}
|
||||||
|
if (viteEnv.VITE_PWA === 'Y' || viteEnv.VITE_VERCEL === 'Y') {
|
||||||
|
plugins.push(pwa());
|
||||||
|
}
|
||||||
if (viteEnv.VITE_SOYBEAN_ROUTE_PLUGIN === 'Y') {
|
if (viteEnv.VITE_SOYBEAN_ROUTE_PLUGIN === 'Y') {
|
||||||
plugins.push(pageRoute());
|
plugins.push(pageRoute());
|
||||||
}
|
}
|
||||||
|
|||||||
31
build/plugins/pwa.ts
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
import { VitePWA } from 'vite-plugin-pwa';
|
||||||
|
|
||||||
|
export default function setupVitePwa() {
|
||||||
|
return VitePWA({
|
||||||
|
registerType: 'autoUpdate',
|
||||||
|
includeAssets: ['favicon.ico'],
|
||||||
|
manifest: {
|
||||||
|
name: 'SoybeanAdmin',
|
||||||
|
short_name: 'SoybeanAdmin',
|
||||||
|
theme_color: '#fff',
|
||||||
|
icons: [
|
||||||
|
{
|
||||||
|
src: '/logo.png',
|
||||||
|
sizes: '192x192',
|
||||||
|
type: 'image/png'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
src: '/logo.png',
|
||||||
|
sizes: '512x512',
|
||||||
|
type: 'image/png'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
src: '/logo.png',
|
||||||
|
sizes: '512x512',
|
||||||
|
type: 'image/png',
|
||||||
|
purpose: 'any maskable'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -7,13 +7,13 @@ import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';
|
|||||||
import { getSrcPath } from '../utils';
|
import { getSrcPath } from '../utils';
|
||||||
|
|
||||||
export default function unplugin(viteEnv: ImportMetaEnv) {
|
export default function unplugin(viteEnv: ImportMetaEnv) {
|
||||||
const { VITE_ICON_PREFIX, VITE_ICON_LOCAL_PREFIX } = viteEnv;
|
const { VITE_ICON_PREFFIX, VITE_ICON_LOCAL_PREFFIX } = viteEnv;
|
||||||
|
|
||||||
const srcPath = getSrcPath();
|
const srcPath = getSrcPath();
|
||||||
const localIconPath = `${srcPath}/assets/svg-icon`;
|
const localIconPath = `${srcPath}/assets/svg-icon`;
|
||||||
|
|
||||||
/** 本地svg图标集合名称 */
|
/** 本地svg图标集合名称 */
|
||||||
const collectionName = VITE_ICON_LOCAL_PREFIX.replace(`${VITE_ICON_PREFIX}-`, '');
|
const collectionName = VITE_ICON_LOCAL_PREFFIX.replace(`${VITE_ICON_PREFFIX}-`, '');
|
||||||
|
|
||||||
return [
|
return [
|
||||||
Icons({
|
Icons({
|
||||||
@@ -31,12 +31,12 @@ export default function unplugin(viteEnv: ImportMetaEnv) {
|
|||||||
types: [{ from: 'vue-router', names: ['RouterLink', 'RouterView'] }],
|
types: [{ from: 'vue-router', names: ['RouterLink', 'RouterView'] }],
|
||||||
resolvers: [
|
resolvers: [
|
||||||
NaiveUiResolver(),
|
NaiveUiResolver(),
|
||||||
IconsResolver({ customCollections: [collectionName], componentPrefix: VITE_ICON_PREFIX })
|
IconsResolver({ customCollections: [collectionName], componentPrefix: VITE_ICON_PREFFIX })
|
||||||
]
|
]
|
||||||
}),
|
}),
|
||||||
createSvgIconsPlugin({
|
createSvgIconsPlugin({
|
||||||
iconDirs: [localIconPath],
|
iconDirs: [localIconPath],
|
||||||
symbolId: `${VITE_ICON_LOCAL_PREFIX}-[dir]-[name]`,
|
symbolId: `${VITE_ICON_LOCAL_PREFFIX}-[dir]-[name]`,
|
||||||
inject: 'body-last',
|
inject: 'body-last',
|
||||||
customDomId: '__SVG_ICON_LOCAL__'
|
customDomId: '__SVG_ICON_LOCAL__'
|
||||||
})
|
})
|
||||||
|
|||||||
7
build/plugins/visualizer.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import { visualizer } from 'rollup-plugin-visualizer';
|
||||||
|
|
||||||
|
export default visualizer({
|
||||||
|
gzipSize: true,
|
||||||
|
brotliSize: true,
|
||||||
|
open: true
|
||||||
|
});
|
||||||
32
docker/.dockerignore
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
node_modules
|
||||||
|
.DS_Store
|
||||||
|
dist
|
||||||
|
.npmrc
|
||||||
|
.cache
|
||||||
|
|
||||||
|
tests/server/static
|
||||||
|
tests/server/static/upload
|
||||||
|
|
||||||
|
.local
|
||||||
|
# local env files
|
||||||
|
.env.local
|
||||||
|
.env.*.local
|
||||||
|
.eslintcache
|
||||||
|
|
||||||
|
# Log files
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
pnpm-debug.log*
|
||||||
|
|
||||||
|
# Editor directories and files
|
||||||
|
.idea
|
||||||
|
# .vscode
|
||||||
|
*.suo
|
||||||
|
*.ntvs*
|
||||||
|
*.njsproj
|
||||||
|
*.sln
|
||||||
|
*.sw?
|
||||||
|
yarn.lock
|
||||||
|
pnpm-lock.yaml
|
||||||
|
/vite-profile.cpuprofile
|
||||||
24
docker/Dockerfile
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
FROM node:16.17.0 as builder
|
||||||
|
|
||||||
|
ENV WORKDIR=/soybean-admin
|
||||||
|
|
||||||
|
WORKDIR $WORKDIR
|
||||||
|
|
||||||
|
COPY ./ $WORKDIR/
|
||||||
|
|
||||||
|
ARG version
|
||||||
|
ENV COMMITID=$version
|
||||||
|
|
||||||
|
RUN npm i -g pnpm
|
||||||
|
|
||||||
|
RUN pnpm install
|
||||||
|
RUN pnpm build
|
||||||
|
|
||||||
|
FROM nginx:alpine as prod
|
||||||
|
|
||||||
|
RUN mkdir /soybean
|
||||||
|
|
||||||
|
COPY --from=builder /soybean-admin/dist /soybean-admin
|
||||||
|
COPY --from=builder /soybean-admin/docker/nginx.conf /etc/nginx/nginx.conf
|
||||||
|
|
||||||
|
EXPOSE 80
|
||||||
54
docker/nginx.conf
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
user nginx;
|
||||||
|
worker_processes 1;
|
||||||
|
error_log /var/log/nginx/error.log warn;
|
||||||
|
pid /var/run/nginx.pid;
|
||||||
|
|
||||||
|
events {
|
||||||
|
worker_connections 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
include /etc/nginx/mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||||
|
'$status $body_bytes_sent "$http_referer" '
|
||||||
|
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||||
|
access_log /var/log/nginx/access.log main;
|
||||||
|
sendfile on;
|
||||||
|
keepalive_timeout 65;
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name localhost;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
# 不缓存html,防止程序更新后缓存继续生效
|
||||||
|
if ($request_filename ~* .*\.(?:htm|html)$) {
|
||||||
|
add_header Cache-Control "private, no-store, no-cache, must-revalidate, proxy-revalidate";
|
||||||
|
access_log on;
|
||||||
|
}
|
||||||
|
root /soybean-admin/;
|
||||||
|
index index.html index.htm;
|
||||||
|
try_files $uri $uri/ /index.html;
|
||||||
|
}
|
||||||
|
|
||||||
|
# location /soybean/soybean-webserver/v1 {
|
||||||
|
# proxy_set_header Host $host;
|
||||||
|
# proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
# proxy_set_header REMOTE-HOST $remote_addr;
|
||||||
|
|
||||||
|
# # 后台接口地址
|
||||||
|
# proxy_pass http://192.168.1.99:30597/v1;
|
||||||
|
# proxy_redirect default;
|
||||||
|
# add_header Access-Control-Allow-Origin *;
|
||||||
|
# add_header Access-Control-Allow-Headers X-Requested-With;
|
||||||
|
# add_header Access-Control-Allow-Methods GET,POST,OPTIONS;
|
||||||
|
# }
|
||||||
|
|
||||||
|
error_page 500 502 503 504 /50x.html;
|
||||||
|
location = /50x.html {
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,12 +1,7 @@
|
|||||||
<!-- prettier-ignore -->
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="zh-cmn-Hans">
|
<html lang="zh-cmn-Hans">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta http-equiv="Expires" content="0" />
|
|
||||||
<meta http-equiv="Pragma" content="no-cache" />
|
|
||||||
<meta http-equiv="Cache-control" content="no-cache" />
|
|
||||||
<meta http-equiv="Cache" content="no-cache" />
|
|
||||||
<link rel="icon" href="/favicon.svg" />
|
<link rel="icon" href="/favicon.svg" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>%VITE_APP_NAME%</title>
|
<title>%VITE_APP_NAME%</title>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import auth from './auth';
|
import auth from './auth';
|
||||||
import route from './route';
|
import route from './route';
|
||||||
|
import management from './management';
|
||||||
|
|
||||||
export default [...auth, ...route];
|
export default [...auth, ...route, ...management];
|
||||||
|
|||||||
33
mock/api/management.ts
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
import { mock } from 'mockjs';
|
||||||
|
import type { MockMethod } from 'vite-plugin-mock';
|
||||||
|
|
||||||
|
const apis: MockMethod[] = [
|
||||||
|
{
|
||||||
|
url: '/mock/getAllUserList',
|
||||||
|
method: 'post',
|
||||||
|
response: (): Service.MockServiceResult<ApiUserManagement.User[]> => {
|
||||||
|
const data = mock({
|
||||||
|
'list|1000': [
|
||||||
|
{
|
||||||
|
id: '@id',
|
||||||
|
userName: '@cname',
|
||||||
|
'age|18-56': 56,
|
||||||
|
'gender|1': ['0', '1', null],
|
||||||
|
phone:
|
||||||
|
/^[1](([3][0-9])|([4][01456789])|([5][012356789])|([6][2567])|([7][0-8])|([8][0-9])|([9][012356789]))[0-9]{8}$/,
|
||||||
|
'email|1': ['@email("qq.com")', null],
|
||||||
|
'userStatus|1': ['1', '2', '3', '4', null]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
code: 200,
|
||||||
|
message: 'ok',
|
||||||
|
data: data.list
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
export default apis;
|
||||||
@@ -8,7 +8,7 @@ const apis: MockMethod[] = [
|
|||||||
response: (options: Service.MockOption): Service.MockServiceResult => {
|
response: (options: Service.MockOption): Service.MockServiceResult => {
|
||||||
const { userId = undefined } = options.body;
|
const { userId = undefined } = options.body;
|
||||||
|
|
||||||
const routeHomeName: AuthRoute.LastDegreeRouteKey = 'multi-menu_first_second';
|
const routeHomeName: AuthRoute.LastDegreeRouteKey = 'dashboard_analysis';
|
||||||
|
|
||||||
const role = userModel.find(item => item.userId === userId)?.userRole || 'user';
|
const role = userModel.find(item => item.userId === userId)?.userRole || 'user';
|
||||||
|
|
||||||
|
|||||||
1204
mock/model/route.ts
96
package.json
@@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"name": "soybean-admin",
|
"name": "soybean-admin",
|
||||||
"version": "0.10.4",
|
"version": "0.10.3",
|
||||||
"description": "A fresh and elegant admin template, based on Vue3、Vite3、TypeScript、NaiveUI and UnoCSS. 一个基于Vue3、Vite3、TypeScript、NaiveUI and UnoCSS的清新优雅的中后台模版。",
|
"description": "A fresh and elegant admin template, based on Vue3、Vite3、TypeScript、NaiveUI and UnoCSS. 一个基于Vue3、Vite3、TypeScript、NaiveUI and UnoCSS的清新优雅的中后台模版。",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Soybean",
|
"name": "Soybean",
|
||||||
"email": "soybeanjs@outlook.com",
|
"email": "honghuangdc@gmail.com",
|
||||||
"url": "https://github.com/soybeanjs"
|
"url": "https://github.com/honghuangdc"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"homepage": "https://github.com/honghuangdc/soybean-admin",
|
"homepage": "https://github.com/honghuangdc/soybean-admin",
|
||||||
@@ -38,10 +38,13 @@
|
|||||||
"dev": "cross-env VITE_SERVICE_ENV=dev vite",
|
"dev": "cross-env VITE_SERVICE_ENV=dev vite",
|
||||||
"dev:test": "cross-env VITE_SERVICE_ENV=test vite",
|
"dev:test": "cross-env VITE_SERVICE_ENV=test vite",
|
||||||
"dev:prod": "cross-env VITE_SERVICE_ENV=prod vite",
|
"dev:prod": "cross-env VITE_SERVICE_ENV=prod vite",
|
||||||
|
"dev:tauri": "pnpm tauri dev",
|
||||||
"build": "npm run typecheck && cross-env VITE_SERVICE_ENV=prod vite build",
|
"build": "npm run typecheck && cross-env VITE_SERVICE_ENV=prod vite build",
|
||||||
"build:dev": "npm run typecheck && cross-env VITE_SERVICE_ENV=dev vite build",
|
"build:dev": "npm run typecheck && cross-env VITE_SERVICE_ENV=dev vite build",
|
||||||
"build:test": "npm run typecheck && cross-env VITE_SERVICE_ENV=test vite build",
|
"build:test": "npm run typecheck && cross-env VITE_SERVICE_ENV=test vite build",
|
||||||
"build:vercel": "cross-env VITE_HASH_ROUTE=Y VITE_VERCEL=Y vite build",
|
"build:vercel": "cross-env VITE_HASH_ROUTE=Y VITE_VERCEL=Y vite build",
|
||||||
|
"build:tauri": "pnpm tauri build",
|
||||||
|
"tauri-icon": "pnpm tauri icon ./public/logo.png",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"typecheck": "vue-tsc --noEmit --skipLibCheck",
|
"typecheck": "vue-tsc --noEmit --skipLibCheck",
|
||||||
"lint": "eslint . --fix",
|
"lint": "eslint . --fix",
|
||||||
@@ -49,61 +52,86 @@
|
|||||||
"commit": "soy git-commit",
|
"commit": "soy git-commit",
|
||||||
"cleanup": "soy cleanup",
|
"cleanup": "soy cleanup",
|
||||||
"update-pkg": "soy ncu",
|
"update-pkg": "soy ncu",
|
||||||
|
"release": "soy release",
|
||||||
"tsx": "tsx",
|
"tsx": "tsx",
|
||||||
"logo": "tsx ./scripts/logo.ts"
|
"logo": "tsx ./scripts/logo.ts",
|
||||||
|
"prepare": "soy init-simple-git-hooks"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@antv/data-set": "0.11.8",
|
||||||
|
"@antv/g2": "4.2.10",
|
||||||
"@better-scroll/core": "2.5.1",
|
"@better-scroll/core": "2.5.1",
|
||||||
"@soybeanjs/vue-materials": "0.2.0",
|
"@soybeanjs/vue-materials": "0.2.0",
|
||||||
"@vueuse/core": "10.4.1",
|
"@vueuse/core": "10.1.2",
|
||||||
"axios": "1.5.0",
|
"axios": "1.4.0",
|
||||||
"clipboard": "2.0.11",
|
"clipboard": "2.0.11",
|
||||||
"colord": "2.9.3",
|
"colord": "2.9.3",
|
||||||
"crypto-js": "4.1.1",
|
"crypto-js": "4.1.1",
|
||||||
"dayjs": "1.11.10",
|
"dayjs": "1.11.8",
|
||||||
|
"echarts": "5.4.2",
|
||||||
"form-data": "4.0.0",
|
"form-data": "4.0.0",
|
||||||
"lodash-es": "4.17.21",
|
"lodash-es": "4.17.21",
|
||||||
"naive-ui": "2.34.4",
|
"naive-ui": "2.34.4",
|
||||||
"pinia": "2.1.6",
|
"pinia": "2.1.4",
|
||||||
|
"print-js": "1.6.0",
|
||||||
"qs": "6.11.2",
|
"qs": "6.11.2",
|
||||||
"ua-parser-js": "1.0.36",
|
"swiper": "9.4.1",
|
||||||
|
"ua-parser-js": "1.0.35",
|
||||||
|
"vditor": "3.9.3",
|
||||||
"vue": "3.3.4",
|
"vue": "3.3.4",
|
||||||
"vue-i18n": "9.4.1",
|
"vue-i18n": "9.2.2",
|
||||||
"vue-router": "4.2.4",
|
"vue-router": "4.2.2",
|
||||||
"xgplayer": "3.0.9"
|
"vuedraggable": "4.1.0",
|
||||||
|
"wangeditor": "4.7.15",
|
||||||
|
"xgplayer": "3.0.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@iconify/json": "2.2.118",
|
"@amap/amap-jsapi-types": "0.0.13",
|
||||||
|
"@iconify/json": "2.2.78",
|
||||||
"@iconify/vue": "4.1.1",
|
"@iconify/vue": "4.1.1",
|
||||||
"@soybeanjs/cli": "0.7.1",
|
"@soybeanjs/cli": "0.6.2",
|
||||||
"@soybeanjs/vite-plugin-vue-page-route": "0.0.10",
|
"@soybeanjs/vite-plugin-vue-page-route": "0.0.5",
|
||||||
"@types/crypto-js": "4.1.2",
|
"@tauri-apps/cli": "^1.3.1",
|
||||||
"@types/node": "20.6.3",
|
"@types/bmapgl": "0.0.7",
|
||||||
"@types/qs": "6.9.8",
|
"@types/crypto-js": "4.1.1",
|
||||||
"@types/ua-parser-js": "0.7.37",
|
"@types/node": "20.3.1",
|
||||||
"@unocss/preset-uno": "0.56.0",
|
"@types/qs": "6.9.7",
|
||||||
"@unocss/transformer-directives": "0.56.0",
|
"@types/ua-parser-js": "0.7.36",
|
||||||
"@unocss/vite": "0.56.0",
|
"@unocss/preset-uno": "0.53.1",
|
||||||
"@vitejs/plugin-vue": "4.3.4",
|
"@unocss/transformer-directives": "0.53.1",
|
||||||
"@vitejs/plugin-vue-jsx": "3.0.2",
|
"@unocss/vite": "0.53.1",
|
||||||
|
"@vitejs/plugin-vue": "4.2.3",
|
||||||
|
"@vitejs/plugin-vue-jsx": "3.0.1",
|
||||||
"cross-env": "7.0.3",
|
"cross-env": "7.0.3",
|
||||||
"eslint": "8.49.0",
|
"eslint": "8.42.0",
|
||||||
"eslint-config-soybeanjs": "0.5.6",
|
"eslint-config-soybeanjs": "0.4.9",
|
||||||
"mockjs": "1.1.0",
|
"mockjs": "1.1.0",
|
||||||
"sass": "1.67.0",
|
"rollup-plugin-visualizer": "5.9.2",
|
||||||
"tsx": "3.12.10",
|
"sass": "1.63.4",
|
||||||
"typescript": "5.2.2",
|
"simple-git-hooks": "2.8.1",
|
||||||
"unplugin-icons": "0.17.0",
|
"tsx": "3.12.7",
|
||||||
"unplugin-vue-components": "0.25.2",
|
"typescript": "5.1.3",
|
||||||
"vite": "4.4.9",
|
"unplugin-icons": "0.16.3",
|
||||||
|
"unplugin-vue-components": "0.25.1",
|
||||||
|
"vite": "4.3.9",
|
||||||
|
"vite-plugin-compression": "0.5.1",
|
||||||
"vite-plugin-mock": "2.9.8",
|
"vite-plugin-mock": "2.9.8",
|
||||||
|
"vite-plugin-progress": "0.0.7",
|
||||||
|
"vite-plugin-pwa": "0.16.4",
|
||||||
"vite-plugin-svg-icons": "2.0.1",
|
"vite-plugin-svg-icons": "2.0.1",
|
||||||
"vite-plugin-vue-devtools": "1.0.0-rc.4",
|
"vite-plugin-vue-devtools": "0.2.0",
|
||||||
"vue-tsc": "1.8.13"
|
"vue-tsc": "1.6.5"
|
||||||
},
|
},
|
||||||
"pnpm": {
|
"pnpm": {
|
||||||
"patchedDependencies": {
|
"patchedDependencies": {
|
||||||
"mockjs@1.1.0": "patches/mockjs@1.1.0.patch"
|
"mockjs@1.1.0": "patches/mockjs@1.1.0.patch"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"simple-git-hooks": {
|
||||||
|
"commit-msg": "pnpm soy git-commit-verify",
|
||||||
|
"pre-commit": "pnpm typecheck && pnpm lint"
|
||||||
|
},
|
||||||
|
"soybean": {
|
||||||
|
"useSoybeanToken": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
6906
pnpm-lock.yaml
generated
@@ -1 +1 @@
|
|||||||
<svg viewBox="0 0 160 160" xmlns="http://www.w3.org/2000/svg"><path d="M81.28 55.9c-.1-11.67-2.93-22.55-9.37-32.38-1-1.5-2.14-2.86-2.5-4.71a8.1 8.1 0 014-8.61 7.89 7.89 0 019.3 1.23 35.999 35.999 0 015.9 8.83 75.18 75.18 0 018.44 28.58 83.211 83.211 0 01-5.23 36.74 102.983 102.983 0 01-3 7.28 1.2 1.2 0 000 1.41c9.58 13.3 21.76 23 37.85 27.24a54.37 54.37 0 0019.68 1.57 7.72 7.72 0 018.36 6.9 7.903 7.903 0 01-6.7 9 64.744 64.744 0 01-23-1.33 77.68 77.68 0 01-36.93-19.88 93.628 93.628 0 01-11.91-13.71 2.18 2.18 0 00-2.3-1.06 72.744 72.744 0 00-27.38 7.55c-11.6 6-20.67 14.58-26.4 26.45a10.134 10.134 0 01-3.7 4.7 8 8 0 01-9.19-.7 7.86 7.86 0 01-2.36-9.28 60.324 60.324 0 018.72-14.52c12.2-15.43 28.21-24.59 47.32-28.57A85.085 85.085 0 0173.07 87c.524.015 1-.307 1.18-.8a76.06 76.06 0 006.53-22.3c.351-2.652.518-5.325.5-8z" fill="#646cff"/><path d="M136.26 108.34a44.742 44.742 0 01-11.13-2.87 46.108 46.108 0 01-19.66-13.76 8 8 0 015.72-13.22 7.93 7.93 0 016.54 2.93 33.27 33.27 0 0018.87 10.75c1.546.155 3.058.553 4.48 1.18a8.08 8.08 0 013.84 9.21c-.92 3.52-4.13 5.81-8.66 5.78zm-80.6-75.02a7.61 7.61 0 016.64 5 49.139 49.139 0 013.64 17 46.33 46.33 0 01-2.46 17.28c-2 5.77-8.24 7.79-12.89 4.15a8.1 8.1 0 01-2.39-9 31.679 31.679 0 001.68-12.36 35.77 35.77 0 00-2.43-11c-2.1-5.45 1.75-11.07 8.21-11.07zm22.26 93.25a8 8 0 01-6.68 7.86 32.88 32.88 0 00-19.7 12.19 8.13 8.13 0 01-11.21 1.62 8 8 0 01-1.41-11.58A51.043 51.043 0 0154 123.81a45.842 45.842 0 0114-5.1c5.35-1.04 9.91 2.56 9.92 7.86z" fill="#646cff"/></svg>
|
<svg viewBox="0 0 160 160" xmlns="http://www.w3.org/2000/svg"><path d="M81.28 55.9c-.1-11.67-2.93-22.55-9.37-32.38-1-1.5-2.14-2.86-2.5-4.71a8.1 8.1 0 014-8.61 7.89 7.89 0 019.3 1.23 35.999 35.999 0 015.9 8.83 75.18 75.18 0 018.44 28.58 83.211 83.211 0 01-5.23 36.74 102.983 102.983 0 01-3 7.28 1.2 1.2 0 000 1.41c9.58 13.3 21.76 23 37.85 27.24a54.37 54.37 0 0019.68 1.57 7.72 7.72 0 018.36 6.9 7.903 7.903 0 01-6.7 9 64.744 64.744 0 01-23-1.33 77.68 77.68 0 01-36.93-19.88 93.628 93.628 0 01-11.91-13.71 2.18 2.18 0 00-2.3-1.06 72.744 72.744 0 00-27.38 7.55c-11.6 6-20.67 14.58-26.4 26.45a10.134 10.134 0 01-3.7 4.7 8 8 0 01-9.19-.7 7.86 7.86 0 01-2.36-9.28 60.324 60.324 0 018.72-14.52c12.2-15.43 28.21-24.59 47.32-28.57A85.085 85.085 0 0173.07 87c.524.015 1-.307 1.18-.8a76.06 76.06 0 006.53-22.3c.351-2.652.518-5.325.5-8z" fill="#1890ff"/><path d="M136.26 108.34a44.742 44.742 0 01-11.13-2.87 46.108 46.108 0 01-19.66-13.76 8 8 0 015.72-13.22 7.93 7.93 0 016.54 2.93 33.27 33.27 0 0018.87 10.75c1.546.155 3.058.553 4.48 1.18a8.08 8.08 0 013.84 9.21c-.92 3.52-4.13 5.81-8.66 5.78zm-80.6-75.02a7.61 7.61 0 016.64 5 49.139 49.139 0 013.64 17 46.33 46.33 0 01-2.46 17.28c-2 5.77-8.24 7.79-12.89 4.15a8.1 8.1 0 01-2.39-9 31.679 31.679 0 001.68-12.36 35.77 35.77 0 00-2.43-11c-2.1-5.45 1.75-11.07 8.21-11.07zm22.26 93.25a8 8 0 01-6.68 7.86 32.88 32.88 0 00-19.7 12.19 8.13 8.13 0 01-11.21 1.62 8 8 0 01-1.41-11.58A51.043 51.043 0 0154 123.81a45.842 45.842 0 0114-5.1c5.35-1.04 9.91 2.56 9.92 7.86z" fill="#1890ff"/></svg>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
3
src-tauri/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Generated by Cargo
|
||||||
|
# will have compiled files and executables
|
||||||
|
/target/
|
||||||
4302
src-tauri/Cargo.lock
generated
Normal file
28
src-tauri/Cargo.toml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
[package]
|
||||||
|
name = "app"
|
||||||
|
version = "0.1.0"
|
||||||
|
description = "A Tauri App"
|
||||||
|
authors = ["you"]
|
||||||
|
license = ""
|
||||||
|
repository = ""
|
||||||
|
default-run = "app"
|
||||||
|
edition = "2021"
|
||||||
|
rust-version = "1.57"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
tauri-build = { version = "1.1.1", features = [] }
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
serde_json = "1.0"
|
||||||
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
|
tauri = { version = "1.1.1", features = ["api-all"] }
|
||||||
|
|
||||||
|
[features]
|
||||||
|
# by default Tauri runs in production mode
|
||||||
|
# when `tauri dev` runs it is executed with `cargo run --no-default-features` if `devPath` is an URL
|
||||||
|
default = [ "custom-protocol" ]
|
||||||
|
# this feature is used for production builds where `devPath` points to the filesystem
|
||||||
|
# DO NOT remove this
|
||||||
|
custom-protocol = [ "tauri/custom-protocol" ]
|
||||||
3
src-tauri/build.rs
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
fn main() {
|
||||||
|
tauri_build::build()
|
||||||
|
}
|
||||||
BIN
src-tauri/icons/128x128.png
Normal file
|
After Width: | Height: | Size: 9.0 KiB |
BIN
src-tauri/icons/128x128@2x.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
src-tauri/icons/32x32.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
src-tauri/icons/Square107x107Logo.png
Normal file
|
After Width: | Height: | Size: 7.8 KiB |
BIN
src-tauri/icons/Square142x142Logo.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
src-tauri/icons/Square150x150Logo.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
src-tauri/icons/Square284x284Logo.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
src-tauri/icons/Square30x30Logo.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
src-tauri/icons/Square310x310Logo.png
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
src-tauri/icons/Square44x44Logo.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
src-tauri/icons/Square71x71Logo.png
Normal file
|
After Width: | Height: | Size: 4.9 KiB |
BIN
src-tauri/icons/Square89x89Logo.png
Normal file
|
After Width: | Height: | Size: 6.4 KiB |
BIN
src-tauri/icons/StoreLogo.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
BIN
src-tauri/icons/icon.icns
Normal file
BIN
src-tauri/icons/icon.ico
Normal file
|
After Width: | Height: | Size: 32 KiB |
BIN
src-tauri/icons/icon.png
Normal file
|
After Width: | Height: | Size: 42 KiB |
10
src-tauri/src/main.rs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#![cfg_attr(
|
||||||
|
all(not(debug_assertions), target_os = "windows"),
|
||||||
|
windows_subsystem = "windows"
|
||||||
|
)]
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
tauri::Builder::default()
|
||||||
|
.run(tauri::generate_context!())
|
||||||
|
.expect("error while running tauri application");
|
||||||
|
}
|
||||||
60
src-tauri/tauri.conf.json
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
{
|
||||||
|
"$schema": "../node_modules/@tauri-apps/cli/schema.json",
|
||||||
|
"build": {
|
||||||
|
"beforeBuildCommand": "npm run build",
|
||||||
|
"beforeDevCommand": "npm run dev",
|
||||||
|
"devPath": "http://localhost:3200",
|
||||||
|
"distDir": "../dist"
|
||||||
|
},
|
||||||
|
"package": {
|
||||||
|
"productName": "soybean-admin",
|
||||||
|
"version": "0.1.0"
|
||||||
|
},
|
||||||
|
"tauri": {
|
||||||
|
"allowlist": {
|
||||||
|
"all": true
|
||||||
|
},
|
||||||
|
"bundle": {
|
||||||
|
"active": true,
|
||||||
|
"category": "DeveloperTool",
|
||||||
|
"copyright": "",
|
||||||
|
"deb": {
|
||||||
|
"depends": []
|
||||||
|
},
|
||||||
|
"externalBin": [],
|
||||||
|
"icon": ["icons/32x32.png", "icons/128x128.png", "icons/128x128@2x.png", "icons/icon.icns", "icons/icon.ico"],
|
||||||
|
"identifier": "cn.soybeanjs.tauri-admin",
|
||||||
|
"longDescription": "",
|
||||||
|
"macOS": {
|
||||||
|
"entitlements": null,
|
||||||
|
"exceptionDomain": "",
|
||||||
|
"frameworks": [],
|
||||||
|
"providerShortName": null,
|
||||||
|
"signingIdentity": null
|
||||||
|
},
|
||||||
|
"resources": [],
|
||||||
|
"shortDescription": "",
|
||||||
|
"targets": "all",
|
||||||
|
"windows": {
|
||||||
|
"certificateThumbprint": null,
|
||||||
|
"digestAlgorithm": "sha256",
|
||||||
|
"timestampUrl": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"security": {
|
||||||
|
"csp": null
|
||||||
|
},
|
||||||
|
"updater": {
|
||||||
|
"active": false
|
||||||
|
},
|
||||||
|
"windows": [
|
||||||
|
{
|
||||||
|
"fullscreen": false,
|
||||||
|
"height": 800,
|
||||||
|
"resizable": true,
|
||||||
|
"title": "soybean-admin",
|
||||||
|
"width": 1000
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,23 +4,25 @@
|
|||||||
<div class="w-56px h-56px my-36px">
|
<div class="w-56px h-56px my-36px">
|
||||||
<div class="relative h-full animate-spin">
|
<div class="relative h-full animate-spin">
|
||||||
<div
|
<div
|
||||||
v-for="(item, index) in loadingClasses"
|
v-for="(item, index) in lodingClasses"
|
||||||
:key="index"
|
:key="index"
|
||||||
class="absolute w-16px h-16px bg-primary rounded-8px animate-pulse"
|
class="absolute w-16px h-16px bg-primary rounded-8px animate-pulse"
|
||||||
:class="item"
|
:class="item"
|
||||||
></div>
|
></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<h2 class="text-28px font-500 text-#646464">{{ $t('system.title') }}</h2>
|
<h2 class="text-28px font-500 text-#646464">{{ title }}</h2>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { sessionStg, getRgbOfColor } from '@/utils';
|
import { useAppInfo } from '@/composables';
|
||||||
import { $t } from '@/locales';
|
import { localStg, getRgbOfColor } from '@/utils';
|
||||||
import themeSettings from '@/settings/theme.json';
|
import themeSettings from '@/settings/theme.json';
|
||||||
|
|
||||||
const loadingClasses = [
|
const { title } = useAppInfo();
|
||||||
|
|
||||||
|
const lodingClasses = [
|
||||||
'left-0 top-0',
|
'left-0 top-0',
|
||||||
'left-0 bottom-0 animate-delay-500',
|
'left-0 bottom-0 animate-delay-500',
|
||||||
'right-0 top-0 animate-delay-1000',
|
'right-0 top-0 animate-delay-1000',
|
||||||
@@ -29,7 +31,7 @@ const loadingClasses = [
|
|||||||
|
|
||||||
function addThemeColorCssVars() {
|
function addThemeColorCssVars() {
|
||||||
const defaultColor = themeSettings.themeColor;
|
const defaultColor = themeSettings.themeColor;
|
||||||
const themeColor = sessionStg.get('themeColor') || defaultColor;
|
const themeColor = localStg.get('themeColor') || defaultColor;
|
||||||
|
|
||||||
const { r, g, b } = getRgbOfColor(themeColor);
|
const { r, g, b } = getRgbOfColor(themeColor);
|
||||||
|
|
||||||
|
|||||||
@@ -13,8 +13,6 @@ defineOptions({ name: 'DarkModeSwitch' });
|
|||||||
interface Props {
|
interface Props {
|
||||||
/** 暗黑模式 */
|
/** 暗黑模式 */
|
||||||
dark?: boolean;
|
dark?: boolean;
|
||||||
/** 自定义暗黑模式动画过渡 */
|
|
||||||
customizeTransition?: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = withDefaults(defineProps<Props>(), {
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
@@ -36,35 +34,32 @@ const darkMode = computed({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
async function handleSwitch(event: MouseEvent) {
|
function handleSwitch(event: MouseEvent) {
|
||||||
const x = event.clientX;
|
const x = event.clientX;
|
||||||
const y = event.clientY;
|
const y = event.clientY;
|
||||||
|
const endRadius = Math.hypot(Math.max(x, innerWidth - x), Math.max(y, innerHeight - y));
|
||||||
if (!props.customizeTransition || !document.startViewTransition) {
|
// @ts-expect-error: Transition API
|
||||||
|
if (!document.startViewTransition) {
|
||||||
darkMode.value = !darkMode.value;
|
darkMode.value = !darkMode.value;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// @ts-expect-error: Transition API
|
||||||
const endRadius = Math.hypot(Math.max(x, innerWidth - x), Math.max(y, innerHeight - y));
|
|
||||||
|
|
||||||
const transition = document.startViewTransition(() => {
|
const transition = document.startViewTransition(() => {
|
||||||
darkMode.value = !darkMode.value;
|
darkMode.value = !darkMode.value;
|
||||||
});
|
});
|
||||||
|
transition.ready.then(() => {
|
||||||
await transition.ready;
|
const clipPath = [`circle(0px at ${x}px ${y}px)`, `circle(${endRadius}px at ${x}px ${y}px)`];
|
||||||
|
document.documentElement.animate(
|
||||||
const clipPath = [`circle(0px at ${x}px ${y}px)`, `circle(${endRadius}px at ${x}px ${y}px)`];
|
{
|
||||||
|
clipPath: darkMode.value ? clipPath : [...clipPath].reverse()
|
||||||
document.documentElement.animate(
|
},
|
||||||
{
|
{
|
||||||
clipPath: darkMode.value ? clipPath : [...clipPath].reverse()
|
duration: 300,
|
||||||
},
|
easing: 'ease-in',
|
||||||
{
|
pseudoElement: darkMode.value ? '::view-transition-new(root)' : '::view-transition-old(root)'
|
||||||
duration: 300,
|
}
|
||||||
easing: 'ease-in',
|
);
|
||||||
pseudoElement: darkMode.value ? '::view-transition-new(root)' : '::view-transition-old(root)'
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { isNumber } from '@/utils';
|
|||||||
|
|
||||||
defineOptions({ name: 'CountTo' });
|
defineOptions({ name: 'CountTo' });
|
||||||
|
|
||||||
type TransitionKey = keyof typeof TransitionPresets;
|
type TansitionKey = keyof typeof TransitionPresets;
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
/** 初始值 */
|
/** 初始值 */
|
||||||
@@ -32,7 +32,7 @@ interface Props {
|
|||||||
/** 使用缓冲动画函数 */
|
/** 使用缓冲动画函数 */
|
||||||
useEasing?: boolean;
|
useEasing?: boolean;
|
||||||
/** 缓冲动画函数类型 */
|
/** 缓冲动画函数类型 */
|
||||||
transition?: TransitionKey;
|
transition?: TansitionKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = withDefaults(defineProps<Props>(), {
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
|||||||
17
src/components/custom/github-link.vue
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<template>
|
||||||
|
<web-site-link label="github地址:" :link="link" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import WebSiteLink from './web-site-link.vue';
|
||||||
|
|
||||||
|
defineOptions({ name: 'GithubLink' });
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
/** github链接 */
|
||||||
|
link: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
defineProps<Props>();
|
||||||
|
</script>
|
||||||
|
<style scoped></style>
|
||||||
77
src/components/custom/icon-select.vue
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
<template>
|
||||||
|
<n-popover placement="bottom-end" trigger="click">
|
||||||
|
<template #trigger>
|
||||||
|
<n-input v-model:value="modelValue" readonly placeholder="点击选择图标">
|
||||||
|
<template #suffix>
|
||||||
|
<svg-icon :icon="selectedIcon" class="text-30px p-5px" />
|
||||||
|
</template>
|
||||||
|
</n-input>
|
||||||
|
</template>
|
||||||
|
<template #header>
|
||||||
|
<n-input v-model:value="searchValue" placeholder="搜索图标"></n-input>
|
||||||
|
</template>
|
||||||
|
<div v-if="iconsList.length > 0" class="grid grid-cols-9 h-auto overflow-auto">
|
||||||
|
<span v-for="iconItem in iconsList" :key="iconItem" @click="handleChange(iconItem)">
|
||||||
|
<svg-icon
|
||||||
|
:icon="iconItem"
|
||||||
|
class="border-1px border-#d9d9d9 text-30px m-2px p-5px cursor-pointer"
|
||||||
|
:class="{ 'border-primary': modelValue === iconItem }"
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<n-empty v-else class="w-306px" description="你什么也找不到" />
|
||||||
|
</n-popover>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { computed, ref } from 'vue';
|
||||||
|
|
||||||
|
defineOptions({ name: 'IconSelect' });
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
/** 选中的图标 */
|
||||||
|
value: string;
|
||||||
|
/** 图标列表 */
|
||||||
|
icons: string[];
|
||||||
|
/** 未选中图标 */
|
||||||
|
emptyIcon?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
emptyIcon: 'mdi:apps'
|
||||||
|
});
|
||||||
|
|
||||||
|
interface Emits {
|
||||||
|
(e: 'update:value', val: string): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const emit = defineEmits<Emits>();
|
||||||
|
|
||||||
|
const modelValue = computed({
|
||||||
|
get() {
|
||||||
|
return props.value;
|
||||||
|
},
|
||||||
|
set(val: string) {
|
||||||
|
emit('update:value', val);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const selectedIcon = computed(() => modelValue.value || props.emptyIcon);
|
||||||
|
|
||||||
|
const searchValue = ref('');
|
||||||
|
|
||||||
|
const iconsList = computed(() => props.icons.filter(v => v.includes(searchValue.value)));
|
||||||
|
|
||||||
|
function handleChange(iconItem: string) {
|
||||||
|
modelValue.value = iconItem;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
:deep(.n-input-wrapper) {
|
||||||
|
padding-right: 0;
|
||||||
|
}
|
||||||
|
:deep(.n-input__suffix) {
|
||||||
|
border: 1px solid #d9d9d9;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
42
src/components/custom/image-verify.vue
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<canvas ref="domRef" width="152" height="40" class="cursor-pointer" @click="getImgCode"></canvas>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { watch } from 'vue';
|
||||||
|
import { useImageVerify } from '@/hooks';
|
||||||
|
|
||||||
|
defineOptions({ name: 'ImageVerify' });
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
code?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
code: ''
|
||||||
|
});
|
||||||
|
|
||||||
|
interface Emits {
|
||||||
|
(e: 'update:code', code: string): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const emit = defineEmits<Emits>();
|
||||||
|
|
||||||
|
const { domRef, imgCode, setImgCode, getImgCode } = useImageVerify();
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.code,
|
||||||
|
newValue => {
|
||||||
|
setImgCode(newValue);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
watch(imgCode, newValue => {
|
||||||
|
emit('update:code', newValue);
|
||||||
|
});
|
||||||
|
|
||||||
|
defineExpose({ getImgCode });
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
@@ -37,13 +37,13 @@ const bindAttrs = computed<{ class: string; style: string }>(() => ({
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
const symbolId = computed(() => {
|
const symbolId = computed(() => {
|
||||||
const { VITE_ICON_LOCAL_PREFIX: prefix } = import.meta.env;
|
const { VITE_ICON_LOCAL_PREFFIX: preffix } = import.meta.env;
|
||||||
|
|
||||||
const defaultLocalIcon = 'no-icon';
|
const defaultLocalIcon = 'no-icon';
|
||||||
|
|
||||||
const icon = props.localIcon || defaultLocalIcon;
|
const icon = props.localIcon || defaultLocalIcon;
|
||||||
|
|
||||||
return `#${prefix}-${icon}`;
|
return `#${preffix}-${icon}`;
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 渲染本地icon */
|
/** 渲染本地icon */
|
||||||
|
|||||||
23
src/components/custom/web-site-link.vue
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<template>
|
||||||
|
<p>
|
||||||
|
<span>{{ label }}</span>
|
||||||
|
<a class="text-blue-500" :href="link" target="_blank">
|
||||||
|
{{ link }}
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
defineOptions({ name: 'WebSiteLink' });
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
/** 网址名称 */
|
||||||
|
label: string;
|
||||||
|
/** 网址链接 */
|
||||||
|
link: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
defineProps<Props>();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
174
src/composables/echarts.ts
Normal file
@@ -0,0 +1,174 @@
|
|||||||
|
import { nextTick, effectScope, onScopeDispose, ref, watch } from 'vue';
|
||||||
|
import type { ComputedRef, Ref } from 'vue';
|
||||||
|
import * as echarts from 'echarts/core';
|
||||||
|
import { BarChart, GaugeChart, LineChart, PictorialBarChart, PieChart, RadarChart, ScatterChart } from 'echarts/charts';
|
||||||
|
import type {
|
||||||
|
BarSeriesOption,
|
||||||
|
GaugeSeriesOption,
|
||||||
|
LineSeriesOption,
|
||||||
|
PictorialBarSeriesOption,
|
||||||
|
PieSeriesOption,
|
||||||
|
RadarSeriesOption,
|
||||||
|
ScatterSeriesOption
|
||||||
|
} from 'echarts/charts';
|
||||||
|
import {
|
||||||
|
DatasetComponent,
|
||||||
|
GridComponent,
|
||||||
|
LegendComponent,
|
||||||
|
TitleComponent,
|
||||||
|
ToolboxComponent,
|
||||||
|
TooltipComponent,
|
||||||
|
TransformComponent
|
||||||
|
} from 'echarts/components';
|
||||||
|
import type {
|
||||||
|
DatasetComponentOption,
|
||||||
|
GridComponentOption,
|
||||||
|
LegendComponentOption,
|
||||||
|
TitleComponentOption,
|
||||||
|
ToolboxComponentOption,
|
||||||
|
TooltipComponentOption
|
||||||
|
} from 'echarts/components';
|
||||||
|
import { LabelLayout, UniversalTransition } from 'echarts/features';
|
||||||
|
import { CanvasRenderer } from 'echarts/renderers';
|
||||||
|
import { useElementSize } from '@vueuse/core';
|
||||||
|
import { useThemeStore } from '@/store';
|
||||||
|
|
||||||
|
export type ECOption = echarts.ComposeOption<
|
||||||
|
| BarSeriesOption
|
||||||
|
| LineSeriesOption
|
||||||
|
| PieSeriesOption
|
||||||
|
| ScatterSeriesOption
|
||||||
|
| PictorialBarSeriesOption
|
||||||
|
| RadarSeriesOption
|
||||||
|
| GaugeSeriesOption
|
||||||
|
| TitleComponentOption
|
||||||
|
| LegendComponentOption
|
||||||
|
| TooltipComponentOption
|
||||||
|
| GridComponentOption
|
||||||
|
| ToolboxComponentOption
|
||||||
|
| DatasetComponentOption
|
||||||
|
>;
|
||||||
|
|
||||||
|
echarts.use([
|
||||||
|
TitleComponent,
|
||||||
|
LegendComponent,
|
||||||
|
TooltipComponent,
|
||||||
|
GridComponent,
|
||||||
|
DatasetComponent,
|
||||||
|
TransformComponent,
|
||||||
|
ToolboxComponent,
|
||||||
|
BarChart,
|
||||||
|
LineChart,
|
||||||
|
PieChart,
|
||||||
|
ScatterChart,
|
||||||
|
PictorialBarChart,
|
||||||
|
RadarChart,
|
||||||
|
GaugeChart,
|
||||||
|
LabelLayout,
|
||||||
|
UniversalTransition,
|
||||||
|
CanvasRenderer
|
||||||
|
]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Echarts hooks函数
|
||||||
|
* @param options - 图表配置
|
||||||
|
* @param renderFun - 图表渲染函数(例如:图表监听函数)
|
||||||
|
* @description 按需引入图表组件,没注册的组件需要先引入
|
||||||
|
*/
|
||||||
|
export function useEcharts(
|
||||||
|
options: Ref<ECOption> | ComputedRef<ECOption>,
|
||||||
|
renderFun?: (chartInstance: echarts.ECharts) => void
|
||||||
|
) {
|
||||||
|
const theme = useThemeStore();
|
||||||
|
|
||||||
|
const domRef = ref<HTMLElement>();
|
||||||
|
|
||||||
|
const initialSize = { width: 0, height: 0 };
|
||||||
|
const { width, height } = useElementSize(domRef, initialSize);
|
||||||
|
|
||||||
|
let chart: echarts.ECharts | null = null;
|
||||||
|
|
||||||
|
function canRender() {
|
||||||
|
return initialSize.width > 0 && initialSize.height > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isRendered() {
|
||||||
|
return Boolean(domRef.value && chart);
|
||||||
|
}
|
||||||
|
|
||||||
|
function update(updateOptions: ECOption) {
|
||||||
|
if (isRendered()) {
|
||||||
|
chart?.clear();
|
||||||
|
chart!.setOption({ ...updateOptions, backgroundColor: 'transparent' });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function render() {
|
||||||
|
if (domRef.value) {
|
||||||
|
const chartTheme = theme.darkMode ? 'dark' : 'light';
|
||||||
|
await nextTick();
|
||||||
|
chart = echarts.init(domRef.value, chartTheme);
|
||||||
|
if (renderFun) {
|
||||||
|
renderFun(chart);
|
||||||
|
}
|
||||||
|
update(options.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function resize() {
|
||||||
|
chart?.resize();
|
||||||
|
}
|
||||||
|
|
||||||
|
function destroy() {
|
||||||
|
chart?.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateTheme() {
|
||||||
|
destroy();
|
||||||
|
render();
|
||||||
|
}
|
||||||
|
|
||||||
|
const scope = effectScope();
|
||||||
|
|
||||||
|
scope.run(() => {
|
||||||
|
watch([width, height], ([newWidth, newHeight]) => {
|
||||||
|
initialSize.width = newWidth;
|
||||||
|
initialSize.height = newHeight;
|
||||||
|
if (newWidth === 0 && newHeight === 0) {
|
||||||
|
// 节点被删除 将chart置为空
|
||||||
|
chart = null;
|
||||||
|
}
|
||||||
|
if (canRender()) {
|
||||||
|
if (!isRendered()) {
|
||||||
|
render();
|
||||||
|
} else {
|
||||||
|
resize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
watch(
|
||||||
|
options,
|
||||||
|
newValue => {
|
||||||
|
update(newValue);
|
||||||
|
},
|
||||||
|
{ deep: true }
|
||||||
|
);
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => theme.darkMode,
|
||||||
|
() => {
|
||||||
|
updateTheme();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
onScopeDispose(() => {
|
||||||
|
destroy();
|
||||||
|
scope.stop();
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
domRef
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -48,7 +48,7 @@ export const useIconRender = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!icon && !localIcon) {
|
if (!icon && !localIcon) {
|
||||||
throw Error('没有传递图标名称,请确保给icon或localIcon传递有效值!');
|
window.console.warn('没有传递图标名称,请确保给icon或localIcon传递有效值!');
|
||||||
}
|
}
|
||||||
|
|
||||||
return () => h(SvgIcon, { icon, localIcon, style });
|
return () => h(SvgIcon, { icon, localIcon, style });
|
||||||
|
|||||||
@@ -2,4 +2,5 @@ export * from './system';
|
|||||||
export * from './router';
|
export * from './router';
|
||||||
export * from './layout';
|
export * from './layout';
|
||||||
export * from './events';
|
export * from './events';
|
||||||
|
export * from './echarts';
|
||||||
export * from './icon';
|
export * from './icon';
|
||||||
|
|||||||
@@ -2,6 +2,26 @@ import UAParser from 'ua-parser-js';
|
|||||||
import { useAuthStore } from '@/store';
|
import { useAuthStore } from '@/store';
|
||||||
import { isArray, isString } from '@/utils';
|
import { isArray, isString } from '@/utils';
|
||||||
|
|
||||||
|
interface AppInfo {
|
||||||
|
/** 项目名称 */
|
||||||
|
name: string;
|
||||||
|
/** 项目标题 */
|
||||||
|
title: string;
|
||||||
|
/** 项目描述 */
|
||||||
|
desc: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 项目信息 */
|
||||||
|
export function useAppInfo(): AppInfo {
|
||||||
|
const { VITE_APP_NAME: name, VITE_APP_TITLE: title, VITE_APP_DESC: desc } = import.meta.env;
|
||||||
|
|
||||||
|
return {
|
||||||
|
name,
|
||||||
|
title,
|
||||||
|
desc
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/** 获取设备信息 */
|
/** 获取设备信息 */
|
||||||
export function useDeviceInfo() {
|
export function useDeviceInfo() {
|
||||||
const parser = new UAParser();
|
const parser = new UAParser();
|
||||||
|
|||||||
@@ -1,2 +1,3 @@
|
|||||||
export * from './service';
|
export * from './service';
|
||||||
export * from './regexp';
|
export * from './regexp';
|
||||||
|
export * from './map-sdk';
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
export const BAIDU_MAP_SDK_URL = `https://api.map.baidu.com/getscript?v=3.0&ak=KSezYymXPth1DIGILRX3oYN9PxbOQQmU&services=&t=20210201100830&s=1`;
|
export const BAIDU_MAP_SDK_URL = `https://api.map.baidu.com/getscript?v=3.0&ak=KSezYymXPth1DIGILRX3oYN9PxbOQQmU&services=&t=20210201100830&s=1`;
|
||||||
|
|
||||||
/** 高德地图sdk地址 */
|
/** 高德地图sdk地址 */
|
||||||
export const AMAP_SDK_URL = 'https://webapi.amap.com/maps?v=2.0&key=e7bd02bd504062087e6563daf4d6721d';
|
export const GAODE_MAP_SDK_URL = 'https://webapi.amap.com/maps?v=2.0&key=e7bd02bd504062087e6563daf4d6721d';
|
||||||
|
|
||||||
/** 腾讯地图sdk地址 */
|
/** 腾讯地图sdk地址 */
|
||||||
export const TENCENT_MAP_SDK_URL = 'https://map.qq.com/api/gljs?v=1.exp&key=A6DBZ-KXPLW-JKSRY-ONZF4-CPHY3-K6BL7';
|
export const TENCENT_MAP_SDK_URL = 'https://map.qq.com/api/gljs?v=1.exp&key=A6DBZ-KXPLW-JKSRY-ONZF4-CPHY3-K6BL7';
|
||||||
|
|||||||
@@ -1,17 +1,32 @@
|
|||||||
import { $t } from '@/locales';
|
|
||||||
import { transformObjectToOption } from './_shared';
|
import { transformObjectToOption } from './_shared';
|
||||||
|
|
||||||
export const loginModuleLabels: Record<UnionKey.LoginModule, string> = {
|
export const loginModuleLabels: Record<UnionKey.LoginModule, string> = {
|
||||||
'pwd-login': $t('page.login.pwdLogin.title'),
|
'pwd-login': '账密登录',
|
||||||
'code-login': $t('page.login.codeLogin.title'),
|
'code-login': '手机验证码登录',
|
||||||
register: $t('page.login.register.title'),
|
register: '注册',
|
||||||
'reset-pwd': $t('page.login.resetPwd.title'),
|
'reset-pwd': '重置密码',
|
||||||
'bind-wechat': $t('page.login.bindWeChat.title')
|
'bind-wechat': '微信绑定'
|
||||||
};
|
};
|
||||||
|
|
||||||
export const userRoleLabels: Record<Auth.RoleType, string> = {
|
export const userRoleLabels: Record<Auth.RoleType, string> = {
|
||||||
super: $t('page.login.pwdLogin.superAdmin'),
|
super: '超级管理员',
|
||||||
admin: $t('page.login.pwdLogin.admin'),
|
admin: '管理员',
|
||||||
user: $t('page.login.pwdLogin.user')
|
user: '普通用户'
|
||||||
};
|
};
|
||||||
export const userRoleOptions = transformObjectToOption(userRoleLabels);
|
export const userRoleOptions = transformObjectToOption(userRoleLabels);
|
||||||
|
|
||||||
|
/** 用户性别 */
|
||||||
|
export const genderLabels: Record<UserManagement.GenderKey, string> = {
|
||||||
|
0: '女',
|
||||||
|
1: '男'
|
||||||
|
};
|
||||||
|
export const genderOptions = transformObjectToOption(genderLabels);
|
||||||
|
|
||||||
|
/** 用户状态 */
|
||||||
|
export const userStatusLabels: Record<UserManagement.UserStatusKey, string> = {
|
||||||
|
1: '启用',
|
||||||
|
2: '禁用',
|
||||||
|
3: '冻结',
|
||||||
|
4: '软删除'
|
||||||
|
};
|
||||||
|
export const userStatusOptions = transformObjectToOption(userStatusLabels);
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import useCountDown from './use-count-down';
|
import useCountDown from './use-count-down';
|
||||||
import useSmsCode from './use-sms-code';
|
import useSmsCode from './use-sms-code';
|
||||||
|
import useImageVerify from './use-image-verify';
|
||||||
|
|
||||||
export { useCountDown, useSmsCode };
|
export { useCountDown, useSmsCode, useImageVerify };
|
||||||
|
|||||||
@@ -1,180 +0,0 @@
|
|||||||
import { ref, reactive } from 'vue';
|
|
||||||
import type { Ref } from 'vue';
|
|
||||||
import type { PaginationProps, DataTableBaseColumn, DataTableSelectionColumn, DataTableExpandColumn } from 'naive-ui';
|
|
||||||
import type { TableColumnGroup } from 'naive-ui/es/data-table/src/interface';
|
|
||||||
import { useLoadingEmpty } from '../common';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 接口请求函数
|
|
||||||
*/
|
|
||||||
type ApiFn<T = any, R = any> = (args: T) => Promise<Service.RequestResult<R>>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 接口请求函数的参数
|
|
||||||
*/
|
|
||||||
type GetApiFnParameters<T extends ApiFn, R = any> = T extends (args: infer P) => Promise<Service.RequestResult<R>>
|
|
||||||
? P
|
|
||||||
: never;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 接口请求函数的返回值
|
|
||||||
*/
|
|
||||||
type GetApiFnReturnType<T extends ApiFn, P = any> = T extends (args: P) => Promise<Service.RequestResult<infer R>>
|
|
||||||
? R
|
|
||||||
: never;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 表格接口请求后转换后的数据
|
|
||||||
*/
|
|
||||||
type Transformer<TableData, Response> = (response: Response) => {
|
|
||||||
data: TableData[];
|
|
||||||
pageNum: number;
|
|
||||||
pageSize: number;
|
|
||||||
total: number;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 列表接口参数更新
|
|
||||||
*/
|
|
||||||
type ApiParamsUpdater<P, R> = (params: P) => R;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页参数
|
|
||||||
*/
|
|
||||||
type PagePropsOfPagination = Pick<PaginationProps, 'page' | 'pageSize'>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 自定义的列 key
|
|
||||||
*/
|
|
||||||
type CustomColumnKey<K = never> = K | 'action';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 表格的列
|
|
||||||
*/
|
|
||||||
type HookTableColumn<T = Record<string, unknown>> =
|
|
||||||
| (Omit<TableColumnGroup<T>, 'key'> & { key: CustomColumnKey<keyof T> })
|
|
||||||
| (Omit<DataTableBaseColumn<T>, 'key'> & { key: CustomColumnKey<keyof T> })
|
|
||||||
| DataTableSelectionColumn<T>
|
|
||||||
| DataTableExpandColumn<T>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 表格配置
|
|
||||||
*/
|
|
||||||
type HookTableConfig<TableData, Fn extends ApiFn> = {
|
|
||||||
/**
|
|
||||||
* 列表接口参数
|
|
||||||
*/
|
|
||||||
apiParams: GetApiFnParameters<Fn>;
|
|
||||||
/**
|
|
||||||
* 列表接口返回数据转换
|
|
||||||
*/
|
|
||||||
transformer: Transformer<TableData, GetApiFnReturnType<Fn>>;
|
|
||||||
/**
|
|
||||||
* 列表列
|
|
||||||
*/
|
|
||||||
columns: () => HookTableColumn<TableData>[];
|
|
||||||
/**
|
|
||||||
* 列表接口参数更新
|
|
||||||
* @description 用于更新分页参数, 如果列表接口的参数不包含同名分页参数属性 `page` 和 `pageSize`, 需要通过此函数更新
|
|
||||||
* @default p => p
|
|
||||||
*/
|
|
||||||
apiParamsUpdater?: ApiParamsUpdater<GetApiFnParameters<Fn> & Partial<PagePropsOfPagination>, GetApiFnParameters<Fn>>;
|
|
||||||
/**
|
|
||||||
* 列表分页参数
|
|
||||||
*/
|
|
||||||
pagination?: PaginationProps;
|
|
||||||
/**
|
|
||||||
* 是否立即请求
|
|
||||||
* @default true
|
|
||||||
*/
|
|
||||||
immediate?: boolean;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通用表格 hook
|
|
||||||
* @param apiFn 接口请求函数
|
|
||||||
* @param config 表格配置
|
|
||||||
*/
|
|
||||||
export default function useHookTable<TableData, Fn extends ApiFn>(apiFn: Fn, config: HookTableConfig<TableData, Fn>) {
|
|
||||||
const { loading, startLoading, endLoading, empty, setEmpty } = useLoadingEmpty();
|
|
||||||
|
|
||||||
const { apiParams, transformer, apiParamsUpdater = p => p, immediate = true } = config;
|
|
||||||
|
|
||||||
const data: Ref<TableData[]> = ref([]);
|
|
||||||
|
|
||||||
function updateData(update: TableData[]) {
|
|
||||||
data.value = update;
|
|
||||||
}
|
|
||||||
|
|
||||||
const columns = ref(config.columns()) as Ref<HookTableColumn<TableData>[]>;
|
|
||||||
|
|
||||||
const requestParams = ref(apiParams) as Ref<HookTableConfig<TableData, Fn>['apiParams']>;
|
|
||||||
|
|
||||||
function updateRequestParamsByPagination(p: PagePropsOfPagination) {
|
|
||||||
requestParams.value = apiParamsUpdater({ ...requestParams.value, ...p });
|
|
||||||
}
|
|
||||||
|
|
||||||
const pagination = reactive({
|
|
||||||
page: 1,
|
|
||||||
pageSize: 10,
|
|
||||||
showSizePicker: true,
|
|
||||||
pageSizes: [10, 15, 20, 25, 30],
|
|
||||||
onChange: (page: number) => {
|
|
||||||
pagination.page = page;
|
|
||||||
|
|
||||||
updateRequestParamsByPagination({ page });
|
|
||||||
getData();
|
|
||||||
},
|
|
||||||
onUpdatePageSize: (pageSize: number) => {
|
|
||||||
pagination.pageSize = pageSize;
|
|
||||||
pagination.page = 1;
|
|
||||||
|
|
||||||
updateRequestParamsByPagination({ pageSize });
|
|
||||||
getData();
|
|
||||||
},
|
|
||||||
...config.pagination
|
|
||||||
}) as PaginationProps;
|
|
||||||
|
|
||||||
function updatePagination(update: Partial<PaginationProps>) {
|
|
||||||
Object.assign(pagination, update);
|
|
||||||
|
|
||||||
updateRequestParamsByPagination({ page: pagination.page, pageSize: pagination.pageSize });
|
|
||||||
}
|
|
||||||
|
|
||||||
async function getData() {
|
|
||||||
startLoading();
|
|
||||||
|
|
||||||
const { data: apiData, error } = await apiFn(requestParams.value);
|
|
||||||
|
|
||||||
if (!error && data) {
|
|
||||||
const { data: tableData, pageNum, pageSize, total } = transformer(apiData);
|
|
||||||
|
|
||||||
updateData(tableData);
|
|
||||||
|
|
||||||
setEmpty(tableData.length === 0);
|
|
||||||
|
|
||||||
updatePagination({ page: pageNum, pageSize, itemCount: total });
|
|
||||||
}
|
|
||||||
|
|
||||||
endLoading();
|
|
||||||
}
|
|
||||||
|
|
||||||
function reloadColumns() {
|
|
||||||
columns.value = config.columns();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (immediate) {
|
|
||||||
getData();
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
data,
|
|
||||||
columns,
|
|
||||||
loading,
|
|
||||||
empty,
|
|
||||||
pagination,
|
|
||||||
getData,
|
|
||||||
updatePagination,
|
|
||||||
reloadColumns
|
|
||||||
};
|
|
||||||
}
|
|
||||||
87
src/hooks/business/use-image-verify.ts
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
import { onMounted, ref } from 'vue';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绘制图形验证码
|
||||||
|
* @param width - 图形宽度
|
||||||
|
* @param height - 图形高度
|
||||||
|
*/
|
||||||
|
export default function useImageVerify(width = 152, height = 40) {
|
||||||
|
const domRef = ref<HTMLCanvasElement>();
|
||||||
|
const imgCode = ref('');
|
||||||
|
|
||||||
|
function setImgCode(code: string) {
|
||||||
|
imgCode.value = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getImgCode() {
|
||||||
|
if (!domRef.value) return;
|
||||||
|
imgCode.value = draw(domRef.value, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getImgCode();
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
domRef,
|
||||||
|
imgCode,
|
||||||
|
setImgCode,
|
||||||
|
getImgCode
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function randomNum(min: number, max: number) {
|
||||||
|
const num = Math.floor(Math.random() * (max - min) + min);
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
|
||||||
|
function randomColor(min: number, max: number) {
|
||||||
|
const r = randomNum(min, max);
|
||||||
|
const g = randomNum(min, max);
|
||||||
|
const b = randomNum(min, max);
|
||||||
|
return `rgb(${r},${g},${b})`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function draw(dom: HTMLCanvasElement, width: number, height: number) {
|
||||||
|
let imgCode = '';
|
||||||
|
|
||||||
|
const NUMBER_STRING = '0123456789';
|
||||||
|
|
||||||
|
const ctx = dom.getContext('2d');
|
||||||
|
if (!ctx) return imgCode;
|
||||||
|
|
||||||
|
ctx.fillStyle = randomColor(180, 230);
|
||||||
|
ctx.fillRect(0, 0, width, height);
|
||||||
|
|
||||||
|
for (let i = 0; i < 4; i += 1) {
|
||||||
|
const text = NUMBER_STRING[randomNum(0, NUMBER_STRING.length)];
|
||||||
|
imgCode += text;
|
||||||
|
const fontSize = randomNum(18, 41);
|
||||||
|
const deg = randomNum(-30, 30);
|
||||||
|
ctx.font = `${fontSize}px Simhei`;
|
||||||
|
ctx.textBaseline = 'top';
|
||||||
|
ctx.fillStyle = randomColor(80, 150);
|
||||||
|
ctx.save();
|
||||||
|
ctx.translate(30 * i + 23, 15);
|
||||||
|
ctx.rotate((deg * Math.PI) / 180);
|
||||||
|
ctx.fillText(text, -15 + 5, -15);
|
||||||
|
ctx.restore();
|
||||||
|
}
|
||||||
|
for (let i = 0; i < 5; i += 1) {
|
||||||
|
ctx.beginPath();
|
||||||
|
ctx.moveTo(randomNum(0, width), randomNum(0, height));
|
||||||
|
ctx.lineTo(randomNum(0, width), randomNum(0, height));
|
||||||
|
ctx.strokeStyle = randomColor(180, 230);
|
||||||
|
ctx.closePath();
|
||||||
|
ctx.stroke();
|
||||||
|
}
|
||||||
|
for (let i = 0; i < 41; i += 1) {
|
||||||
|
ctx.beginPath();
|
||||||
|
ctx.arc(randomNum(0, width), randomNum(0, height), 1, 0, 2 * Math.PI);
|
||||||
|
ctx.closePath();
|
||||||
|
ctx.fillStyle = randomColor(150, 200);
|
||||||
|
ctx.fill();
|
||||||
|
}
|
||||||
|
|
||||||
|
return imgCode;
|
||||||
|
}
|
||||||
151
src/hooks/business/use-table.ts
Normal file
@@ -0,0 +1,151 @@
|
|||||||
|
import { ref, reactive } from 'vue';
|
||||||
|
import type { Ref } from 'vue';
|
||||||
|
import type { DataTableBaseColumn, DataTableSelectionColumn, DataTableExpandColumn, PaginationProps } from 'naive-ui';
|
||||||
|
import type { TableColumnGroup, InternalRowData } from 'naive-ui/es/data-table/src/interface';
|
||||||
|
import { useLoadingEmpty } from '../common';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格分页参数
|
||||||
|
*/
|
||||||
|
type PaginationParams = Pick<PaginationProps, 'page' | 'pageSize'>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格请求接口的参数
|
||||||
|
*/
|
||||||
|
type ApiParams = Record<string, unknown> & PaginationParams;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格请求接口的结果
|
||||||
|
* @description 这里用属性list来表示后端接口返回的表格数据
|
||||||
|
*/
|
||||||
|
type ApiData<TableData = Record<string, unknown>> = Record<string, unknown> & { list: TableData[] };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格接口的请求函数
|
||||||
|
*/
|
||||||
|
type ApiFn<Params = ApiParams, TableData = Record<string, unknown>> = (
|
||||||
|
params: Params
|
||||||
|
) => Promise<Service.RequestResult<ApiData<TableData>>>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格接口请求后转换后的数据
|
||||||
|
*/
|
||||||
|
type TransformedTableData<TableData = Record<string, unknown>> = {
|
||||||
|
data: TableData[];
|
||||||
|
pageNum: number;
|
||||||
|
pageSize: number;
|
||||||
|
total: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格的列
|
||||||
|
*/
|
||||||
|
type DataTableColumn<T = InternalRowData> =
|
||||||
|
| (Omit<TableColumnGroup<T>, 'key'> & { key: keyof T })
|
||||||
|
| (Omit<DataTableBaseColumn<T>, 'key'> & { key: keyof T })
|
||||||
|
| DataTableSelectionColumn<T>
|
||||||
|
| DataTableExpandColumn<T>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格数据转换器
|
||||||
|
* @description 将不同接口的表格数据转换成统一的类型
|
||||||
|
*/
|
||||||
|
type Transformer<TableData = Record<string, unknown>> = (
|
||||||
|
apiData: ApiData<TableData>
|
||||||
|
) => TransformedTableData<TableData>;
|
||||||
|
|
||||||
|
type TableParams<TableData = Record<string, unknown>, Params = ApiParams> = {
|
||||||
|
apiFn: ApiFn<Params, TableData>;
|
||||||
|
apiParams: Params;
|
||||||
|
transformer: Transformer<TableData>;
|
||||||
|
columns: DataTableColumn<TableData>[];
|
||||||
|
pagination?: PaginationProps;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function useTable<TableData extends Record<string, unknown>, Params extends ApiParams>(
|
||||||
|
params: TableParams<TableData, Params>,
|
||||||
|
immediate = true
|
||||||
|
) {
|
||||||
|
const { loading, startLoading, endLoading, empty, setEmpty } = useLoadingEmpty();
|
||||||
|
const data: Ref<TableData[]> = ref([]);
|
||||||
|
|
||||||
|
function updateData(update: TableData[]) {
|
||||||
|
data.value = update;
|
||||||
|
}
|
||||||
|
|
||||||
|
let dataSource: TableData[] = [];
|
||||||
|
function setDataSource(source: TableData[]) {
|
||||||
|
dataSource = source;
|
||||||
|
}
|
||||||
|
|
||||||
|
function resetData() {
|
||||||
|
data.value = dataSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
const columns = ref(params.columns) as Ref<DataTableColumn<TableData>[]>;
|
||||||
|
|
||||||
|
const pagination = reactive({
|
||||||
|
...getPagination(params.pagination),
|
||||||
|
onChange: (page: number) => {
|
||||||
|
pagination.page = page;
|
||||||
|
},
|
||||||
|
onUpdatePageSize: (pageSize: number) => {
|
||||||
|
pagination.pageSize = pageSize;
|
||||||
|
pagination.page = 1;
|
||||||
|
}
|
||||||
|
}) as PaginationProps;
|
||||||
|
|
||||||
|
function updatePagination(update: Partial<PaginationProps>) {
|
||||||
|
Object.assign(pagination, update);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getData() {
|
||||||
|
const apiParams: Params = { ...params.apiParams };
|
||||||
|
apiParams.page = apiParams.page || pagination.page;
|
||||||
|
apiParams.pageSize = apiParams.pageSize || pagination.pageSize;
|
||||||
|
|
||||||
|
startLoading();
|
||||||
|
const { data: apiData } = await params.apiFn(apiParams);
|
||||||
|
|
||||||
|
if (apiData) {
|
||||||
|
const transformedData = params.transformer(apiData);
|
||||||
|
|
||||||
|
updateData(transformedData.data);
|
||||||
|
|
||||||
|
setDataSource(transformedData.data);
|
||||||
|
|
||||||
|
setEmpty(transformedData.data.length === 0);
|
||||||
|
|
||||||
|
updatePagination({ page: transformedData.pageNum, pageSize: transformedData.pageSize });
|
||||||
|
}
|
||||||
|
|
||||||
|
endLoading();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (immediate) {
|
||||||
|
getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
data,
|
||||||
|
columns,
|
||||||
|
loading,
|
||||||
|
empty,
|
||||||
|
pagination,
|
||||||
|
getData,
|
||||||
|
updateData,
|
||||||
|
resetData
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function getPagination(pagination?: Partial<PaginationProps>) {
|
||||||
|
const defaultPagination: Partial<PaginationProps> = {
|
||||||
|
page: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
showSizePicker: true,
|
||||||
|
pageSizes: [10, 15, 20, 25, 30]
|
||||||
|
};
|
||||||
|
Object.assign(defaultPagination, pagination);
|
||||||
|
|
||||||
|
return defaultPagination;
|
||||||
|
}
|
||||||
23
src/layouts/common/global-header/components/github-site.vue
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<template>
|
||||||
|
<hover-container
|
||||||
|
tooltip-content="github"
|
||||||
|
class="w-40px h-full"
|
||||||
|
:inverted="theme.header.inverted"
|
||||||
|
@click="handleClickLink"
|
||||||
|
>
|
||||||
|
<icon-mdi-github class="text-20px" />
|
||||||
|
</hover-container>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { useThemeStore } from '@/store';
|
||||||
|
|
||||||
|
defineOptions({ name: 'GithubSite' });
|
||||||
|
|
||||||
|
const theme = useThemeStore();
|
||||||
|
function handleClickLink() {
|
||||||
|
window.open('https://github.com/honghuangdc/soybean-admin', '_blank');
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
@@ -35,7 +35,7 @@ import { routePath } from '@/router';
|
|||||||
import { useRouteStore, useThemeStore } from '@/store';
|
import { useRouteStore, useThemeStore } from '@/store';
|
||||||
import { useRouterPush } from '@/composables';
|
import { useRouterPush } from '@/composables';
|
||||||
import { getBreadcrumbByRouteKey } from '@/utils';
|
import { getBreadcrumbByRouteKey } from '@/utils';
|
||||||
import { $t } from '@/locales';
|
import { t } from '@/locales';
|
||||||
|
|
||||||
defineOptions({ name: 'GlobalBreadcrumb' });
|
defineOptions({ name: 'GlobalBreadcrumb' });
|
||||||
|
|
||||||
@@ -48,8 +48,8 @@ const breadcrumbs = computed(() =>
|
|||||||
getBreadcrumbByRouteKey(route.name as string, routeStore.menus as App.GlobalMenuOption[], routePath('root')).map(
|
getBreadcrumbByRouteKey(route.name as string, routeStore.menus as App.GlobalMenuOption[], routePath('root')).map(
|
||||||
item => ({
|
item => ({
|
||||||
...item,
|
...item,
|
||||||
label: item.i18nTitle ? $t(item.i18nTitle) : item.label,
|
label: item.i18nTitle ? t(item.i18nTitle) : item.label,
|
||||||
options: item.options?.map(oItem => ({ ...oItem, label: oItem.i18nTitle ? $t(oItem.i18nTitle) : oItem.label }))
|
options: item.options?.map(oItem => ({ ...oItem, label: oItem.i18nTitle ? t(oItem.i18nTitle) : oItem.label }))
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,10 +1,23 @@
|
|||||||
import MenuCollapse from './menu-collapse.vue';
|
import MenuCollapse from './menu-collapse.vue';
|
||||||
import GlobalBreadcrumb from './global-breadcrumb.vue';
|
import GlobalBreadcrumb from './global-breadcrumb.vue';
|
||||||
import HeaderMenu from './header-menu.vue';
|
import HeaderMenu from './header-menu.vue';
|
||||||
|
import GithubSite from './github-site.vue';
|
||||||
import FullScreen from './full-screen.vue';
|
import FullScreen from './full-screen.vue';
|
||||||
import ThemeMode from './theme-mode.vue';
|
import ThemeMode from './theme-mode.vue';
|
||||||
import UserAvatar from './user-avatar.vue';
|
import UserAvatar from './user-avatar.vue';
|
||||||
|
import SystemMessage from './system-message.vue';
|
||||||
import SettingButton from './setting-button.vue';
|
import SettingButton from './setting-button.vue';
|
||||||
import ToggleLang from './toggle-lang.vue';
|
import ToggleLang from './toggle-lang.vue';
|
||||||
|
|
||||||
export { MenuCollapse, GlobalBreadcrumb, HeaderMenu, FullScreen, ThemeMode, UserAvatar, SettingButton, ToggleLang };
|
export {
|
||||||
|
MenuCollapse,
|
||||||
|
GlobalBreadcrumb,
|
||||||
|
HeaderMenu,
|
||||||
|
GithubSite,
|
||||||
|
FullScreen,
|
||||||
|
ThemeMode,
|
||||||
|
UserAvatar,
|
||||||
|
SystemMessage,
|
||||||
|
SettingButton,
|
||||||
|
ToggleLang
|
||||||
|
};
|
||||||
|
|||||||
57
src/layouts/common/global-header/components/message-list.vue
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
<template>
|
||||||
|
<n-scrollbar class="max-h-360px">
|
||||||
|
<n-list>
|
||||||
|
<n-list-item
|
||||||
|
v-for="(item, index) in list"
|
||||||
|
:key="item.id"
|
||||||
|
class="hover:bg-#f6f6f6 dark:hover:bg-dark cursor-pointer"
|
||||||
|
@click="handleRead(index)"
|
||||||
|
>
|
||||||
|
<n-thing class="px-15px" :class="{ 'opacity-30': item.isRead }">
|
||||||
|
<template #avatar>
|
||||||
|
<n-avatar v-if="item.avatar" :src="item.avatar" />
|
||||||
|
<svg-icon v-else class="text-34px text-primary" :icon="item.icon" :local-icon="item.svgIcon" />
|
||||||
|
</template>
|
||||||
|
<template #header>
|
||||||
|
<n-ellipsis :line-clamp="1">
|
||||||
|
{{ item.title }}
|
||||||
|
<template #tooltip>
|
||||||
|
{{ item.title }}
|
||||||
|
</template>
|
||||||
|
</n-ellipsis>
|
||||||
|
</template>
|
||||||
|
<template v-if="item.tagTitle" #header-extra>
|
||||||
|
<n-tag v-bind="item.tagProps" size="small">{{ item.tagTitle }}</n-tag>
|
||||||
|
</template>
|
||||||
|
<template #description>
|
||||||
|
<n-ellipsis v-if="item.description" :line-clamp="2">
|
||||||
|
{{ item.description }}
|
||||||
|
</n-ellipsis>
|
||||||
|
<p>{{ item.date }}</p>
|
||||||
|
</template>
|
||||||
|
</n-thing>
|
||||||
|
</n-list-item>
|
||||||
|
</n-list>
|
||||||
|
</n-scrollbar>
|
||||||
|
</template>
|
||||||
|
<script lang="ts" setup>
|
||||||
|
defineOptions({ name: 'MessageList' });
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
list?: App.MessageList[];
|
||||||
|
}
|
||||||
|
|
||||||
|
withDefaults(defineProps<Props>(), {
|
||||||
|
list: () => []
|
||||||
|
});
|
||||||
|
|
||||||
|
interface Emits {
|
||||||
|
(e: 'read', val: number): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const emit = defineEmits<Emits>();
|
||||||
|
|
||||||
|
function handleRead(index: number) {
|
||||||
|
emit('read', index);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
217
src/layouts/common/global-header/components/system-message.vue
Normal file
@@ -0,0 +1,217 @@
|
|||||||
|
<template>
|
||||||
|
<n-popover class="!p-0" trigger="click" placement="bottom">
|
||||||
|
<template #trigger>
|
||||||
|
<hover-container tooltip-content="消息通知" :inverted="theme.header.inverted" class="relative w-40px h-full">
|
||||||
|
<icon-clarity:notification-line class="text-18px" />
|
||||||
|
<n-badge
|
||||||
|
:value="count"
|
||||||
|
:max="99"
|
||||||
|
:class="[count < 10 ? '-right-2px' : '-right-10px']"
|
||||||
|
class="absolute top-10px"
|
||||||
|
/>
|
||||||
|
</hover-container>
|
||||||
|
</template>
|
||||||
|
<n-tabs
|
||||||
|
v-model:value="currentTab"
|
||||||
|
:class="[isMobile ? 'w-276px' : 'w-360px']"
|
||||||
|
type="line"
|
||||||
|
justify-content="space-evenly"
|
||||||
|
>
|
||||||
|
<n-tab-pane v-for="(item, index) in tabData" :key="item.key" :name="index">
|
||||||
|
<template #tab>
|
||||||
|
<div class="flex-x-center items-center" :class="[isMobile ? 'w-92px' : 'w-120px']">
|
||||||
|
<span class="mr-5px">{{ item.name }}</span>
|
||||||
|
<n-badge
|
||||||
|
v-bind="item.badgeProps"
|
||||||
|
:value="item.list.filter(message => !message.isRead).length"
|
||||||
|
:max="99"
|
||||||
|
show-zero
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<loading-empty-wrapper
|
||||||
|
class="h-360px"
|
||||||
|
:loading="loading"
|
||||||
|
:empty="item.list.length === 0"
|
||||||
|
placeholder-class="bg-$n-color transition-background-color duration-300 ease-in-out"
|
||||||
|
>
|
||||||
|
<message-list :list="item.list" @read="handleRead" />
|
||||||
|
</loading-empty-wrapper>
|
||||||
|
</n-tab-pane>
|
||||||
|
</n-tabs>
|
||||||
|
<div v-if="showAction" class="flex border-t border-$n-divider-color cursor-pointer">
|
||||||
|
<div class="flex-1 text-center py-10px" @click="handleClear">清空</div>
|
||||||
|
<div class="flex-1 text-center py-10px border-l border-$n-divider-color" @click="handleAllRead">全部已读</div>
|
||||||
|
<div class="flex-1 text-center py-10px border-l border-$n-divider-color" @click="handleLoadMore">查看更多</div>
|
||||||
|
</div>
|
||||||
|
</n-popover>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { computed, ref } from 'vue';
|
||||||
|
import { useThemeStore } from '@/store';
|
||||||
|
import { useBasicLayout } from '@/composables';
|
||||||
|
import { useBoolean } from '@/hooks';
|
||||||
|
import MessageList from './message-list.vue';
|
||||||
|
|
||||||
|
defineOptions({ name: 'SystemMessage' });
|
||||||
|
|
||||||
|
const theme = useThemeStore();
|
||||||
|
const { isMobile } = useBasicLayout();
|
||||||
|
const { bool: loading, setBool: setLoading } = useBoolean();
|
||||||
|
|
||||||
|
const currentTab = ref(0);
|
||||||
|
|
||||||
|
const tabData = ref<App.MessageTab[]>([
|
||||||
|
{
|
||||||
|
key: 1,
|
||||||
|
name: '通知',
|
||||||
|
badgeProps: { type: 'warning' },
|
||||||
|
list: [
|
||||||
|
{ id: 1, icon: 'ri:message-3-line', title: '你收到了5条新消息', date: '2022-06-17' },
|
||||||
|
{ id: 4, icon: 'ri:message-3-line', title: 'Soybean Admin 1.0.0 版本正在筹备中', date: '2022-06-17' },
|
||||||
|
{ id: 2, icon: 'ri:message-3-line', title: 'Soybean Admin 0.9.6 版本发布了', date: '2022-06-16' },
|
||||||
|
{ id: 3, icon: 'ri:message-3-line', title: 'Soybean Admin 0.9.5 版本发布了', date: '2022-06-07' },
|
||||||
|
{
|
||||||
|
id: 5,
|
||||||
|
icon: 'ri:message-3-line',
|
||||||
|
title: '测试超长标题测试超长标题测试超长标题测试超长标题测试超长标题测试超长标题测试超长标题测试超长标题',
|
||||||
|
date: '2022-06-17'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 2,
|
||||||
|
name: '消息',
|
||||||
|
badgeProps: { type: 'error' },
|
||||||
|
list: [
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
title: '项目动态',
|
||||||
|
svgIcon: 'avatar',
|
||||||
|
description: 'Soybean 刚才把工作台页面随便写了一些,凑合能看了!',
|
||||||
|
date: '2021-11-07 22:45:32'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
title: '项目动态',
|
||||||
|
svgIcon: 'avatar',
|
||||||
|
description: 'Soybean 正在忙于为soybean-admin写项目说明文档!',
|
||||||
|
date: '2021-11-03 20:33:31'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 3,
|
||||||
|
title: '项目动态',
|
||||||
|
svgIcon: 'avatar',
|
||||||
|
description: 'Soybean 准备为soybean-admin 1.0的发布做充分的准备工作!',
|
||||||
|
date: '2021-10-31 22:43:12'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 4,
|
||||||
|
title: '项目动态',
|
||||||
|
svgIcon: 'avatar',
|
||||||
|
description: '@yanbowe 向soybean-admin提交了一个bug,多标签栏不会自适应。',
|
||||||
|
date: '2021-10-27 10:24:54'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 5,
|
||||||
|
title: '项目动态',
|
||||||
|
svgIcon: 'avatar',
|
||||||
|
description: 'Soybean 在2021年5月28日创建了开源项目soybean-admin!',
|
||||||
|
date: '2021-05-28 22:22:22'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 3,
|
||||||
|
name: '待办',
|
||||||
|
badgeProps: { type: 'info' },
|
||||||
|
list: [
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
icon: 'ri:calendar-todo-line',
|
||||||
|
title: '缓存主题配置',
|
||||||
|
description: '任务正在计划中',
|
||||||
|
date: '2022-06-17',
|
||||||
|
tagTitle: '未开始',
|
||||||
|
tagProps: { type: 'default' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
icon: 'ri:calendar-todo-line',
|
||||||
|
title: '添加锁屏组件、全局Iframe组件',
|
||||||
|
description: '任务正在计划中',
|
||||||
|
date: '2022-06-17',
|
||||||
|
tagTitle: '未开始',
|
||||||
|
tagProps: { type: 'default' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 3,
|
||||||
|
icon: 'ri:calendar-todo-line',
|
||||||
|
title: '示例页面完善',
|
||||||
|
description: '任务正在计划中',
|
||||||
|
date: '2022-06-17',
|
||||||
|
tagTitle: '未开始',
|
||||||
|
tagProps: { type: 'default' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 4,
|
||||||
|
icon: 'ri:calendar-todo-line',
|
||||||
|
title: '表单、表格示例',
|
||||||
|
description: '任务正在计划中',
|
||||||
|
date: '2022-06-17',
|
||||||
|
tagTitle: '未开始',
|
||||||
|
tagProps: { type: 'default' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 5,
|
||||||
|
icon: 'ri:calendar-todo-line',
|
||||||
|
title: '性能优化(优化递归函数)',
|
||||||
|
description: '任务正在计划中',
|
||||||
|
date: '2022-06-17',
|
||||||
|
tagTitle: '未开始',
|
||||||
|
tagProps: { type: 'default' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 6,
|
||||||
|
icon: 'ri:calendar-todo-line',
|
||||||
|
title: '精简版(新分支thin)',
|
||||||
|
description: '任务正在计划中',
|
||||||
|
date: '2022-06-17',
|
||||||
|
tagTitle: '未开始',
|
||||||
|
tagProps: { type: 'default' }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
const count = computed(() => {
|
||||||
|
return tabData.value.reduce((acc, cur) => {
|
||||||
|
return acc + cur.list.filter(item => !item.isRead).length;
|
||||||
|
}, 0);
|
||||||
|
});
|
||||||
|
|
||||||
|
const showAction = computed(() => tabData.value[currentTab.value].list.length > 0);
|
||||||
|
|
||||||
|
function handleRead(index: number) {
|
||||||
|
tabData.value[currentTab.value].list[index].isRead = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleAllRead() {
|
||||||
|
tabData.value[currentTab.value].list.forEach(item => Object.assign(item, { isRead: true }));
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleClear() {
|
||||||
|
tabData.value[currentTab.value].list = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleLoadMore() {
|
||||||
|
const { list } = tabData.value[currentTab.value];
|
||||||
|
setLoading(true);
|
||||||
|
setTimeout(() => {
|
||||||
|
list.push(...tabData.value[currentTab.value].list);
|
||||||
|
setLoading(false);
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style scoped></style>
|
||||||
@@ -1,11 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<hover-container class="w-40px" :inverted="theme.header.inverted" tooltip-content="主题模式">
|
<hover-container class="w-40px" :inverted="theme.header.inverted" tooltip-content="主题模式">
|
||||||
<dark-mode-switch
|
<dark-mode-switch :dark="theme.darkMode" class="wh-full" @update:dark="theme.setDarkMode" />
|
||||||
:dark="theme.darkMode"
|
|
||||||
:customize-transition="theme.isCustomizeDarkModeTransition"
|
|
||||||
class="wh-full"
|
|
||||||
@update:dark="theme.setDarkMode"
|
|
||||||
/>
|
|
||||||
</hover-container>
|
</hover-container>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import { localStg } from '@/utils';
|
|||||||
const theme = useThemeStore();
|
const theme = useThemeStore();
|
||||||
const { locale } = useI18n();
|
const { locale } = useI18n();
|
||||||
|
|
||||||
const language = ref<I18nType.LangType>(localStg.get('lang') || 'zh-CN');
|
const language = ref<I18nType.langType>(localStg.get('lang') || 'zh-CN');
|
||||||
const options = [
|
const options = [
|
||||||
{
|
{
|
||||||
label: '中文',
|
label: '中文',
|
||||||
@@ -31,9 +31,9 @@ const options = [
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
const handleSelect = (key: string) => {
|
const handleSelect = (key: string) => {
|
||||||
language.value = key as I18nType.LangType;
|
language.value = key as I18nType.langType;
|
||||||
locale.value = key;
|
locale.value = key;
|
||||||
localStg.set('lang', key as I18nType.LangType);
|
localStg.set('lang', key as I18nType.langType);
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style scoped></style>
|
<style scoped></style>
|
||||||
|
|||||||
@@ -7,9 +7,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<header-menu v-else />
|
<header-menu v-else />
|
||||||
<div class="flex justify-end h-full">
|
<div class="flex justify-end h-full">
|
||||||
|
<global-search />
|
||||||
|
<github-site />
|
||||||
<full-screen />
|
<full-screen />
|
||||||
<theme-mode />
|
<theme-mode />
|
||||||
<toggle-lang />
|
<toggle-lang />
|
||||||
|
<system-message />
|
||||||
<setting-button v-if="showButton" />
|
<setting-button v-if="showButton" />
|
||||||
<user-avatar />
|
<user-avatar />
|
||||||
</div>
|
</div>
|
||||||
@@ -20,12 +23,15 @@
|
|||||||
import { useThemeStore } from '@/store';
|
import { useThemeStore } from '@/store';
|
||||||
import { useBasicLayout } from '@/composables';
|
import { useBasicLayout } from '@/composables';
|
||||||
import GlobalLogo from '../global-logo/index.vue';
|
import GlobalLogo from '../global-logo/index.vue';
|
||||||
|
import GlobalSearch from '../global-search/index.vue';
|
||||||
import {
|
import {
|
||||||
FullScreen,
|
FullScreen,
|
||||||
|
GithubSite,
|
||||||
GlobalBreadcrumb,
|
GlobalBreadcrumb,
|
||||||
HeaderMenu,
|
HeaderMenu,
|
||||||
MenuCollapse,
|
MenuCollapse,
|
||||||
SettingButton,
|
SettingButton,
|
||||||
|
SystemMessage,
|
||||||
ThemeMode,
|
ThemeMode,
|
||||||
UserAvatar,
|
UserAvatar,
|
||||||
ToggleLang
|
ToggleLang
|
||||||
|
|||||||
@@ -2,14 +2,14 @@
|
|||||||
<router-link :to="routeHomePath" class="flex-center w-full nowrap-hidden">
|
<router-link :to="routeHomePath" class="flex-center w-full nowrap-hidden">
|
||||||
<system-logo class="text-32px text-primary" />
|
<system-logo class="text-32px text-primary" />
|
||||||
<h2 v-show="showTitle" class="pl-8px text-16px font-bold text-primary transition duration-300 ease-in-out">
|
<h2 v-show="showTitle" class="pl-8px text-16px font-bold text-primary transition duration-300 ease-in-out">
|
||||||
{{ $t('system.title') }}
|
{{ t('message.system.title') }}
|
||||||
</h2>
|
</h2>
|
||||||
</router-link>
|
</router-link>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { routePath } from '@/router';
|
import { routePath } from '@/router';
|
||||||
import { $t } from '@/locales';
|
import { t } from '@/locales';
|
||||||
|
|
||||||
defineOptions({ name: 'GlobalLogo' });
|
defineOptions({ name: 'GlobalLogo' });
|
||||||
|
|
||||||
|
|||||||
3
src/layouts/common/global-search/components/index.ts
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
import SearchModal from './search-modal.vue';
|
||||||
|
|
||||||
|
export { SearchModal };
|
||||||
@@ -22,9 +22,6 @@ defineOptions({ name: 'SearchFooter' });
|
|||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.icon {
|
.icon {
|
||||||
box-shadow:
|
box-shadow: inset 0 -2px #cdcde6, inset 0 0 1px 1px #fff, 0 1px 2px 1px #1e235a66;
|
||||||
inset 0 -2px #cdcde6,
|
|
||||||
inset 0 0 1px 1px #fff,
|
|
||||||
0 1px 2px 1px #1e235a66;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
147
src/layouts/common/global-search/components/search-modal.vue
Normal file
@@ -0,0 +1,147 @@
|
|||||||
|
<template>
|
||||||
|
<n-modal
|
||||||
|
v-model:show="show"
|
||||||
|
:segmented="{ footer: 'soft' }"
|
||||||
|
:closable="false"
|
||||||
|
preset="card"
|
||||||
|
footer-style="padding: 0; margin: 0"
|
||||||
|
class="fixed left-0 right-0"
|
||||||
|
:class="[isMobile ? 'wh-full top-0px rounded-0' : 'w-630px top-50px']"
|
||||||
|
@after-leave="handleClose"
|
||||||
|
>
|
||||||
|
<n-input-group>
|
||||||
|
<n-input ref="inputRef" v-model:value="keyword" clearable placeholder="请输入关键词搜索" @input="handleSearch">
|
||||||
|
<template #prefix>
|
||||||
|
<icon-uil-search class="text-15px text-#c2c2c2" />
|
||||||
|
</template>
|
||||||
|
</n-input>
|
||||||
|
<n-button v-if="isMobile" type="primary" ghost @click="handleClose">取消</n-button>
|
||||||
|
</n-input-group>
|
||||||
|
|
||||||
|
<div class="mt-20px">
|
||||||
|
<n-empty v-if="resultOptions.length === 0" description="暂无搜索结果" />
|
||||||
|
<search-result v-else v-model:value="activePath" :options="resultOptions" @enter="handleEnter" />
|
||||||
|
</div>
|
||||||
|
<template #footer>
|
||||||
|
<search-footer v-if="!isMobile" />
|
||||||
|
</template>
|
||||||
|
</n-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { computed, nextTick, ref, shallowRef, watch } from 'vue';
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
|
import { onKeyStroke, useDebounceFn } from '@vueuse/core';
|
||||||
|
import { useRouteStore } from '@/store';
|
||||||
|
import { useBasicLayout } from '@/composables';
|
||||||
|
import SearchResult from './search-result.vue';
|
||||||
|
import SearchFooter from './search-footer.vue';
|
||||||
|
|
||||||
|
defineOptions({ name: 'SearchModal' });
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
/** 弹窗显隐 */
|
||||||
|
value: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = defineProps<Props>();
|
||||||
|
|
||||||
|
interface Emits {
|
||||||
|
(e: 'update:value', val: boolean): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const emit = defineEmits<Emits>();
|
||||||
|
|
||||||
|
const { isMobile } = useBasicLayout();
|
||||||
|
const router = useRouter();
|
||||||
|
const routeStore = useRouteStore();
|
||||||
|
|
||||||
|
const keyword = ref('');
|
||||||
|
const activePath = ref('');
|
||||||
|
const resultOptions = shallowRef<AuthRoute.Route[]>([]);
|
||||||
|
const inputRef = ref<HTMLInputElement>();
|
||||||
|
|
||||||
|
const handleSearch = useDebounceFn(search, 300);
|
||||||
|
|
||||||
|
const show = computed({
|
||||||
|
get() {
|
||||||
|
return props.value;
|
||||||
|
},
|
||||||
|
set(val: boolean) {
|
||||||
|
emit('update:value', val);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
watch(show, async val => {
|
||||||
|
if (val) {
|
||||||
|
/** 自动聚焦 */
|
||||||
|
await nextTick();
|
||||||
|
inputRef.value?.focus();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/** 查询 */
|
||||||
|
function search() {
|
||||||
|
resultOptions.value = routeStore.searchMenus.filter(
|
||||||
|
menu => keyword.value && menu.meta?.title.toLocaleLowerCase().includes(keyword.value.toLocaleLowerCase().trim())
|
||||||
|
);
|
||||||
|
if (resultOptions.value?.length > 0) {
|
||||||
|
activePath.value = resultOptions.value[0].path;
|
||||||
|
} else {
|
||||||
|
activePath.value = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleClose() {
|
||||||
|
show.value = false;
|
||||||
|
/** 延时处理防止用户看到某些操作 */
|
||||||
|
setTimeout(() => {
|
||||||
|
resultOptions.value = [];
|
||||||
|
keyword.value = '';
|
||||||
|
}, 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** key up */
|
||||||
|
function handleUp() {
|
||||||
|
const { length } = resultOptions.value;
|
||||||
|
if (length === 0) return;
|
||||||
|
const index = resultOptions.value.findIndex(item => item.path === activePath.value);
|
||||||
|
if (index === 0) {
|
||||||
|
activePath.value = resultOptions.value[length - 1].path;
|
||||||
|
} else {
|
||||||
|
activePath.value = resultOptions.value[index - 1].path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** key down */
|
||||||
|
function handleDown() {
|
||||||
|
const { length } = resultOptions.value;
|
||||||
|
if (length === 0) return;
|
||||||
|
const index = resultOptions.value.findIndex(item => item.path === activePath.value);
|
||||||
|
if (index + 1 === length) {
|
||||||
|
activePath.value = resultOptions.value[0].path;
|
||||||
|
} else {
|
||||||
|
activePath.value = resultOptions.value[index + 1].path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** key enter */
|
||||||
|
function handleEnter() {
|
||||||
|
const { length } = resultOptions.value;
|
||||||
|
if (length === 0 || activePath.value === '') return;
|
||||||
|
const routeItem = resultOptions.value.find(item => item.path === activePath.value);
|
||||||
|
if (routeItem?.meta?.href) {
|
||||||
|
window.open(activePath.value, '__blank');
|
||||||
|
} else {
|
||||||
|
router.push(activePath.value);
|
||||||
|
handleClose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onKeyStroke('Escape', handleClose);
|
||||||
|
onKeyStroke('Enter', handleEnter);
|
||||||
|
onKeyStroke('ArrowUp', handleUp);
|
||||||
|
onKeyStroke('ArrowDown', handleDown);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped></style>
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
<template>
|
||||||
|
<n-scrollbar>
|
||||||
|
<div class="pb-12px">
|
||||||
|
<template v-for="item in options" :key="item.path">
|
||||||
|
<div
|
||||||
|
class="bg-#e5e7eb dark:bg-dark h-56px mt-8px px-14px rounded-4px cursor-pointer flex-y-center justify-between"
|
||||||
|
:style="{
|
||||||
|
background: item.path === active ? theme.themeColor : '',
|
||||||
|
color: item.path === active ? '#fff' : ''
|
||||||
|
}"
|
||||||
|
@click="handleTo"
|
||||||
|
@mouseenter="handleMouse(item)"
|
||||||
|
>
|
||||||
|
<svg-icon :icon="item.meta.icon" :local-icon="item.meta.localIcon" />
|
||||||
|
<span class="flex-1 ml-5px">{{ item.meta?.title }}</span>
|
||||||
|
<icon-ant-design-enter-outlined class="icon text-20px p-2px mr-3px" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</n-scrollbar>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { computed } from 'vue';
|
||||||
|
import { useThemeStore } from '@/store';
|
||||||
|
|
||||||
|
defineOptions({ name: 'SearchResult' });
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
value: string;
|
||||||
|
options: AuthRoute.Route[];
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = defineProps<Props>();
|
||||||
|
|
||||||
|
interface Emits {
|
||||||
|
(e: 'update:value', val: string): void;
|
||||||
|
(e: 'enter'): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const emit = defineEmits<Emits>();
|
||||||
|
|
||||||
|
const theme = useThemeStore();
|
||||||
|
|
||||||
|
const active = computed({
|
||||||
|
get() {
|
||||||
|
return props.value;
|
||||||
|
},
|
||||||
|
set(val: string) {
|
||||||
|
emit('update:value', val);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/** 鼠标移入 */
|
||||||
|
async function handleMouse(item: AuthRoute.Route) {
|
||||||
|
active.value = item.path;
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleTo() {
|
||||||
|
emit('enter');
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped></style>
|
||||||
30
src/layouts/common/global-search/index.vue
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<hover-container
|
||||||
|
class="w-40px h-full"
|
||||||
|
tooltip-content="搜索"
|
||||||
|
:inverted="theme.header.inverted"
|
||||||
|
@click="handleSearch"
|
||||||
|
>
|
||||||
|
<icon-uil-search class="text-20px" />
|
||||||
|
</hover-container>
|
||||||
|
<search-modal v-model:value="show" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { useThemeStore } from '@/store';
|
||||||
|
import { useBoolean } from '@/hooks';
|
||||||
|
import { SearchModal } from './components';
|
||||||
|
|
||||||
|
defineOptions({ name: 'GlobalSearch' });
|
||||||
|
|
||||||
|
const { bool: show, toggle } = useBoolean();
|
||||||
|
const theme = useThemeStore();
|
||||||
|
|
||||||
|
function handleSearch() {
|
||||||
|
toggle();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped></style>
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
:style="{ width: showDrawer ? theme.sider.mixChildMenuWidth + 'px' : '0px' }"
|
:style="{ width: showDrawer ? theme.sider.mixChildMenuWidth + 'px' : '0px' }"
|
||||||
>
|
>
|
||||||
<header class="header-height flex-y-center justify-between" :style="{ height: theme.header.height + 'px' }">
|
<header class="header-height flex-y-center justify-between" :style="{ height: theme.header.height + 'px' }">
|
||||||
<h2 class="text-primary pl-8px text-16px font-bold">{{ $t('system.title') }}</h2>
|
<h2 class="text-primary pl-8px text-16px font-bold">{{ title }}</h2>
|
||||||
<div class="px-8px text-16px text-gray-600 cursor-pointer" @click="app.toggleMixSiderFixed">
|
<div class="px-8px text-16px text-gray-600 cursor-pointer" @click="app.toggleMixSiderFixed">
|
||||||
<icon-mdi-pin-off v-if="app.mixSiderFixed" />
|
<icon-mdi-pin-off v-if="app.mixSiderFixed" />
|
||||||
<icon-mdi-pin v-else />
|
<icon-mdi-pin v-else />
|
||||||
@@ -35,9 +35,8 @@ import { computed, ref, watch } from 'vue';
|
|||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import type { MenuOption } from 'naive-ui';
|
import type { MenuOption } from 'naive-ui';
|
||||||
import { useAppStore, useThemeStore } from '@/store';
|
import { useAppStore, useThemeStore } from '@/store';
|
||||||
import { useRouterPush } from '@/composables';
|
import { useAppInfo, useRouterPush } from '@/composables';
|
||||||
import { getActiveKeyPathsOfMenus } from '@/utils';
|
import { getActiveKeyPathsOfMenus } from '@/utils';
|
||||||
import { $t } from '@/locales';
|
|
||||||
|
|
||||||
defineOptions({ name: 'MixMenuDrawer' });
|
defineOptions({ name: 'MixMenuDrawer' });
|
||||||
|
|
||||||
@@ -54,6 +53,7 @@ const route = useRoute();
|
|||||||
const app = useAppStore();
|
const app = useAppStore();
|
||||||
const theme = useThemeStore();
|
const theme = useThemeStore();
|
||||||
const { routerPush } = useRouterPush();
|
const { routerPush } = useRouterPush();
|
||||||
|
const { title } = useAppInfo();
|
||||||
|
|
||||||
const showDrawer = computed(() => (props.visible && props.menus.length) || app.mixSiderFixed);
|
const showDrawer = computed(() => (props.visible && props.menus.length) || app.mixSiderFixed);
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import { useRouterPush } from '@/composables';
|
|||||||
import { useBoolean } from '@/hooks';
|
import { useBoolean } from '@/hooks';
|
||||||
import { translateMenuLabel } from '@/utils';
|
import { translateMenuLabel } from '@/utils';
|
||||||
import { GlobalLogo } from '@/layouts/common';
|
import { GlobalLogo } from '@/layouts/common';
|
||||||
import { $t } from '@/locales';
|
import { t } from '@/locales';
|
||||||
import { MixMenuCollapse, MixMenuDetail, MixMenuDrawer } from './components';
|
import { MixMenuCollapse, MixMenuDetail, MixMenuDrawer } from './components';
|
||||||
|
|
||||||
defineOptions({ name: 'VerticalMixSider' });
|
defineOptions({ name: 'VerticalMixSider' });
|
||||||
@@ -53,7 +53,7 @@ const firstDegreeMenus = computed(() =>
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
routeName,
|
routeName,
|
||||||
label: i18nTitle ? $t(i18nTitle) : label,
|
label: i18nTitle ? t(i18nTitle) : label,
|
||||||
icon,
|
icon,
|
||||||
hasChildren
|
hasChildren
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,21 +6,26 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useRouteStore } from '@/store';
|
import { useAppStore, useRouteStore } from '@/store';
|
||||||
import { useLoading } from '@/hooks';
|
import { useLoading } from '@/hooks';
|
||||||
|
|
||||||
defineOptions({ name: 'ReloadButton' });
|
defineOptions({ name: 'ReloadButton' });
|
||||||
|
|
||||||
const { reCacheRoute } = useRouteStore();
|
const app = useAppStore();
|
||||||
|
const routeStore = useRouteStore();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { loading, startLoading, endLoading } = useLoading();
|
const { loading, startLoading, endLoading } = useLoading();
|
||||||
|
|
||||||
async function handleRefresh() {
|
function handleRefresh() {
|
||||||
|
const isCached = routeStore.cacheRoutes.includes(String(route.name));
|
||||||
|
if (isCached) {
|
||||||
|
routeStore.removeCacheRoute(route.name as AuthRoute.AllRouteKey);
|
||||||
|
}
|
||||||
startLoading();
|
startLoading();
|
||||||
|
app.reloadPage();
|
||||||
await reCacheRoute(route.name as AuthRoute.AllRouteKey);
|
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
if (isCached) {
|
||||||
|
routeStore.addCacheRoute(route.name as AuthRoute.AllRouteKey);
|
||||||
|
}
|
||||||
endLoading();
|
endLoading();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
class="inline-block align-text-bottom text-16px"
|
class="inline-block align-text-bottom text-16px"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
{{ item.meta.i18nTitle ? $t(item.meta.i18nTitle) : item.meta.title }}
|
{{ item.meta.i18nTitle ? t(item.meta.i18nTitle) : item.meta.title }}
|
||||||
</PageTab>
|
</PageTab>
|
||||||
</div>
|
</div>
|
||||||
<context-menu
|
<context-menu
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
import { computed, nextTick, reactive, ref, watch } from 'vue';
|
import { computed, nextTick, reactive, ref, watch } from 'vue';
|
||||||
import { PageTab } from '@soybeanjs/vue-materials';
|
import { PageTab } from '@soybeanjs/vue-materials';
|
||||||
import { useTabStore, useThemeStore } from '@/store';
|
import { useTabStore, useThemeStore } from '@/store';
|
||||||
import { $t } from '@/locales';
|
import { t } from '@/locales';
|
||||||
import { ContextMenu } from './components';
|
import { ContextMenu } from './components';
|
||||||
|
|
||||||
defineOptions({ name: 'TabDetail' });
|
defineOptions({ name: 'TabDetail' });
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<n-divider title-placement="center">{{ $t('layout.settingDrawer.themeModeTitle') }}</n-divider>
|
<n-divider title-placement="center">主题模式</n-divider>
|
||||||
<n-space vertical size="large">
|
<n-space vertical size="large">
|
||||||
<setting-menu :label="$t('layout.settingDrawer.darkMode')">
|
<setting-menu label="深色主题">
|
||||||
<n-switch :value="theme.darkMode" @update:value="theme.setDarkMode">
|
<n-switch :value="theme.darkMode" @update:value="theme.setDarkMode">
|
||||||
<template #checked>
|
<template #checked>
|
||||||
<icon-mdi-white-balance-sunny class="text-14px text-white" />
|
<icon-mdi-white-balance-sunny class="text-14px text-white" />
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</n-switch>
|
</n-switch>
|
||||||
</setting-menu>
|
</setting-menu>
|
||||||
<setting-menu :label="$t('layout.settingDrawer.followSystemTheme')">
|
<setting-menu label="跟随系统">
|
||||||
<n-switch :value="theme.followSystemTheme" @update:value="theme.setFollowSystemTheme">
|
<n-switch :value="theme.followSystemTheme" @update:value="theme.setFollowSystemTheme">
|
||||||
<template #checked>
|
<template #checked>
|
||||||
<icon-ic-baseline-do-not-disturb class="text-14px text-white" />
|
<icon-ic-baseline-do-not-disturb class="text-14px text-white" />
|
||||||
@@ -21,23 +21,13 @@
|
|||||||
</template>
|
</template>
|
||||||
</n-switch>
|
</n-switch>
|
||||||
</setting-menu>
|
</setting-menu>
|
||||||
<setting-menu :label="$t('layout.settingDrawer.isCustomizeDarkModeTransition')">
|
<setting-menu label="侧边栏深色">
|
||||||
<n-switch :value="theme.isCustomizeDarkModeTransition" @update:value="theme.setIsCustomizeDarkModeTransition">
|
|
||||||
<template #checked>
|
|
||||||
<icon-ic-baseline-do-not-disturb class="text-14px text-white" />
|
|
||||||
</template>
|
|
||||||
<template #unchecked>
|
|
||||||
<icon-ic-round-hdr-auto class="text-14px text-white" />
|
|
||||||
</template>
|
|
||||||
</n-switch>
|
|
||||||
</setting-menu>
|
|
||||||
<setting-menu :label="$t('layout.settingDrawer.sider.inverted')">
|
|
||||||
<n-switch :value="theme.sider.inverted" @update:value="theme.setSiderInverted" />
|
<n-switch :value="theme.sider.inverted" @update:value="theme.setSiderInverted" />
|
||||||
</setting-menu>
|
</setting-menu>
|
||||||
<setting-menu :label="$t('layout.settingDrawer.header.inverted')">
|
<setting-menu label="头部深色">
|
||||||
<n-switch :value="theme.header.inverted" @update:value="theme.setHeaderInverted" />
|
<n-switch :value="theme.header.inverted" @update:value="theme.setHeaderInverted" />
|
||||||
</setting-menu>
|
</setting-menu>
|
||||||
<setting-menu :label="$t('layout.settingDrawer.footer.inverted')">
|
<setting-menu label="底部深色">
|
||||||
<n-switch :value="theme.footer.inverted" @update:value="theme.setFooterInverted" />
|
<n-switch :value="theme.footer.inverted" @update:value="theme.setFooterInverted" />
|
||||||
</setting-menu>
|
</setting-menu>
|
||||||
</n-space>
|
</n-space>
|
||||||
@@ -45,7 +35,6 @@
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { useThemeStore } from '@/store';
|
import { useThemeStore } from '@/store';
|
||||||
import { $t } from '@/locales';
|
|
||||||
import SettingMenu from '../setting-menu/index.vue';
|
import SettingMenu from '../setting-menu/index.vue';
|
||||||
|
|
||||||
defineOptions({ name: 'DarkMode' });
|
defineOptions({ name: 'DarkMode' });
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<n-divider title-placement="center">{{ $t('layout.settingDrawer.layoutModelTitle') }}</n-divider>
|
<n-divider title-placement="center">布局模式</n-divider>
|
||||||
<n-space justify="space-around" :wrap="true" :size="24" class="px-12px">
|
<n-space justify="space-around" :wrap="true" :size="24" class="px-12px">
|
||||||
<layout-card
|
<layout-card
|
||||||
v-for="item in theme.layout.modeList"
|
v-for="item in theme.layout.modeList"
|
||||||
@@ -43,7 +43,6 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useThemeStore } from '@/store';
|
import { useThemeStore } from '@/store';
|
||||||
import { $t } from '@/locales';
|
|
||||||
import { LayoutCard } from './components';
|
import { LayoutCard } from './components';
|
||||||
|
|
||||||
defineOptions({ name: 'LayoutMode' });
|
defineOptions({ name: 'LayoutMode' });
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<n-divider title-placement="center">{{ $t('layout.settingDrawer.pageFunctionsTitle') }}</n-divider>
|
<n-divider title-placement="center">界面功能</n-divider>
|
||||||
<n-space vertical size="large">
|
<n-space vertical size="large">
|
||||||
<setting-menu :label="$t('layout.settingDrawer.scrollMode')">
|
<setting-menu label="滚动模式">
|
||||||
<n-select
|
<n-select
|
||||||
class="w-120px"
|
class="w-120px"
|
||||||
size="small"
|
size="small"
|
||||||
@@ -10,10 +10,10 @@
|
|||||||
@update:value="theme.setScrollMode"
|
@update:value="theme.setScrollMode"
|
||||||
/>
|
/>
|
||||||
</setting-menu>
|
</setting-menu>
|
||||||
<setting-menu :label="$t('layout.settingDrawer.fixedHeaderAndTab')">
|
<setting-menu label="固定头部和多页签">
|
||||||
<n-switch :value="theme.fixedHeaderAndTab" @update:value="theme.setIsFixedHeaderAndTab" />
|
<n-switch :value="theme.fixedHeaderAndTab" @update:value="theme.setIsFixedHeaderAndTab" />
|
||||||
</setting-menu>
|
</setting-menu>
|
||||||
<setting-menu :label="$t('layout.settingDrawer.menu.horizontalPosition')">
|
<setting-menu label="顶部菜单位置">
|
||||||
<n-select
|
<n-select
|
||||||
class="w-120px"
|
class="w-120px"
|
||||||
size="small"
|
size="small"
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
@update:value="theme.setHorizontalMenuPosition"
|
@update:value="theme.setHorizontalMenuPosition"
|
||||||
/>
|
/>
|
||||||
</setting-menu>
|
</setting-menu>
|
||||||
<setting-menu :label="$t('layout.settingDrawer.header.height')">
|
<setting-menu label="头部高度">
|
||||||
<n-input-number
|
<n-input-number
|
||||||
class="w-120px"
|
class="w-120px"
|
||||||
size="small"
|
size="small"
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
@update:value="theme.setHeaderHeight"
|
@update:value="theme.setHeaderHeight"
|
||||||
/>
|
/>
|
||||||
</setting-menu>
|
</setting-menu>
|
||||||
<setting-menu :label="$t('layout.settingDrawer.tab.height')">
|
<setting-menu label="多页签高度">
|
||||||
<n-input-number
|
<n-input-number
|
||||||
class="w-120px"
|
class="w-120px"
|
||||||
size="small"
|
size="small"
|
||||||
@@ -40,10 +40,10 @@
|
|||||||
@update:value="theme.setTabHeight"
|
@update:value="theme.setTabHeight"
|
||||||
/>
|
/>
|
||||||
</setting-menu>
|
</setting-menu>
|
||||||
<setting-menu :label="$t('layout.settingDrawer.tab.isCache')">
|
<setting-menu label="多页签缓存">
|
||||||
<n-switch :value="theme.tab.isCache" @update:value="theme.setTabIsCache" />
|
<n-switch :value="theme.tab.isCache" @update:value="theme.setTabIsCache" />
|
||||||
</setting-menu>
|
</setting-menu>
|
||||||
<setting-menu :label="$t('layout.settingDrawer.sider.width')">
|
<setting-menu label="侧边栏展开宽度">
|
||||||
<n-input-number
|
<n-input-number
|
||||||
class="w-120px"
|
class="w-120px"
|
||||||
size="small"
|
size="small"
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
@update:value="theme.setSiderWidth"
|
@update:value="theme.setSiderWidth"
|
||||||
/>
|
/>
|
||||||
</setting-menu>
|
</setting-menu>
|
||||||
<setting-menu :label="$t('layout.settingDrawer.sider.mixWidth')">
|
<setting-menu label="左侧混合侧边栏展开宽度">
|
||||||
<n-input-number
|
<n-input-number
|
||||||
class="w-120px"
|
class="w-120px"
|
||||||
size="small"
|
size="small"
|
||||||
@@ -61,13 +61,13 @@
|
|||||||
@update:value="theme.setMixSiderWidth"
|
@update:value="theme.setMixSiderWidth"
|
||||||
/>
|
/>
|
||||||
</setting-menu>
|
</setting-menu>
|
||||||
<setting-menu :label="$t('layout.settingDrawer.footer.visible')">
|
<setting-menu label="显示底部">
|
||||||
<n-switch :value="theme.footer.visible" @update:value="theme.setFooterVisible" />
|
<n-switch :value="theme.footer.visible" @update:value="theme.setFooterVisible" />
|
||||||
</setting-menu>
|
</setting-menu>
|
||||||
<setting-menu :label="$t('layout.settingDrawer.footer.fixed')">
|
<setting-menu label="固定底部">
|
||||||
<n-switch :value="theme.footer.fixed" @update:value="theme.setFooterIsFixed" />
|
<n-switch :value="theme.footer.fixed" @update:value="theme.setFooterIsFixed" />
|
||||||
</setting-menu>
|
</setting-menu>
|
||||||
<setting-menu :label="$t('layout.settingDrawer.footer.right')">
|
<setting-menu label="底部居右">
|
||||||
<n-switch :value="theme.footer.right" @update:value="theme.setFooterIsRight" />
|
<n-switch :value="theme.footer.right" @update:value="theme.setFooterIsRight" />
|
||||||
</setting-menu>
|
</setting-menu>
|
||||||
</n-space>
|
</n-space>
|
||||||
@@ -75,7 +75,6 @@
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { useThemeStore } from '@/store';
|
import { useThemeStore } from '@/store';
|
||||||
import { $t } from '@/locales';
|
|
||||||
import SettingMenu from '../setting-menu/index.vue';
|
import SettingMenu from '../setting-menu/index.vue';
|
||||||
|
|
||||||
defineOptions({ name: 'PageFunc' });
|
defineOptions({ name: 'PageFunc' });
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
<template>
|
<template>
|
||||||
<n-divider title-placement="center">{{ $t('layout.settingDrawer.pageViewTitle') }}</n-divider>
|
<n-divider title-placement="center">界面显示</n-divider>
|
||||||
<n-space vertical size="large">
|
<n-space vertical size="large">
|
||||||
<setting-menu :label="$t('layout.settingDrawer.header.crumb.visible')">
|
<setting-menu label="面包屑">
|
||||||
<n-switch :value="theme.header.crumb.visible" @update:value="theme.setHeaderCrumbVisible" />
|
<n-switch :value="theme.header.crumb.visible" @update:value="theme.setHeaderCrumbVisible" />
|
||||||
</setting-menu>
|
</setting-menu>
|
||||||
<setting-menu :label="$t('layout.settingDrawer.header.crumb.icon')">
|
<setting-menu label="面包屑图标">
|
||||||
<n-switch :value="theme.header.crumb.showIcon" @update:value="theme.setHeaderCrumbIconVisible" />
|
<n-switch :value="theme.header.crumb.showIcon" @update:value="theme.setHeaderCrumbIconVisible" />
|
||||||
</setting-menu>
|
</setting-menu>
|
||||||
<setting-menu :label="$t('layout.settingDrawer.tab.visible')">
|
<setting-menu label="多页签">
|
||||||
<n-switch :value="theme.tab.visible" @update:value="theme.setTabVisible" />
|
<n-switch :value="theme.tab.visible" @update:value="theme.setTabVisible" />
|
||||||
</setting-menu>
|
</setting-menu>
|
||||||
<setting-menu :label="$t('layout.settingDrawer.tab.modeList.mode')">
|
<setting-menu label="多页签风格">
|
||||||
<n-select
|
<n-select
|
||||||
class="w-120px"
|
class="w-120px"
|
||||||
size="small"
|
size="small"
|
||||||
@@ -19,10 +19,10 @@
|
|||||||
@update:value="theme.setTabMode"
|
@update:value="theme.setTabMode"
|
||||||
/>
|
/>
|
||||||
</setting-menu>
|
</setting-menu>
|
||||||
<setting-menu :label="$t('layout.settingDrawer.page.animate')">
|
<setting-menu label="页面切换动画">
|
||||||
<n-switch :value="theme.page.animate" @update:value="theme.setPageIsAnimate" />
|
<n-switch :value="theme.page.animate" @update:value="theme.setPageIsAnimate" />
|
||||||
</setting-menu>
|
</setting-menu>
|
||||||
<setting-menu :label="$t('layout.settingDrawer.page.animateMode')">
|
<setting-menu label="页面切换动画类型">
|
||||||
<n-select
|
<n-select
|
||||||
class="w-120px"
|
class="w-120px"
|
||||||
size="small"
|
size="small"
|
||||||
@@ -36,7 +36,6 @@
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { useThemeStore } from '@/store';
|
import { useThemeStore } from '@/store';
|
||||||
import { $t } from '@/locales';
|
|
||||||
import SettingMenu from '../setting-menu/index.vue';
|
import SettingMenu from '../setting-menu/index.vue';
|
||||||
|
|
||||||
defineOptions({ name: 'PageView' });
|
defineOptions({ name: 'PageView' });
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<n-divider title-placement="center">{{ $t('layout.settingDrawer.systemThemeTitle') }}</n-divider>
|
<n-divider title-placement="center">系统主题</n-divider>
|
||||||
<n-grid :cols="8" :x-gap="8" :y-gap="12">
|
<n-grid :cols="8" :x-gap="8" :y-gap="12">
|
||||||
<n-grid-item v-for="color in theme.themeColorList" :key="color" class="flex-x-center">
|
<n-grid-item v-for="color in theme.themeColorList" :key="color" class="flex-x-center">
|
||||||
<color-checkbox :color="color" :checked="color === theme.themeColor" @click="theme.setThemeColor(color)" />
|
<color-checkbox :color="color" :checked="color === theme.themeColor" @click="theme.setThemeColor(color)" />
|
||||||
@@ -7,9 +7,7 @@
|
|||||||
</n-grid>
|
</n-grid>
|
||||||
<n-space :vertical="true" class="pt-12px">
|
<n-space :vertical="true" class="pt-12px">
|
||||||
<n-color-picker :value="theme.themeColor" :show-alpha="false" @update-value="theme.setThemeColor" />
|
<n-color-picker :value="theme.themeColor" :show-alpha="false" @update-value="theme.setThemeColor" />
|
||||||
<n-button :block="true" :type="otherColorBtnType" @click="openModal">
|
<n-button :block="true" :type="otherColorBtnType" @click="openModal">更多颜色</n-button>
|
||||||
{{ $t('layout.settingDrawer.systemTheme.moreColors') }}
|
|
||||||
</n-button>
|
|
||||||
</n-space>
|
</n-space>
|
||||||
<color-modal :visible="visible" @close="closeModal" />
|
<color-modal :visible="visible" @close="closeModal" />
|
||||||
</template>
|
</template>
|
||||||
@@ -19,7 +17,6 @@ import { computed } from 'vue';
|
|||||||
import { isInTraditionColors } from '@/settings';
|
import { isInTraditionColors } from '@/settings';
|
||||||
import { useThemeStore } from '@/store';
|
import { useThemeStore } from '@/store';
|
||||||
import { useBoolean } from '@/hooks';
|
import { useBoolean } from '@/hooks';
|
||||||
import { $t } from '@/locales';
|
|
||||||
import { ColorCheckbox, ColorModal } from './components';
|
import { ColorCheckbox, ColorModal } from './components';
|
||||||
|
|
||||||
defineOptions({ name: 'ThemeColorSelect' });
|
defineOptions({ name: 'ThemeColorSelect' });
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<n-divider title-placement="center">{{ $t('layout.settingDrawer.themeConfiguration.title') }}</n-divider>
|
<n-divider title-placement="center">主题配置</n-divider>
|
||||||
<textarea id="themeConfigCopyTarget" v-model="dataClipboardText" class="absolute opacity-0" />
|
<textarea id="themeConfigCopyTarget" v-model="dataClipboardText" class="absolute opacity-0" />
|
||||||
<n-space vertical>
|
<n-space vertical>
|
||||||
<div ref="copyRef" data-clipboard-target="#themeConfigCopyTarget">
|
<div ref="copyRef" data-clipboard-target="#themeConfigCopyTarget">
|
||||||
<n-button type="primary" :block="true">{{ $t('layout.settingDrawer.themeConfiguration.copy') }}</n-button>
|
<n-button type="primary" :block="true">拷贝当前配置</n-button>
|
||||||
</div>
|
</div>
|
||||||
<n-button type="warning" :block="true" @click="handleResetConfig">
|
<n-button type="warning" :block="true" @click="handleResetConfig">重置当前配置</n-button>
|
||||||
{{ $t('layout.settingDrawer.themeConfiguration.reset') }}
|
|
||||||
</n-button>
|
|
||||||
</n-space>
|
</n-space>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -15,7 +13,6 @@
|
|||||||
import { onMounted, onUnmounted, ref, watch } from 'vue';
|
import { onMounted, onUnmounted, ref, watch } from 'vue';
|
||||||
import Clipboard from 'clipboard';
|
import Clipboard from 'clipboard';
|
||||||
import { useThemeStore } from '@/store';
|
import { useThemeStore } from '@/store';
|
||||||
import { $t } from '@/locales';
|
|
||||||
|
|
||||||
defineOptions({ name: 'ThemeConfig' });
|
defineOptions({ name: 'ThemeConfig' });
|
||||||
|
|
||||||
@@ -31,7 +28,7 @@ function getClipboardText() {
|
|||||||
|
|
||||||
function handleResetConfig() {
|
function handleResetConfig() {
|
||||||
theme.resetThemeStore();
|
theme.resetThemeStore();
|
||||||
window.$message?.success($t('layout.settingDrawer.themeConfiguration.resetSuccess'));
|
window.$message?.success('已重置配置,请重新拷贝!');
|
||||||
}
|
}
|
||||||
|
|
||||||
function clipboardEventListener() {
|
function clipboardEventListener() {
|
||||||
@@ -39,9 +36,9 @@ function clipboardEventListener() {
|
|||||||
const copy = new Clipboard(copyRef.value);
|
const copy = new Clipboard(copyRef.value);
|
||||||
copy.on('success', () => {
|
copy.on('success', () => {
|
||||||
window.$dialog?.success({
|
window.$dialog?.success({
|
||||||
title: $t('layout.settingDrawer.themeConfiguration.operateSuccess'),
|
title: '操作成功',
|
||||||
content: $t('layout.settingDrawer.themeConfiguration.copySuccess'),
|
content: '复制成功,请替换 src/settings/theme.json的内容!',
|
||||||
positiveText: $t('layout.settingDrawer.themeConfiguration.confirmCopy')
|
positiveText: '确定'
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<n-drawer :show="app.settingDrawerVisible" display-directive="show" :width="330" @mask-click="app.closeSettingDrawer">
|
<n-drawer :show="app.settingDrawerVisible" display-directive="show" :width="330" @mask-click="app.closeSettingDrawer">
|
||||||
<n-drawer-content :title="$t('layout.settingDrawer.title')" :native-scrollbar="false">
|
<n-drawer-content title="主题配置" :native-scrollbar="false">
|
||||||
<dark-mode />
|
<dark-mode />
|
||||||
<layout-mode />
|
<layout-mode />
|
||||||
<theme-color-select />
|
<theme-color-select />
|
||||||
@@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useAppStore } from '@/store';
|
import { useAppStore } from '@/store';
|
||||||
import { $t } from '@/locales';
|
|
||||||
import { DarkMode, DrawerButton, LayoutMode, PageFunc, PageView, ThemeColorSelect, ThemeConfig } from './components';
|
import { DarkMode, DrawerButton, LayoutMode, PageFunc, PageView, ThemeColorSelect, ThemeConfig } from './components';
|
||||||
|
|
||||||
defineOptions({ name: 'SettingDrawer' });
|
defineOptions({ name: 'SettingDrawer' });
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import type { App } from 'vue';
|
import type { App } from 'vue';
|
||||||
import { createI18n } from 'vue-i18n';
|
import { createI18n } from 'vue-i18n';
|
||||||
import type { TranslateOptions } from 'vue-i18n';
|
import { localStg } from '@/utils';
|
||||||
import { localStg } from '@/utils/storage';
|
import messages from './lang';
|
||||||
import messages from './locale';
|
import type { LocaleKey } from './lang';
|
||||||
|
|
||||||
const i18n = createI18n({
|
const i18n = createI18n({
|
||||||
locale: localStg.get('lang') || 'zh-CN',
|
locale: localStg.get('lang') || 'zh-CN',
|
||||||
@@ -15,20 +15,10 @@ export function setupI18n(app: App) {
|
|||||||
app.use(i18n);
|
app.use(i18n);
|
||||||
}
|
}
|
||||||
|
|
||||||
interface T {
|
export function t(key: string) {
|
||||||
(key: I18nType.I18nKey): string;
|
return i18n.global.t(key);
|
||||||
(key: I18nType.I18nKey, plural: number, options?: TranslateOptions<I18nType.LangType>): string;
|
|
||||||
(key: I18nType.I18nKey, defaultMsg: string, options?: TranslateOptions<I18nType.I18nKey>): string;
|
|
||||||
(key: I18nType.I18nKey, list: unknown[], options?: TranslateOptions<I18nType.I18nKey>): string;
|
|
||||||
(key: I18nType.I18nKey, list: unknown[], plural: number): string;
|
|
||||||
(key: I18nType.I18nKey, list: unknown[], defaultMsg: string): string;
|
|
||||||
(key: I18nType.I18nKey, named: Record<string, unknown>, options?: TranslateOptions<I18nType.LangType>): string;
|
|
||||||
(key: I18nType.I18nKey, named: Record<string, unknown>, plural: number): string;
|
|
||||||
(key: I18nType.I18nKey, named: Record<string, unknown>, defaultMsg: string): string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const $t = i18n.global.t as T;
|
export function setLocale(locale: LocaleKey) {
|
||||||
|
|
||||||
export function setLocale(locale: I18nType.LangType) {
|
|
||||||
i18n.global.locale.value = locale;
|
i18n.global.locale.value = locale;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,217 +1,83 @@
|
|||||||
const locale: I18nType.Schema = {
|
import type { LocaleMessages } from 'vue-i18n';
|
||||||
system: {
|
|
||||||
title: 'SoybeanAdmin'
|
const locale: LocaleMessages<I18nType.Schema> = {
|
||||||
},
|
message: {
|
||||||
common: {
|
system: {
|
||||||
add: 'Add',
|
title: 'SoybeanAdmin'
|
||||||
addSuccess: 'Add Success',
|
|
||||||
edit: 'Edit',
|
|
||||||
editSuccess: 'Edit Success',
|
|
||||||
delete: 'Delete',
|
|
||||||
deleteSuccess: 'Delete Success',
|
|
||||||
batchDelete: 'Batch Delete',
|
|
||||||
confirm: 'Confirm',
|
|
||||||
cancel: 'Cancel',
|
|
||||||
pleaseCheckValue: 'Please check the value is valid',
|
|
||||||
action: 'Action'
|
|
||||||
},
|
|
||||||
routes: {
|
|
||||||
dashboard: {
|
|
||||||
_value: 'Dashboard',
|
|
||||||
analysis: 'Analysis',
|
|
||||||
workbench: 'Workbench'
|
|
||||||
},
|
},
|
||||||
document: {
|
routes: {
|
||||||
_value: 'Document',
|
dashboard: {
|
||||||
vue: 'Vue Document',
|
_value: 'Dashboard',
|
||||||
vite: 'Vite Document',
|
analysis: 'Analysis',
|
||||||
naive: 'NaiveUI Document',
|
workbench: 'Workbench'
|
||||||
project: 'Project Document',
|
|
||||||
'project-link': 'Project Document(href)'
|
|
||||||
},
|
|
||||||
component: {
|
|
||||||
_value: 'Component',
|
|
||||||
button: 'Button',
|
|
||||||
card: 'Card',
|
|
||||||
table: 'Table'
|
|
||||||
},
|
|
||||||
plugin: {
|
|
||||||
_value: 'Plugin',
|
|
||||||
charts: {
|
|
||||||
_value: 'Chart',
|
|
||||||
echarts: 'ECharts',
|
|
||||||
antv: 'AntV'
|
|
||||||
},
|
},
|
||||||
copy: 'Copy',
|
document: {
|
||||||
editor: {
|
_value: 'Document',
|
||||||
_value: 'Editor',
|
vue: 'Vue Document',
|
||||||
quill: 'Quill',
|
vite: 'Vite Document',
|
||||||
markdown: 'Markdown'
|
naive: 'NaiveUI Document',
|
||||||
|
project: 'Project Document',
|
||||||
|
'project-link': 'Project Document(href)'
|
||||||
},
|
},
|
||||||
icon: 'Icon',
|
component: {
|
||||||
map: 'Map',
|
_value: 'Component',
|
||||||
print: 'Print',
|
button: 'Button',
|
||||||
swiper: 'Swiper',
|
card: 'Card',
|
||||||
video: 'Video'
|
table: 'Table'
|
||||||
},
|
|
||||||
'auth-demo': {
|
|
||||||
_value: 'Auth Demo',
|
|
||||||
permission: 'Toggle Permission',
|
|
||||||
super: 'Super Auth'
|
|
||||||
},
|
|
||||||
function: {
|
|
||||||
_value: 'Function',
|
|
||||||
tab: 'System Tab'
|
|
||||||
},
|
|
||||||
exception: {
|
|
||||||
_value: 'Exception',
|
|
||||||
403: '403',
|
|
||||||
404: '404',
|
|
||||||
500: '500'
|
|
||||||
},
|
|
||||||
'multi-menu': {
|
|
||||||
_value: 'Multi Degree Menu',
|
|
||||||
first: {
|
|
||||||
_value: 'First Degree',
|
|
||||||
second: 'Second Degree',
|
|
||||||
'second-new': {
|
|
||||||
_value: 'Second Degree With Children',
|
|
||||||
third: 'Third Degree'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
management: {
|
|
||||||
_value: 'System Management',
|
|
||||||
auth: 'Auth',
|
|
||||||
role: 'Role',
|
|
||||||
route: 'Route',
|
|
||||||
user: 'User'
|
|
||||||
},
|
|
||||||
about: 'About'
|
|
||||||
},
|
|
||||||
layout: {
|
|
||||||
settingDrawer: {
|
|
||||||
title: 'Theme configuration',
|
|
||||||
themeModeTitle: 'Theme mode',
|
|
||||||
darkMode: 'Dark mode',
|
|
||||||
layoutModelTitle: 'Layout mode',
|
|
||||||
systemThemeTitle: 'System theme',
|
|
||||||
pageFunctionsTitle: 'Page functions',
|
|
||||||
pageViewTitle: 'Page view',
|
|
||||||
followSystemTheme: 'Follow the system',
|
|
||||||
isCustomizeDarkModeTransition: 'Custom dark theme animation transition',
|
|
||||||
scrollMode: 'scrollMode',
|
|
||||||
scrollModeList: {
|
|
||||||
wrapper: 'Outer layer scroll',
|
|
||||||
content: 'Main body scroll'
|
|
||||||
},
|
},
|
||||||
fixedHeaderAndTab: 'Fixed header and multiple tabs',
|
plugin: {
|
||||||
header: {
|
_value: 'Plugin',
|
||||||
inverted: 'darkHead',
|
charts: {
|
||||||
height: 'Head Height',
|
_value: 'Chart',
|
||||||
crumb: {
|
echarts: 'ECharts',
|
||||||
visible: 'Crumb',
|
antv: 'AntV'
|
||||||
icon: 'Crumb icon'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
tab: {
|
|
||||||
visible: 'Multi-page tab',
|
|
||||||
height: 'Multiple tab height',
|
|
||||||
modeList: {
|
|
||||||
mode: 'Multi-tab style',
|
|
||||||
chrome: 'Google style',
|
|
||||||
button: 'Button style'
|
|
||||||
},
|
},
|
||||||
isCache: 'Multiple tab caching'
|
copy: 'Copy',
|
||||||
|
editor: {
|
||||||
|
_value: 'Editor',
|
||||||
|
quill: 'Quill',
|
||||||
|
markdown: 'Markdown'
|
||||||
|
},
|
||||||
|
icon: 'Icon',
|
||||||
|
map: 'Map',
|
||||||
|
print: 'Print',
|
||||||
|
swiper: 'Swiper',
|
||||||
|
video: 'Video'
|
||||||
},
|
},
|
||||||
sider: {
|
'auth-demo': {
|
||||||
inverted: 'Dark sidebar',
|
_value: 'Auth Demo',
|
||||||
width: 'Sidebar expanded width',
|
permission: 'Toggle Permission',
|
||||||
mixWidth: 'Left hybrid sidebar expanded width'
|
super: 'Super Auth'
|
||||||
},
|
},
|
||||||
menu: {
|
function: {
|
||||||
horizontalPosition: 'Top menu position',
|
_value: 'Function',
|
||||||
horizontalPositionList: {
|
tab: 'System Tab'
|
||||||
flexStart: 'Right',
|
},
|
||||||
center: 'center',
|
exception: {
|
||||||
flexEnd: 'Left'
|
_value: 'Exception',
|
||||||
|
403: '403',
|
||||||
|
404: '404',
|
||||||
|
500: '500'
|
||||||
|
},
|
||||||
|
'multi-menu': {
|
||||||
|
_value: 'Multi Degree Menu',
|
||||||
|
first: {
|
||||||
|
_value: 'First Degree',
|
||||||
|
second: 'Second Degree',
|
||||||
|
'second-new': {
|
||||||
|
_value: 'Second Degree With Children',
|
||||||
|
third: 'Third Degree'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
footer: {
|
management: {
|
||||||
inverted: 'Dark bottom',
|
_value: 'System Management',
|
||||||
visible: 'Show bottom',
|
auth: 'Auth',
|
||||||
fixed: 'Fixed bottom',
|
role: 'Role',
|
||||||
right: 'Bottom to the right'
|
route: 'Route',
|
||||||
|
user: 'User'
|
||||||
},
|
},
|
||||||
page: {
|
about: 'About'
|
||||||
animate: 'switch animation',
|
|
||||||
animateMode: 'switch animation type',
|
|
||||||
animateModeList: {
|
|
||||||
zoomFade: 'Gradual change',
|
|
||||||
zoomOut: 'Flash',
|
|
||||||
fadeSlide: 'Slide',
|
|
||||||
fade: 'Fade away',
|
|
||||||
fadeBottom: 'Bottom fade',
|
|
||||||
fadeScale: 'Resizing fade away'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
systemTheme: {
|
|
||||||
moreColors: 'More colors'
|
|
||||||
},
|
|
||||||
themeConfiguration: {
|
|
||||||
title: 'Theme configuration',
|
|
||||||
copy: 'Copy the current configuration',
|
|
||||||
reset: 'Reset the current configuration',
|
|
||||||
resetSuccess: 'The configuration has been reset, please copy it again!',
|
|
||||||
operateSuccess: 'Successful operation',
|
|
||||||
copySuccess: 'Copy success, please replace the content of src/settings/theme.json!',
|
|
||||||
confirmCopy: 'Confirm'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
page: {
|
|
||||||
login: {
|
|
||||||
common: {
|
|
||||||
userNamePlaceholder: 'Please enter user name',
|
|
||||||
phonePlaceholder: 'Please enter phone number',
|
|
||||||
codePlaceholder: 'Please enter verification code',
|
|
||||||
passwordPlaceholder: 'Please enter password',
|
|
||||||
confirmPasswordPlaceholder: 'Please enter password again',
|
|
||||||
codeLogin: 'Verification code login',
|
|
||||||
confirm: 'Confirm',
|
|
||||||
back: 'Back',
|
|
||||||
validateSuccess: 'Verification passed',
|
|
||||||
loginSuccess: 'Login success',
|
|
||||||
welcomeBack: 'Welcome back, {userName}!'
|
|
||||||
},
|
|
||||||
pwdLogin: {
|
|
||||||
title: 'Password Login',
|
|
||||||
rememberMe: 'Remember me',
|
|
||||||
forgetPassword: 'Forget password?',
|
|
||||||
register: 'Register account',
|
|
||||||
otherAccountLogin: 'Other Account Login',
|
|
||||||
otherLoginMode: 'Other Login Mode',
|
|
||||||
superAdmin: 'Super Administrator',
|
|
||||||
admin: 'Administrator',
|
|
||||||
user: 'Ordinary User'
|
|
||||||
},
|
|
||||||
codeLogin: {
|
|
||||||
title: 'Verification Code Login',
|
|
||||||
getCode: 'Get verification code',
|
|
||||||
imageCodePlaceholder: 'Please enter image verification code'
|
|
||||||
},
|
|
||||||
register: {
|
|
||||||
title: 'Register Account',
|
|
||||||
agreement: 'I have read and agree to',
|
|
||||||
protocol: '《User Agreement》',
|
|
||||||
policy: '《Privacy Policy》'
|
|
||||||
},
|
|
||||||
resetPwd: {
|
|
||||||
title: 'Reset Password'
|
|
||||||
},
|
|
||||||
bindWeChat: {
|
|
||||||
title: 'Bind WeChat'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
13
src/locales/lang/index.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import zhCN from './zh-cn';
|
||||||
|
import en from './en';
|
||||||
|
import kmKH from './km-KH';
|
||||||
|
|
||||||
|
const locales = {
|
||||||
|
'zh-CN': zhCN,
|
||||||
|
en,
|
||||||
|
'km-KH': kmKH
|
||||||
|
};
|
||||||
|
|
||||||
|
export type LocaleKey = keyof typeof locales;
|
||||||
|
|
||||||
|
export default locales;
|
||||||
@@ -1,217 +1,83 @@
|
|||||||
const locale: I18nType.Schema = {
|
import type { LocaleMessages } from 'vue-i18n';
|
||||||
system: {
|
|
||||||
title: 'ប្រព័ន្ធគ្រប់គ្រង'
|
const locale: LocaleMessages<I18nType.Schema> = {
|
||||||
},
|
message: {
|
||||||
common: {
|
system: {
|
||||||
add: 'បន្ថែម',
|
title: 'ប្រព័ន្ធគ្រប់គ្រង'
|
||||||
addSuccess: 'បន្ថែមជោគជ័យ',
|
|
||||||
edit: 'កែប្រែ',
|
|
||||||
editSuccess: 'កែប្រែជោគជ័យ',
|
|
||||||
delete: 'លុប',
|
|
||||||
deleteSuccess: 'លុបជោគជ័យ',
|
|
||||||
batchDelete: 'លុបច្រើន',
|
|
||||||
confirm: 'យល់ព្រម',
|
|
||||||
cancel: 'បោះបង់',
|
|
||||||
pleaseCheckValue: 'សូមពិនិត្យមើលតម្លៃដែលបានបញ្ចូលដើម្បីបញ្ជាក់ថាត្រូវប្រើប្រាស់បាន',
|
|
||||||
action: 'សកម្មភាព'
|
|
||||||
},
|
|
||||||
routes: {
|
|
||||||
dashboard: {
|
|
||||||
_value: 'ផ្ទាំងទិន្នន័យ',
|
|
||||||
analysis: 'ផ្ទាំងវិភាគ',
|
|
||||||
workbench: 'ផ្ទាំងការងារ'
|
|
||||||
},
|
},
|
||||||
document: {
|
routes: {
|
||||||
_value: 'ឯកសារ',
|
dashboard: {
|
||||||
vue: 'ឯកសារ Vue',
|
_value: 'ផ្ទាំងទិន្នន័យ',
|
||||||
vite: 'ឯកសារ Vite',
|
analysis: 'ផ្ទាំងវិភាគ',
|
||||||
naive: 'ឯកសារ NaiveUI',
|
workbench: 'ផ្ទាំងការងារ'
|
||||||
project: 'ឯកសារគម្រោង',
|
|
||||||
'project-link': 'ឯកសារគម្រោង(href)'
|
|
||||||
},
|
|
||||||
component: {
|
|
||||||
_value: 'សមាសភាគ',
|
|
||||||
button: 'ប៊ូតុង',
|
|
||||||
card: 'កាត',
|
|
||||||
table: 'តារាង'
|
|
||||||
},
|
|
||||||
plugin: {
|
|
||||||
_value: 'មុខងារជំនួយ',
|
|
||||||
charts: {
|
|
||||||
_value: 'តារាង Chart',
|
|
||||||
echarts: 'តារាង ECharts',
|
|
||||||
antv: 'AntV'
|
|
||||||
},
|
},
|
||||||
copy: 'ចម្លង',
|
document: {
|
||||||
editor: {
|
_value: 'ឯកសារ',
|
||||||
_value: 'កែប្រែ',
|
vue: 'ឯកសារ Vue',
|
||||||
quill: 'Quill',
|
vite: 'ឯកសារ Vite',
|
||||||
markdown: 'Markdown'
|
naive: 'ឯកសារ NaiveUI',
|
||||||
|
project: 'ឯកសារគម្រោង',
|
||||||
|
'project-link': 'ឯកសារគម្រោង(href)'
|
||||||
},
|
},
|
||||||
icon: 'អាយខន',
|
component: {
|
||||||
map: 'ផែនទី',
|
_value: 'សមាសភាគ',
|
||||||
print: 'បោះពុម្ភ',
|
button: 'ប៊ូតុង',
|
||||||
swiper: 'Swiper',
|
card: 'កាត',
|
||||||
video: 'វីដេអូ'
|
table: 'តារាង'
|
||||||
},
|
|
||||||
'auth-demo': {
|
|
||||||
_value: 'ឌីមូ Auth',
|
|
||||||
permission: 'បិទ/បើកការអនុញ្ញាត',
|
|
||||||
super: 'Super Auth'
|
|
||||||
},
|
|
||||||
function: {
|
|
||||||
_value: 'មុខងារ',
|
|
||||||
tab: 'ថេបប្រព័ន្ធ'
|
|
||||||
},
|
|
||||||
exception: {
|
|
||||||
_value: 'ករណីពិេសស',
|
|
||||||
403: '403',
|
|
||||||
404: '404',
|
|
||||||
500: '500'
|
|
||||||
},
|
|
||||||
'multi-menu': {
|
|
||||||
_value: 'ម៉ឺនុយពហុដឺក្រេ',
|
|
||||||
first: {
|
|
||||||
_value: 'ដឺក្រេទី១',
|
|
||||||
second: 'ដែក្រេទី២',
|
|
||||||
'second-new': {
|
|
||||||
_value: 'ដឺក្រេទី២មានអនុក្រោម',
|
|
||||||
third: 'ដឺក្រេទី៣'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
management: {
|
|
||||||
_value: 'ការគ្រប់គ្រងប្រព័ន្ធ',
|
|
||||||
auth: 'Auth',
|
|
||||||
role: 'សិទ្ធី',
|
|
||||||
route: 'ផ្លូវប្រព័ន្ធ',
|
|
||||||
user: 'អ្នកប្រើប្រាស់'
|
|
||||||
},
|
|
||||||
about: 'អំពីប្រព័ន្ធ'
|
|
||||||
},
|
|
||||||
layout: {
|
|
||||||
settingDrawer: {
|
|
||||||
title: 'ការកំណត់ស្បែក',
|
|
||||||
themeModeTitle: 'ស្បែករបស់របស់អ្នក',
|
|
||||||
darkMode: 'របៀបងារស្បែកងងឹត',
|
|
||||||
layoutModelTitle: 'របៀបប្រើប្រាស់របស់អ្នក',
|
|
||||||
systemThemeTitle: 'ស្បែករបស់ប្រព័ន្ធគ្រប់គ្រង',
|
|
||||||
pageFunctionsTitle: 'មុខងារទំនាក់ទំនងរបស់ទំព័រ',
|
|
||||||
pageViewTitle: 'ទំព័រទស្សន៍ទាយ',
|
|
||||||
followSystemTheme: 'តាមដានស្បែកប្រព័ន្ធគ្រប់គ្រង',
|
|
||||||
isCustomizeDarkModeTransition: 'ប្រើប្រាស់របៀបងារស្បែកងងឹតផ្ទាល់ខ្លួន',
|
|
||||||
scrollMode: 'របៀបរុករក',
|
|
||||||
scrollModeList: {
|
|
||||||
wrapper: 'រុករកជាក់លាក់',
|
|
||||||
content: 'រុករកមានមុខងារ'
|
|
||||||
},
|
},
|
||||||
fixedHeaderAndTab: 'បិទការរុករកជាក់លាក់និងរុករកមានមុខងារ',
|
plugin: {
|
||||||
header: {
|
_value: 'មុខងារជំនួយ',
|
||||||
inverted: 'បង្កើតការរុករកជាក់លាក់',
|
charts: {
|
||||||
height: 'កម្ពស់',
|
_value: 'តារាង Chart',
|
||||||
crumb: {
|
echarts: 'តារាង ECharts',
|
||||||
visible: 'បង្ហាញរុករកជាក់លាក់',
|
antv: 'AntV'
|
||||||
icon: 'រុករកជាក់លាក់រូបតំណាង'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
tab: {
|
|
||||||
visible: 'បង្ហាញរុករកជាក់លាក់',
|
|
||||||
height: 'កម្ពស់',
|
|
||||||
modeList: {
|
|
||||||
mode: 'របៀប',
|
|
||||||
chrome: 'ក្រុមហ៊ុន',
|
|
||||||
button: 'ប៊ូតុង'
|
|
||||||
},
|
},
|
||||||
isCache: 'រក្សាទុកការរុករកជាក់លាក់'
|
|
||||||
},
|
|
||||||
sider: {
|
|
||||||
inverted: 'បង្កើតការរុករកជាក់លាក់',
|
|
||||||
width: 'ទទឹង',
|
|
||||||
mixWidth: 'ទទឹងបញ្ចូល'
|
|
||||||
},
|
|
||||||
menu: {
|
|
||||||
horizontalPosition: 'ទីតាំងផ្ដេក',
|
|
||||||
horizontalPositionList: {
|
|
||||||
flexStart: 'ចាប់ផ្ដើមឈុត',
|
|
||||||
center: 'កណ្តាល',
|
|
||||||
flexEnd: 'ចាប់ផ្ដើមចុងក្រោយ'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
footer: {
|
|
||||||
inverted: 'បង្កើតការរុករកជាក់លាក់',
|
|
||||||
visible: 'បង្ហាញការរុករកជាក់លាក់',
|
|
||||||
fixed: 'ការរុករកជាក់លាក់',
|
|
||||||
right: 'ត្រឡប់ទៅស្តាំ'
|
|
||||||
},
|
|
||||||
page: {
|
|
||||||
animate: 'ការផ្លាស់ប្តូរ',
|
|
||||||
animateMode: 'របៀបផ្លាស់ប្តូរ',
|
|
||||||
animateModeList: {
|
|
||||||
zoomFade: 'ពង្រីកបង្ហាញនិងលាស់ប្តូរ',
|
|
||||||
zoomOut: 'ពង្រីកបង្ហាញនិងលាស់ប្តូរ',
|
|
||||||
fadeSlide: 'ពង្រីកបង្ហាញនិងលាស់ប្តូរ',
|
|
||||||
fade: 'ពង្រីកបង្ហាញនិងលាស់ប្តូរ',
|
|
||||||
fadeBottom: 'ពង្រីកបង្ហាញនិងលាស់ប្តូរ',
|
|
||||||
fadeScale: 'ពង្រីកបង្ហាញនិងលាស់ប្តូរ'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
systemTheme: {
|
|
||||||
moreColors: 'ពន្លឺច្រើនទៀត'
|
|
||||||
},
|
|
||||||
themeConfiguration: {
|
|
||||||
title: 'ការកំណត់ស្បែក',
|
|
||||||
copy: 'ចម្លង',
|
copy: 'ចម្លង',
|
||||||
reset: 'កំណត់ឡើងវិញ',
|
editor: {
|
||||||
resetSuccess: 'កំណត់ឡើងវិញជោគជ័យ, សូមចម្លងឯកសារស្បែកឡើងវិញ!',
|
_value: 'កែប្រែ',
|
||||||
operateSuccess: 'សម្រាប់ការប្រើប្រាស់ជោគជ័យ',
|
quill: 'Quill',
|
||||||
copySuccess: 'ចម្លងជោគជ័យ, សូមជោគជ័យឯកសារ src/settings/theme.json!',
|
markdown: 'Markdown'
|
||||||
confirmCopy: 'យល់ព្រម'
|
},
|
||||||
}
|
icon: 'អាយខន',
|
||||||
}
|
map: 'ផែនទី',
|
||||||
},
|
print: 'បោះពុម្ភ',
|
||||||
page: {
|
swiper: 'Swiper',
|
||||||
login: {
|
video: 'វីដេអូ'
|
||||||
common: {
|
|
||||||
userNamePlaceholder: 'ឈ្មោះអ្នកប្រើប្រាស់',
|
|
||||||
phonePlaceholder: 'លេខទូរស័ព្ទ',
|
|
||||||
codePlaceholder: 'លេខកូដ',
|
|
||||||
passwordPlaceholder: 'លេខសម្ងាត់',
|
|
||||||
confirmPasswordPlaceholder: 'បញ្ជាក់លេខសម្ងាត់',
|
|
||||||
codeLogin: 'ចូលតាមលេខកូដ',
|
|
||||||
confirm: 'យល់ព្រម',
|
|
||||||
back: 'ត្រឡប់ក្រោយ',
|
|
||||||
validateSuccess: 'បញ្ជាក់ជោគជ័យ',
|
|
||||||
loginSuccess: 'ចូលជោគជ័យ',
|
|
||||||
welcomeBack: 'សូមស្វាគមន៍ម្តងទៀត, {userName}!'
|
|
||||||
},
|
},
|
||||||
pwdLogin: {
|
'auth-demo': {
|
||||||
title: 'ចូលគណនី',
|
_value: 'ឌីមូ Auth',
|
||||||
rememberMe: 'ចងចាំខ្ញុំ',
|
permission: 'បិទ/បើកការអនុញ្ញាត',
|
||||||
forgetPassword: 'ភ្លេចលេខសម្ងាត់',
|
super: 'Super Auth'
|
||||||
register: 'ចុះឈ្មោះ',
|
},
|
||||||
otherAccountLogin: 'ចូលតាមគណនីផ្សេងទៀត',
|
function: {
|
||||||
otherLoginMode: 'របៀបចូលគណនីផ្សេងទៀត',
|
_value: 'មុខងារ',
|
||||||
superAdmin: 'អ្នកគ្រប់គ្រងសុវត្ថិភាព',
|
tab: 'ថេបប្រព័ន្ធ'
|
||||||
admin: 'អ្នកគ្រប់គ្រង',
|
},
|
||||||
|
exception: {
|
||||||
|
_value: 'ករណីពិេសស',
|
||||||
|
403: '403',
|
||||||
|
404: '404',
|
||||||
|
500: '500'
|
||||||
|
},
|
||||||
|
'multi-menu': {
|
||||||
|
_value: 'ម៉ឺនុយពហុដឺក្រេ',
|
||||||
|
first: {
|
||||||
|
_value: 'ដឺក្រេទី១',
|
||||||
|
second: 'ដែក្រេទី២',
|
||||||
|
'second-new': {
|
||||||
|
_value: 'ដឺក្រេទី២មានអនុក្រោម',
|
||||||
|
third: 'ដឺក្រេទី៣'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
management: {
|
||||||
|
_value: 'ការគ្រប់គ្រងប្រព័ន្ធ',
|
||||||
|
auth: 'Auth',
|
||||||
|
role: 'សិទ្ធី',
|
||||||
|
route: 'ផ្លូវប្រព័ន្ធ',
|
||||||
user: 'អ្នកប្រើប្រាស់'
|
user: 'អ្នកប្រើប្រាស់'
|
||||||
},
|
},
|
||||||
codeLogin: {
|
about: 'អំពីប្រព័ន្ធ'
|
||||||
title: 'ចូលតាមលេខកូដ',
|
|
||||||
getCode: 'ទទួលលេខកូដ',
|
|
||||||
imageCodePlaceholder: 'លេខកូដរូបភាព'
|
|
||||||
},
|
|
||||||
register: {
|
|
||||||
title: 'ចុះឈ្មោះ',
|
|
||||||
agreement: 'យល់ព្រមនឹង',
|
|
||||||
protocol: 'សម្រាប់ការប្រើប្រាស់',
|
|
||||||
policy: 'គោលការណ៍ផ្សេងៗ'
|
|
||||||
},
|
|
||||||
resetPwd: {
|
|
||||||
title: 'កំណត់លេខសម្ងាត់ថ្មី'
|
|
||||||
},
|
|
||||||
bindWeChat: {
|
|
||||||
title: 'ភ្ជាប់គណនីរបស់អ្នកជាមួយគណនីរបស់អ្នក'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,219 +0,0 @@
|
|||||||
const locale: I18nType.Schema = {
|
|
||||||
system: {
|
|
||||||
title: 'Soybean管理系统'
|
|
||||||
},
|
|
||||||
common: {
|
|
||||||
add: '添加',
|
|
||||||
addSuccess: '添加成功',
|
|
||||||
edit: '修改',
|
|
||||||
editSuccess: '修改成功',
|
|
||||||
delete: '删除',
|
|
||||||
deleteSuccess: '删除成功',
|
|
||||||
batchDelete: '批量删除',
|
|
||||||
confirm: '确认',
|
|
||||||
cancel: '取消',
|
|
||||||
pleaseCheckValue: '请检查输入的值是否合法',
|
|
||||||
action: '操作'
|
|
||||||
},
|
|
||||||
routes: {
|
|
||||||
dashboard: {
|
|
||||||
_value: '仪表盘',
|
|
||||||
analysis: '分析页',
|
|
||||||
workbench: '工作台'
|
|
||||||
},
|
|
||||||
document: {
|
|
||||||
_value: '文档',
|
|
||||||
vue: 'Vue文档',
|
|
||||||
vite: 'Vite文档',
|
|
||||||
naive: 'NaiveUI文档',
|
|
||||||
project: '项目文档',
|
|
||||||
'project-link': '项目文档(外链)'
|
|
||||||
},
|
|
||||||
component: {
|
|
||||||
_value: '组件示例',
|
|
||||||
button: '按钮',
|
|
||||||
card: '卡片',
|
|
||||||
table: '表格'
|
|
||||||
},
|
|
||||||
plugin: {
|
|
||||||
_value: '插件示例',
|
|
||||||
charts: {
|
|
||||||
_value: '图表',
|
|
||||||
echarts: 'ECharts',
|
|
||||||
antv: 'AntV'
|
|
||||||
},
|
|
||||||
copy: '剪贴板',
|
|
||||||
editor: {
|
|
||||||
_value: '编辑器',
|
|
||||||
quill: '富文本',
|
|
||||||
markdown: 'Markdown'
|
|
||||||
},
|
|
||||||
icon: '图标',
|
|
||||||
map: '地图',
|
|
||||||
print: '打印',
|
|
||||||
swiper: 'Swiper',
|
|
||||||
video: '视频'
|
|
||||||
},
|
|
||||||
'auth-demo': {
|
|
||||||
_value: '权限示例',
|
|
||||||
permission: '切换权限',
|
|
||||||
super: '超级管理员可见'
|
|
||||||
},
|
|
||||||
function: {
|
|
||||||
_value: '功能',
|
|
||||||
tab: 'Tab页签'
|
|
||||||
},
|
|
||||||
exception: {
|
|
||||||
_value: '异常页',
|
|
||||||
403: '403',
|
|
||||||
404: '404',
|
|
||||||
500: '500'
|
|
||||||
},
|
|
||||||
'multi-menu': {
|
|
||||||
_value: '多级菜单',
|
|
||||||
first: {
|
|
||||||
_value: '一级菜单',
|
|
||||||
second: '二级菜单',
|
|
||||||
'second-new': {
|
|
||||||
_value: '二级菜单(有子菜单)',
|
|
||||||
third: '三级菜单'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
management: {
|
|
||||||
_value: '系统管理',
|
|
||||||
auth: '权限管理',
|
|
||||||
role: '角色管理',
|
|
||||||
route: '路由管理',
|
|
||||||
user: '用户管理'
|
|
||||||
},
|
|
||||||
about: '关于'
|
|
||||||
},
|
|
||||||
layout: {
|
|
||||||
settingDrawer: {
|
|
||||||
title: '主题配置',
|
|
||||||
themeModeTitle: '主题模式',
|
|
||||||
darkMode: '深色主题',
|
|
||||||
layoutModelTitle: '布局模式',
|
|
||||||
systemThemeTitle: '系统主题',
|
|
||||||
pageFunctionsTitle: '界面功能',
|
|
||||||
pageViewTitle: '界面显示',
|
|
||||||
followSystemTheme: '跟随系统',
|
|
||||||
isCustomizeDarkModeTransition: '自定义暗黑主题动画过渡',
|
|
||||||
scrollMode: '滚动模式',
|
|
||||||
scrollModeList: {
|
|
||||||
wrapper: '外层滚动',
|
|
||||||
content: '主体滚动'
|
|
||||||
},
|
|
||||||
fixedHeaderAndTab: '固定头部和多页签',
|
|
||||||
header: {
|
|
||||||
inverted: '头部深色',
|
|
||||||
height: '头部高度',
|
|
||||||
crumb: {
|
|
||||||
visible: '面包屑',
|
|
||||||
icon: '面包屑图标'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
tab: {
|
|
||||||
visible: '多页签',
|
|
||||||
height: '多页签高度',
|
|
||||||
modeList: {
|
|
||||||
mode: '多页签风格',
|
|
||||||
chrome: '谷歌风格',
|
|
||||||
button: '按钮风格'
|
|
||||||
},
|
|
||||||
isCache: '多页签缓存'
|
|
||||||
},
|
|
||||||
sider: {
|
|
||||||
inverted: '侧边栏深色',
|
|
||||||
width: '侧边栏展开宽度',
|
|
||||||
mixWidth: '左侧混合侧边栏展开宽度'
|
|
||||||
},
|
|
||||||
menu: {
|
|
||||||
horizontalPosition: '顶部菜单位置',
|
|
||||||
horizontalPositionList: {
|
|
||||||
flexStart: '居左',
|
|
||||||
center: '居中',
|
|
||||||
flexEnd: '居右'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
footer: {
|
|
||||||
inverted: '底部深色',
|
|
||||||
visible: '显示底部',
|
|
||||||
fixed: '固定底部',
|
|
||||||
right: '底部居右'
|
|
||||||
},
|
|
||||||
page: {
|
|
||||||
animate: '页面切换动画',
|
|
||||||
animateMode: '页面切换动画类型',
|
|
||||||
animateModeList: {
|
|
||||||
zoomFade: '渐变',
|
|
||||||
zoomOut: '闪现',
|
|
||||||
fadeSlide: '滑动',
|
|
||||||
fade: '消退',
|
|
||||||
fadeBottom: '底部消退',
|
|
||||||
fadeScale: '缩放消退'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
systemTheme: {
|
|
||||||
moreColors: '更多颜色'
|
|
||||||
},
|
|
||||||
themeConfiguration: {
|
|
||||||
title: '主题配置',
|
|
||||||
copy: '拷贝当前配置',
|
|
||||||
reset: '重置当前配置',
|
|
||||||
resetSuccess: '已重置配置,请重新拷贝!',
|
|
||||||
operateSuccess: '操作成功',
|
|
||||||
copySuccess: '复制成功,请替换 src/settings/theme.json的内容!',
|
|
||||||
confirmCopy: '确认'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
page: {
|
|
||||||
login: {
|
|
||||||
common: {
|
|
||||||
userNamePlaceholder: '请输入用户名',
|
|
||||||
phonePlaceholder: '请输入手机号',
|
|
||||||
codePlaceholder: '请输入验证码',
|
|
||||||
passwordPlaceholder: '请输入密码',
|
|
||||||
confirmPasswordPlaceholder: '请再次输入密码',
|
|
||||||
codeLogin: '验证码登录',
|
|
||||||
confirm: '确定',
|
|
||||||
back: '返回',
|
|
||||||
validateSuccess: '验证成功',
|
|
||||||
loginSuccess: '登录成功',
|
|
||||||
welcomeBack: '欢迎回来,{userName}!'
|
|
||||||
},
|
|
||||||
pwdLogin: {
|
|
||||||
title: '密码登录',
|
|
||||||
rememberMe: '记住我',
|
|
||||||
forgetPassword: '忘记密码?',
|
|
||||||
register: '注册账号',
|
|
||||||
otherAccountLogin: '其他账号登录',
|
|
||||||
otherLoginMode: '其他登录方式',
|
|
||||||
superAdmin: '超级管理员',
|
|
||||||
admin: '管理员',
|
|
||||||
user: '普通用户'
|
|
||||||
},
|
|
||||||
codeLogin: {
|
|
||||||
title: '验证码登录',
|
|
||||||
getCode: '获取验证码',
|
|
||||||
imageCodePlaceholder: '请输入图片验证码'
|
|
||||||
},
|
|
||||||
register: {
|
|
||||||
title: '注册账号',
|
|
||||||
agreement: '我已经仔细阅读并接受',
|
|
||||||
protocol: '《用户协议》',
|
|
||||||
policy: '《隐私权政策》'
|
|
||||||
},
|
|
||||||
resetPwd: {
|
|
||||||
title: '重置密码'
|
|
||||||
},
|
|
||||||
bindWeChat: {
|
|
||||||
title: '绑定微信'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export default locale;
|
|
||||||
85
src/locales/lang/zh-cn.ts
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
import type { LocaleMessages } from 'vue-i18n';
|
||||||
|
|
||||||
|
const locale: LocaleMessages<I18nType.Schema> = {
|
||||||
|
message: {
|
||||||
|
system: {
|
||||||
|
title: 'Soybean管理系统'
|
||||||
|
},
|
||||||
|
routes: {
|
||||||
|
dashboard: {
|
||||||
|
_value: '仪表盘',
|
||||||
|
analysis: '分析页',
|
||||||
|
workbench: '工作台'
|
||||||
|
},
|
||||||
|
document: {
|
||||||
|
_value: '文档',
|
||||||
|
vue: 'Vue文档',
|
||||||
|
vite: 'Vite文档',
|
||||||
|
naive: 'NaiveUI文档',
|
||||||
|
project: '项目文档',
|
||||||
|
'project-link': '项目文档(外链)'
|
||||||
|
},
|
||||||
|
component: {
|
||||||
|
_value: '组件示例',
|
||||||
|
button: '按钮',
|
||||||
|
card: '卡片',
|
||||||
|
table: '表格'
|
||||||
|
},
|
||||||
|
plugin: {
|
||||||
|
_value: '插件示例',
|
||||||
|
charts: {
|
||||||
|
_value: '图表',
|
||||||
|
echarts: 'ECharts',
|
||||||
|
antv: 'AntV'
|
||||||
|
},
|
||||||
|
copy: '剪贴板',
|
||||||
|
editor: {
|
||||||
|
_value: '编辑器',
|
||||||
|
quill: '富文本',
|
||||||
|
markdown: 'Markdown'
|
||||||
|
},
|
||||||
|
icon: '图标',
|
||||||
|
map: '地图',
|
||||||
|
print: '打印',
|
||||||
|
swiper: 'Swiper',
|
||||||
|
video: '视频'
|
||||||
|
},
|
||||||
|
'auth-demo': {
|
||||||
|
_value: '权限示例',
|
||||||
|
permission: '切换权限',
|
||||||
|
super: '超级管理员可见'
|
||||||
|
},
|
||||||
|
function: {
|
||||||
|
_value: '功能',
|
||||||
|
tab: 'Tab页签'
|
||||||
|
},
|
||||||
|
exception: {
|
||||||
|
_value: '异常页',
|
||||||
|
403: '403',
|
||||||
|
404: '404',
|
||||||
|
500: '500'
|
||||||
|
},
|
||||||
|
'multi-menu': {
|
||||||
|
_value: '多级菜单',
|
||||||
|
first: {
|
||||||
|
_value: '一级菜单',
|
||||||
|
second: '二级菜单',
|
||||||
|
'second-new': {
|
||||||
|
_value: '二级菜单(有子菜单)',
|
||||||
|
third: '三级菜单'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
management: {
|
||||||
|
_value: '系统管理',
|
||||||
|
auth: '权限管理',
|
||||||
|
role: '角色管理',
|
||||||
|
route: '路由管理',
|
||||||
|
user: '用户管理'
|
||||||
|
},
|
||||||
|
about: '关于'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export default locale;
|
||||||