mirror of
https://github.com/fantastic-admin/basic.git
synced 2026-10-07 02:54:05 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
623da2b411 | ||
|
|
e24a722545 | ||
|
|
f8794e2a5e | ||
|
|
d7808da1ca | ||
|
|
a1d326810e | ||
|
|
3be15b2446 | ||
|
|
97757e33c3 | ||
|
|
4378226ae6 | ||
|
|
5956008dbf | ||
|
|
cf16db603a | ||
|
|
e68d67d606 | ||
|
|
1bce49cce6 | ||
|
|
52c1bb4b58 | ||
|
|
1ea3345556 | ||
|
|
35d31a078e | ||
|
|
2b18c3f138 | ||
|
|
10c8401a88 | ||
|
|
b0ac06172e | ||
|
|
2a902473a8 | ||
|
|
f02298bf1b | ||
|
|
5fcd3fe5ed | ||
|
|
ee47369579 | ||
|
|
ce7477b10d | ||
|
|
609e77c159 | ||
|
|
db4aa406eb | ||
|
|
5bfb3c8fb0 | ||
|
|
5e59d12d73 | ||
|
|
097e700464 | ||
|
|
501e82dd44 | ||
|
|
dcad2c6ecf | ||
|
|
2b08e82c5e | ||
|
|
b533c5a040 | ||
|
|
33db1040be | ||
|
|
ebf61b0738 | ||
|
|
7daea6d605 | ||
|
|
1473a6c7e3 | ||
|
|
87f5b60211 | ||
|
|
6d58f1c2f3 | ||
|
|
abac8e0152 | ||
|
|
643d458ac2 | ||
|
|
c5217aabc1 | ||
|
|
b3b8947b62 | ||
|
|
ea929ac427 | ||
|
|
2100bbe7b0 | ||
|
|
39ba382fec | ||
|
|
e87c46ad0a | ||
|
|
a6e66c3f47 | ||
|
|
2080d0be5f | ||
|
|
62f489baf4 | ||
|
|
6f31b04ae8 | ||
|
|
cfb4f23f18 | ||
|
|
eff07c2833 | ||
|
|
7f98ab21b3 | ||
|
|
fcb7cb541d | ||
|
|
3ab394e772 | ||
|
|
75411af22f | ||
|
|
2909caaf0e | ||
|
|
83b87a5f3f | ||
|
|
cfd23d54da | ||
|
|
40b7f93d97 | ||
|
|
7f455c5494 | ||
|
|
382ece82f7 | ||
|
|
3bd695627d | ||
|
|
ceb6a1f5ba | ||
|
|
88900d6ed3 | ||
|
|
d40c42a810 | ||
|
|
91c7350c34 | ||
|
|
924a42e270 | ||
|
|
5fcfcb7770 | ||
|
|
65b2b0fcda | ||
|
|
c34c2d1052 | ||
|
|
159832443a | ||
|
|
0ae0f6f352 | ||
|
|
0f19e26650 | ||
|
|
efd8536469 | ||
|
|
3ed947c8da | ||
|
|
ffd040a0ef | ||
|
|
026dfdbaef | ||
|
|
4c22d91170 | ||
|
|
6327abb078 | ||
|
|
484f35d27a | ||
|
|
a5b3c5660d | ||
|
|
76c66f9bc9 | ||
|
|
b3cfb95f59 | ||
|
|
dac7f4b0c1 | ||
|
|
d83b21715b | ||
|
|
a57c62765b | ||
|
|
2b38152485 | ||
|
|
57e982ed61 | ||
|
|
2fe0fc95ee | ||
|
|
fab5d0539b | ||
|
|
e79bd1dc50 | ||
|
|
1e155369b2 | ||
|
|
cb230f77bd | ||
|
|
6f59ddf6b8 | ||
|
|
7668bd5063 | ||
|
|
5e3fa9a567 | ||
|
|
571190cd78 | ||
|
|
bd5c921bca | ||
|
|
b236df4e30 | ||
|
|
657bec97f6 | ||
|
|
5d0141011b | ||
|
|
b8e53fb259 | ||
|
|
66c0e4f8c7 | ||
|
|
7457fcc23e | ||
|
|
9a7331f32f | ||
|
|
87819b4b5d | ||
|
|
d00fc26616 | ||
|
|
647edd7207 | ||
|
|
23d36432da | ||
|
|
2fdc4f18ca | ||
|
|
961df08e2b | ||
|
|
1d62ac7558 | ||
|
|
456ef83081 | ||
|
|
90b588028a | ||
|
|
9e444c83f8 | ||
|
|
57fcd2785c | ||
|
|
3c8b4881b4 | ||
|
|
e32d0561c7 | ||
|
|
d303776825 | ||
|
|
3ef0f69bcc | ||
|
|
b00477d5fa | ||
|
|
fe00fa1e6f | ||
|
|
f0679a1d59 | ||
|
|
4c4f811f39 | ||
|
|
03e5e99896 | ||
|
|
fda48176ee | ||
|
|
b639b487db | ||
|
|
dbd93ffb7f | ||
|
|
daf9b1b2e2 | ||
|
|
e023671bac | ||
|
|
e6265a7c64 | ||
|
|
8c629050ba | ||
|
|
c7d2a857f7 | ||
|
|
b19344a1c1 | ||
|
|
b632b4d3a8 | ||
|
|
98d21845ce | ||
|
|
bbeeac41ce | ||
|
|
449495f03d | ||
|
|
14583bbaa5 | ||
|
|
045ab02bb2 | ||
|
|
b883133dc6 | ||
|
|
5269dba56b | ||
|
|
4911affd28 | ||
|
|
cb53f4c84e | ||
|
|
3164e33f1d | ||
|
|
06eee21032 | ||
|
|
79184f4eeb | ||
|
|
8416b61f6b | ||
|
|
a90a19c62e | ||
|
|
ee819445d2 | ||
|
|
679ad4c9ee | ||
|
|
805c13ba7a | ||
|
|
c61675b311 | ||
|
|
a105df66b1 | ||
|
|
107e820776 | ||
|
|
04fa39c295 | ||
|
|
1685f8b7be | ||
|
|
73074101e1 | ||
|
|
e802354cab | ||
|
|
26274fdb8e | ||
|
|
f26b4cc50e | ||
|
|
fd1d57cebe | ||
|
|
4ac539d082 | ||
|
|
fa81882f25 | ||
|
|
606ce62cfd | ||
|
|
7479dfe818 | ||
|
|
a8e964acd4 | ||
|
|
aab429b997 | ||
|
|
64fd2eb59c | ||
|
|
c9d25a0e8d | ||
|
|
fc44d941d0 | ||
|
|
362562112a | ||
|
|
5e5100de11 | ||
|
|
b60236035a | ||
|
|
a4b33eea73 | ||
|
|
46138b8da9 | ||
|
|
b4e0e9740d | ||
|
|
af1324c2cf | ||
|
|
a8b41c7237 | ||
|
|
5704453835 | ||
|
|
f9c1c2df42 | ||
|
|
9812058805 | ||
|
|
a55f3016ce | ||
|
|
52b25d1eae | ||
|
|
42da9626b7 | ||
|
|
06d6e18dac | ||
|
|
55dcff3b22 | ||
|
|
8d5c14ea16 | ||
|
|
36c9a73375 | ||
|
|
f6477e03db | ||
|
|
0dfdb0ff32 | ||
|
|
2f1dc07eff | ||
|
|
af49dc8113 | ||
|
|
67e16872e4 | ||
|
|
1dd1677969 | ||
|
|
6c1fca69dc | ||
|
|
f3993b8563 | ||
|
|
d39f5c3af6 | ||
|
|
86df38a142 | ||
|
|
548eac59f2 | ||
|
|
8dee916774 | ||
|
|
59ffda20e7 | ||
|
|
d908f3ce26 | ||
|
|
cc9226f19e | ||
|
|
30a303195f | ||
|
|
75d815d315 | ||
|
|
2b8a198aaf | ||
|
|
e015f29e9e | ||
|
|
795d428ed8 |
Executable
+10
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"EditorConfig.EditorConfig",
|
||||
"mikestead.dotenv",
|
||||
"dbaeumer.vscode-eslint",
|
||||
"stylelint.vscode-stylelint",
|
||||
"Vue.volar",
|
||||
"antfu.unocss"
|
||||
]
|
||||
}
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"eslint.useFlatConfig": true,
|
||||
"prettier.enable": false,
|
||||
"editor.formatOnSave": false,
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.fixAll.eslint": "explicit",
|
||||
"source.fixAll.stylelint": "explicit",
|
||||
"source.organizeImports": "never"
|
||||
},
|
||||
"stylelint.validate": [
|
||||
"css",
|
||||
"postcss",
|
||||
"scss",
|
||||
"vue"
|
||||
],
|
||||
"eslint.validate": [
|
||||
"javascript",
|
||||
"javascriptreact",
|
||||
"typescript",
|
||||
"typescriptreact",
|
||||
"vue",
|
||||
"html",
|
||||
"markdown",
|
||||
"json",
|
||||
"jsonc",
|
||||
"yaml"
|
||||
],
|
||||
"typescript.tsdk": "node_modules/typescript/lib"
|
||||
}
|
||||
@@ -6,6 +6,10 @@ VITE_APP_TITLE = Fantastic-admin 基础版
|
||||
VITE_APP_API_BASEURL = /
|
||||
# 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空
|
||||
VITE_APP_DEBUG_TOOL =
|
||||
# 是否禁用开发者工具,可防止被调试
|
||||
VITE_APP_DISABLE_DEVTOOL = false
|
||||
|
||||
# 是否开启代理
|
||||
VITE_OPEN_PROXY = false
|
||||
# 是否开启开发者工具
|
||||
VITE_OPEN_DEVTOOLS = false
|
||||
|
||||
+5
-1
@@ -1,11 +1,13 @@
|
||||
# 应用配置面板
|
||||
VITE_APP_SETTING = false
|
||||
# 页面标题
|
||||
VITE_APP_TITLE = 页面标题
|
||||
VITE_APP_TITLE = Fantastic-admin 基础版
|
||||
# 接口请求地址,会设置到 axios 的 baseURL 参数上
|
||||
VITE_APP_API_BASEURL = /
|
||||
# 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空
|
||||
VITE_APP_DEBUG_TOOL =
|
||||
# 是否禁用开发者工具,可防止被调试
|
||||
VITE_APP_DISABLE_DEVTOOL = false
|
||||
|
||||
# 是否在打包时启用 Mock
|
||||
VITE_BUILD_MOCK = false
|
||||
@@ -13,3 +15,5 @@ VITE_BUILD_MOCK = false
|
||||
VITE_BUILD_SOURCEMAP = false
|
||||
# 是否在打包时开启压缩,支持 gzip 和 brotli
|
||||
VITE_BUILD_COMPRESS = gzip,brotli
|
||||
# 是否在打包后生成存档,支持 zip 和 tar
|
||||
VITE_BUILD_ARCHIVE =
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
# 应用配置面板
|
||||
VITE_APP_SETTING = false
|
||||
# 页面标题
|
||||
VITE_APP_TITLE = 页面标题(test)
|
||||
VITE_APP_TITLE = Fantastic-admin 基础版
|
||||
# 接口请求地址,会设置到 axios 的 baseURL 参数上
|
||||
VITE_APP_API_BASEURL = /
|
||||
# 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空
|
||||
VITE_APP_DEBUG_TOOL =
|
||||
# 是否禁用开发者工具,可防止被调试
|
||||
VITE_APP_DISABLE_DEVTOOL = false
|
||||
|
||||
# 是否在打包时启用 Mock
|
||||
VITE_BUILD_MOCK = true
|
||||
@@ -13,3 +15,5 @@ VITE_BUILD_MOCK = true
|
||||
VITE_BUILD_SOURCEMAP = true
|
||||
# 是否在打包时开启压缩,支持 gzip 和 brotli
|
||||
VITE_BUILD_COMPRESS =
|
||||
# 是否在打包后生成存档,支持 zip 和 tar
|
||||
VITE_BUILD_ARCHIVE =
|
||||
|
||||
@@ -9,13 +9,13 @@ jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 16.x
|
||||
node-version: 22
|
||||
|
||||
- run: npx changelogithub # or changelogithub@0.12 if ensure the stable result
|
||||
env:
|
||||
@@ -25,7 +25,7 @@ jobs:
|
||||
needs: release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
@@ -57,7 +57,7 @@ jobs:
|
||||
needs: release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: example
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
name: repo-sync
|
||||
|
||||
on:
|
||||
# 每天自动同步
|
||||
# 每天 00:05 自动同步
|
||||
schedule:
|
||||
- cron: '0 0 * * *'
|
||||
- cron: '5 0 * * *'
|
||||
# 手动触发部署
|
||||
workflow_dispatch:
|
||||
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"*.{ts,tsx,vue}": "eslint . --cache --fix",
|
||||
"*.{css,scss,vue}": "stylelint src/**/*.{css,scss,vue} --cache --fix --allow-empty-input"
|
||||
"*.{ts,tsx,vue}": "eslint --cache --fix",
|
||||
"*.{css,scss,vue}": "stylelint --cache --fix"
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
22
|
||||
@@ -1,2 +1,4 @@
|
||||
shamefully-hoist=true
|
||||
strict-peer-dependencies=false
|
||||
engine-strict=true
|
||||
verify-deps-before-run=prompt
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
dist
|
||||
node_modules
|
||||
src/assets/sprites
|
||||
public/tinymce
|
||||
@@ -1,45 +0,0 @@
|
||||
{
|
||||
"extends": [
|
||||
"stylelint-stylistic/config",
|
||||
"stylelint-config-standard-scss",
|
||||
"stylelint-config-standard-vue/scss"
|
||||
],
|
||||
"plugins": [
|
||||
"stylelint-scss"
|
||||
],
|
||||
"rules": {
|
||||
"stylistic/max-line-length": null,
|
||||
"stylistic/block-closing-brace-newline-after": [
|
||||
"always",
|
||||
{
|
||||
"ignoreAtRules": ["if", "else"]
|
||||
}
|
||||
],
|
||||
"at-rule-no-unknown": null,
|
||||
"no-descending-specificity": null,
|
||||
"property-no-unknown": null,
|
||||
"font-family-no-missing-generic-family-keyword": null,
|
||||
"selector-class-pattern": null,
|
||||
"function-no-unknown": [
|
||||
true,
|
||||
{
|
||||
"ignoreFunctions": [
|
||||
"v-bind",
|
||||
"map-get",
|
||||
"lighten",
|
||||
"darken"
|
||||
]
|
||||
}
|
||||
],
|
||||
"selector-pseudo-element-no-unknown": [
|
||||
true,
|
||||
{
|
||||
"ignorePseudoElements": [
|
||||
"/^view-transition/"
|
||||
]
|
||||
}
|
||||
],
|
||||
"scss/double-slash-comment-empty-line-before": null,
|
||||
"scss/no-global-function-names": null
|
||||
}
|
||||
}
|
||||
Vendored
-1
@@ -5,7 +5,6 @@
|
||||
"dbaeumer.vscode-eslint",
|
||||
"stylelint.vscode-stylelint",
|
||||
"Vue.volar",
|
||||
"Vue.vscode-typescript-vue-plugin",
|
||||
"antfu.unocss"
|
||||
]
|
||||
}
|
||||
|
||||
Vendored
+4
-2
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"eslint.experimental.useFlatConfig": true,
|
||||
"eslint.useFlatConfig": true,
|
||||
"prettier.enable": false,
|
||||
"editor.formatOnSave": false,
|
||||
"editor.codeActionsOnSave": {
|
||||
@@ -9,6 +9,7 @@
|
||||
},
|
||||
"stylelint.validate": [
|
||||
"css",
|
||||
"postcss",
|
||||
"scss",
|
||||
"vue"
|
||||
],
|
||||
@@ -23,5 +24,6 @@
|
||||
"json",
|
||||
"jsonc",
|
||||
"yaml"
|
||||
]
|
||||
],
|
||||
"typescript.tsdk": "node_modules/typescript/lib"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<p align="center">
|
||||
<img src="https://fantastic-admin.gitee.io/logo.png" width="200" height="200" />
|
||||
<img src="https://fantastic-admin.hurui.me/logo.svg" width="200" height="200" />
|
||||
</p>
|
||||
|
||||
<h1 align="center">Fantastic-admin</h1>
|
||||
@@ -7,16 +7,9 @@
|
||||
<p align="center">一款<b>开箱即用</b>的 Vue3 中后台管理系统框架</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://fantastic-admin.gitee.io" target="_blank">官网</a>
|
||||
<sup><a href="https://fantastic-admin.github.io" target="_blank">备用地址</a></sup>
|
||||
<a href="https://fantastic-admin.hurui.me" target="_blank">官网</a>
|
||||
<span> | </span>
|
||||
<a href="https://fantastic-admin.gitee.io/support.html" target="_blank">技术支持</a>
|
||||
<span> | </span>
|
||||
演示
|
||||
<sup><a href="https://fantastic-admin.gitee.io/basic-example" target="_blank">基础版</a> <a href="https://fantastic-admin.gitee.io/pro-example" target="_blank">专业版</a></sup>
|
||||
<span> | </span>
|
||||
购买
|
||||
<sup><a href="https://fantastic-admin.gitee.io/buy.html" target="_blank">专业版</a></sup>
|
||||
<a href="https://fantastic-admin.pages.dev" target="_blank">备用地址</a>
|
||||
<p>
|
||||
|
||||
<p align="center">
|
||||
@@ -53,14 +46,14 @@
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><img src="https://fantastic-admin.gitee.io/preview1.png" /></td>
|
||||
<td><img src="https://fantastic-admin.gitee.io/preview2.png" /></td>
|
||||
<td><img src="https://fantastic-admin.gitee.io/preview3.png" /></td>
|
||||
<td><img src="https://fantastic-admin.hurui.me/preview1.png" /></td>
|
||||
<td><img src="https://fantastic-admin.hurui.me/preview2.png" /></td>
|
||||
<td><img src="https://fantastic-admin.hurui.me/preview3.png" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://fantastic-admin.gitee.io/preview4.png" /></td>
|
||||
<td><img src="https://fantastic-admin.gitee.io/preview5.png" /></td>
|
||||
<td><img src="https://fantastic-admin.gitee.io/preview6.png" /></td>
|
||||
<td><img src="https://fantastic-admin.hurui.me/preview4.png" /></td>
|
||||
<td><img src="https://fantastic-admin.hurui.me/preview5.png" /></td>
|
||||
<td><img src="https://fantastic-admin.hurui.me/preview6.png" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -83,12 +76,12 @@
|
||||
<table>
|
||||
<tr>
|
||||
<th colspan="3" align="center">
|
||||
<a href="https://hooray.gitee.io/fantastic-startkit/" target="_blank">Fantastic-startkit</a>
|
||||
<a href="https://hooray.github.io/fantastic-startkit/" target="_blank">Fantastic-startkit</a>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="3" align="center">
|
||||
一款开箱即用的 Vue3 项目启动套件
|
||||
一款简单好用的 Vue3 项目启动套件
|
||||
</th>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -96,7 +89,7 @@
|
||||
<table>
|
||||
<tr>
|
||||
<th colspan="3" align="center">
|
||||
<a href="https://one-step-admin.gitee.io" target="_blank">One-step-admin</a>
|
||||
<a href="https://one-step-admin.hurui.me" target="_blank">One-step-admin</a>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -105,13 +98,32 @@
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://one-step-admin.gitee.io/preview1.png" /></td>
|
||||
<td><img src="https://one-step-admin.gitee.io/preview2.png" /></td>
|
||||
<td><img src="https://one-step-admin.gitee.io/preview3.png" /></td>
|
||||
<td><img src="https://one-step-admin.hurui.me/preview1.png" /></td>
|
||||
<td><img src="https://one-step-admin.hurui.me/preview2.png" /></td>
|
||||
<td><img src="https://one-step-admin.hurui.me/preview3.png" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://one-step-admin.gitee.io/preview4.png" /></td>
|
||||
<td><img src="https://one-step-admin.gitee.io/preview5.png" /></td>
|
||||
<td><img src="https://one-step-admin.gitee.io/preview6.png" /></td>
|
||||
<td><img src="https://one-step-admin.hurui.me/preview4.png" /></td>
|
||||
<td><img src="https://one-step-admin.hurui.me/preview5.png" /></td>
|
||||
<td><img src="https://one-step-admin.hurui.me/preview6.png" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th colspan="4" align="center">
|
||||
<a href="https://fantastic-mobile.hurui.me" target="_blank">Fantastic-mobile</a>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="4" align="center">
|
||||
一款自成一派的移动端 H5 框架
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://fantastic-mobile.hurui.me/preview1.png" /></td>
|
||||
<td><img src="https://fantastic-mobile.hurui.me/preview2.png" /></td>
|
||||
<td><img src="https://fantastic-mobile.hurui.me/preview3.png" /></td>
|
||||
<td><img src="https://fantastic-mobile.hurui.me/preview4.png" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"$schema": "https://shadcn-vue.com/schema.json",
|
||||
"style": "default",
|
||||
"typescript": true,
|
||||
"tailwind": {
|
||||
"config": "tailwind.config.js",
|
||||
"css": "src/assets/index.css",
|
||||
"baseColor": "neutral",
|
||||
"cssVariables": true
|
||||
},
|
||||
"aliases": {
|
||||
"components": "@/ui/shadcn",
|
||||
"utils": "@/utils",
|
||||
"lib": "@/utils"
|
||||
}
|
||||
}
|
||||
+5
-1
@@ -6,13 +6,17 @@ export default antfu(
|
||||
ignores: [
|
||||
'public',
|
||||
'dist*',
|
||||
'src/ui/shadcn/ui',
|
||||
],
|
||||
},
|
||||
{
|
||||
rules: {
|
||||
'eslint-comments/no-unlimited-disable': 'off',
|
||||
'curly': ['error', 'all'],
|
||||
'antfu/consistent-list-newline': 'off',
|
||||
'ts/no-unused-expressions': ['error', {
|
||||
allowShortCircuit: true,
|
||||
allowTernary: true,
|
||||
}],
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
+2
-12
@@ -2,8 +2,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
<link rel="stylesheet" href="/loading.css" />
|
||||
<link rel="icon" href="/favicon.svg" />
|
||||
<link rel="stylesheet" href="/browser_upgrade/index.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta http-equiv="Expires" content="0">
|
||||
@@ -14,21 +13,12 @@
|
||||
</head>
|
||||
<body>
|
||||
<div id="app">
|
||||
<div class="fantastic-admin-home">
|
||||
<div class="loading">
|
||||
<div class="square"></div>
|
||||
<div class="square"></div>
|
||||
<div class="square"></div>
|
||||
<div class="square"></div>
|
||||
</div>
|
||||
<div class="text">载入中</div>
|
||||
</div>
|
||||
<div id="browser-upgrade">
|
||||
<div class="title">为了您的体验,推荐使用以下浏览器</div>
|
||||
<div class="browsers">
|
||||
<a href="https://www.microsoft.com/edge" target="_blank" class="browser">
|
||||
<img class="browser-icon" src="/browser_upgrade/edge.png" />
|
||||
<div class="browser-name">Mircosoft Edge</div>
|
||||
<div class="browser-name">Microsoft Edge</div>
|
||||
</a>
|
||||
<a href="https://www.google.cn/chrome/" target="_blank" class="browser">
|
||||
<img class="browser-icon" src="/browser_upgrade/chrome.png" />
|
||||
|
||||
+204
@@ -0,0 +1,204 @@
|
||||
<style>
|
||||
@keyframes rainbow {
|
||||
0% { --rainbow-color: #00a98e; }
|
||||
1.25% { --rainbow-color: #00a996; }
|
||||
2.5% { --rainbow-color: #00a99f; }
|
||||
3.75% { --rainbow-color: #00a9a7; }
|
||||
5% { --rainbow-color: #00a9b0; }
|
||||
6.25% { --rainbow-color: #00a9b8; }
|
||||
7.5% { --rainbow-color: #00a9c0; }
|
||||
8.75% { --rainbow-color: #00a8c7; }
|
||||
10% { --rainbow-color: #00a8cf; }
|
||||
11.25% { --rainbow-color: #00a7d5; }
|
||||
12.5% { --rainbow-color: #00a6dc; }
|
||||
13.75% { --rainbow-color: #00a6e2; }
|
||||
15% { --rainbow-color: #00a4e7; }
|
||||
16.25% { --rainbow-color: #00a3ec; }
|
||||
17.5% { --rainbow-color: #00a2f1; }
|
||||
18.75% { --rainbow-color: #00a0f4; }
|
||||
20% { --rainbow-color: #009ff7; }
|
||||
21.25% { --rainbow-color: #009dfa; }
|
||||
22.5% { --rainbow-color: #009bfc; }
|
||||
23.75% { --rainbow-color: #0098fd; }
|
||||
25% { --rainbow-color: #0096fd; }
|
||||
26.25% { --rainbow-color: #0093fd; }
|
||||
27.5% { --rainbow-color: #2e90fc; }
|
||||
28.75% { --rainbow-color: #4d8dfa; }
|
||||
30% { --rainbow-color: #638af8; }
|
||||
31.25% { --rainbow-color: #7587f5; }
|
||||
32.5% { --rainbow-color: #8583f1; }
|
||||
33.75% { --rainbow-color: #9280ed; }
|
||||
35% { --rainbow-color: #9f7ce9; }
|
||||
36.25% { --rainbow-color: #aa78e3; }
|
||||
37.5% { --rainbow-color: #b574dd; }
|
||||
38.75% { --rainbow-color: #be71d7; }
|
||||
40% { --rainbow-color: #c76dd1; }
|
||||
41.25% { --rainbow-color: #cf69c9; }
|
||||
42.5% { --rainbow-color: #d566c2; }
|
||||
43.75% { --rainbow-color: #dc63ba; }
|
||||
45% { --rainbow-color: #e160b3; }
|
||||
46.25% { --rainbow-color: #e65eab; }
|
||||
47.5% { --rainbow-color: #e95ca2; }
|
||||
48.75% { --rainbow-color: #ed5a9a; }
|
||||
50% { --rainbow-color: #ef5992; }
|
||||
51.25% { --rainbow-color: #f15989; }
|
||||
52.5% { --rainbow-color: #f25981; }
|
||||
53.75% { --rainbow-color: #f25a79; }
|
||||
55% { --rainbow-color: #f25c71; }
|
||||
56.25% { --rainbow-color: #f15e69; }
|
||||
57.5% { --rainbow-color: #ef6061; }
|
||||
58.75% { --rainbow-color: #ed635a; }
|
||||
60% { --rainbow-color: #eb6552; }
|
||||
61.25% { --rainbow-color: #e8694b; }
|
||||
62.5% { --rainbow-color: #e46c44; }
|
||||
63.75% { --rainbow-color: #e06f3d; }
|
||||
65% { --rainbow-color: #db7336; }
|
||||
66.25% { --rainbow-color: #d77630; }
|
||||
67.5% { --rainbow-color: #d17a2a; }
|
||||
68.75% { --rainbow-color: #cc7d24; }
|
||||
70% { --rainbow-color: #c6811e; }
|
||||
71.25% { --rainbow-color: #bf8418; }
|
||||
72.5% { --rainbow-color: #b98713; }
|
||||
73.75% { --rainbow-color: #b28a0f; }
|
||||
75% { --rainbow-color: #ab8d0c; }
|
||||
76.25% { --rainbow-color: #a3900b; }
|
||||
77.5% { --rainbow-color: #9c920d; }
|
||||
78.75% { --rainbow-color: #949510; }
|
||||
80% { --rainbow-color: #8b9715; }
|
||||
81.25% { --rainbow-color: #83991b; }
|
||||
82.5% { --rainbow-color: #7a9b21; }
|
||||
83.75% { --rainbow-color: #719d27; }
|
||||
85% { --rainbow-color: #679e2e; }
|
||||
86.25% { --rainbow-color: #5da035; }
|
||||
87.5% { --rainbow-color: #51a13c; }
|
||||
88.75% { --rainbow-color: #44a244; }
|
||||
90% { --rainbow-color: #34a44b; }
|
||||
91.25% { --rainbow-color: #1ba553; }
|
||||
92.5% { --rainbow-color: #00a65b; }
|
||||
93.75% { --rainbow-color: #00a663; }
|
||||
95% { --rainbow-color: #00a76c; }
|
||||
96.25% { --rainbow-color: #00a874; }
|
||||
97.5% { --rainbow-color: #00a87d; }
|
||||
98.75% { --rainbow-color: #00a985; }
|
||||
100% { --rainbow-color: #00a98e; }
|
||||
}
|
||||
|
||||
:root {
|
||||
--rainbow-color: #00a98e;
|
||||
animation: rainbow 20s linear infinite;
|
||||
}
|
||||
|
||||
.loading-container {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 10000;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
color: var(--rainbow-color);
|
||||
user-select: none;
|
||||
background-color: snow;
|
||||
}
|
||||
|
||||
.loading-container *::before,
|
||||
.loading-container *::after {
|
||||
box-sizing: content-box;
|
||||
}
|
||||
|
||||
.loading-container .loading {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.loading-container .loading .square {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
.loading-container .loading .square::before {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
content: "";
|
||||
border: 3px solid var(--rainbow-color);
|
||||
border-radius: 15%;
|
||||
animation: square-to-dot-animation 2s linear infinite;
|
||||
}
|
||||
|
||||
.loading-container .loading .square:nth-child(1)::before {
|
||||
animation-delay: calc(150ms * 1);
|
||||
}
|
||||
|
||||
.loading-container .loading .square:nth-child(2)::before {
|
||||
animation-delay: calc(150ms * 2);
|
||||
}
|
||||
|
||||
.loading-container .loading .square:nth-child(3)::before {
|
||||
animation-delay: calc(150ms * 3);
|
||||
}
|
||||
|
||||
.loading-container .loading .square:nth-child(4)::before {
|
||||
animation-delay: calc(150ms * 4);
|
||||
}
|
||||
|
||||
@keyframes square-to-dot-animation {
|
||||
15%,
|
||||
25% {
|
||||
width: 0;
|
||||
height: 0;
|
||||
margin: 5px;
|
||||
border-width: 5px;
|
||||
border-radius: 100%;
|
||||
}
|
||||
|
||||
40% {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
margin: initial;
|
||||
border-width: 3px;
|
||||
border-radius: 15%;
|
||||
}
|
||||
}
|
||||
|
||||
.loading-container .name {
|
||||
position: relative;
|
||||
margin-top: 20px;
|
||||
font-size: 24px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.loading-container .tips {
|
||||
position: relative;
|
||||
margin-top: 10px;
|
||||
font-size: 16px;
|
||||
opacity: 0.5;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.loading-container .tips::after {
|
||||
position: absolute;
|
||||
padding-left: 5px;
|
||||
content: "…";
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="loading-container">
|
||||
<div class="loading">
|
||||
<div class="square"></div>
|
||||
<div class="square"></div>
|
||||
<div class="square"></div>
|
||||
<div class="square"></div>
|
||||
</div>
|
||||
<div class="name">%VITE_APP_TITLE%</div>
|
||||
<div class="tips">载入中</div>
|
||||
</div>
|
||||
+89
-67
@@ -1,96 +1,118 @@
|
||||
{
|
||||
"type": "module",
|
||||
"version": "4.3.0",
|
||||
"version": "5.3.0",
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vue-tsc && vite build",
|
||||
"build:test": "vue-tsc && vite build --mode test",
|
||||
"build": "vue-tsc -b && vite build",
|
||||
"build:test": "vue-tsc -b && vite build --mode test",
|
||||
"serve": "http-server ./dist -o",
|
||||
"serve:test": "http-server ./dist-test -o",
|
||||
"svgo": "svgo -f src/assets/icons",
|
||||
"new": "plop",
|
||||
"generate:icons": "esno ./scripts/generate.icons.ts",
|
||||
"lint": "npm-run-all -s lint:tsc lint:eslint lint:stylelint",
|
||||
"lint:tsc": "vue-tsc",
|
||||
"lint:tsc": "vue-tsc -b",
|
||||
"lint:eslint": "eslint . --cache --fix",
|
||||
"lint:stylelint": "stylelint src/**/*.{css,scss,vue} --cache --fix --allow-empty-input",
|
||||
"postinstall": "simple-git-hooks",
|
||||
"lint:stylelint": "stylelint \"src/**/*.{css,scss,vue}\" --cache --fix",
|
||||
"preinstall": "npx only-allow pnpm",
|
||||
"postinstall": "simple-git-hooks",
|
||||
"taze": "taze minor -wIr",
|
||||
"commit": "git cz",
|
||||
"release": "bumpp"
|
||||
},
|
||||
"dependencies": {
|
||||
"@headlessui/vue": "^1.7.16",
|
||||
"@vueuse/core": "^10.7.0",
|
||||
"@vueuse/integrations": "^10.7.0",
|
||||
"axios": "^1.6.2",
|
||||
"dayjs": "^1.11.10",
|
||||
"defu": "^6.1.3",
|
||||
"element-plus": "^2.4.4",
|
||||
"eruda": "^3.0.1",
|
||||
"floating-vue": "2.0.0-beta.24",
|
||||
"hotkeys-js": "^3.13.3",
|
||||
"lodash-es": "^4.17.21",
|
||||
"@vee-validate/zod": "^4.15.0",
|
||||
"@vueuse/components": "^13.1.0",
|
||||
"@vueuse/core": "^13.1.0",
|
||||
"@vueuse/integrations": "^13.1.0",
|
||||
"axios": "^1.9.0",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
"dayjs": "^1.11.13",
|
||||
"defu": "^6.1.4",
|
||||
"disable-devtool": "^0.3.8",
|
||||
"element-plus": "^2.9.9",
|
||||
"eruda": "^3.4.1",
|
||||
"es-toolkit": "^1.36.0",
|
||||
"hotkeys-js": "^3.13.9",
|
||||
"lucide-vue-next": "^0.503.0",
|
||||
"mitt": "^3.0.1",
|
||||
"mockjs": "^1.1.0",
|
||||
"nprogress": "^0.2.0",
|
||||
"overlayscrollbars": "^2.4.6",
|
||||
"overlayscrollbars-vue": "^0.5.6",
|
||||
"path-browserify": "^1.0.1",
|
||||
"path-to-regexp": "^6.2.1",
|
||||
"pinia": "^2.1.7",
|
||||
"qs": "^6.11.2",
|
||||
"scule": "^1.1.1",
|
||||
"path-to-regexp": "^8.2.0",
|
||||
"pinia": "^3.0.2",
|
||||
"qs": "^6.14.0",
|
||||
"reka-ui": "^2.2.0",
|
||||
"scule": "^1.3.0",
|
||||
"tailwind-merge": "^3.2.0",
|
||||
"ua-parser-js": "^2.0.3",
|
||||
"vconsole": "^3.15.1",
|
||||
"vue": "^3.3.13",
|
||||
"vue-m-message": "^4.0.2",
|
||||
"vue-router": "^4.2.5"
|
||||
"vee-validate": "^4.15.0",
|
||||
"vue": "^3.5.13",
|
||||
"vue-router": "^4.5.1",
|
||||
"vue-sonner": "^1.3.2",
|
||||
"zod": "^3.24.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@antfu/eslint-config": "2.4.6",
|
||||
"@iconify/json": "^2.2.160",
|
||||
"@iconify/vue": "^4.1.1",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"@antfu/eslint-config": "4.3.0",
|
||||
"@faker-js/faker": "^9.7.0",
|
||||
"@iconify/json": "^2.2.333",
|
||||
"@iconify/vue": "^4.3.0",
|
||||
"@stylistic/stylelint-config": "^2.0.0",
|
||||
"@types/nprogress": "^0.2.3",
|
||||
"@types/path-browserify": "^1.0.2",
|
||||
"@types/qs": "^6.9.10",
|
||||
"@unocss/eslint-plugin": "^0.58.0",
|
||||
"@vitejs/plugin-legacy": "^5.2.0",
|
||||
"@vitejs/plugin-vue": "^4.5.2",
|
||||
"@vitejs/plugin-vue-jsx": "^3.1.0",
|
||||
"autoprefixer": "^10.4.16",
|
||||
"bumpp": "^9.2.1",
|
||||
"cz-git": "^1.8.0",
|
||||
"eslint": "^8.56.0",
|
||||
"esno": "^4.0.0",
|
||||
"fs-extra": "^11.2.0",
|
||||
"@types/path-browserify": "^1.0.3",
|
||||
"@types/qs": "^6.9.18",
|
||||
"@unocss/eslint-plugin": "^66.0.0",
|
||||
"@unocss/preset-legacy-compat": "^66.0.0",
|
||||
"@vitejs/plugin-legacy": "^6.1.1",
|
||||
"@vitejs/plugin-vue": "^5.2.3",
|
||||
"@vitejs/plugin-vue-jsx": "^4.1.2",
|
||||
"@vue/tsconfig": "^0.7.0",
|
||||
"autoprefixer": "^10.4.21",
|
||||
"boxen": "^8.0.1",
|
||||
"bumpp": "^10.1.0",
|
||||
"cz-git": "^1.11.1",
|
||||
"eslint": "^9.25.1",
|
||||
"esno": "^4.8.0",
|
||||
"fs-extra": "^11.3.0",
|
||||
"http-server": "^14.1.1",
|
||||
"inquirer": "^9.2.12",
|
||||
"lint-staged": "^15.2.0",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"plop": "^4.0.0",
|
||||
"sass": "^1.69.5",
|
||||
"simple-git-hooks": "^2.9.0",
|
||||
"stylelint": "^15.11.0",
|
||||
"stylelint-config-standard-scss": "^11.1.0",
|
||||
"inquirer": "^12.6.0",
|
||||
"lint-staged": "^15.5.1",
|
||||
"npm-run-all2": "^7.0.2",
|
||||
"picocolors": "^1.1.1",
|
||||
"plop": "^4.0.1",
|
||||
"postcss": "^8.5.3",
|
||||
"postcss-nested": "^7.0.2",
|
||||
"sass-embedded": "^1.87.0",
|
||||
"simple-git-hooks": "^2.13.0",
|
||||
"stylelint": "^16.19.1",
|
||||
"stylelint-config-recess-order": "^6.0.0",
|
||||
"stylelint-config-standard-scss": "^14.0.0",
|
||||
"stylelint-config-standard-vue": "^1.0.0",
|
||||
"stylelint-scss": "^5.3.1",
|
||||
"stylelint-stylistic": "^0.4.3",
|
||||
"svgo": "^3.1.0",
|
||||
"terser": "^5.26.0",
|
||||
"typescript": "^5.3.3",
|
||||
"unocss": "^0.58.0",
|
||||
"unplugin-auto-import": "^0.17.2",
|
||||
"unplugin-vue-components": "^0.26.0",
|
||||
"vite": "^5.0.10",
|
||||
"vite-plugin-banner": "^0.7.1",
|
||||
"vite-plugin-compression": "^0.5.1",
|
||||
"vite-plugin-mock": "^2.9.8",
|
||||
"vite-plugin-pages": "^0.32.0",
|
||||
"stylelint-scss": "^6.11.1",
|
||||
"svgo": "^3.3.2",
|
||||
"taze": "^19.0.4",
|
||||
"typescript": "^5.8.3",
|
||||
"unocss": "^66.0.0",
|
||||
"unocss-preset-animations": "^1.2.1",
|
||||
"unplugin-auto-import": "^19.1.2",
|
||||
"unplugin-turbo-console": "^2.1.3",
|
||||
"unplugin-vue-components": "^28.5.0",
|
||||
"vite": "^6.2.7",
|
||||
"vite-plugin-app-loading": "^0.3.1",
|
||||
"vite-plugin-archiver": "^0.1.2",
|
||||
"vite-plugin-banner": "^0.8.1",
|
||||
"vite-plugin-compression2": "^1.3.3",
|
||||
"vite-plugin-env-parse": "^1.0.15",
|
||||
"vite-plugin-fake-server": "^2.2.0",
|
||||
"vite-plugin-pages": "^0.33.0",
|
||||
"vite-plugin-svg-icons": "^2.0.1",
|
||||
"vite-plugin-vue-inspector": "^4.0.2",
|
||||
"vite-plugin-vue-meta-layouts": "^0.3.4",
|
||||
"vue-tsc": "^1.8.25"
|
||||
"vite-plugin-vue-devtools": "^7.7.6",
|
||||
"vite-plugin-vue-meta-layouts": "^0.5.1",
|
||||
"vue-tsc": "^2.2.10"
|
||||
},
|
||||
"simple-git-hooks": {
|
||||
"pre-commit": "pnpm lint-staged",
|
||||
|
||||
@@ -12,6 +12,6 @@ defineOptions({
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// 样式
|
||||
<style scoped>
|
||||
/* 样式 */
|
||||
</style>
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
import Mock from 'mockjs'
|
||||
import { faker } from '@faker-js/faker'
|
||||
import { defineFakeRoute } from 'vite-plugin-fake-server/client'
|
||||
|
||||
const AllList: any[] = []
|
||||
for (let i = 0; i < 50; i++) {
|
||||
AllList.push(Mock.mock({
|
||||
id: '@id',
|
||||
title: '@ctitle(10, 20)',
|
||||
}))
|
||||
AllList.push({
|
||||
id: i + 1,
|
||||
title: faker.color.human(),
|
||||
})
|
||||
}
|
||||
|
||||
export default [
|
||||
export default defineFakeRoute([
|
||||
{
|
||||
url: '/mock/{{#if relativePath}}{{ relativePath }}/{{/if}}{{ moduleName }}/list',
|
||||
method: 'get',
|
||||
response: (option: any) => {
|
||||
const { title, from, limit } = option.query
|
||||
response: ({ query }) => {
|
||||
const { title, from, limit } = query
|
||||
const list = AllList.filter((item) => {
|
||||
return title ? item.title.includes(title) : true
|
||||
})
|
||||
@@ -33,8 +34,8 @@ export default [
|
||||
{
|
||||
url: '/mock/{{#if relativePath}}{{ relativePath }}/{{/if}}{{ moduleName }}/detail',
|
||||
method: 'get',
|
||||
response: (option: any) => {
|
||||
const info = AllList.filter(item => item.id === option.query.id)
|
||||
response: ({ query }) => {
|
||||
const info = AllList.filter(item => item.id === query.id)
|
||||
return {
|
||||
error: '',
|
||||
status: 1,
|
||||
@@ -45,34 +46,40 @@ export default [
|
||||
{
|
||||
url: '/mock/{{#if relativePath}}{{ relativePath }}/{{/if}}{{ moduleName }}/create',
|
||||
method: 'post',
|
||||
response: {
|
||||
error: '',
|
||||
status: 1,
|
||||
data: {
|
||||
isSuccess: true,
|
||||
},
|
||||
response: () => {
|
||||
return {
|
||||
error: '',
|
||||
status: 1,
|
||||
data: {
|
||||
isSuccess: true,
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
url: '/mock/{{#if relativePath}}{{ relativePath }}/{{/if}}{{ moduleName }}/edit',
|
||||
method: 'post',
|
||||
response: {
|
||||
error: '',
|
||||
status: 1,
|
||||
data: {
|
||||
isSuccess: true,
|
||||
},
|
||||
response: () => {
|
||||
return {
|
||||
error: '',
|
||||
status: 1,
|
||||
data: {
|
||||
isSuccess: true,
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
url: '/mock/{{#if relativePath}}{{ relativePath }}/{{/if}}{{ moduleName }}/delete',
|
||||
method: 'post',
|
||||
response: {
|
||||
error: '',
|
||||
status: 1,
|
||||
data: {
|
||||
isSuccess: true,
|
||||
},
|
||||
response: () => {
|
||||
return {
|
||||
error: '',
|
||||
status: 1,
|
||||
data: {
|
||||
isSuccess: true,
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
]
|
||||
])
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import path from 'node:path'
|
||||
import fs from 'node:fs'
|
||||
import path from 'node:path'
|
||||
|
||||
function getFolder(path) {
|
||||
const components = []
|
||||
|
||||
@@ -17,6 +17,6 @@ defineOptions({
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// 样式
|
||||
<style scoped>
|
||||
/* 样式 */
|
||||
</style>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import path from 'node:path'
|
||||
import fs from 'node:fs'
|
||||
import path from 'node:path'
|
||||
|
||||
function getFolder(path) {
|
||||
const components = []
|
||||
|
||||
+10841
-8161
File diff suppressed because it is too large
Load Diff
+2
-1
@@ -1,5 +1,6 @@
|
||||
export default {
|
||||
plugins: {
|
||||
autoprefixer: {},
|
||||
'autoprefixer': {},
|
||||
'postcss-nested': {},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
#browser-upgrade {
|
||||
position: absolute;
|
||||
z-index: 10001;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
z-index: 10001;
|
||||
display: none;
|
||||
user-select: none;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
color: #736477;
|
||||
user-select: none;
|
||||
background-color: snow;
|
||||
}
|
||||
|
||||
#browser-upgrade .title {
|
||||
margin: 40px 0;
|
||||
text-align: center;
|
||||
font-size: 24px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#browser-upgrade .browsers {
|
||||
@@ -24,8 +24,8 @@
|
||||
#browser-upgrade .browsers .browser {
|
||||
display: inline-block;
|
||||
margin: 0 20px;
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#browser-upgrade .browsers .browser .browser-icon {
|
||||
@@ -37,10 +37,10 @@
|
||||
}
|
||||
|
||||
#browser-upgrade .browsers .browser .browser-name {
|
||||
text-align: center;
|
||||
margin-top: 10px;
|
||||
padding-bottom: 2px;
|
||||
margin-top: 10px;
|
||||
color: #736477;
|
||||
text-align: center;
|
||||
border-bottom: 1px solid transparent;
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 17 KiB |
@@ -0,0 +1,14 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -21 206 206" xml:space="preserve">
|
||||
<path d="M0,82.57C0,58.4,0,34.23,0,10.06C0,1.35,1.35,0,10.03,0C45.36,0,80.7-0.01,116.03,0.03c1.77,0,3.59,0.26,5.29,0.74
|
||||
c3.07,0.87,3.57,3.21,2.45,5.8c-4.37,10.1-8.83,20.15-13.31,30.2c-1.44,3.23-4.06,4.26-7.54,4.25c-18.5-0.09-37,0.1-55.5-0.14
|
||||
c-4.95-0.06-6.49,2.12-6.46,6.47c0.02,3,0.11,6.01-0.02,9c-0.3,6.8,0.34,9.29,9.51,9.62c5.36,0.19,10.73,0.04,16.09,0.04
|
||||
c7.57,0,15.15-0.04,22.72,0.01c5.13,0.03,6.6,2.12,4.59,6.89C90.43,81.09,86.27,89,83.4,97.35c-2.59,7.55-8.57,7.27-14.28,7.56
|
||||
c-7.48,0.38-15,0.17-22.5,0.06c-3.69-0.05-4.96,1.04-4.86,5.18c0.36,15.83,0.26,31.67,0.12,47.5c-0.04,4.2-2.26,6.53-6.94,6.42
|
||||
c-9-0.21-18-0.06-27-0.06c-6.05,0-7.91-1.8-7.92-7.94C-0.02,131.57,0,107.07,0,82.57z" fill="#42b883" />
|
||||
<path d="M132.98,94.13c-8.21,18.88-16.33,37.1-24.06,55.48c-6.02,14.31-5.81,14.4-21.31,14.4c-6.67,0-13.33,0.05-20-0.01
|
||||
c-5.91-0.05-7.71-2.44-5.46-7.61c6.86-15.8,13.86-31.55,20.82-47.31c9.41-21.32,18.81-42.63,28.24-63.94
|
||||
c5.59-12.62,11.14-25.25,16.94-37.77c0.82-1.78,2.95-4.09,4.47-4.09c1.63,0,4,2.11,4.78,3.86c13.4,29.78,26.56,59.66,39.87,89.49
|
||||
c6.48,14.53,13.16,28.97,19.72,43.46c2.57,5.68,5.11,11.38,7.61,17.1c1.61,3.68-0.13,6.75-4.12,6.77
|
||||
c-23.83,0.08-47.66,0.09-71.49-0.01c-4.03-0.02-5.46-2.47-3.98-6.17c2.26-5.63,4.77-11.16,6.95-16.82c1.74-4.54,4.92-6.06,9.6-5.98
|
||||
c9.65,0.16,9.89-0.55,5.89-9.13c-4.57-9.81-8.76-19.8-13.14-29.7C134.08,95.62,133.68,95.17,132.98,94.13z" fill="#42b883" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
@@ -1,92 +0,0 @@
|
||||
#app {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.fantastic-admin-home {
|
||||
position: absolute;
|
||||
z-index: 10000;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
user-select: none;
|
||||
color: #736477;
|
||||
background-color: snow;
|
||||
}
|
||||
|
||||
.fantastic-admin-home .loading {
|
||||
height: 40px;
|
||||
width: 40px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.fantastic-admin-home .loading .square {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 20px;
|
||||
width: 20px;
|
||||
}
|
||||
|
||||
.fantastic-admin-home .loading .square::before {
|
||||
content: "";
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border-radius: 15%;
|
||||
border: 3px solid #8c858f;
|
||||
animation: square-to-dot-animation 2s linear infinite;
|
||||
}
|
||||
|
||||
.fantastic-admin-home .loading .square:nth-child(1)::before {
|
||||
animation-delay: calc(150ms * 1);
|
||||
}
|
||||
|
||||
.fantastic-admin-home .loading .square:nth-child(2)::before {
|
||||
animation-delay: calc(150ms * 2);
|
||||
}
|
||||
|
||||
.fantastic-admin-home .loading .square:nth-child(3)::before {
|
||||
animation-delay: calc(150ms * 3);
|
||||
}
|
||||
|
||||
.fantastic-admin-home .loading .square:nth-child(4)::before {
|
||||
animation-delay: calc(150ms * 4);
|
||||
}
|
||||
|
||||
@keyframes square-to-dot-animation {
|
||||
15%,
|
||||
25% {
|
||||
border-radius: 100%;
|
||||
width: 0;
|
||||
height: 0;
|
||||
margin: 5px;
|
||||
border-width: 5px;
|
||||
}
|
||||
|
||||
40% {
|
||||
border-radius: 15%;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
margin: initial;
|
||||
border-width: 3px;
|
||||
}
|
||||
}
|
||||
|
||||
.fantastic-admin-home .text {
|
||||
position: relative;
|
||||
font-size: 24px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.fantastic-admin-home .text::after {
|
||||
content: "…";
|
||||
position: absolute;
|
||||
padding-left: 5px;
|
||||
}
|
||||
Executable → Regular
+66
-71
@@ -1,80 +1,75 @@
|
||||
import { exec } from 'node:child_process'
|
||||
import path from 'node:path'
|
||||
import process from 'node:process'
|
||||
import fs from 'fs-extra'
|
||||
import inquirer from 'inquirer'
|
||||
import { lookupCollection, lookupCollections } from '@iconify/json'
|
||||
import { checkbox, confirm } from '@inquirer/prompts'
|
||||
import fs from 'fs-extra'
|
||||
|
||||
async function generateIcons() {
|
||||
// 拿到全部图标集的原始数据
|
||||
const raw = await lookupCollections()
|
||||
// 拿到全部图标集的原始数据
|
||||
const raw = await lookupCollections()
|
||||
|
||||
let lastChoose = fs.readFileSync(path.resolve(process.cwd(), 'src/iconify/index.json'), 'utf-8')
|
||||
lastChoose = JSON.parse(lastChoose)
|
||||
let lastChoose = fs.readFileSync(path.resolve(process.cwd(), 'src/iconify/index.json'), 'utf-8')
|
||||
lastChoose = JSON.parse(lastChoose)
|
||||
|
||||
// 取出可使用的图标集数据用于 inquirer 选择,并按名称排序
|
||||
const collections = Object.entries(raw).map(([id, item]) => ({
|
||||
...item,
|
||||
id,
|
||||
})).sort((a, b) => a.name.localeCompare(b.name))
|
||||
// 取出可使用的图标集数据用于 inquirer 选择,并按名称排序
|
||||
const collections = Object.entries(raw).map(([id, item]) => ({
|
||||
...item,
|
||||
id,
|
||||
})).sort((a, b) => a.name.localeCompare(b.name))
|
||||
|
||||
/**
|
||||
* 分别会在对应目录下生成以下文件,其中(1)(3)用于离线下载并安装图标,(2)用于图标选择器使用
|
||||
* (1) src/iconify/index.json 记录用户 inquirer 的交互信息
|
||||
* (2) src/iconify/data.json 包含多个图标集数据,仅记录图标名
|
||||
* (3) public/icons/*-raw.json 多个图标集的原始数据,独立存放,用于离线使用
|
||||
*/
|
||||
inquirer.prompt([
|
||||
{
|
||||
type: 'checkbox',
|
||||
message: '请选择需要生成的图标集',
|
||||
name: 'collections',
|
||||
choices: collections.map(item => ({
|
||||
name: `${item.name} (${item.total} icons)`,
|
||||
value: item.id,
|
||||
})),
|
||||
default: lastChoose.collections,
|
||||
},
|
||||
{
|
||||
type: 'confirm',
|
||||
name: 'isOfflineUse',
|
||||
message: '是否需要离线使用',
|
||||
default: false,
|
||||
},
|
||||
]).then(async (answers) => {
|
||||
await fs.writeJSON(
|
||||
path.resolve(process.cwd(), 'src/iconify/index.json'),
|
||||
{
|
||||
collections: answers.collections,
|
||||
isOfflineUse: answers.isOfflineUse,
|
||||
},
|
||||
)
|
||||
|
||||
const outputDir = path.resolve(process.cwd(), 'public/icons')
|
||||
await fs.ensureDir(outputDir)
|
||||
await fs.emptyDir(outputDir)
|
||||
|
||||
const collectionsMeta: object[] = []
|
||||
for (const info of answers.collections) {
|
||||
const setData = await lookupCollection(info)
|
||||
|
||||
collectionsMeta.push({
|
||||
prefix: setData.prefix,
|
||||
info: setData.info,
|
||||
icons: Object.keys(setData.icons),
|
||||
})
|
||||
|
||||
const offlineFilePath = path.join(outputDir, `${info}-raw.json`)
|
||||
|
||||
if (answers.isOfflineUse) {
|
||||
await fs.writeJSON(offlineFilePath, setData)
|
||||
}
|
||||
}
|
||||
|
||||
await fs.writeJSON(
|
||||
path.resolve(process.cwd(), 'src/iconify/data.json'),
|
||||
collectionsMeta,
|
||||
)
|
||||
})
|
||||
/**
|
||||
* 分别会在对应目录下生成以下文件,其中(1)(3)用于离线下载并安装图标,(2)用于图标选择器使用
|
||||
* (1) src/iconify/index.json 记录用户 inquirer 的交互信息
|
||||
* (2) src/iconify/data.json 包含多个图标集数据,仅记录图标名
|
||||
* (3) public/icons/*-raw.json 多个图标集的原始数据,独立存放,用于离线使用
|
||||
*/
|
||||
const answers = {
|
||||
collections: await checkbox({
|
||||
message: '请选择需要生成的图标集',
|
||||
choices: collections.map(item => ({
|
||||
name: `${item.name} (${item.total} icons)`,
|
||||
value: item.id,
|
||||
checked: lastChoose.collections.includes(item.id),
|
||||
})),
|
||||
}),
|
||||
isOfflineUse: await confirm({
|
||||
message: '是否需要离线使用',
|
||||
default: false,
|
||||
}),
|
||||
}
|
||||
|
||||
generateIcons()
|
||||
await fs.writeJSON(
|
||||
path.resolve(process.cwd(), 'src/iconify/index.json'),
|
||||
{
|
||||
collections: answers.collections,
|
||||
isOfflineUse: answers.isOfflineUse,
|
||||
},
|
||||
)
|
||||
|
||||
const outputDir = path.resolve(process.cwd(), 'public/icons')
|
||||
await fs.ensureDir(outputDir)
|
||||
await fs.emptyDir(outputDir)
|
||||
|
||||
const collectionsMeta: object[] = []
|
||||
for (const info of answers.collections) {
|
||||
const setData = await lookupCollection(info)
|
||||
|
||||
collectionsMeta.push({
|
||||
prefix: setData.prefix,
|
||||
info: setData.info,
|
||||
icons: Object.keys(setData.icons),
|
||||
})
|
||||
|
||||
const offlineFilePath = path.join(outputDir, `${info}-raw.json`)
|
||||
|
||||
if (answers.isOfflineUse) {
|
||||
await fs.writeJSON(offlineFilePath, setData)
|
||||
}
|
||||
}
|
||||
|
||||
await fs.writeJSON(
|
||||
path.resolve(process.cwd(), 'src/iconify/data.json'),
|
||||
collectionsMeta,
|
||||
)
|
||||
|
||||
exec('eslint src/iconify/data.json src/iconify/index.json --cache --fix')
|
||||
|
||||
+17
-37
@@ -1,30 +1,19 @@
|
||||
<script setup lang="ts">
|
||||
import eruda from 'eruda'
|
||||
import VConsole from 'vconsole'
|
||||
import hotkeys from 'hotkeys-js'
|
||||
import eventBus from './utils/eventBus'
|
||||
import Provider from './ui-provider/index.vue'
|
||||
import useSettingsStore from '@/store/modules/settings'
|
||||
import { ua } from '@/utils/ua'
|
||||
import Provider from './ui/provider/index.vue'
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
const settingsStore = useSettingsStore()
|
||||
const { auth } = useAuth()
|
||||
|
||||
// 侧边栏主导航当前实际宽度
|
||||
const mainSidebarActualWidth = computed(() => {
|
||||
let actualWidth = Number.parseInt(getComputedStyle(document.documentElement).getPropertyValue('--g-main-sidebar-width'))
|
||||
if (settingsStore.settings.menu.menuMode === 'single' || (settingsStore.settings.menu.menuMode === 'head' && settingsStore.mode !== 'mobile')) {
|
||||
actualWidth = 0
|
||||
}
|
||||
return `${actualWidth}px`
|
||||
})
|
||||
document.body.setAttribute('data-os', ua.getOS().name || '')
|
||||
|
||||
// 侧边栏次导航当前实际宽度
|
||||
const subSidebarActualWidth = computed(() => {
|
||||
let actualWidth = Number.parseInt(getComputedStyle(document.documentElement).getPropertyValue('--g-sub-sidebar-width'))
|
||||
if (settingsStore.settings.menu.subMenuCollapse && settingsStore.mode !== 'mobile') {
|
||||
actualWidth = Number.parseInt(getComputedStyle(document.documentElement).getPropertyValue('--g-sub-sidebar-collapse-width'))
|
||||
}
|
||||
return `${actualWidth}px`
|
||||
const isAuth = computed(() => {
|
||||
return route.matched.every((item) => {
|
||||
return auth(item.meta.auth ?? '')
|
||||
})
|
||||
})
|
||||
|
||||
// 设置网页 title
|
||||
@@ -46,30 +35,21 @@ watch([
|
||||
|
||||
onMounted(() => {
|
||||
settingsStore.setMode(document.documentElement.clientWidth)
|
||||
window.onresize = () => {
|
||||
window.addEventListener('resize', () => {
|
||||
settingsStore.setMode(document.documentElement.clientWidth)
|
||||
}
|
||||
hotkeys('alt+i', () => {
|
||||
eventBus.emit('global-system-info-toggle')
|
||||
})
|
||||
})
|
||||
|
||||
import.meta.env.VITE_APP_DEBUG_TOOL === 'eruda' && eruda.init()
|
||||
import.meta.env.VITE_APP_DEBUG_TOOL === 'vconsole' && new VConsole()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Provider>
|
||||
<RouterView
|
||||
v-slot="{ Component, route }"
|
||||
:style="{
|
||||
'--g-main-sidebar-actual-width': mainSidebarActualWidth,
|
||||
'--g-sub-sidebar-actual-width': subSidebarActualWidth,
|
||||
}"
|
||||
>
|
||||
<component :is="Component" v-if="auth(route.meta.auth ?? '')" />
|
||||
<NotAllowed v-else />
|
||||
<RouterView v-slot="{ Component }">
|
||||
<component :is="Component" v-if="isAuth" />
|
||||
<FaNotAllowed v-else />
|
||||
</RouterView>
|
||||
<SystemInfo />
|
||||
<FaBackToTop />
|
||||
<FaToast />
|
||||
<FaNotification />
|
||||
<FaSystemInfo />
|
||||
</Provider>
|
||||
</template>
|
||||
|
||||
+14
-12
@@ -1,11 +1,10 @@
|
||||
import axios from 'axios'
|
||||
|
||||
// import qs from 'qs'
|
||||
import Message from 'vue-m-message'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import axios from 'axios'
|
||||
// import qs from 'qs'
|
||||
import { toast } from 'vue-sonner'
|
||||
|
||||
const api = axios.create({
|
||||
baseURL: (import.meta.env.DEV && import.meta.env.VITE_OPEN_PROXY === 'true') ? '/proxy/' : import.meta.env.VITE_APP_API_BASEURL,
|
||||
baseURL: (import.meta.env.DEV && import.meta.env.VITE_OPEN_PROXY) ? '/proxy/' : import.meta.env.VITE_APP_API_BASEURL,
|
||||
timeout: 1000 * 60,
|
||||
responseType: 'json',
|
||||
})
|
||||
@@ -34,25 +33,28 @@ api.interceptors.response.use(
|
||||
(response) => {
|
||||
/**
|
||||
* 全局拦截请求发送后返回的数据,如果数据有报错则在这做全局的错误提示
|
||||
* 假设返回数据格式为:{ status: 1, error: '', data: '' }
|
||||
* 假设返回数据格式为:{ status: 1, error: '', data: {} }
|
||||
* 规则是当 status 为 1 时表示请求成功,为 0 时表示接口需要登录或者登录状态失效,需要重新登录
|
||||
* 请求出错时 error 会返回错误信息
|
||||
*/
|
||||
if (response.data.status === 1) {
|
||||
if (response.data.error !== '') {
|
||||
// 错误提示
|
||||
Message.error(response.data.error, {
|
||||
zIndex: 2000,
|
||||
toast.warning('Warning', {
|
||||
description: response.data.error,
|
||||
})
|
||||
return Promise.reject(response.data)
|
||||
}
|
||||
}
|
||||
else {
|
||||
useUserStore().logout()
|
||||
useUserStore().requestLogout()
|
||||
}
|
||||
return Promise.resolve(response.data)
|
||||
},
|
||||
(error) => {
|
||||
if (error.status === 401) {
|
||||
useUserStore().requestLogout()
|
||||
throw error
|
||||
}
|
||||
let message = error.message
|
||||
if (message === 'Network Error') {
|
||||
message = '后端网络故障'
|
||||
@@ -63,8 +65,8 @@ api.interceptors.response.use(
|
||||
else if (message.includes('Request failed with status code')) {
|
||||
message = `接口${message.substr(message.length - 3)}异常`
|
||||
}
|
||||
Message.error(message, {
|
||||
zIndex: 2000,
|
||||
toast.error('Error', {
|
||||
description: message,
|
||||
})
|
||||
return Promise.reject(error)
|
||||
},
|
||||
|
||||
@@ -17,7 +17,7 @@ export default {
|
||||
// 修改密码
|
||||
passwordEdit: (data: {
|
||||
password: string
|
||||
newpassword: string
|
||||
newPassword: string
|
||||
}) => api.post('user/password/edit', data, {
|
||||
baseURL: '/mock/',
|
||||
}),
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" class="icon" viewBox="0 0 1024 1024"><path d="M704 328a72 72 0 1 0 144 0 72 72 0 1 0-144 0z"/><path d="M999.904 116.608a32 32 0 0 0-21.952-10.912L521.76 73.792a31.552 31.552 0 0 0-27.2 11.904l-92.192 114.848a32 32 0 0 0 .672 40.896l146.144 169.952-147.456 194.656 36.48-173.376a32 32 0 0 0-11.136-31.424L235.616 245.504l79.616-125.696a32 32 0 0 0-29.28-49.024L45.76 87.552a32 32 0 0 0-29.696 34.176l55.808 798.016a32.064 32.064 0 0 0 34.304 29.696l176.512-13.184c17.632-1.312 30.848-16.672 29.504-34.272s-16.576-31.04-34.304-29.536L133.44 883.232l-6.432-92.512 125.312-12.576a32 32 0 0 0 28.672-35.04 32.16 32.16 0 0 0-35.04-28.672L122.56 726.848 82.144 149.184l145.152-10.144-60.96 96.224a32 32 0 0 0 6.848 41.952l198.4 161.344-58.752 279.296a30.912 30.912 0 0 0 .736 14.752 31.68 31.68 0 0 0 1.408 11.04l51.52 154.56a31.968 31.968 0 0 0 27.456 21.76l523.104 47.552a32.064 32.064 0 0 0 34.848-29.632l55.776-798.048a32.064 32.064 0 0 0-7.776-23.232zm-98.912 630.848-412.576-39.648a31.52 31.52 0 0 0-34.912 28.768 32 32 0 0 0 28.8 34.912l414.24 39.808-6.272 89.536-469.728-42.72-39.584-118.72 234.816-310.016a31.936 31.936 0 0 0-1.248-40.192L468.896 219.84l65.088-81.056 407.584 28.48-40.576 580.192z"/></svg>
|
||||
|
Before Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 4.0 KiB |
@@ -0,0 +1,14 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-25 -46 256 256" xml:space="preserve">
|
||||
<path d="M0,82.57C0,58.4,0,34.23,0,10.06C0,1.35,1.35,0,10.03,0C45.36,0,80.7-0.01,116.03,0.03c1.77,0,3.59,0.26,5.29,0.74
|
||||
c3.07,0.87,3.57,3.21,2.45,5.8c-4.37,10.1-8.83,20.15-13.31,30.2c-1.44,3.23-4.06,4.26-7.54,4.25c-18.5-0.09-37,0.1-55.5-0.14
|
||||
c-4.95-0.06-6.49,2.12-6.46,6.47c0.02,3,0.11,6.01-0.02,9c-0.3,6.8,0.34,9.29,9.51,9.62c5.36,0.19,10.73,0.04,16.09,0.04
|
||||
c7.57,0,15.15-0.04,22.72,0.01c5.13,0.03,6.6,2.12,4.59,6.89C90.43,81.09,86.27,89,83.4,97.35c-2.59,7.55-8.57,7.27-14.28,7.56
|
||||
c-7.48,0.38-15,0.17-22.5,0.06c-3.69-0.05-4.96,1.04-4.86,5.18c0.36,15.83,0.26,31.67,0.12,47.5c-0.04,4.2-2.26,6.53-6.94,6.42
|
||||
c-9-0.21-18-0.06-27-0.06c-6.05,0-7.91-1.8-7.92-7.94C-0.02,131.57,0,107.07,0,82.57z" fill="#35495e" />
|
||||
<path d="M132.98,94.13c-8.21,18.88-16.33,37.1-24.06,55.48c-6.02,14.31-5.81,14.4-21.31,14.4c-6.67,0-13.33,0.05-20-0.01
|
||||
c-5.91-0.05-7.71-2.44-5.46-7.61c6.86-15.8,13.86-31.55,20.82-47.31c9.41-21.32,18.81-42.63,28.24-63.94
|
||||
c5.59-12.62,11.14-25.25,16.94-37.77c0.82-1.78,2.95-4.09,4.47-4.09c1.63,0,4,2.11,4.78,3.86c13.4,29.78,26.56,59.66,39.87,89.49
|
||||
c6.48,14.53,13.16,28.97,19.72,43.46c2.57,5.68,5.11,11.38,7.61,17.1c1.61,3.68-0.13,6.75-4.12,6.77
|
||||
c-23.83,0.08-47.66,0.09-71.49-0.01c-4.03-0.02-5.46-2.47-3.98-6.17c2.26-5.63,4.77-11.16,6.95-16.82c1.74-4.54,4.92-6.06,9.6-5.98
|
||||
c9.65,0.16,9.89-0.55,5.89-9.13c-4.57-9.81-8.76-19.8-13.14-29.7C134.08,95.62,133.68,95.17,132.98,94.13z" fill="#42b883" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
Executable
+80
@@ -0,0 +1,80 @@
|
||||
/* 页面布局 CSS 变量 */
|
||||
:root {
|
||||
/* 头部高度 */
|
||||
--g-header-height: 60px;
|
||||
|
||||
/* 侧边栏宽度 */
|
||||
--g-main-sidebar-width: 80px;
|
||||
--g-sub-sidebar-width: 220px;
|
||||
--g-sub-sidebar-collapse-width: 64px;
|
||||
|
||||
/* 侧边栏 Logo 区域高度 */
|
||||
--g-sidebar-logo-height: 50px;
|
||||
|
||||
/* 标签栏高度 */
|
||||
--g-tabbar-height: 50px;
|
||||
|
||||
/* 工具栏高度 */
|
||||
--g-toolbar-height: 50px;
|
||||
}
|
||||
|
||||
/* 明暗模式 CSS 变量 */
|
||||
/* stylelint-disable-next-line no-duplicate-selectors */
|
||||
:root {
|
||||
color-scheme: light;
|
||||
|
||||
&::view-transition-old(root),
|
||||
&::view-transition-new(root) {
|
||||
mix-blend-mode: normal;
|
||||
animation: none;
|
||||
}
|
||||
|
||||
&::view-transition-old(root) {
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
&::view-transition-new(root) {
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
&.dark {
|
||||
color-scheme: dark;
|
||||
|
||||
&::view-transition-old(root) {
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
&::view-transition-new(root) {
|
||||
z-index: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
* {
|
||||
scrollbar-color: hsl(var(--border)) transparent;
|
||||
scrollbar-width: thin;
|
||||
border-color: hsl(var(--border));
|
||||
}
|
||||
|
||||
html,
|
||||
body {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
font-family: var(--font-family);
|
||||
color: hsl(var(--foreground));
|
||||
background: hsl(var(--background));
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
}
|
||||
|
||||
#app {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
/* textarea 字体跟随系统 */
|
||||
textarea {
|
||||
font-family: inherit;
|
||||
}
|
||||
@@ -1,140 +0,0 @@
|
||||
// 页面布局 CSS 变量
|
||||
:root {
|
||||
// 头部高度
|
||||
--g-header-height: 60px;
|
||||
// 侧边栏宽度
|
||||
--g-main-sidebar-width: 80px;
|
||||
--g-sub-sidebar-width: 220px;
|
||||
--g-sub-sidebar-collapse-width: 64px;
|
||||
// 侧边栏 Logo 区域高度
|
||||
--g-sidebar-logo-height: 50px;
|
||||
// 工具栏高度
|
||||
--g-toolbar-height: 50px;
|
||||
}
|
||||
|
||||
// 明暗模式 CSS 变量
|
||||
/* stylelint-disable-next-line no-duplicate-selectors */
|
||||
:root {
|
||||
&::view-transition-old(root),
|
||||
&::view-transition-new(root) {
|
||||
animation: none;
|
||||
mix-blend-mode: normal;
|
||||
}
|
||||
|
||||
&::view-transition-old(root) {
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
&::view-transition-new(root) {
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
--g-box-shadow-color: rgb(0 0 0 / 12%);
|
||||
|
||||
&.dark {
|
||||
&::view-transition-old(root) {
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
&::view-transition-new(root) {
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
--g-box-shadow-color: rgb(0 0 0 / 72%);
|
||||
}
|
||||
}
|
||||
|
||||
::-webkit-scrollbar {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
background-color: rgb(0 0 0 / 40%);
|
||||
background-clip: padding-box;
|
||||
border: 3px solid transparent;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb:hover {
|
||||
background-color: rgb(0 0 0 / 50%);
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
html,
|
||||
body {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
background-color: var(--g-container-bg);
|
||||
box-sizing: border-box;
|
||||
font-family: Lato, "PingFang SC", "Microsoft YaHei", sans-serif;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
|
||||
&.overflow-hidden {
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: inherit;
|
||||
}
|
||||
|
||||
// 右侧内容区针对fixed元素,有横向铺满的需求,可在fixed元素上设置 [data-fixed-calc-width]
|
||||
[data-fixed-calc-width] {
|
||||
position: fixed;
|
||||
left: 50%;
|
||||
right: 0;
|
||||
width: calc(100% - var(--g-main-sidebar-actual-width) - var(--g-sub-sidebar-actual-width));
|
||||
transform: translateX(-50%) translateX(calc(var(--g-main-sidebar-actual-width) / 2)) translateX(calc(var(--g-sub-sidebar-actual-width) / 2));
|
||||
}
|
||||
|
||||
[data-mode="mobile"] {
|
||||
[data-fixed-calc-width] {
|
||||
width: 100% !important;
|
||||
transform: translateX(-50%) !important;
|
||||
}
|
||||
}
|
||||
// textarea 字体跟随系统
|
||||
textarea {
|
||||
font-family: inherit;
|
||||
}
|
||||
|
||||
/* Overrides Floating Vue */
|
||||
.v-popper--theme-dropdown,
|
||||
.v-popper--theme-tooltip {
|
||||
--at-apply: inline-flex;
|
||||
}
|
||||
|
||||
.v-popper--theme-dropdown .v-popper__inner,
|
||||
.v-popper--theme-tooltip .v-popper__inner {
|
||||
--at-apply: bg-white dark:bg-stone-8 text-dark dark:text-white rounded shadow ring-1 ring-gray-200 dark:ring-gray-800 border border-solid border-stone/20 text-xs font-normal;
|
||||
|
||||
box-shadow: 0 6px 30px rgb(0 0 0 / 10%);
|
||||
}
|
||||
|
||||
.v-popper--theme-tooltip .v-popper__arrow-inner,
|
||||
.v-popper--theme-dropdown .v-popper__arrow-inner {
|
||||
visibility: visible;
|
||||
|
||||
--at-apply: border-white dark:border-stone-8;
|
||||
}
|
||||
|
||||
.v-popper--theme-tooltip .v-popper__arrow-outer,
|
||||
.v-popper--theme-dropdown .v-popper__arrow-outer {
|
||||
--at-apply: border-stone/20;
|
||||
}
|
||||
|
||||
.v-popper--theme-tooltip.v-popper--shown,
|
||||
.v-popper--theme-tooltip.v-popper--shown * {
|
||||
transition: none !important;
|
||||
}
|
||||
|
||||
[data-overlayscrollbars-contents] {
|
||||
overscroll-behavior: contain;
|
||||
}
|
||||
@@ -3,48 +3,48 @@
|
||||
|
||||
.bar {
|
||||
position: fixed;
|
||||
z-index: 1031;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 3000;
|
||||
width: 100%;
|
||||
height: 2px;
|
||||
background: rgb(var(--ui-primary));
|
||||
background: hsl(var(--primary));
|
||||
}
|
||||
|
||||
.peg {
|
||||
display: block;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
display: block;
|
||||
width: 100px;
|
||||
height: 100%;
|
||||
box-shadow: 0 0 10px hsl(var(--primary)), 0 0 5px hsl(var(--primary));
|
||||
opacity: 1;
|
||||
transform: rotate(3deg) translate(0, -4px);
|
||||
box-shadow: 0 0 10px rgb(var(--ui-primary)), 0 0 5px rgb(var(--ui-primary));
|
||||
}
|
||||
|
||||
.spinner {
|
||||
display: block;
|
||||
position: fixed;
|
||||
z-index: 1031;
|
||||
top: 11px;
|
||||
right: 14px;
|
||||
z-index: 2000;
|
||||
display: block;
|
||||
|
||||
.spinner-icon {
|
||||
box-sizing: border-box;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
box-sizing: border-box;
|
||||
border: solid 2px transparent;
|
||||
border-top-color: hsl(var(--primary));
|
||||
border-left-color: hsl(var(--primary));
|
||||
border-radius: 50%;
|
||||
border-top-color: rgb(var(--ui-primary));
|
||||
border-left-color: rgb(var(--ui-primary));
|
||||
animation: nprogress-spinner 400ms linear infinite;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.nprogress-custom-parent {
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
|
||||
#nprogress .spinner,
|
||||
#nprogress .bar {
|
||||
@@ -7,9 +7,9 @@
|
||||
} @else {
|
||||
/* stylelint-disable-next-line value-no-vendor-prefix */
|
||||
display: -webkit-box;
|
||||
overflow: hidden;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: $line;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
}
|
||||
|
||||
@if $type == xy {
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translateX(-50%) translateY(-50%);
|
||||
}
|
||||
}
|
||||
@@ -46,8 +46,8 @@
|
||||
|
||||
&::before,
|
||||
&::after {
|
||||
content: "";
|
||||
display: block;
|
||||
clear: both;
|
||||
display: block;
|
||||
content: "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
<script setup lang="ts">
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import useSettingsStore from '@/store/modules/settings'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import { cn } from '@/utils'
|
||||
import eventBus from '@/utils/eventBus'
|
||||
import Profile from './profile.vue'
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
onlyAvatar?: boolean
|
||||
dropdownAlign?: 'start' | 'center' | 'end'
|
||||
dropdownSide?: 'left' | 'right' | 'top' | 'bottom'
|
||||
buttonVariant?: 'secondary' | 'ghost'
|
||||
class?: HTMLAttributes['class']
|
||||
}>(), {
|
||||
dropdownAlign: 'end',
|
||||
dropdownSide: 'right',
|
||||
buttonVariant: 'ghost',
|
||||
})
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
const settingsStore = useSettingsStore()
|
||||
const userStore = useUserStore()
|
||||
|
||||
const isProfileShow = ref(false)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FaDropdown
|
||||
:align="dropdownAlign" :side="dropdownSide" :items="[
|
||||
[
|
||||
{ label: settingsStore.settings.home.title, icon: 'i-mdi:home', handle: () => router.push({ path: settingsStore.settings.home.fullPath }), hide: !settingsStore.settings.home.enable },
|
||||
{ label: '个人设置', icon: 'i-mdi:account', handle: () => isProfileShow = true },
|
||||
],
|
||||
[
|
||||
{ label: '快捷键介绍', icon: 'i-mdi:keyboard', handle: () => eventBus.emit('global-hotkeys-intro-toggle'), hide: settingsStore.mode !== 'pc' },
|
||||
],
|
||||
[
|
||||
{ label: '退出登录', icon: 'i-mdi:logout', handle: () => userStore.logout(settingsStore.settings.home.fullPath) },
|
||||
],
|
||||
]" class="flex-center"
|
||||
>
|
||||
<template #label>
|
||||
<div class="space-y-2">
|
||||
<div class="text-xs text-secondary-foreground/50 font-light">
|
||||
当前登录账号
|
||||
</div>
|
||||
<div class="flex-center-start gap-2">
|
||||
<FaAvatar :src="userStore.avatar" :fallback="userStore.account.slice(0, 5)" shape="square" />
|
||||
<div class="space-y-1">
|
||||
<div class="text-base lh-none">
|
||||
{{ userStore.account }}
|
||||
</div>
|
||||
<div class="text-xs text-secondary-foreground/50 font-normal">
|
||||
[ 这里可以显示邮箱 ]
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<FaButton
|
||||
:variant="buttonVariant" :class="cn('flex-center gap-1 p-2', {
|
||||
'size-8 p-1': onlyAvatar,
|
||||
}, props.class)"
|
||||
>
|
||||
<FaAvatar :src="userStore.avatar" :class="cn('size-6', { 'size-full': onlyAvatar })">
|
||||
<FaIcon name="i-carbon:user-avatar-filled" class="size-6 text-secondary-foreground/50" />
|
||||
</FaAvatar>
|
||||
<div v-if="settingsStore.mode === 'pc' && !onlyAvatar" class="min-w-0 flex-center-between flex-1 gap-2">
|
||||
<div class="flex-1 truncate text-start">
|
||||
{{ userStore.account }}
|
||||
</div>
|
||||
<FaIcon name="i-material-symbols:expand-all-rounded" />
|
||||
</div>
|
||||
</FaButton>
|
||||
</FaDropdown>
|
||||
<FaModal v-model="isProfileShow" align-center :header="false" :footer="false" :close-on-click-overlay="false" :close-on-press-escape="false" class="h-500px min-w-600px overflow-hidden" content-class="min-h-full p-0 flex">
|
||||
<Profile />
|
||||
</FaModal>
|
||||
</template>
|
||||
@@ -0,0 +1,36 @@
|
||||
<script setup lang="ts">
|
||||
import EditPasswordForm from '@/components/AccountForm/EditPasswordForm.vue'
|
||||
|
||||
const active = ref(0)
|
||||
const tabs = ref([
|
||||
{
|
||||
title: '基本设置',
|
||||
description: '账号的基本信息,头像、昵称等',
|
||||
},
|
||||
{
|
||||
title: '安全设置',
|
||||
description: '定期修改密码可以提高帐号安全性',
|
||||
},
|
||||
])
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="min-h-full w-full">
|
||||
<div class="fixed inset-s-0 bottom-0 top-0 h-full w-40 border-e">
|
||||
<div v-for="(tab, index) in tabs" :key="index" class="cursor-pointer px-4 py-3 transition-background-color space-y-2 hover-bg-accent/50" :class="{ 'bg-accent hover-bg-accent!': active === index }" @click="active = index">
|
||||
<div class="text-base text-accent-foreground leading-tight">
|
||||
{{ tab.title }}
|
||||
</div>
|
||||
<div class="text-xs text-accent-foreground/50">
|
||||
{{ tab.description }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ms-40 min-h-full flex-col-center p-10">
|
||||
<div v-if="active === 0">
|
||||
请开发者自行扩展
|
||||
</div>
|
||||
<EditPasswordForm v-if="active === 1" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,91 @@
|
||||
<script setup lang="ts">
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import { FormControl, FormField, FormItem, FormMessage } from '@/ui/shadcn/ui/form'
|
||||
import { toTypedSchema } from '@vee-validate/zod'
|
||||
import { useForm } from 'vee-validate'
|
||||
import { toast } from 'vue-sonner'
|
||||
import * as z from 'zod'
|
||||
|
||||
defineOptions({
|
||||
name: 'EditPasswordForm',
|
||||
})
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
const loading = ref(false)
|
||||
|
||||
const form = useForm({
|
||||
validationSchema: toTypedSchema(
|
||||
z.object({
|
||||
password: z.string().min(1, '请输入原密码'),
|
||||
newPassword: z.string().min(1, '请输入新密码').min(6, '密码长度为6到18位').max(18, '密码长度为6到18位'),
|
||||
checkPassword: z.string().min(1, '请确认新密码'),
|
||||
}).refine(data => data.newPassword === data.checkPassword, {
|
||||
message: '两次输入的密码不一致',
|
||||
path: ['checkPassword'],
|
||||
}),
|
||||
),
|
||||
initialValues: {
|
||||
password: '',
|
||||
newPassword: '',
|
||||
checkPassword: '',
|
||||
},
|
||||
})
|
||||
const onSubmit = form.handleSubmit((values) => {
|
||||
loading.value = true
|
||||
userStore.editPassword(values).then(async () => {
|
||||
toast.success('模拟修改成功,请重新登录')
|
||||
userStore.logout()
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="w-full flex-col-stretch-center">
|
||||
<div class="mb-6 space-y-2">
|
||||
<h3 class="text-4xl color-[var(--el-text-color-primary)] font-bold">
|
||||
修改密码
|
||||
</h3>
|
||||
<p class="text-sm text-muted-foreground lg:text-base">
|
||||
请输入原密码、新密码和确认密码
|
||||
</p>
|
||||
</div>
|
||||
<form @submit="onSubmit">
|
||||
<FormField v-slot="{ componentField, errors }" name="password">
|
||||
<FormItem class="relative pb-6 space-y-0">
|
||||
<FormControl>
|
||||
<FaInput type="password" placeholder="请输入原密码" class="w-full" :class="errors.length && 'border-destructive'" v-bind="componentField" />
|
||||
</FormControl>
|
||||
<Transition enter-active-class="transition-opacity" enter-from-class="opacity-0" leave-active-class="transition-opacity" leave-to-class="opacity-0">
|
||||
<FormMessage class="absolute bottom-1 text-xs" />
|
||||
</Transition>
|
||||
</FormItem>
|
||||
</FormField>
|
||||
<FormField v-slot="{ componentField, errors }" name="newPassword">
|
||||
<FormItem class="relative pb-6 space-y-0">
|
||||
<FormControl>
|
||||
<FaInput type="password" placeholder="请输入新密码" class="w-full" :class="errors.length && 'border-destructive'" v-bind="componentField" />
|
||||
</FormControl>
|
||||
<Transition enter-active-class="transition-opacity" enter-from-class="opacity-0" leave-active-class="transition-opacity" leave-to-class="opacity-0">
|
||||
<FormMessage class="absolute bottom-1 text-xs" />
|
||||
</Transition>
|
||||
</FormItem>
|
||||
</FormField>
|
||||
<FormField v-slot="{ componentField, errors }" name="checkPassword">
|
||||
<FormItem class="relative pb-6 space-y-0">
|
||||
<FormControl>
|
||||
<FaInput type="password" placeholder="请确认新密码" class="w-full" :class="errors.length && 'border-destructive'" v-bind="componentField" />
|
||||
</FormControl>
|
||||
<Transition enter-active-class="transition-opacity" enter-from-class="opacity-0" leave-active-class="transition-opacity" leave-to-class="opacity-0">
|
||||
<FormMessage class="absolute bottom-1 text-xs" />
|
||||
</Transition>
|
||||
</FormItem>
|
||||
</FormField>
|
||||
<FaButton :loading="loading" size="lg" class="mt-8 w-full" type="submit">
|
||||
保存
|
||||
</FaButton>
|
||||
</form>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,151 @@
|
||||
<script setup lang="ts">
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import { FormControl, FormField, FormItem, FormMessage } from '@/ui/shadcn/ui/form'
|
||||
import { toTypedSchema } from '@vee-validate/zod'
|
||||
import { useForm } from 'vee-validate'
|
||||
import * as z from 'zod'
|
||||
|
||||
defineOptions({
|
||||
name: 'LoginForm',
|
||||
})
|
||||
|
||||
const props = defineProps<{
|
||||
account?: string
|
||||
}>()
|
||||
|
||||
const emits = defineEmits<{
|
||||
onLogin: [account?: string]
|
||||
onRegister: [account?: string]
|
||||
onResetPassword: [account?: string]
|
||||
}>()
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
const title = import.meta.env.VITE_APP_TITLE
|
||||
const loading = ref(false)
|
||||
|
||||
// 登录方式,default 账号密码登录,qrcode 扫码登录
|
||||
const type = ref<'default' | 'qrcode'>('default')
|
||||
|
||||
const form = useForm({
|
||||
validationSchema: toTypedSchema(z.object({
|
||||
account: z.string().min(1, '请输入用户名'),
|
||||
password: z.string().min(1, '请输入密码'),
|
||||
remember: z.boolean(),
|
||||
})),
|
||||
initialValues: {
|
||||
account: props.account ?? localStorage.getItem('login_account') ?? '',
|
||||
password: '',
|
||||
remember: !!localStorage.getItem('login_account'),
|
||||
},
|
||||
})
|
||||
const onSubmit = form.handleSubmit((values) => {
|
||||
loading.value = true
|
||||
userStore.login(values).then(() => {
|
||||
if (values.remember) {
|
||||
localStorage.setItem('login_account', values.account)
|
||||
}
|
||||
else {
|
||||
localStorage.removeItem('login_account')
|
||||
}
|
||||
emits('onLogin', values.account)
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
})
|
||||
|
||||
function testAccount(account: string) {
|
||||
form.setFieldValue('account', account)
|
||||
form.setFieldValue('password', '123456')
|
||||
onSubmit()
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="min-h-500px w-full flex-col-stretch-center p-12">
|
||||
<div class="mb-6 space-y-2">
|
||||
<h3 class="text-4xl color-[var(--el-text-color-primary)] font-bold">
|
||||
欢迎使用 👋🏻
|
||||
</h3>
|
||||
<p class="text-sm text-muted-foreground lg:text-base">
|
||||
{{ title }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="mb-4">
|
||||
<FaTabs
|
||||
v-model="type" :list="[
|
||||
{ label: '账号密码登录', value: 'default' },
|
||||
{ label: '扫码登录', value: 'qrcode' },
|
||||
]" class="inline-flex"
|
||||
/>
|
||||
</div>
|
||||
<div v-show="type === 'default'">
|
||||
<form @submit="onSubmit">
|
||||
<FormField v-slot="{ componentField, errors }" name="account">
|
||||
<FormItem class="relative pb-6 space-y-0">
|
||||
<FormControl>
|
||||
<FaInput type="text" placeholder="请输入用户名" class="w-full" :class="errors.length && 'border-destructive'" v-bind="componentField" />
|
||||
</FormControl>
|
||||
<Transition enter-active-class="transition-opacity" enter-from-class="opacity-0" leave-active-class="transition-opacity" leave-to-class="opacity-0">
|
||||
<FormMessage class="absolute bottom-1 text-xs" />
|
||||
</Transition>
|
||||
</FormItem>
|
||||
</FormField>
|
||||
<FormField v-slot="{ componentField, errors }" name="password">
|
||||
<FormItem class="relative pb-6 space-y-0">
|
||||
<FormControl>
|
||||
<FaInput type="password" placeholder="请输入密码" class="w-full" :class="errors.length && 'border-destructive'" v-bind="componentField" />
|
||||
</FormControl>
|
||||
<Transition enter-active-class="transition-opacity" enter-from-class="opacity-0" leave-active-class="transition-opacity" leave-to-class="opacity-0">
|
||||
<FormMessage class="absolute bottom-1 text-xs" />
|
||||
</Transition>
|
||||
</FormItem>
|
||||
</FormField>
|
||||
<div class="mb-4 flex-center-between">
|
||||
<div class="flex-center-start">
|
||||
<FormField v-slot="{ componentField }" type="checkbox" name="remember">
|
||||
<FormItem>
|
||||
<FormControl>
|
||||
<FaCheckbox v-bind="componentField">
|
||||
记住我
|
||||
</FaCheckbox>
|
||||
</FormControl>
|
||||
</FormItem>
|
||||
</FormField>
|
||||
</div>
|
||||
<FaButton variant="link" class="h-auto p-0" type="button" @click="emits('onResetPassword', form.values.account)">
|
||||
忘记密码了?
|
||||
</FaButton>
|
||||
</div>
|
||||
<FaButton :loading="loading" size="lg" class="w-full" type="submit">
|
||||
登录
|
||||
</FaButton>
|
||||
<div class="mt-4 flex-center gap-2 text-sm">
|
||||
<span class="text-secondary-foreground op-50">还没有帐号?</span>
|
||||
<FaButton variant="link" class="h-auto p-0" type="button" @click="emits('onRegister', form.values.account)">
|
||||
注册新帐号
|
||||
</FaButton>
|
||||
</div>
|
||||
</form>
|
||||
<div class="mt-4 text-center -mb-4">
|
||||
<FaDivider>演示账号一键登录</FaDivider>
|
||||
<div class="space-x-2">
|
||||
<FaButton variant="default" size="sm" plain @click="testAccount('admin')">
|
||||
admin
|
||||
</FaButton>
|
||||
<FaButton variant="outline" size="sm" plain @click="testAccount('test')">
|
||||
test
|
||||
</FaButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-show="type === 'qrcode'">
|
||||
<div class="flex-col-center">
|
||||
<img src="https://s2.loli.net/2024/04/26/GsahtuIZ9XOg5jr.png" class="h-[250px] w-[250px]">
|
||||
<div class="mt-2 text-sm text-secondary-foreground op-50">
|
||||
请使用微信扫码登录
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,102 @@
|
||||
<script setup lang="ts">
|
||||
import { FormControl, FormField, FormItem, FormMessage } from '@/ui/shadcn/ui/form'
|
||||
import { toTypedSchema } from '@vee-validate/zod'
|
||||
import { useForm } from 'vee-validate'
|
||||
import * as z from 'zod'
|
||||
|
||||
defineOptions({
|
||||
name: 'RegisterForm',
|
||||
})
|
||||
|
||||
const props = defineProps<{
|
||||
account?: string
|
||||
}>()
|
||||
|
||||
const emits = defineEmits<{
|
||||
onLogin: [account?: string]
|
||||
onRegister: [account?: string]
|
||||
}>()
|
||||
|
||||
const loading = ref(false)
|
||||
|
||||
const form = useForm({
|
||||
validationSchema: toTypedSchema(
|
||||
z.object({
|
||||
account: z.string().min(1, '请输入用户名'),
|
||||
captcha: z.string().min(6, '请输入验证码'),
|
||||
password: z.string().min(1, '请输入密码').min(6, '密码长度为6到18位').max(18, '密码长度为6到18位'),
|
||||
checkPassword: z.string().min(1, '请再次输入密码'),
|
||||
}).refine(data => data.password === data.checkPassword, {
|
||||
message: '两次输入的密码不一致',
|
||||
path: ['checkPassword'],
|
||||
}),
|
||||
),
|
||||
initialValues: {
|
||||
account: props.account ?? '',
|
||||
captcha: '',
|
||||
password: '',
|
||||
checkPassword: '',
|
||||
},
|
||||
})
|
||||
const onSubmit = form.handleSubmit((values) => {
|
||||
loading.value = true
|
||||
emits('onRegister', values.account)
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="min-h-500px w-full flex-col-stretch-center p-12">
|
||||
<form @submit="onSubmit">
|
||||
<div class="mb-8 space-y-2">
|
||||
<h3 class="text-4xl color-[var(--el-text-color-primary)] font-bold">
|
||||
探索从这里开始 🚀
|
||||
</h3>
|
||||
<p class="text-sm text-muted-foreground lg:text-base">
|
||||
演示系统未提供该功能
|
||||
</p>
|
||||
</div>
|
||||
<FormField v-slot="{ componentField, errors }" name="account">
|
||||
<FormItem class="relative pb-6 space-y-0">
|
||||
<FormControl>
|
||||
<FaInput type="text" placeholder="请输入用户名" class="w-full" :class="errors.length && 'border-destructive'" v-bind="componentField" />
|
||||
</FormControl>
|
||||
<Transition enter-active-class="transition-opacity" enter-from-class="opacity-0" leave-active-class="transition-opacity" leave-to-class="opacity-0">
|
||||
<FormMessage class="absolute bottom-1 text-xs" />
|
||||
</Transition>
|
||||
</FormItem>
|
||||
</FormField>
|
||||
<FormField v-slot="{ componentField, value, errors }" name="password">
|
||||
<FormItem class="relative pb-6 space-y-0">
|
||||
<FormControl>
|
||||
<FaInput type="password" placeholder="请输入密码" class="w-full" :class="errors.length && 'border-destructive'" v-bind="componentField" />
|
||||
</FormControl>
|
||||
<FormDescription>
|
||||
<FaPasswordStrength :password="value" class="mt-2" />
|
||||
</FormDescription>
|
||||
<Transition enter-active-class="transition-opacity" enter-from-class="opacity-0" leave-active-class="transition-opacity" leave-to-class="opacity-0">
|
||||
<FormMessage class="absolute bottom-1 text-xs" />
|
||||
</Transition>
|
||||
</FormItem>
|
||||
</FormField>
|
||||
<FormField v-slot="{ componentField, errors }" name="checkPassword">
|
||||
<FormItem class="relative pb-6 space-y-0">
|
||||
<FormControl>
|
||||
<FaInput type="password" placeholder="请再次输入密码" class="w-full" :class="errors.length && 'border-destructive'" v-bind="componentField" />
|
||||
</FormControl>
|
||||
<Transition enter-active-class="transition-opacity" enter-from-class="opacity-0" leave-active-class="transition-opacity" leave-to-class="opacity-0">
|
||||
<FormMessage class="absolute bottom-1 text-xs" />
|
||||
</Transition>
|
||||
</FormItem>
|
||||
</FormField>
|
||||
<FaButton :loading="loading" size="lg" class="mt-4 w-full" type="submit">
|
||||
注册
|
||||
</FaButton>
|
||||
<div class="mt-4 flex-center gap-2 text-sm">
|
||||
<span class="text-secondary-foreground op-50">已经有帐号?</span>
|
||||
<FaButton variant="link" class="h-auto p-0" @click="emits('onLogin', form.values.account)">
|
||||
去登录
|
||||
</FaButton>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,108 @@
|
||||
<script setup lang="ts">
|
||||
import { FormControl, FormField, FormItem, FormMessage } from '@/ui/shadcn/ui/form'
|
||||
import { toTypedSchema } from '@vee-validate/zod'
|
||||
import { useForm } from 'vee-validate'
|
||||
import * as z from 'zod'
|
||||
|
||||
defineOptions({
|
||||
name: 'ResetPasswordForm',
|
||||
})
|
||||
|
||||
const props = defineProps<{
|
||||
account?: string
|
||||
}>()
|
||||
|
||||
const emits = defineEmits<{
|
||||
onLogin: [account?: string]
|
||||
onResetPassword: [account?: string]
|
||||
}>()
|
||||
|
||||
const loading = ref(false)
|
||||
|
||||
const form = useForm({
|
||||
validationSchema: toTypedSchema(z.object({
|
||||
account: z.string().min(1, '请输入用户名'),
|
||||
captcha: z.string().min(6, '请输入验证码'),
|
||||
newPassword: z.string().min(1, '请输入新密码').min(6, '密码长度为6到18位').max(18, '密码长度为6到18位'),
|
||||
})),
|
||||
initialValues: {
|
||||
account: props.account ?? '',
|
||||
captcha: '',
|
||||
newPassword: '',
|
||||
},
|
||||
})
|
||||
const onSubmit = form.handleSubmit((values) => {
|
||||
loading.value = true
|
||||
emits('onResetPassword', values.account)
|
||||
})
|
||||
|
||||
const countdown = ref(0)
|
||||
const countdownInterval = ref(Number.NaN)
|
||||
function handleSendCaptcha() {
|
||||
countdown.value = 60
|
||||
countdownInterval.value = window.setInterval(() => {
|
||||
countdown.value--
|
||||
if (countdown.value === 0) {
|
||||
clearInterval(countdownInterval.value)
|
||||
}
|
||||
}, 1000)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="min-h-500px w-full flex-col-stretch-center p-12">
|
||||
<form @submit="onSubmit">
|
||||
<div class="mb-8 space-y-2">
|
||||
<h3 class="text-4xl color-[var(--el-text-color-primary)] font-bold">
|
||||
忘记密码了? 🔒
|
||||
</h3>
|
||||
<p class="text-sm text-muted-foreground lg:text-base">
|
||||
演示系统未提供该功能
|
||||
</p>
|
||||
</div>
|
||||
<FormField v-slot="{ componentField, errors }" name="account">
|
||||
<FormItem class="relative pb-6 space-y-0">
|
||||
<FormControl>
|
||||
<FaInput type="text" placeholder="请输入用户名" class="w-full" :class="errors.length && 'border-destructive'" v-bind="componentField" />
|
||||
</FormControl>
|
||||
<Transition enter-active-class="transition-opacity" enter-from-class="opacity-0" leave-active-class="transition-opacity" leave-to-class="opacity-0">
|
||||
<FormMessage class="absolute bottom-1 text-xs" />
|
||||
</Transition>
|
||||
</FormItem>
|
||||
</FormField>
|
||||
<div class="flex-start-between gap-2">
|
||||
<FormField v-slot="{ componentField, value, setValue }" name="captcha">
|
||||
<FormItem class="relative pb-6 space-y-0">
|
||||
<FormControl>
|
||||
<FaPinInput :model-value="value" :name="componentField.name" :length="6" class="border-destructive" @update:model-value="val => setValue(val)" />
|
||||
</FormControl>
|
||||
<Transition enter-active-class="transition-opacity" enter-from-class="opacity-0" leave-active-class="transition-opacity" leave-to-class="opacity-0">
|
||||
<FormMessage class="absolute bottom-1 text-xs" />
|
||||
</Transition>
|
||||
</FormItem>
|
||||
</FormField>
|
||||
<FaButton variant="outline" size="lg" :disabled="countdown > 0" class="flex-1 px-4" @click="handleSendCaptcha">
|
||||
{{ countdown === 0 ? '发送验证码' : `${countdown} 秒后可重新发送` }}
|
||||
</FaButton>
|
||||
</div>
|
||||
<FormField v-slot="{ componentField, errors }" name="newPassword">
|
||||
<FormItem class="relative pb-6 space-y-0">
|
||||
<FormControl>
|
||||
<FaInput type="password" placeholder="请输入新密码" class="w-full" :class="errors.length && 'border-destructive'" v-bind="componentField" />
|
||||
</FormControl>
|
||||
<Transition enter-active-class="transition-opacity" enter-from-class="opacity-0" leave-active-class="transition-opacity" leave-to-class="opacity-0">
|
||||
<FormMessage class="absolute bottom-1 text-xs" />
|
||||
</Transition>
|
||||
</FormItem>
|
||||
</FormField>
|
||||
<FaButton :loading="loading" size="lg" class="mt-4 w-full" type="submit">
|
||||
确认
|
||||
</FaButton>
|
||||
<div class="mt-4 flex-center gap-2 text-sm color-[var(--el-text-color-secondary)]">
|
||||
<FaButton variant="link" class="h-auto p-0" @click="emits('onLogin', form.values.account)">
|
||||
去登录
|
||||
</FaButton>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,20 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
defineOptions({
|
||||
name: 'Auth',
|
||||
})
|
||||
|
||||
const props = defineProps<{
|
||||
value: string | string[]
|
||||
}>()
|
||||
|
||||
function check() {
|
||||
return useAuth().auth(props.value)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<slot v-if="check()" />
|
||||
<slot v-else name="no-auth" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,20 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
defineOptions({
|
||||
name: 'AuthAll',
|
||||
})
|
||||
|
||||
const props = defineProps<{
|
||||
value: string[]
|
||||
}>()
|
||||
|
||||
function check() {
|
||||
return useAuth().authAll(props.value)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<slot v-if="check()" />
|
||||
<slot v-else name="no-auth" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -17,6 +17,7 @@ const props = withDefaults(
|
||||
files?: UploadUserFile[]
|
||||
notip?: boolean
|
||||
ext?: string[]
|
||||
httpRequest?: UploadProps['httpRequest']
|
||||
}>(),
|
||||
{
|
||||
name: 'file',
|
||||
@@ -29,11 +30,15 @@ const props = withDefaults(
|
||||
)
|
||||
|
||||
const emits = defineEmits<{
|
||||
'onSuccess': [
|
||||
onSuccess: [
|
||||
res: any,
|
||||
file: UploadUserFile,
|
||||
fileList: UploadUserFile[],
|
||||
]
|
||||
onRemove: [
|
||||
file: UploadUserFile,
|
||||
fileList: UploadUserFile[],
|
||||
]
|
||||
}>()
|
||||
|
||||
const beforeUpload: UploadProps['beforeUpload'] = (file) => {
|
||||
@@ -57,6 +62,33 @@ const onExceed: UploadProps['onExceed'] = () => {
|
||||
const onSuccess: UploadProps['onSuccess'] = (res, file, fileList) => {
|
||||
emits('onSuccess', res, file, fileList)
|
||||
}
|
||||
|
||||
const onRemove: UploadProps['onRemove'] = (file, fileList) => {
|
||||
emits('onRemove', file, fileList)
|
||||
}
|
||||
|
||||
const onPreview: UploadProps['onPreview'] = (e) => {
|
||||
const getBlob = (url: string) => new Promise((resolve) => {
|
||||
const xhr = new XMLHttpRequest()
|
||||
xhr.open('GET', url, true)
|
||||
xhr.responseType = 'blob'
|
||||
xhr.onload = () => {
|
||||
if (xhr.status === 200) {
|
||||
resolve(xhr.response)
|
||||
}
|
||||
}
|
||||
xhr.send()
|
||||
})
|
||||
getBlob(e.url!).then((blob: any) => {
|
||||
const a = document.createElement('a')
|
||||
const url = window.URL.createObjectURL(blob)
|
||||
const event = new MouseEvent('click')
|
||||
a.target = '_blank'
|
||||
a.download = e.name
|
||||
a.href = url
|
||||
a.dispatchEvent(event)
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -68,12 +100,15 @@ const onSuccess: UploadProps['onSuccess'] = (res, file, fileList) => {
|
||||
:before-upload="beforeUpload"
|
||||
:on-exceed="onExceed"
|
||||
:on-success="onSuccess"
|
||||
:on-remove="onRemove"
|
||||
:on-preview="onPreview"
|
||||
:http-request="httpRequest"
|
||||
:file-list="files"
|
||||
:limit="max"
|
||||
drag
|
||||
>
|
||||
<div class="slot">
|
||||
<SvgIcon name="ep:upload-filled" class="el-icon--upload" />
|
||||
<FaIcon name="i-ep:upload-filled" class="el-icon--upload" />
|
||||
<div class="el-upload__text">
|
||||
将文件拖到此处,或<em>点击上传</em>
|
||||
</div>
|
||||
@@ -88,7 +123,7 @@ const onSuccess: UploadProps['onSuccess'] = (res, file, fileList) => {
|
||||
</ElUpload>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped>
|
||||
:deep(.el-upload.is-drag) {
|
||||
display: inline-block;
|
||||
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
defineOptions({
|
||||
name: 'FixedActionBar',
|
||||
})
|
||||
|
||||
const isBottom = ref(false)
|
||||
|
||||
onMounted(() => {
|
||||
onScroll()
|
||||
window.addEventListener('scroll', onScroll)
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
window.removeEventListener('scroll', onScroll)
|
||||
})
|
||||
|
||||
function onScroll() {
|
||||
// 变量scrollTop是滚动条滚动时,滚动条上端距离顶部的距离
|
||||
const scrollTop = document.documentElement.scrollTop || document.body.scrollTop
|
||||
// 变量windowHeight是可视区的高度
|
||||
const windowHeight = document.documentElement.clientHeight || document.body.clientHeight
|
||||
// 变量scrollHeight是滚动条的总高度(当前可滚动的页面的总高度)
|
||||
const scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight
|
||||
// 滚动条到底部
|
||||
isBottom.value = Math.ceil(scrollTop + windowHeight) >= scrollHeight
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
class="bottom-0 z-4 bg-[var(--g-container-bg)] p-5 text-center transition" :class="[
|
||||
isBottom ? 'shadow-[0_0_1px_0_var(--g-box-shadow-color)]' : 'shadow-[0_-10px_10px_-10px_var(--g-box-shadow-color)]',
|
||||
]" data-fixed-calc-width
|
||||
>
|
||||
<slot />
|
||||
</div>
|
||||
</template>
|
||||
@@ -28,22 +28,22 @@ const realHeight = computed(() => {
|
||||
<ElImage :src="src" fit="cover" :style="`width:${realWidth};height:${realHeight};`" :preview-src-list="[src]" preview-teleported>
|
||||
<template #error>
|
||||
<div class="image-slot">
|
||||
<SvgIcon name="image-load-fail" />
|
||||
<FaIcon name="i-ph:image-broken-duotone" />
|
||||
</div>
|
||||
</template>
|
||||
</ElImage>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped>
|
||||
.el-image {
|
||||
border-radius: 5px;
|
||||
background-color: var(--el-fill-color);
|
||||
border-radius: 5px;
|
||||
box-shadow: var(--el-box-shadow-light);
|
||||
transition: background-color 0.3s, var(--el-transition-box-shadow);
|
||||
|
||||
:deep(.el-image__inner) {
|
||||
transition: all 0.3s;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s;
|
||||
|
||||
&:hover {
|
||||
transform: scale(1.2);
|
||||
@@ -52,12 +52,12 @@ const realHeight = computed(() => {
|
||||
|
||||
:deep(.image-slot) {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
color: #909399;
|
||||
font-size: 30px;
|
||||
color: #909399;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -12,17 +12,16 @@ const props = withDefaults(
|
||||
headers?: UploadProps['headers']
|
||||
data?: UploadProps['data']
|
||||
name?: UploadProps['name']
|
||||
url?: string
|
||||
size?: number
|
||||
width?: number
|
||||
height?: number
|
||||
placeholder?: string
|
||||
notip?: boolean
|
||||
ext?: string[]
|
||||
httpRequest?: UploadProps['httpRequest']
|
||||
}>(),
|
||||
{
|
||||
name: 'file',
|
||||
url: '',
|
||||
size: 2,
|
||||
width: 150,
|
||||
height: 150,
|
||||
@@ -33,14 +32,15 @@ const props = withDefaults(
|
||||
)
|
||||
|
||||
const emits = defineEmits<{
|
||||
'update:url': [
|
||||
url: string,
|
||||
]
|
||||
'onSuccess': [
|
||||
onSuccess: [
|
||||
res: any,
|
||||
]
|
||||
}>()
|
||||
|
||||
const url = defineModel<string>({
|
||||
default: '',
|
||||
})
|
||||
|
||||
const uploadData = ref({
|
||||
imageViewerVisible: false,
|
||||
progress: {
|
||||
@@ -59,7 +59,7 @@ function previewClose() {
|
||||
}
|
||||
// 移除
|
||||
function remove() {
|
||||
emits('update:url', '')
|
||||
url.value = ''
|
||||
}
|
||||
const beforeUpload: UploadProps['beforeUpload'] = (file) => {
|
||||
const fileName = file.name.split('.')
|
||||
@@ -98,13 +98,14 @@ const onSuccess: UploadProps['onSuccess'] = (res) => {
|
||||
:before-upload="beforeUpload"
|
||||
:on-progress="onProgress"
|
||||
:on-success="onSuccess"
|
||||
:http-request="httpRequest"
|
||||
drag
|
||||
class="image-upload"
|
||||
>
|
||||
<ElImage v-if="url === ''" :src="url === '' ? placeholder : url" :style="`width:${width}px;height:${height}px;`" fit="fill">
|
||||
<template #error>
|
||||
<div class="image-slot" :style="`width:${width}px;height:${height}px;`">
|
||||
<SvgIcon name="ep:plus" class="icon" />
|
||||
<FaIcon name="i-ep:plus" class="icon" />
|
||||
</div>
|
||||
</template>
|
||||
</ElImage>
|
||||
@@ -112,11 +113,11 @@ const onSuccess: UploadProps['onSuccess'] = (res) => {
|
||||
<ElImage :src="url" :style="`width:${width}px;height:${height}px;`" fit="fill" />
|
||||
<div class="mask">
|
||||
<div class="actions">
|
||||
<span title="预览" @click.stop="preview">
|
||||
<SvgIcon name="ep:zoom-in" class="icon" />
|
||||
<span @click.stop="preview">
|
||||
<FaIcon name="i-ep:zoom-in" class="icon" />
|
||||
</span>
|
||||
<span title="移除" @click.stop="remove">
|
||||
<SvgIcon name="ep:delete" class="icon" />
|
||||
<span @click.stop="remove">
|
||||
<FaIcon name="i-ep:delete" class="icon" />
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -135,7 +136,7 @@ const onSuccess: UploadProps['onSuccess'] = (res) => {
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped>
|
||||
.upload-container {
|
||||
line-height: initial;
|
||||
}
|
||||
@@ -146,33 +147,35 @@ const onSuccess: UploadProps['onSuccess'] = (res) => {
|
||||
|
||||
.image {
|
||||
position: relative;
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
border-radius: 6px;
|
||||
|
||||
.mask {
|
||||
opacity: 0;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: var(--el-overlay-color-lighter);
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s;
|
||||
|
||||
.actions {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
@include position-center(xy);
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
transform: translateX(-50%) translateY(-50%);
|
||||
|
||||
span {
|
||||
width: 50%;
|
||||
color: var(--el-color-white);
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
color: var(--el-color-white);
|
||||
transition: color 0.1s, transform 0.1s;
|
||||
|
||||
&:hover {
|
||||
@@ -207,8 +210,8 @@ const onSuccess: UploadProps['onSuccess'] = (res) => {
|
||||
|
||||
.image-slot {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
color: var(--el-text-color-placeholder);
|
||||
@@ -224,19 +227,21 @@ const onSuccess: UploadProps['onSuccess'] = (res) => {
|
||||
top: 0;
|
||||
|
||||
&::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
left: 0;
|
||||
top: 0;
|
||||
content: "";
|
||||
background-color: var(--el-overlay-color-lighter);
|
||||
}
|
||||
|
||||
.el-progress {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
z-index: 1;
|
||||
|
||||
@include position-center(xy);
|
||||
transform: translateX(-50%) translateY(-50%);
|
||||
|
||||
.el-progress__text {
|
||||
color: var(--el-text-color-placeholder);
|
||||
|
||||
@@ -12,7 +12,6 @@ const props = withDefaults(
|
||||
headers?: UploadProps['headers']
|
||||
data?: UploadProps['data']
|
||||
name?: UploadProps['name']
|
||||
url?: string[]
|
||||
size?: number
|
||||
max?: number
|
||||
width?: number
|
||||
@@ -20,10 +19,10 @@ const props = withDefaults(
|
||||
placeholder?: string
|
||||
notip?: boolean
|
||||
ext?: string[]
|
||||
httpRequest?: UploadProps['httpRequest']
|
||||
}>(),
|
||||
{
|
||||
name: 'file',
|
||||
url: () => [],
|
||||
size: 2,
|
||||
max: 3,
|
||||
width: 150,
|
||||
@@ -35,14 +34,15 @@ const props = withDefaults(
|
||||
)
|
||||
|
||||
const emits = defineEmits<{
|
||||
'update:url': [
|
||||
url: string[],
|
||||
]
|
||||
'onSuccess': [
|
||||
onSuccess: [
|
||||
res: any,
|
||||
]
|
||||
}>()
|
||||
|
||||
const url = defineModel<string[]>({
|
||||
default: [],
|
||||
})
|
||||
|
||||
const uploadData = ref({
|
||||
dialogImageIndex: 0,
|
||||
imageViewerVisible: false,
|
||||
@@ -63,20 +63,16 @@ function previewClose() {
|
||||
}
|
||||
// 移除
|
||||
function remove(index: number) {
|
||||
const url = props.url
|
||||
url.splice(index, 1)
|
||||
emits('update:url', url)
|
||||
url.value.splice(index, 1)
|
||||
}
|
||||
// 移动
|
||||
function move(index: number, type: 'left' | 'right') {
|
||||
const url = props.url
|
||||
if (type === 'left' && index !== 0) {
|
||||
url[index] = url.splice(index - 1, 1, url[index])[0]
|
||||
url.value[index] = url.value.splice(index - 1, 1, url.value[index])[0]
|
||||
}
|
||||
if (type === 'right' && index !== url.length - 1) {
|
||||
url[index] = url.splice(index + 1, 1, url[index])[0]
|
||||
if (type === 'right' && index !== url.value.length - 1) {
|
||||
url.value[index] = url.value.splice(index + 1, 1, url.value[index])[0]
|
||||
}
|
||||
emits('update:url', url)
|
||||
}
|
||||
|
||||
const beforeUpload: UploadProps['beforeUpload'] = (file) => {
|
||||
@@ -111,17 +107,17 @@ const onSuccess: UploadProps['onSuccess'] = (res) => {
|
||||
<ElImage v-if="index < max" :src="item" :style="`width:${width}px;height:${height}px;`" fit="cover" />
|
||||
<div class="mask">
|
||||
<div class="actions">
|
||||
<span title="预览" @click="preview(index)">
|
||||
<SvgIcon name="ep:zoom-in" class="icon" />
|
||||
<span @click="preview(index)">
|
||||
<FaIcon name="i-ep:zoom-in" class="icon" />
|
||||
</span>
|
||||
<span title="移除" @click="remove(index)">
|
||||
<SvgIcon name="ep:delete" class="icon" />
|
||||
<span @click="remove(index)">
|
||||
<FaIcon name="i-ep:delete" class="icon" />
|
||||
</span>
|
||||
<span v-show="url.length > 1" title="左移" :class="{ disabled: index === 0 }" @click="move(index, 'left')">
|
||||
<SvgIcon name="ep:back" class="icon" />
|
||||
<span v-show="url.length > 1" :class="{ disabled: index === 0 }" @click="move(index, 'left')">
|
||||
<FaIcon name="i-ep:back" class="icon" />
|
||||
</span>
|
||||
<span v-show="url.length > 1" title="右移" :class="{ disabled: index === url.length - 1 }" @click="move(index, 'right')">
|
||||
<SvgIcon name="ep:right" class="icon" />
|
||||
<span v-show="url.length > 1" :class="{ disabled: index === url.length - 1 }" @click="move(index, 'right')">
|
||||
<FaIcon name="i-ep:right" class="icon" />
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -136,11 +132,12 @@ const onSuccess: UploadProps['onSuccess'] = (res) => {
|
||||
:before-upload="beforeUpload"
|
||||
:on-progress="onProgress"
|
||||
:on-success="onSuccess"
|
||||
:http-request="httpRequest"
|
||||
drag
|
||||
class="images-upload"
|
||||
>
|
||||
<div class="image-slot" :style="`width:${width}px;height:${height}px;`">
|
||||
<SvgIcon name="ep:plus" class="icon" />
|
||||
<FaIcon name="i-ep:plus" class="icon" />
|
||||
</div>
|
||||
<div v-show="uploadData.progress.percent" class="progress" :style="`width:${width}px;height:${height}px;`">
|
||||
<ElImage :src="uploadData.progress.preview" :style="`width:${width}px;height:${height}px;`" fit="fill" />
|
||||
@@ -156,7 +153,7 @@ const onSuccess: UploadProps['onSuccess'] = (res) => {
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped>
|
||||
.upload-container {
|
||||
line-height: initial;
|
||||
}
|
||||
@@ -168,35 +165,37 @@ const onSuccess: UploadProps['onSuccess'] = (res) => {
|
||||
.images {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
margin-right: 10px;
|
||||
margin-inline-end: 10px;
|
||||
overflow: hidden;
|
||||
border: 1px dashed var(--el-border-color);
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
|
||||
.mask {
|
||||
opacity: 0;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: var(--el-overlay-color-lighter);
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s;
|
||||
|
||||
.actions {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
@include position-center(xy);
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
transform: translateX(-50%) translateY(-50%);
|
||||
|
||||
span {
|
||||
width: 50%;
|
||||
color: var(--el-color-white);
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
color: var(--el-color-white);
|
||||
transition: color 0.1s, transform 0.1s;
|
||||
|
||||
&.disabled {
|
||||
@@ -236,8 +235,8 @@ const onSuccess: UploadProps['onSuccess'] = (res) => {
|
||||
|
||||
.image-slot {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
color: var(--el-text-color-placeholder);
|
||||
@@ -253,19 +252,21 @@ const onSuccess: UploadProps['onSuccess'] = (res) => {
|
||||
top: 0;
|
||||
|
||||
&::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
left: 0;
|
||||
top: 0;
|
||||
content: "";
|
||||
background-color: var(--el-overlay-color-lighter);
|
||||
}
|
||||
|
||||
.el-progress {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
z-index: 1;
|
||||
|
||||
@include position-center(xy);
|
||||
transform: translateX(-50%) translateY(-50%);
|
||||
|
||||
.el-progress__text {
|
||||
color: var(--el-text-color-placeholder);
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
defineOptions({
|
||||
name: 'PageHeader',
|
||||
})
|
||||
|
||||
defineProps<{
|
||||
title?: string
|
||||
content?: string
|
||||
}>()
|
||||
|
||||
const slots = useSlots()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="page-header mb-5 flex flex-wrap items-center justify-between gap-5 bg-[var(--g-container-bg)] px-5 py-4 transition-background-color-300">
|
||||
<div class="main flex-[1_1_70%]">
|
||||
<div class="text-2xl">
|
||||
<slot name="title">
|
||||
{{ title }}
|
||||
</slot>
|
||||
</div>
|
||||
<div class="mt-2 text-sm text-stone-5 empty:hidden">
|
||||
<slot name="content">
|
||||
{{ content }}
|
||||
</slot>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="slots.default" class="ml-a flex-none">
|
||||
<slot />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,47 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
defineOptions({
|
||||
name: 'PageMain',
|
||||
})
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
title?: string
|
||||
collaspe?: boolean
|
||||
height?: string
|
||||
}>(),
|
||||
{
|
||||
title: '',
|
||||
collaspe: false,
|
||||
height: '',
|
||||
},
|
||||
)
|
||||
|
||||
const titleSlot = !!useSlots().title
|
||||
|
||||
const isCollaspe = ref(props.collaspe)
|
||||
function unCollaspe() {
|
||||
isCollaspe.value = false
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
class="page-main relative m-4 flex flex-col bg-[var(--g-container-bg)] transition-background-color-300" :class="{
|
||||
'of-hidden': isCollaspe,
|
||||
}" :style="{
|
||||
height: isCollaspe ? height : '',
|
||||
}"
|
||||
>
|
||||
<div v-if="titleSlot || title" class="title-container border-b-1 border-b-[var(--g-bg)] border-b-solid px-5 py-4 transition-border-color-300">
|
||||
<slot name="title">
|
||||
{{ title }}
|
||||
</slot>
|
||||
</div>
|
||||
<div class="main-container p-5">
|
||||
<slot />
|
||||
</div>
|
||||
<div v-if="isCollaspe" class="collaspe absolute bottom-0 w-full cursor-pointer from-transparent to-[var(--g-container-bg)] bg-gradient-to-b pb-2 pt-10 text-center" @click="unCollaspe">
|
||||
<SvgIcon name="ep:arrow-down" class="text-xl op-30 transition-opacity hover:op-100" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,149 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
// 行政区划数据来源于 https://github.com/modood/Administrative-divisions-of-China
|
||||
import pcasRaw from './pcas-code.json'
|
||||
|
||||
defineOptions({
|
||||
name: 'PcasCascader',
|
||||
})
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
modelValue: string[] | {
|
||||
code: string
|
||||
name: string
|
||||
}[]
|
||||
disabled?: boolean
|
||||
type?: 'pc' | 'pca' | 'pcas'
|
||||
format?: 'code' | 'name' | 'both'
|
||||
}>(),
|
||||
{
|
||||
disabled: false,
|
||||
type: 'pca',
|
||||
format: 'code',
|
||||
},
|
||||
)
|
||||
|
||||
const emits = defineEmits<{
|
||||
'update:modelValue': [
|
||||
value: string[] | {
|
||||
code: string
|
||||
name: string
|
||||
}[],
|
||||
]
|
||||
}>()
|
||||
|
||||
interface pcasItem {
|
||||
code: string
|
||||
name: string
|
||||
children?: pcasItem[]
|
||||
}
|
||||
|
||||
const pcasData = computed(() => {
|
||||
const data: pcasItem[] = []
|
||||
// 省份
|
||||
pcasRaw.forEach((p) => {
|
||||
const tempP: pcasItem = {
|
||||
code: p.code,
|
||||
name: p.name,
|
||||
}
|
||||
const tempChildrenC: pcasItem[] = []
|
||||
// 城市
|
||||
p.children.forEach((c) => {
|
||||
const tempC: pcasItem = {
|
||||
code: c.code,
|
||||
name: c.name,
|
||||
}
|
||||
if (['pca', 'pcas'].includes(props.type)) {
|
||||
const tempChildrenA: pcasItem[] = []
|
||||
// 区县
|
||||
c.children.forEach((a) => {
|
||||
const tempA: pcasItem = {
|
||||
code: a.code,
|
||||
name: a.name,
|
||||
}
|
||||
if (props.type === 'pcas') {
|
||||
const tempChildrenS: pcasItem[] = []
|
||||
// 街道
|
||||
a.children.forEach((s) => {
|
||||
const tempS: pcasItem = {
|
||||
code: s.code,
|
||||
name: s.name,
|
||||
}
|
||||
tempChildrenS.push(tempS)
|
||||
})
|
||||
tempA.children = tempChildrenS
|
||||
}
|
||||
tempChildrenA.push(tempA)
|
||||
})
|
||||
tempC.children = tempChildrenA
|
||||
}
|
||||
tempChildrenC.push(tempC)
|
||||
})
|
||||
tempP.children = tempChildrenC
|
||||
data.push(tempP)
|
||||
})
|
||||
return data
|
||||
})
|
||||
|
||||
const myValue = computed({
|
||||
// 将入参数据转成 code 码
|
||||
get: () => {
|
||||
return anyToCode(props.modelValue)
|
||||
},
|
||||
// 将 code 码转成出参数据
|
||||
set: (value) => {
|
||||
emits('update:modelValue', value ? codeToAny(value) : [])
|
||||
},
|
||||
})
|
||||
|
||||
function anyToCode(value: any[], dictionarie: any[] = pcasData.value) {
|
||||
const input: string[] = []
|
||||
if (value.length > 0) {
|
||||
const findItem = dictionarie.find((item) => {
|
||||
if (props.format === 'code') {
|
||||
return item.code === value[0]
|
||||
}
|
||||
else if (props.format === 'name') {
|
||||
return item.name === value[0]
|
||||
}
|
||||
else {
|
||||
return item.name === value[0].name && item.code === value[0].code
|
||||
}
|
||||
})
|
||||
input.push(findItem.code)
|
||||
if (findItem.children) {
|
||||
input.push(...anyToCode(value.slice(1 - value.length), findItem.children))
|
||||
}
|
||||
}
|
||||
return input
|
||||
}
|
||||
|
||||
function codeToAny(codes: string[], dictionarie: any[] = pcasData.value): any {
|
||||
const output = []
|
||||
const findItem = dictionarie.find(item => item.code === codes[0])
|
||||
if (findItem) {
|
||||
switch (props.format) {
|
||||
case 'code':
|
||||
output.push(findItem.code)
|
||||
break
|
||||
case 'name':
|
||||
output.push(findItem.name)
|
||||
break
|
||||
case 'both':
|
||||
output.push({
|
||||
code: findItem.code,
|
||||
name: findItem.name,
|
||||
})
|
||||
}
|
||||
const newCodes = codes.slice(1 - codes.length)
|
||||
if (newCodes.length > 0 && findItem.children) {
|
||||
output.push(...codeToAny(newCodes, findItem.children))
|
||||
}
|
||||
}
|
||||
return output
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ElCascader v-model="myValue" :options="pcasData as any[]" :props="{ value: 'code', label: 'name' }" :disabled="disabled" clearable filterable />
|
||||
</template>
|
||||
File diff suppressed because one or more lines are too long
@@ -1,55 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
defineOptions({
|
||||
name: 'SearchBar',
|
||||
})
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
fold?: boolean
|
||||
showToggle?: boolean
|
||||
background?: boolean
|
||||
}>(),
|
||||
{
|
||||
fold: true,
|
||||
showToggle: true,
|
||||
background: false,
|
||||
},
|
||||
)
|
||||
|
||||
const emits = defineEmits<{
|
||||
'update:fold': [
|
||||
value: boolean,
|
||||
]
|
||||
'toggle': [
|
||||
value: boolean,
|
||||
]
|
||||
}>()
|
||||
|
||||
const isFold = ref(props.fold)
|
||||
|
||||
watch(() => props.fold, (value) => {
|
||||
isFold.value = value
|
||||
emits('update:fold', value)
|
||||
})
|
||||
|
||||
function toggle() {
|
||||
isFold.value = !isFold.value
|
||||
emits('toggle', isFold.value)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
class="relative" :class="{
|
||||
'py-4': showToggle,
|
||||
'px-4 bg-[var(--g-bg)] transition': background,
|
||||
}"
|
||||
>
|
||||
<slot :fold="isFold" />
|
||||
<div v-if="showToggle" class="absolute bottom-0 left-0 w-full translate-y-1/2 text-center">
|
||||
<button class="h-5 inline-flex cursor-pointer select-none items-center border-size-0 rounded bg-[var(--g-bg)] px-2 text-xs font-medium outline-none" @click="toggle">
|
||||
<SvgIcon :name="isFold ? 'ep:caret-bottom' : 'ep:caret-top' " />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,78 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { Icon } from '@iconify/vue'
|
||||
import { isOfflineUse } from '@/iconify/index.json'
|
||||
|
||||
defineOptions({
|
||||
name: 'SvgIcon',
|
||||
})
|
||||
|
||||
const props = defineProps<{
|
||||
name: string
|
||||
async?: boolean
|
||||
flip?: 'horizontal' | 'vertical' | 'both'
|
||||
rotate?: number
|
||||
color?: string
|
||||
size?: string | number
|
||||
}>()
|
||||
|
||||
const outputType = computed(() => {
|
||||
if (props.name.indexOf('i-') === 0) {
|
||||
return (props.async || isOfflineUse) ? 'svg' : 'css'
|
||||
}
|
||||
else if (props.name.includes(':')) {
|
||||
return 'svg'
|
||||
}
|
||||
else {
|
||||
return 'custom'
|
||||
}
|
||||
})
|
||||
|
||||
const outputName = computed(() => {
|
||||
if (props.name.indexOf('i-') === 0) {
|
||||
let conversionName = props.name
|
||||
if (props.async || isOfflineUse) {
|
||||
conversionName = conversionName.replace('i-', '')
|
||||
}
|
||||
return conversionName
|
||||
}
|
||||
else {
|
||||
return props.name
|
||||
}
|
||||
})
|
||||
|
||||
const style = computed(() => {
|
||||
const transform = []
|
||||
if (props.flip) {
|
||||
switch (props.flip) {
|
||||
case 'horizontal':
|
||||
transform.push('rotateY(180deg)')
|
||||
break
|
||||
case 'vertical':
|
||||
transform.push('rotateX(180deg)')
|
||||
break
|
||||
case 'both':
|
||||
transform.push('rotateX(180deg)')
|
||||
transform.push('rotateY(180deg)')
|
||||
break
|
||||
}
|
||||
}
|
||||
if (props.rotate) {
|
||||
transform.push(`rotate(${props.rotate % 360}deg)`)
|
||||
}
|
||||
return {
|
||||
...(props.color && { color: props.color }),
|
||||
...(props.size && { fontSize: typeof props.size === 'number' ? `${props.size}px` : props.size }),
|
||||
...(transform.length && { transform: transform.join(' ') }),
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<i class="relative h-[1em] w-[1em] flex-inline items-center justify-center fill-current leading-[1em]" :style="style">
|
||||
<i v-if="outputType === 'css'" :class="outputName" />
|
||||
<Icon v-else-if="outputType === 'svg'" :icon="outputName" />
|
||||
<svg v-else h-1em w-1em aria-hidden="true">
|
||||
<use :xlink:href="`#icon-${outputName}`" />
|
||||
</svg>
|
||||
</i>
|
||||
</template>
|
||||
@@ -1,64 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import eventBus from '@/utils/eventBus'
|
||||
|
||||
const isShow = ref(false)
|
||||
|
||||
const { pkg, lastBuildTime } = __SYSTEM_INFO__
|
||||
|
||||
onMounted(() => {
|
||||
eventBus.on('global-system-info-toggle', () => {
|
||||
isShow.value = !isShow.value
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<HSlideover v-model="isShow" title="系统信息">
|
||||
<div class="px-4">
|
||||
<h2 class="m-0 text-lg font-bold">
|
||||
版本号
|
||||
</h2>
|
||||
<div class="my-4 text-center text-lg font-sans">
|
||||
{{ pkg.version }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-4">
|
||||
<h2 class="m-0 text-lg font-bold">
|
||||
最后编译时间
|
||||
</h2>
|
||||
<div class="my-4 text-center text-lg font-sans">
|
||||
{{ lastBuildTime }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-4">
|
||||
<h2 class="m-0 text-lg font-bold">
|
||||
生产环境依赖
|
||||
</h2>
|
||||
<ul class="list-none pl-0 text-sm">
|
||||
<li v-for="(val, key) in (pkg.dependencies as object)" :key="key" class="flex items-center justify-between rounded px-2 py-1.5 hover:bg-stone-1 dark:hover:bg-stone-9">
|
||||
<div class="font-bold">
|
||||
{{ key }}
|
||||
</div>
|
||||
<div class="font-sans">
|
||||
{{ val }}
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="px-4">
|
||||
<h2 class="m-0 text-lg font-bold">
|
||||
开发环境依赖
|
||||
</h2>
|
||||
<ul class="list-none pl-0 text-sm">
|
||||
<li v-for="(val, key) in (pkg.devDependencies as object)" :key="key" class="flex items-center justify-between rounded px-2 py-1.5 hover:bg-stone-1 dark:hover:bg-stone-9">
|
||||
<div class="font-bold">
|
||||
{{ key }}
|
||||
</div>
|
||||
<div class="font-sans">
|
||||
{{ val }}
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</HSlideover>
|
||||
</template>
|
||||
@@ -1,38 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
defineOptions({
|
||||
name: 'Trend',
|
||||
})
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
value: string
|
||||
type?: 'up' | 'down'
|
||||
prefix?: string
|
||||
suffix?: string
|
||||
reverse?: boolean
|
||||
}>(),
|
||||
{
|
||||
type: 'up',
|
||||
prefix: '',
|
||||
suffix: '',
|
||||
reverse: false,
|
||||
},
|
||||
)
|
||||
|
||||
const isUp = computed(() => {
|
||||
let isUp = props.type === 'up'
|
||||
if (props.reverse) {
|
||||
isUp = !isUp
|
||||
}
|
||||
return isUp
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex items-center transition" :class="`${isUp ? 'c-green' : 'c-red'}`">
|
||||
<span v-if="prefix" class="prefix">{{ prefix }}</span>
|
||||
<span class="text">{{ value }}</span>
|
||||
<span v-if="suffix" class="suffix">{{ suffix }}</span>
|
||||
<SvgIcon name="ep:caret-top" :rotate="isUp ? 0 : 180" class="ml-1 transition" />
|
||||
</div>
|
||||
</template>
|
||||
Executable → Regular
+1
-1
File diff suppressed because one or more lines are too long
@@ -1,10 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import { useClipboard } from '@vueuse/core'
|
||||
import Message from 'vue-m-message'
|
||||
import settingsDefault from '@/settings.default'
|
||||
import eventBus from '@/utils/eventBus'
|
||||
import useSettingsStore from '@/store/modules/settings'
|
||||
import useMenuStore from '@/store/modules/menu'
|
||||
import useSettingsStore from '@/store/modules/settings'
|
||||
import eventBus from '@/utils/eventBus'
|
||||
import { diffTwoObj } from '@/utils/object'
|
||||
import { useClipboard } from '@vueuse/core'
|
||||
import { toast } from 'vue-sonner'
|
||||
|
||||
defineOptions({
|
||||
name: 'AppSetting',
|
||||
@@ -17,16 +18,16 @@ const menuStore = useMenuStore()
|
||||
|
||||
const isShow = ref(false)
|
||||
|
||||
const isDark = computed({
|
||||
const appRadius = computed<number[]>({
|
||||
get() {
|
||||
return settingsStore.settings.app.colorScheme === 'dark'
|
||||
return [settingsStore.settings.app.radius]
|
||||
},
|
||||
set(value) {
|
||||
settingsStore.settings.app.colorScheme = value ? 'dark' : 'light'
|
||||
settingsStore.settings.app.radius = value[0]
|
||||
},
|
||||
})
|
||||
|
||||
watch(() => settingsStore.settings.menu.menuMode, (value) => {
|
||||
watch(() => settingsStore.settings.menu.mode, (value) => {
|
||||
if (value === 'single') {
|
||||
menuStore.setActived(0)
|
||||
}
|
||||
@@ -45,377 +46,403 @@ const { copy, copied, isSupported } = useClipboard()
|
||||
|
||||
watch(copied, (val) => {
|
||||
if (val) {
|
||||
Message.success('复制成功,请粘贴到 src/settings.ts 文件中!', {
|
||||
zIndex: 2000,
|
||||
toast.success('复制成功,请粘贴到 src/settings.ts 文件中!', {
|
||||
position: 'top-center',
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
interface AnyObject {
|
||||
[key: string]: any
|
||||
}
|
||||
// 比较两个对象,并提取出不同的部分
|
||||
function getObjectDiff(originalObj: AnyObject, diffObj: AnyObject): AnyObject {
|
||||
if (typeof originalObj !== 'object' || typeof diffObj !== 'object') {
|
||||
return diffObj
|
||||
}
|
||||
const diff: AnyObject = {}
|
||||
for (const key in diffObj) {
|
||||
const originalValue = originalObj[key]
|
||||
const diffValue = diffObj[key]
|
||||
if (originalValue !== diffValue) {
|
||||
if (typeof originalValue === 'object' && typeof diffValue === 'object') {
|
||||
const nestedDiff = getObjectDiff(originalValue, diffValue)
|
||||
if (Object.keys(nestedDiff).length > 0) {
|
||||
diff[key] = nestedDiff
|
||||
}
|
||||
}
|
||||
else {
|
||||
diff[key] = diffValue
|
||||
}
|
||||
}
|
||||
}
|
||||
return diff
|
||||
}
|
||||
|
||||
function handleCopy() {
|
||||
copy(JSON.stringify(getObjectDiff(settingsDefault, settingsStore.settings), null, 2))
|
||||
copy(JSON.stringify(diffTwoObj(settingsDefault, settingsStore.settings), null, 2))
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<HSlideover v-model="isShow" title="应用配置">
|
||||
<FaDrawer v-model="isShow" title="应用配置" description="在生产环境中应关闭该模块" :footer="isSupported" content-class="sm:min-w-md">
|
||||
<div class="rounded-2 bg-rose/20 px-4 py-2 text-sm/6 c-rose">
|
||||
<p class="my-1">
|
||||
应用配置可实时预览效果,但只是临时生效,要想真正应用于项目,可以点击下方的「复制配置」按钮,并将配置粘贴到 src/settings.ts 文件中。
|
||||
</p>
|
||||
<p class="my-1">
|
||||
注意:在生产环境中应关闭该模块。
|
||||
</p>
|
||||
应用配置可实时预览效果,但只是临时生效,要想真正应用于项目,可以点击下方的「复制配置」按钮,并将配置粘贴到 src/settings.ts 文件中。
|
||||
</div>
|
||||
<div class="divider">
|
||||
颜色主题风格
|
||||
</div>
|
||||
<div class="flex items-center justify-center pb-4">
|
||||
<HToggle v-model="isDark" on-icon="ri:sun-line" off-icon="ri:moon-line" />
|
||||
</div>
|
||||
<div v-if="settingsStore.mode === 'pc'" class="divider">
|
||||
导航栏模式
|
||||
</div>
|
||||
<div v-if="settingsStore.mode === 'pc'" class="menu-mode">
|
||||
<HTooltip text="侧边栏模式 (含主导航)" placement="bottom" :delay="500">
|
||||
<div class="mode mode-side" :class="{ active: settingsStore.settings.menu.menuMode === 'side' }" @click="settingsStore.settings.menu.menuMode = 'side'">
|
||||
<div class="mode-container" />
|
||||
<div>
|
||||
<FaDivider>颜色主题风格</FaDivider>
|
||||
<div class="flex items-center justify-center pb-4">
|
||||
<FaTabs
|
||||
v-model="settingsStore.settings.app.colorScheme"
|
||||
:list="[
|
||||
{ icon: 'i-ri:sun-line', label: '明亮', value: 'light' },
|
||||
{ icon: 'i-ri:moon-line', label: '暗黑', value: 'dark' },
|
||||
{ icon: 'i-codicon:color-mode', label: '系统', value: '' },
|
||||
]"
|
||||
class="w-60"
|
||||
/>
|
||||
</div>
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
圆角系数
|
||||
</div>
|
||||
</HTooltip>
|
||||
<HTooltip text="顶部模式" placement="bottom" :delay="500">
|
||||
<div class="mode mode-head" :class="{ active: settingsStore.settings.menu.menuMode === 'head' }" @click="settingsStore.settings.menu.menuMode = 'head'">
|
||||
<div class="mode-container" />
|
||||
<FaSlider v-model="appRadius" :min="0" :max="1" :step="0.25" class="w-1/2" />
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="settingsStore.mode === 'pc'">
|
||||
<FaDivider>导航栏模式</FaDivider>
|
||||
<div class="menu-mode">
|
||||
<FaTooltip text="侧边栏模式 (含主导航)" :delay="500">
|
||||
<div class="mode mode-side" :class="{ active: settingsStore.settings.menu.mode === 'side' }" @click="settingsStore.settings.menu.mode = 'side'">
|
||||
<div class="mode-container" />
|
||||
</div>
|
||||
</FaTooltip>
|
||||
<FaTooltip text="顶部模式" :delay="500">
|
||||
<div class="mode mode-head" :class="{ active: settingsStore.settings.menu.mode === 'head' }" @click="settingsStore.settings.menu.mode = 'head'">
|
||||
<div class="mode-container" />
|
||||
</div>
|
||||
</FaTooltip>
|
||||
<FaTooltip text="侧边栏模式 (不含主导航)" :delay="500">
|
||||
<div class="mode mode-single" :class="{ active: settingsStore.settings.menu.mode === 'single' }" @click="settingsStore.settings.menu.mode = 'single'">
|
||||
<div class="mode-container" />
|
||||
</div>
|
||||
</FaTooltip>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<FaDivider>导航栏</FaDivider>
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
主导航点击模式
|
||||
<FaTooltip text="智能选择会判断次导航是否只有且只有一个可访问的菜单进行切换或跳转操作">
|
||||
<FaIcon name="i-ri:question-line" />
|
||||
</FaTooltip>
|
||||
</div>
|
||||
</HTooltip>
|
||||
<HTooltip text="侧边栏模式 (不含主导航)" placement="bottom" :delay="500">
|
||||
<div class="mode mode-single" :class="{ active: settingsStore.settings.menu.menuMode === 'single' }" @click="settingsStore.settings.menu.menuMode = 'single'">
|
||||
<div class="mode-container" />
|
||||
<div class="flex-center-start gap-1">
|
||||
<FaButton
|
||||
v-for="(item, index) in [
|
||||
{ label: '切换', value: 'switch' },
|
||||
{ label: '跳转', value: 'jump' },
|
||||
{ label: '智能选择', value: 'smart' },
|
||||
]" :key="index" :variant="settingsStore.settings.menu.mainMenuClickMode === item.value ? 'default' : 'outline'" size="sm" @click="settingsStore.settings.menu.mainMenuClickMode = (item.value as any)"
|
||||
>
|
||||
{{ item.label }}
|
||||
</FaButton>
|
||||
</div>
|
||||
</HTooltip>
|
||||
</div>
|
||||
<div class="divider">
|
||||
导航栏
|
||||
</div>
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
主导航切换跳转
|
||||
<HTooltip text="开启该功能后,切换主导航时,页面自动跳转至该主导航下,次导航里第一个导航">
|
||||
<SvgIcon name="ri:question-line" />
|
||||
</HTooltip>
|
||||
</div>
|
||||
<HToggle v-model="settingsStore.settings.menu.switchMainMenuAndPageJump" :disabled="['single'].includes(settingsStore.settings.menu.menuMode)" />
|
||||
</div>
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
次导航保持展开一个
|
||||
<HTooltip text="开启该功能后,次导航只保持单个菜单的展开">
|
||||
<SvgIcon name="ri:question-line" />
|
||||
</HTooltip>
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
次导航保持展开一个
|
||||
<FaTooltip text="开启该功能后,次导航只保持单个菜单的展开">
|
||||
<FaIcon name="i-ri:question-line" />
|
||||
</FaTooltip>
|
||||
</div>
|
||||
<FaSwitch v-model="settingsStore.settings.menu.subMenuUniqueOpened" />
|
||||
</div>
|
||||
<HToggle v-model="settingsStore.settings.menu.subMenuUniqueOpened" />
|
||||
</div>
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
次导航是否折叠
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
次导航是否折叠
|
||||
</div>
|
||||
<FaSwitch v-model="settingsStore.settings.menu.subMenuCollapse" />
|
||||
</div>
|
||||
<HToggle v-model="settingsStore.settings.menu.subMenuCollapse" />
|
||||
</div>
|
||||
<div v-if="settingsStore.mode === 'pc'" class="setting-item">
|
||||
<div class="label">
|
||||
显示次导航折叠按钮
|
||||
<div v-if="settingsStore.mode === 'pc'" class="setting-item">
|
||||
<div class="label">
|
||||
显示次导航折叠按钮
|
||||
</div>
|
||||
<FaSwitch v-model="settingsStore.settings.menu.enableSubMenuCollapseButton" />
|
||||
</div>
|
||||
<HToggle v-model="settingsStore.settings.menu.enableSubMenuCollapseButton" />
|
||||
</div>
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
是否启用快捷键
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
是否启用快捷键
|
||||
</div>
|
||||
<FaSwitch v-model="settingsStore.settings.menu.enableHotkeys" :disabled="['single'].includes(settingsStore.settings.menu.mode)" />
|
||||
</div>
|
||||
<HToggle v-model="settingsStore.settings.menu.enableHotkeys" :disabled="['single'].includes(settingsStore.settings.menu.menuMode)" />
|
||||
</div>
|
||||
<div class="divider">
|
||||
顶栏
|
||||
</div>
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
模式
|
||||
<div>
|
||||
<FaDivider>顶栏</FaDivider>
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
模式
|
||||
</div>
|
||||
<div class="flex-center-start gap-1">
|
||||
<FaButton
|
||||
v-for="(item, index) in [
|
||||
{ label: '静止', value: 'static' },
|
||||
{ label: '固定', value: 'fixed' },
|
||||
{ label: '粘性', value: 'sticky' },
|
||||
]" :key="index" :variant="settingsStore.settings.topbar.mode === item.value ? 'default' : 'outline'" size="sm" @click="settingsStore.settings.topbar.mode = (item.value as any)"
|
||||
>
|
||||
{{ item.label }}
|
||||
</FaButton>
|
||||
</div>
|
||||
</div>
|
||||
<HCheckList
|
||||
v-model="settingsStore.settings.topbar.mode" :options="[
|
||||
{ label: '静止', value: 'static' },
|
||||
{ label: '固定', value: 'fixed' },
|
||||
{ label: '粘性', value: 'sticky' },
|
||||
]"
|
||||
/>
|
||||
</div>
|
||||
<div class="divider">
|
||||
工具栏
|
||||
</div>
|
||||
<div v-if="settingsStore.mode === 'pc'" class="setting-item">
|
||||
<div class="label">
|
||||
全屏
|
||||
<div>
|
||||
<FaDivider>标签栏</FaDivider>
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
是否启用
|
||||
</div>
|
||||
<FaSwitch v-model="settingsStore.settings.tabbar.enable" />
|
||||
</div>
|
||||
<HToggle v-model="settingsStore.settings.toolbar.enableFullscreen" />
|
||||
</div>
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
页面刷新
|
||||
<HTooltip text="使用框架内提供的刷新功能进行页面刷新">
|
||||
<SvgIcon name="ri:question-line" />
|
||||
</HTooltip>
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
是否显示图标
|
||||
</div>
|
||||
<FaSwitch v-model="settingsStore.settings.tabbar.enableIcon" :disabled="!settingsStore.settings.tabbar.enable" />
|
||||
</div>
|
||||
<HToggle v-model="settingsStore.settings.toolbar.enablePageReload" />
|
||||
</div>
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
颜色主题
|
||||
<HTooltip text="开启后可在明亮/暗黑模式中切换">
|
||||
<SvgIcon name="ri:question-line" />
|
||||
</HTooltip>
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
是否启用快捷键
|
||||
</div>
|
||||
<FaSwitch v-model="settingsStore.settings.tabbar.enableHotkeys" :disabled="!settingsStore.settings.tabbar.enable" />
|
||||
</div>
|
||||
<HToggle v-model="settingsStore.settings.toolbar.enableColorScheme" />
|
||||
</div>
|
||||
<div v-if="settingsStore.mode === 'pc'" class="divider">
|
||||
面包屑导航
|
||||
</div>
|
||||
<div v-if="settingsStore.mode === 'pc'" class="setting-item">
|
||||
<div class="label">
|
||||
是否启用
|
||||
<div>
|
||||
<FaDivider>工具栏</FaDivider>
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
是否启用
|
||||
</div>
|
||||
<FaSwitch v-model="settingsStore.settings.toolbar.enable" />
|
||||
</div>
|
||||
<HToggle v-model="settingsStore.settings.breadcrumb.enable" />
|
||||
</div>
|
||||
<div class="divider">
|
||||
页面
|
||||
</div>
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
是否启用快捷键
|
||||
<div v-if="settingsStore.mode === 'pc'" class="setting-item">
|
||||
<div class="label">
|
||||
面包屑导航
|
||||
</div>
|
||||
<FaSwitch v-model="settingsStore.settings.toolbar.breadcrumb" :disabled="!settingsStore.settings.toolbar.enable" />
|
||||
</div>
|
||||
<HToggle v-model="settingsStore.settings.mainPage.enableHotkeys" />
|
||||
</div>
|
||||
<div class="divider">
|
||||
导航搜索
|
||||
</div>
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
是否启用
|
||||
<HTooltip text="对导航进行快捷搜索">
|
||||
<SvgIcon name="ri:question-line" />
|
||||
</HTooltip>
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
导航搜索
|
||||
<FaTooltip text="对导航进行快捷搜索">
|
||||
<FaIcon name="i-ri:question-line" />
|
||||
</FaTooltip>
|
||||
</div>
|
||||
<FaSwitch v-model="settingsStore.settings.toolbar.navSearch" :disabled="!settingsStore.settings.toolbar.enable" />
|
||||
</div>
|
||||
<HToggle v-model="settingsStore.settings.navSearch.enable" />
|
||||
</div>
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
是否启用快捷键
|
||||
<div v-if="settingsStore.mode === 'pc'" class="setting-item">
|
||||
<div class="label">
|
||||
全屏
|
||||
</div>
|
||||
<FaSwitch v-model="settingsStore.settings.toolbar.fullscreen" :disabled="!settingsStore.settings.toolbar.enable" />
|
||||
</div>
|
||||
<HToggle v-model="settingsStore.settings.navSearch.enableHotkeys" :disabled="!settingsStore.settings.navSearch.enable" />
|
||||
</div>
|
||||
<div class="divider">
|
||||
底部版权
|
||||
</div>
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
是否启用
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
页面刷新
|
||||
<FaTooltip text="使用框架内提供的刷新功能进行页面刷新">
|
||||
<FaIcon name="i-ri:question-line" />
|
||||
</FaTooltip>
|
||||
</div>
|
||||
<FaSwitch v-model="settingsStore.settings.toolbar.pageReload" :disabled="!settingsStore.settings.toolbar.enable" />
|
||||
</div>
|
||||
<HToggle v-model="settingsStore.settings.copyright.enable" />
|
||||
</div>
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
日期
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
颜色主题
|
||||
<FaTooltip text="开启后可在明亮/暗黑模式中切换">
|
||||
<FaIcon name="i-ri:question-line" />
|
||||
</FaTooltip>
|
||||
</div>
|
||||
<FaSwitch v-model="settingsStore.settings.toolbar.colorScheme" :disabled="!settingsStore.settings.toolbar.enable" />
|
||||
</div>
|
||||
<HInput v-model="settingsStore.settings.copyright.dates" :disabled="!settingsStore.settings.copyright.enable" />
|
||||
</div>
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
公司
|
||||
<div>
|
||||
<FaDivider>主页</FaDivider>
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
是否启用快捷键
|
||||
</div>
|
||||
<FaSwitch v-model="settingsStore.settings.mainPage.enableHotkeys" :disabled="!settingsStore.settings.toolbar.enable" />
|
||||
</div>
|
||||
<HInput v-model="settingsStore.settings.copyright.company" :disabled="!settingsStore.settings.copyright.enable" />
|
||||
</div>
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
网址
|
||||
<div>
|
||||
<FaDivider>导航搜索</FaDivider>
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
是否启用快捷键
|
||||
</div>
|
||||
<FaSwitch v-model="settingsStore.settings.navSearch.enableHotkeys" :disabled="!settingsStore.settings.toolbar.navSearch" />
|
||||
</div>
|
||||
<HInput v-model="settingsStore.settings.copyright.website" :disabled="!settingsStore.settings.copyright.enable" />
|
||||
</div>
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
备案
|
||||
<div>
|
||||
<FaDivider>底部版权</FaDivider>
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
是否启用
|
||||
</div>
|
||||
<FaSwitch v-model="settingsStore.settings.copyright.enable" />
|
||||
</div>
|
||||
<HInput v-model="settingsStore.settings.copyright.beian" :disabled="!settingsStore.settings.copyright.enable" />
|
||||
</div>
|
||||
<div class="divider">
|
||||
主页
|
||||
</div>
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
是否启用
|
||||
<HTooltip text="该功能开启时,登录成功默认进入主页,反之则默认进入导航栏里第一个导航页面">
|
||||
<SvgIcon name="ri:question-line" />
|
||||
</HTooltip>
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
日期
|
||||
</div>
|
||||
<FaInput v-model="settingsStore.settings.copyright.dates" :disabled="!settingsStore.settings.copyright.enable" />
|
||||
</div>
|
||||
<HToggle v-model="settingsStore.settings.home.enable" />
|
||||
</div>
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
主页名称
|
||||
<HTooltip text="开启国际化时,该设置无效">
|
||||
<SvgIcon name="ri:question-line" />
|
||||
</HTooltip>
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
公司
|
||||
</div>
|
||||
<FaInput v-model="settingsStore.settings.copyright.company" :disabled="!settingsStore.settings.copyright.enable" />
|
||||
</div>
|
||||
<HInput v-model="settingsStore.settings.home.title" />
|
||||
</div>
|
||||
<div class="divider">
|
||||
其它
|
||||
</div>
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
是否启用权限
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
网址
|
||||
</div>
|
||||
<FaInput v-model="settingsStore.settings.copyright.website" :disabled="!settingsStore.settings.copyright.enable" />
|
||||
</div>
|
||||
<HToggle v-model="settingsStore.settings.app.enablePermission" />
|
||||
</div>
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
载入进度条
|
||||
<HTooltip text="该功能开启时,跳转路由会看到页面顶部有进度条">
|
||||
<SvgIcon name="ri:question-line" />
|
||||
</HTooltip>
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
备案
|
||||
</div>
|
||||
<FaInput v-model="settingsStore.settings.copyright.beian" :disabled="!settingsStore.settings.copyright.enable" />
|
||||
</div>
|
||||
<HToggle v-model="settingsStore.settings.app.enableProgress" />
|
||||
</div>
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
动态标题
|
||||
<HTooltip text="该功能开启时,页面标题会显示当前路由标题,格式为“页面标题 - 网站名称”;关闭时则显示网站名称,网站名称在项目根目录下 .env.* 文件里配置">
|
||||
<SvgIcon name="ri:question-line" />
|
||||
</HTooltip>
|
||||
<div>
|
||||
<FaDivider>主页</FaDivider>
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
是否启用
|
||||
<FaTooltip text="该功能开启时,登录成功默认进入主页,反之则默认进入导航栏里第一个导航页面">
|
||||
<FaIcon name="i-ri:question-line" />
|
||||
</FaTooltip>
|
||||
</div>
|
||||
<FaSwitch v-model="settingsStore.settings.home.enable" />
|
||||
</div>
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
主页名称
|
||||
<FaTooltip text="开启国际化时,该设置无效">
|
||||
<FaIcon name="i-ri:question-line" />
|
||||
</FaTooltip>
|
||||
</div>
|
||||
<FaInput v-model="settingsStore.settings.home.title" />
|
||||
</div>
|
||||
<HToggle v-model="settingsStore.settings.app.enableDynamicTitle" />
|
||||
</div>
|
||||
<template v-if="isSupported" #footer>
|
||||
<HButton block @click="handleCopy">
|
||||
<SvgIcon name="ep:document-copy" />
|
||||
<div>
|
||||
<FaDivider>其它</FaDivider>
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
是否启用权限
|
||||
</div>
|
||||
<FaSwitch v-model="settingsStore.settings.app.enablePermission" />
|
||||
</div>
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
载入进度条
|
||||
<FaTooltip text="该功能开启时,跳转路由会看到页面顶部有进度条">
|
||||
<FaIcon name="i-ri:question-line" />
|
||||
</FaTooltip>
|
||||
</div>
|
||||
<FaSwitch v-model="settingsStore.settings.app.enableProgress" />
|
||||
</div>
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
哀悼模式
|
||||
<FaTooltip text="该功能开启时,整站会变为灰色">
|
||||
<FaIcon name="i-ri:question-line" />
|
||||
</FaTooltip>
|
||||
</div>
|
||||
<FaSwitch v-model="settingsStore.settings.app.enableMournMode" />
|
||||
</div>
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
色弱模式
|
||||
</div>
|
||||
<FaSwitch v-model="settingsStore.settings.app.enableColorAmblyopiaMode" />
|
||||
</div>
|
||||
<div class="setting-item">
|
||||
<div class="label">
|
||||
动态标题
|
||||
<FaTooltip text="该功能开启时,页面标题会显示当前路由标题,格式为“页面标题 - 网站名称”;关闭时则显示网站名称,网站名称在项目根目录下 .env.* 文件里配置">
|
||||
<FaIcon name="i-ri:question-line" />
|
||||
</FaTooltip>
|
||||
</div>
|
||||
<FaSwitch v-model="settingsStore.settings.app.enableDynamicTitle" />
|
||||
</div>
|
||||
</div>
|
||||
<template #footer>
|
||||
<FaButton class="w-full" @click="handleCopy">
|
||||
<FaIcon name="i-ep:document-copy" />
|
||||
复制配置
|
||||
</HButton>
|
||||
</FaButton>
|
||||
</template>
|
||||
</HSlideover>
|
||||
</FaDrawer>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.divider {
|
||||
--at-apply: flex items-center justify-between gap-4 my-4 whitespace-nowrap text-sm font-500;
|
||||
|
||||
&::before,
|
||||
&::after {
|
||||
--at-apply: content-empty w-full h-1px bg-stone-2 dark:bg-stone-6;
|
||||
}
|
||||
}
|
||||
|
||||
<style scoped>
|
||||
.menu-mode {
|
||||
--at-apply: flex items-center justify-center gap-4 pb-4;
|
||||
--uno: flex items-center justify-center gap-4 pb-4;
|
||||
|
||||
.mode {
|
||||
--at-apply: relative w-16 h-12 rounded-2 ring-1 ring-stone-2 dark:ring-stone-7 cursor-pointer transition;
|
||||
--uno: relative w-16 h-12 rounded-2 ring-1 ring-border cursor-pointer transition;
|
||||
|
||||
&.active {
|
||||
--at-apply: ring-ui-primary ring-2;
|
||||
--uno: ring-primary ring-2;
|
||||
}
|
||||
|
||||
&::before,
|
||||
&::after,
|
||||
.mode-container {
|
||||
--at-apply: absolute pointer-events-none;
|
||||
--uno: absolute pointer-events-none;
|
||||
}
|
||||
|
||||
&::before {
|
||||
--at-apply: content-empty bg-ui-primary;
|
||||
--uno: content-empty bg-primary;
|
||||
}
|
||||
|
||||
&::after {
|
||||
--at-apply: content-empty bg-ui-primary/60;
|
||||
--uno: content-empty bg-primary/60;
|
||||
}
|
||||
|
||||
.mode-container {
|
||||
--at-apply: bg-ui-primary/20 border-dashed border-ui-primary;
|
||||
--uno: bg-primary/20 border-width-1.5 border-dashed border-primary;
|
||||
|
||||
&::before {
|
||||
--at-apply: content-empty absolute w-full h-full;
|
||||
--uno: content-empty absolute w-full h-full;
|
||||
}
|
||||
}
|
||||
|
||||
&-side {
|
||||
&::before {
|
||||
--at-apply: top-2 bottom-2 left-2 w-2 rounded-tl-1 rounded-bl-1;
|
||||
--uno: top-2 bottom-2 left-2 w-2 rounded-tl-1 rounded-bl-1;
|
||||
}
|
||||
|
||||
&::after {
|
||||
--at-apply: top-2 bottom-2 left-4.5 w-3;
|
||||
--uno: top-2 bottom-2 left-4.5 w-3;
|
||||
}
|
||||
|
||||
.mode-container {
|
||||
--at-apply: inset-t-2 inset-r-2 inset-b-2 inset-l-8 rounded-tr-1 rounded-br-1;
|
||||
--uno: inset-t-2 inset-r-2 inset-b-2 inset-l-8 rounded-tr-1 rounded-br-1;
|
||||
}
|
||||
}
|
||||
|
||||
&-head {
|
||||
&::before {
|
||||
--at-apply: top-2 left-2 right-2 h-2 rounded-tl-1 rounded-tr-1;
|
||||
--uno: top-2 left-2 right-2 h-2 rounded-tl-1 rounded-tr-1;
|
||||
}
|
||||
|
||||
&::after {
|
||||
--at-apply: top-4.5 left-2 bottom-2 w-3 rounded-bl-1;
|
||||
--uno: top-4.5 left-2 bottom-2 w-3 rounded-bl-1;
|
||||
}
|
||||
|
||||
.mode-container {
|
||||
--at-apply: inset-t-4.5 inset-r-2 inset-b-2 inset-l-5.5 rounded-br-1;
|
||||
--uno: inset-t-4.5 inset-r-2 inset-b-2 inset-l-5.5 rounded-br-1;
|
||||
}
|
||||
}
|
||||
|
||||
&-single {
|
||||
&::after {
|
||||
--at-apply: top-2 left-2 bottom-2 w-3 rounded-tl-1 rounded-bl-1;
|
||||
--uno: top-2 left-2 bottom-2 w-3 rounded-tl-1 rounded-bl-1;
|
||||
}
|
||||
|
||||
.mode-container {
|
||||
--at-apply: inset-t-2 inset-r-2 inset-b-2 inset-l-5.5 rounded-tr-1 rounded-br-1;
|
||||
--uno: inset-t-2 inset-r-2 inset-b-2 inset-l-5.5 rounded-tr-1 rounded-br-1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.setting-item {
|
||||
--at-apply: flex items-center justify-between gap-4 px-4 py-2 rounded-2 transition hover:bg-stone-1 dark:hover:bg-stone-9;
|
||||
--uno: flex items-center justify-between gap-4 px-4 py-2 rounded-lg transition hover-bg-secondary;
|
||||
|
||||
.label {
|
||||
--at-apply: flex items-center flex-shrink-0 gap-2 text-sm;
|
||||
--uno: flex items-center flex-shrink-0 gap-2 text-sm;
|
||||
|
||||
i {
|
||||
--at-apply: text-xl text-orange cursor-help;
|
||||
--uno: text-xl text-orange cursor-help;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
defineOptions({
|
||||
name: 'BackTop',
|
||||
})
|
||||
|
||||
const transitionClass = {
|
||||
enterActiveClass: 'ease-out duration-300',
|
||||
enterFromClass: 'opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95',
|
||||
enterToClass: 'opacity-100 translate-y-0 sm:scale-100',
|
||||
leaveActiveClass: 'ease-in duration-200',
|
||||
leaveFromClass: 'opacity-100 translate-y-0 sm:scale-100',
|
||||
leaveToClass: 'opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95',
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
window.addEventListener('scroll', handleScroll)
|
||||
handleScroll()
|
||||
})
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
window.removeEventListener('scroll', handleScroll)
|
||||
})
|
||||
|
||||
const scrollTop = ref<number | null>(null)
|
||||
function handleScroll() {
|
||||
scrollTop.value = document.documentElement.scrollTop
|
||||
}
|
||||
|
||||
function handleClick() {
|
||||
document.documentElement.scrollTo({
|
||||
top: 0,
|
||||
behavior: 'smooth',
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Teleport to="body">
|
||||
<Transition v-bind="transitionClass">
|
||||
<div v-if="scrollTop && scrollTop >= 200" class="fixed bottom-4 right-4 z-1000 h-12 w-12 flex cursor-pointer items-center justify-center rounded-full bg-white shadow-lg ring-1 ring-stone-3 ring-inset dark:bg-dark hover:bg-stone-1 dark:ring-stone-7 dark:hover:bg-dark/50" @click="handleClick">
|
||||
<SvgIcon name="icon-park-outline:to-top-one" :size="24" />
|
||||
</div>
|
||||
</Transition>
|
||||
</Teleport>
|
||||
</template>
|
||||
@@ -4,7 +4,7 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped>
|
||||
:deep(.breadcrumb-item) {
|
||||
&:first-child {
|
||||
.separator {
|
||||
|
||||
@@ -22,14 +22,14 @@ function onClick() {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="breadcrumb-item flex items-center text-dark dark:text-white">
|
||||
<div class="breadcrumb-item flex items-center text-foreground">
|
||||
<span class="separator mx-2">
|
||||
{{ separator }}
|
||||
</span>
|
||||
<span
|
||||
class="text flex items-center opacity-60"
|
||||
:class="{
|
||||
'is-link cursor-pointer transition-opacity hover:opacity-100': !!props.to,
|
||||
'is-link cursor-pointer transition-opacity hover-opacity-100': !!props.to,
|
||||
}" @click="onClick"
|
||||
>
|
||||
<slot />
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import useSettingsStore from '@/store/modules/settings'
|
||||
|
||||
defineOptions({
|
||||
name: 'Copyright',
|
||||
})
|
||||
|
||||
const settingsStore = useSettingsStore()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<footer v-if="settingsStore.settings.copyright.enable" class="copyright">
|
||||
<span>Copyright</span>
|
||||
<SvgIcon name="ri:copyright-line" :size="18" />
|
||||
<span v-if="settingsStore.settings.copyright.dates">{{ settingsStore.settings.copyright.dates }}</span>
|
||||
<template v-if="settingsStore.settings.copyright.company">
|
||||
<a v-if="settingsStore.settings.copyright.website" :href="settingsStore.settings.copyright.website" target="_blank" rel="noopener">{{ settingsStore.settings.copyright.company }}</a>
|
||||
<span v-else>{{ settingsStore.settings.copyright.company }}</span>
|
||||
</template>
|
||||
<a v-if="settingsStore.settings.copyright.beian" href="https://beian.miit.gov.cn/" target="_blank" rel="noopener">{{ settingsStore.settings.copyright.beian }}</a>
|
||||
</footer>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.copyright {
|
||||
--at-apply: flex items-center justify-center flex-wrap my-4 px-4 text-sm text-stone-5;
|
||||
|
||||
span,
|
||||
a {
|
||||
--at-apply: px-1;
|
||||
}
|
||||
|
||||
a {
|
||||
--at-apply: text-center no-underline text-stone-5 hover:text-dark dark:hover:text-light transition;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,8 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import Logo from '../Logo/index.vue'
|
||||
import Tools from '../Tools/index.vue'
|
||||
import { useSlots } from '@/slots'
|
||||
import useMenuStore from '@/store/modules/menu'
|
||||
import useSettingsStore from '@/store/modules/settings'
|
||||
import Logo from '../Logo/index.vue'
|
||||
|
||||
defineOptions({
|
||||
name: 'LayoutHeader',
|
||||
@@ -12,153 +12,128 @@ const settingsStore = useSettingsStore()
|
||||
const menuStore = useMenuStore()
|
||||
|
||||
const { switchTo } = useMenu()
|
||||
|
||||
const menuRef = ref()
|
||||
|
||||
// 顶部模式鼠标滚动
|
||||
function handlerMouserScroll(event: WheelEvent) {
|
||||
menuRef.value.scrollBy({
|
||||
left: (event.deltaY || event.detail) > 0 ? 50 : -50,
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Transition name="header">
|
||||
<header v-if="settingsStore.mode === 'pc' && settingsStore.settings.menu.menuMode === 'head'">
|
||||
<header v-if="settingsStore.mode === 'pc' && settingsStore.settings.menu.mode === 'head'">
|
||||
<div class="header-container">
|
||||
<div class="main">
|
||||
<Logo class="title" />
|
||||
<div ref="menuRef" class="menu-container" @wheel.prevent="handlerMouserScroll">
|
||||
<!-- 顶部模式 -->
|
||||
<div class="menu flex of-hidden transition-all">
|
||||
<template v-for="(item, index) in menuStore.allMenus" :key="index">
|
||||
<component :is="useSlots('header-start')" />
|
||||
<Logo class="title" />
|
||||
<component :is="useSlots('header-after-logo')" />
|
||||
<FaScrollArea :scrollbar="false" mask horizontal gradient-color="var(--g-header-bg)" class="menu-container h-full flex-1">
|
||||
<!-- 顶部模式 -->
|
||||
<div class="menu h-full flex of-hidden transition-all">
|
||||
<template v-for="(item, index) in menuStore.allMenus" :key="index">
|
||||
<div
|
||||
class="menu-item relative mx-1 py-2 transition-all" :class="{
|
||||
active: index === menuStore.actived,
|
||||
}"
|
||||
>
|
||||
<div
|
||||
class="menu-item relative transition-all" :class="{
|
||||
active: index === menuStore.actived,
|
||||
}"
|
||||
v-if="item.children && item.children.length !== 0" class="group menu-item-container relative h-full w-full flex cursor-pointer items-center justify-between gap-1 rounded-lg px-3 text-[var(--g-header-menu-color)] transition-all hover-(bg-[var(--g-header-menu-hover-bg)] text-[var(--g-header-menu-hover-color)])" :class="{
|
||||
'text-[var(--g-header-menu-active-color)]! bg-[var(--g-header-menu-active-bg)]!': index === menuStore.actived,
|
||||
}" :title="typeof item.meta?.title === 'function' ? item.meta?.title() : item.meta?.title" @click="switchTo(index)"
|
||||
>
|
||||
<div
|
||||
v-if="item.children && item.children.length !== 0" class="group menu-item-container h-full w-full flex cursor-pointer items-center justify-between gap-1 px-3 text-[var(--g-header-menu-color)] transition-all hover:(bg-[var(--g-header-menu-hover-bg)] text-[var(--g-header-menu-hover-color)])" :class="{
|
||||
'text-[var(--g-header-menu-active-color)]! bg-[var(--g-header-menu-active-bg)]!': index === menuStore.actived,
|
||||
}" :title="typeof item.meta?.title === 'function' ? item.meta?.title() : item.meta?.title" @click="switchTo(index)"
|
||||
>
|
||||
<div class="inline-flex flex-1 items-center justify-center gap-1">
|
||||
<SvgIcon v-if="item.meta?.icon" :name="item.meta?.icon" :size="20" class="menu-item-container-icon transition-transform group-hover:scale-120" async />
|
||||
<span class="w-full flex-1 truncate text-sm transition-height transition-opacity transition-width">
|
||||
{{ typeof item.meta?.title === 'function' ? item.meta?.title() : item.meta?.title }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="inline-flex flex-1 items-center justify-center gap-1">
|
||||
<FaIcon v-if="item.meta?.icon" :name="item.meta?.icon" class="menu-item-container-icon transition-transform group-hover-scale-120" />
|
||||
<span class="w-full flex-1 truncate text-sm transition-height transition-opacity transition-width">
|
||||
{{ typeof item.meta?.title === 'function' ? item.meta?.title() : item.meta?.title }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</FaScrollArea>
|
||||
<component :is="useSlots('header-after-menu')" />
|
||||
<div class="flex-center">
|
||||
<AccountButton only-avatar dropdown-side="bottom" class="size-12 p-2" />
|
||||
</div>
|
||||
<Tools />
|
||||
<component :is="useSlots('header-end')" />
|
||||
</div>
|
||||
</header>
|
||||
</Transition>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped>
|
||||
header {
|
||||
position: fixed;
|
||||
z-index: 2000;
|
||||
top: 0;
|
||||
right: var(--scrollbar-width, 0);
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 2000;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin: 0 auto;
|
||||
padding: 0 20px;
|
||||
width: 100%;
|
||||
width: calc(100% - var(--scrollbar-width, 0px));
|
||||
height: var(--g-header-height);
|
||||
margin: 0 auto;
|
||||
color: var(--g-header-color);
|
||||
background-color: var(--g-header-bg);
|
||||
box-shadow: -1px 0 0 0 var(--g-border-color), 1px 0 0 0 var(--g-border-color), 0 1px 0 0 var(--g-border-color);
|
||||
box-shadow: -1px 0 0 0 hsl(var(--border)), 1px 0 0 0 hsl(var(--border)), 0 1px 0 0 hsl(var(--border));
|
||||
transition: background-color 0.3s;
|
||||
|
||||
.header-container {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0 auto;
|
||||
display: flex;
|
||||
gap: 30px;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
.main {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
:deep(a.title) {
|
||||
position: relative;
|
||||
width: inherit;
|
||||
height: inherit;
|
||||
padding: inherit;
|
||||
background-color: inherit;
|
||||
|
||||
.logo {
|
||||
width: initial;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
span {
|
||||
font-size: 20px;
|
||||
letter-spacing: 1px;
|
||||
color: var(--g-header-color);
|
||||
}
|
||||
}
|
||||
|
||||
.menu-container {
|
||||
flex: 1;
|
||||
margin: 0 30px;
|
||||
padding: 0 20px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow-x: auto;
|
||||
mask-image: linear-gradient(to right, transparent, #000 20px, #000 calc(100% - 20px), transparent);
|
||||
padding: 0 12px;
|
||||
margin: 0 auto;
|
||||
|
||||
// firefox隐藏滚动条
|
||||
scrollbar-width: none;
|
||||
:deep(a.title) {
|
||||
position: relative;
|
||||
flex: 0;
|
||||
width: inherit;
|
||||
height: inherit;
|
||||
padding: 0;
|
||||
background-color: inherit;
|
||||
|
||||
// chrome隐藏滚动条
|
||||
&::-webkit-scrollbar {
|
||||
display: none;
|
||||
.logo {
|
||||
width: initial;
|
||||
max-width: initial;
|
||||
height: min(70%, 50px);
|
||||
}
|
||||
|
||||
span {
|
||||
font-size: 20px;
|
||||
color: var(--g-header-color);
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.menu {
|
||||
display: inline-flex;
|
||||
height: 100%;
|
||||
.menu-container {
|
||||
.menu {
|
||||
display: inline-flex;
|
||||
height: 100%;
|
||||
|
||||
:deep(.menu-item) {
|
||||
.menu-item-container {
|
||||
color: var(--g-header-menu-color);
|
||||
:deep(.menu-item) {
|
||||
.menu-item-container {
|
||||
color: var(--g-header-menu-color);
|
||||
|
||||
&:hover {
|
||||
color: var(--g-header-menu-hover-color);
|
||||
background-color: var(--g-header-menu-hover-bg);
|
||||
&:hover {
|
||||
color: var(--g-header-menu-hover-color);
|
||||
background-color: var(--g-header-menu-hover-bg);
|
||||
}
|
||||
|
||||
.menu-item-container-icon {
|
||||
font-size: 20px !important;
|
||||
}
|
||||
}
|
||||
|
||||
&.active .menu-item-container {
|
||||
color: var(--g-header-menu-active-color);
|
||||
background-color: var(--g-header-menu-active-bg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.active .menu-item-container {
|
||||
color: var(--g-header-menu-active-color);
|
||||
background-color: var(--g-header-menu-active-bg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.tools) {
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
|
||||
// 头部动画
|
||||
/* 头部动画 */
|
||||
.header-enter-active,
|
||||
.header-leave-active {
|
||||
transition: transform 0.3s;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import eventBus from '@/utils/eventBus'
|
||||
import useSettingsStore from '@/store/modules/settings'
|
||||
import eventBus from '@/utils/eventBus'
|
||||
|
||||
defineOptions({
|
||||
name: 'HotkeysIntro',
|
||||
@@ -18,39 +18,95 @@ onMounted(() => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<HDialog v-model="isShow" title="快捷键介绍">
|
||||
<FaModal v-model="isShow" title="快捷键介绍" :footer="false">
|
||||
<div class="px-4">
|
||||
<div class="grid gap-2 md:grid-cols-2">
|
||||
<div class="grid gap-4 sm-grid-cols-2">
|
||||
<div>
|
||||
<h2 class="m-0 text-lg font-bold">
|
||||
全局
|
||||
</h2>
|
||||
<ul class="list-none pl-4 text-sm">
|
||||
<li class="py-1">
|
||||
<HKbd>{{ settingsStore.os === 'mac' ? '⌥' : 'Alt' }}</HKbd>
|
||||
<HKbd>I</HKbd>
|
||||
<ul class="list-none ps-2 pt-2 text-sm">
|
||||
<li class="flex-baseline gap-2 py-1">
|
||||
<div class="flex-shrink-0 space-x-1">
|
||||
<FaKbd>{{ settingsStore.os === 'mac' ? '⌘' : 'Ctrl' }}</FaKbd>
|
||||
<FaKbd>I</FaKbd>
|
||||
</div>
|
||||
查看系统信息
|
||||
</li>
|
||||
<li v-if="settingsStore.settings.navSearch.enable && settingsStore.settings.navSearch.enableHotkeys" class="py-1">
|
||||
<HKbd>{{ settingsStore.os === 'mac' ? '⌥' : 'Alt' }}</HKbd>
|
||||
<HKbd>S</HKbd>
|
||||
<li v-if="settingsStore.settings.toolbar.navSearch && settingsStore.settings.navSearch.enableHotkeys" class="flex-baseline gap-2 py-1">
|
||||
<div class="flex-shrink-0 space-x-1">
|
||||
<FaKbd>{{ settingsStore.os === 'mac' ? '⌘' : 'Ctrl' }}</FaKbd>
|
||||
<FaKbd>K</FaKbd>
|
||||
</div>
|
||||
唤起导航搜索
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div v-if="settingsStore.settings.menu.enableHotkeys && ['side', 'head'].includes(settingsStore.settings.menu.menuMode)">
|
||||
<div v-if="settingsStore.settings.menu.enableHotkeys && ['side', 'head'].includes(settingsStore.settings.menu.mode)">
|
||||
<h2 class="m-0 text-lg font-bold">
|
||||
主导航
|
||||
</h2>
|
||||
<ul class="list-none pl-4 text-sm">
|
||||
<li class="py-1">
|
||||
<HKbd>{{ settingsStore.os === 'mac' ? '⌥' : 'Alt' }}</HKbd>
|
||||
<HKbd>`</HKbd>
|
||||
<ul class="list-none ps-2 pt-2 text-sm">
|
||||
<li class="flex-baseline gap-2 py-1">
|
||||
<div class="flex-shrink-0 space-x-1">
|
||||
<FaKbd>{{ settingsStore.os === 'mac' ? '⌥' : 'Alt' }}</FaKbd>
|
||||
<FaKbd>`</FaKbd>
|
||||
</div>
|
||||
激活下一个主导航
|
||||
</li>
|
||||
<li class="flex-baseline gap-2 py-1">
|
||||
<div class="flex-shrink-0 space-x-1">
|
||||
<FaKbd>{{ settingsStore.os === 'mac' ? '⌥' : 'Alt' }}</FaKbd>
|
||||
<FaKbd>{{ settingsStore.os === 'mac' ? '⇧' : 'Shift' }}</FaKbd>
|
||||
<FaKbd>`</FaKbd>
|
||||
</div>
|
||||
激活上一个主导航
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div v-if="settingsStore.settings.tabbar.enable && settingsStore.settings.tabbar.enableHotkeys">
|
||||
<h2 class="m-0 text-lg font-bold">
|
||||
标签栏
|
||||
</h2>
|
||||
<ul class="list-none ps-2 pt-2 text-sm">
|
||||
<li class="flex-baseline gap-2 py-1">
|
||||
<div class="flex-shrink-0 space-x-1">
|
||||
<FaKbd>{{ settingsStore.os === 'mac' ? '⌥' : 'Alt' }}</FaKbd>
|
||||
<FaKbd>←</FaKbd>
|
||||
</div>
|
||||
切换到上一个标签页
|
||||
</li>
|
||||
<li class="flex-baseline gap-2 py-1">
|
||||
<div class="flex-shrink-0 space-x-1">
|
||||
<FaKbd>{{ settingsStore.os === 'mac' ? '⌥' : 'Alt' }}</FaKbd>
|
||||
<FaKbd>→</FaKbd>
|
||||
</div>
|
||||
切换到下一个标签页
|
||||
</li>
|
||||
<li class="flex-baseline gap-2 py-1">
|
||||
<div class="flex-shrink-0 space-x-1">
|
||||
<FaKbd>{{ settingsStore.os === 'mac' ? '⌥' : 'Alt' }}</FaKbd>
|
||||
<FaKbd>W</FaKbd>
|
||||
</div>
|
||||
关闭当前标签页
|
||||
</li>
|
||||
<li class="flex-baseline gap-2 py-1">
|
||||
<div class="flex-shrink-0 space-x-1">
|
||||
<FaKbd>{{ settingsStore.os === 'mac' ? '⌥' : 'Alt' }}</FaKbd>
|
||||
<FaKbd>1~9</FaKbd>
|
||||
</div>
|
||||
切换到第 n 个标签页
|
||||
</li>
|
||||
<li class="flex-baseline gap-2 py-1">
|
||||
<div class="flex-shrink-0 space-x-1">
|
||||
<FaKbd>{{ settingsStore.os === 'mac' ? '⌥' : 'Alt' }}</FaKbd>
|
||||
<FaKbd>0</FaKbd>
|
||||
</div>
|
||||
切换到最后一个标签页
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</HDialog>
|
||||
</FaModal>
|
||||
</template>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import imgLogo from '@/assets/images/logo.svg'
|
||||
import useSettingsStore from '@/store/modules/settings'
|
||||
import imgLogo from '@/assets/images/logo.png'
|
||||
|
||||
defineOptions({
|
||||
name: 'Logo',
|
||||
@@ -26,7 +26,7 @@ const to = computed(() => settingsStore.settings.home.enable ? settingsStore.set
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<RouterLink :to="to" class="h-[var(--g-sidebar-logo-height)] w-inherit flex-center gap-2 px-3 text-inherit no-underline" :class="{ 'cursor-pointer': settingsStore.settings.home.enable }" :title="title">
|
||||
<RouterLink :to class="h-[var(--g-sidebar-logo-height)] w-inherit flex-center gap-2 px-3 text-inherit no-underline" :class="{ 'cursor-default': !settingsStore.settings.home.enable }" :title="title">
|
||||
<img v-if="showLogo" :src="logo" class="logo h-[30px] w-[30px] object-contain">
|
||||
<span v-if="showTitle" class="block truncate font-bold">{{ title }}</span>
|
||||
</RouterLink>
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import Logo from '../Logo/index.vue'
|
||||
import useSettingsStore from '@/store/modules/settings'
|
||||
import { useSlots } from '@/slots'
|
||||
import useMenuStore from '@/store/modules/menu'
|
||||
import useSettingsStore from '@/store/modules/settings'
|
||||
import hotkeys from 'hotkeys-js'
|
||||
import Logo from '../Logo/index.vue'
|
||||
|
||||
defineOptions({
|
||||
name: 'MainSidebar',
|
||||
@@ -11,49 +13,77 @@ const settingsStore = useSettingsStore()
|
||||
const menuStore = useMenuStore()
|
||||
|
||||
const { switchTo } = useMenu()
|
||||
|
||||
onMounted(() => {
|
||||
hotkeys('alt+`', (e) => {
|
||||
if (settingsStore.settings.menu.enableHotkeys && ['side', 'head'].includes(settingsStore.settings.menu.mode)) {
|
||||
e.preventDefault()
|
||||
switchTo(menuStore.actived + 1 < menuStore.allMenus.length ? menuStore.actived + 1 : 0)
|
||||
}
|
||||
})
|
||||
hotkeys('alt+shift+`', (e) => {
|
||||
if (settingsStore.settings.menu.enableHotkeys && ['side', 'head'].includes(settingsStore.settings.menu.mode)) {
|
||||
e.preventDefault()
|
||||
switchTo(menuStore.actived - 1 >= 0 ? menuStore.actived - 1 : menuStore.allMenus.length - 1)
|
||||
}
|
||||
})
|
||||
})
|
||||
onUnmounted(() => {
|
||||
hotkeys.unbind('alt+`')
|
||||
hotkeys.unbind('alt+shift+`')
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Transition name="main-sidebar">
|
||||
<div v-if="settingsStore.settings.menu.menuMode === 'side' || (settingsStore.mode === 'mobile' && settingsStore.settings.menu.menuMode !== 'single')" class="main-sidebar-container">
|
||||
<div v-if="settingsStore.settings.menu.mode === 'side' || (settingsStore.mode === 'mobile' && settingsStore.settings.menu.mode !== 'single')" class="main-sidebar-container">
|
||||
<component :is="useSlots('main-sidebar-top')" />
|
||||
<Logo :show-title="false" class="sidebar-logo" />
|
||||
<!-- 侧边栏模式(含主导航) -->
|
||||
<div class="menu flex flex-col of-hidden transition-all">
|
||||
<template v-for="(item, index) in menuStore.allMenus" :key="index">
|
||||
<div
|
||||
class="menu-item relative transition-all" :class="{
|
||||
active: index === menuStore.actived,
|
||||
}"
|
||||
>
|
||||
<component :is="useSlots('main-sidebar-after-logo')" />
|
||||
<FaScrollArea :scrollbar="false" mask gradient-color="var(--g-main-sidebar-bg)" class="menu">
|
||||
<!-- 侧边栏模式(含主导航) -->
|
||||
<div class="w-full flex flex-col of-hidden py-1 transition-all -mt-2">
|
||||
<template v-for="(item, index) in menuStore.allMenus" :key="index">
|
||||
<div
|
||||
v-if="item.children && item.children.length !== 0" class="group menu-item-container h-full w-full flex cursor-pointer items-center justify-between gap-1 py-4 text-[var(--g-main-sidebar-menu-color)] transition-all hover:(bg-[var(--g-main-sidebar-menu-hover-bg)] text-[var(--g-main-sidebar-menu-hover-color)]) px-2!" :class="{
|
||||
'text-[var(--g-main-sidebar-menu-active-color)]! bg-[var(--g-main-sidebar-menu-active-bg)]!': index === menuStore.actived,
|
||||
}" :title="typeof item.meta?.title === 'function' ? item.meta?.title() : item.meta?.title" @click="switchTo(index)"
|
||||
class="menu-item relative px-2 py-1 transition-all" :class="{
|
||||
active: index === menuStore.actived,
|
||||
}"
|
||||
>
|
||||
<div class="w-full inline-flex flex-1 flex-col items-center justify-center gap-[2px]">
|
||||
<SvgIcon v-if="item.meta?.icon" :name="item.meta?.icon" :size="20" class="menu-item-container-icon transition-transform group-hover:scale-120" async />
|
||||
<span class="w-full flex-1 truncate text-center text-sm transition-height transition-opacity transition-width">
|
||||
{{ typeof item.meta?.title === 'function' ? item.meta?.title() : item.meta?.title }}
|
||||
</span>
|
||||
<div
|
||||
v-if="item.children && item.children.length !== 0" class="group menu-item-container relative h-full w-full flex cursor-pointer items-center justify-between gap-1 rounded-lg py-4 text-[var(--g-main-sidebar-menu-color)] transition-all hover-(bg-[var(--g-main-sidebar-menu-hover-bg)] text-[var(--g-main-sidebar-menu-hover-color)]) px-2!" :class="{
|
||||
'text-[var(--g-main-sidebar-menu-active-color)]! bg-[var(--g-main-sidebar-menu-active-bg)]!': index === menuStore.actived,
|
||||
}" :title="typeof item.meta?.title === 'function' ? item.meta?.title() : item.meta?.title" @click="switchTo(index)"
|
||||
>
|
||||
<div class="w-full inline-flex flex-1 flex-col items-center justify-center gap-[2px]">
|
||||
<FaIcon v-if="item.meta?.icon" :name="item.meta?.icon" class="menu-item-container-icon transition-transform group-hover-scale-120" />
|
||||
<span class="w-full flex-1 truncate text-center text-sm transition-height transition-opacity transition-width">
|
||||
{{ typeof item.meta?.title === 'function' ? item.meta?.title() : item.meta?.title }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
</div>
|
||||
</FaScrollArea>
|
||||
<component :is="useSlots('main-sidebar-after-menu')" />
|
||||
<div class="flex-center px-4 py-3">
|
||||
<AccountButton only-avatar :button-variant="settingsStore.settings.menu.mode === 'side' ? 'secondary' : 'ghost'" class="size-12 p-2" />
|
||||
</div>
|
||||
<component :is="useSlots('main-sidebar-bottom')" />
|
||||
</div>
|
||||
</Transition>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped>
|
||||
.main-sidebar-container {
|
||||
position: relative;
|
||||
z-index: 10;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
width: var(--g-main-sidebar-width);
|
||||
color: var(--g-main-sidebar-menu-color);
|
||||
background-color: var(--g-main-sidebar-bg);
|
||||
box-shadow: 1px 0 0 0 var(--g-border-color);
|
||||
box-shadow: 1px 0 0 0 hsl(var(--border)), -1px 0 0 0 hsl(var(--border));
|
||||
transition: background-color 0.3s, color 0.3s, box-shadow 0.3s;
|
||||
|
||||
.sidebar-logo {
|
||||
@@ -63,17 +93,6 @@ const { switchTo } = useMenu()
|
||||
|
||||
.menu {
|
||||
flex: 1;
|
||||
width: initial;
|
||||
overflow: hidden auto;
|
||||
overscroll-behavior: contain;
|
||||
|
||||
// firefox隐藏滚动条
|
||||
scrollbar-width: none;
|
||||
|
||||
// chrome隐藏滚动条
|
||||
&::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
:deep(.menu-item) {
|
||||
.menu-item-container {
|
||||
@@ -86,7 +105,7 @@ const { switchTo } = useMenu()
|
||||
}
|
||||
|
||||
.menu-item-container-icon {
|
||||
font-size: 24px !important;
|
||||
font-size: 20px !important;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +117,7 @@ const { switchTo } = useMenu()
|
||||
}
|
||||
}
|
||||
|
||||
// 主侧边栏动画
|
||||
/* 主侧边栏动画 */
|
||||
.main-sidebar-enter-active,
|
||||
.main-sidebar-leave-active {
|
||||
transition: 0.3s;
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import SubMenu from './sub.vue'
|
||||
import Item from './item.vue'
|
||||
import type { MenuInjection, MenuProps } from './types'
|
||||
import { cn } from '@/utils'
|
||||
import Item from './item.vue'
|
||||
import SubMenu from './sub.vue'
|
||||
import { rootMenuInjectionKey } from './types'
|
||||
|
||||
defineOptions({
|
||||
@@ -69,11 +70,7 @@ const closeMenu: MenuInjection['closeMenu'] = (index) => {
|
||||
})
|
||||
return
|
||||
}
|
||||
Object.keys(subMenus.value).forEach((item) => {
|
||||
if (subMenus.value[item].indexPath.includes(index)) {
|
||||
openedMenus.value = openedMenus.value.filter(item => item !== index)
|
||||
}
|
||||
})
|
||||
openedMenus.value = openedMenus.value.filter(item => item !== index)
|
||||
}
|
||||
|
||||
function setSubMenusActive(index: string) {
|
||||
@@ -106,7 +103,7 @@ const handleSubMenuClick: MenuInjection['handleSubMenuClick'] = (index, indexPat
|
||||
function initMenu() {
|
||||
const activeItem = activeIndex.value && items.value[activeIndex.value]
|
||||
setSubMenusActive(activeIndex.value)
|
||||
if (!activeItem || props.collapse) {
|
||||
if (!activeItem || isMenuPopup.value || props.collapse) {
|
||||
return
|
||||
}
|
||||
// 展开该菜单项的路径上所有子菜单
|
||||
@@ -162,16 +159,16 @@ provide(rootMenuInjectionKey, reactive({
|
||||
|
||||
<template>
|
||||
<div
|
||||
class="flex flex-col of-hidden transition-all" :class="{
|
||||
'w-[200px]': !isMenuPopup && props.mode === 'vertical',
|
||||
'w-[64px]': isMenuPopup && props.mode === 'vertical',
|
||||
'h-[80px]': props.mode === 'horizontal',
|
||||
'flex-row! w-auto': isMenuPopup && props.mode === 'horizontal',
|
||||
}"
|
||||
:class="cn('h-full w-full flex flex-col of-hidden transition-all-300', {
|
||||
'flex-row w-auto': isMenuPopup && props.mode === 'horizontal',
|
||||
'py-1': props.mode === 'vertical',
|
||||
})"
|
||||
>
|
||||
<template v-for="(item, index) in menu" :key="index">
|
||||
<SubMenu v-if="item.children?.length" :menu="item" :unique-key="[item.path ?? JSON.stringify(item)]" />
|
||||
<Item v-else :item="item" :unique-key="[item.path ?? JSON.stringify(item)]" @click="handleMenuItemClick(item.path ?? JSON.stringify(item))" />
|
||||
<template v-for="item in menu" :key="item.path ?? JSON.stringify(item)">
|
||||
<template v-if="item.meta?.menu !== false">
|
||||
<SubMenu v-if="item.children?.length" :menu="item" :unique-key="[item.path ?? JSON.stringify(item)]" />
|
||||
<Item v-else :item="item" :unique-key="[item.path ?? JSON.stringify(item)]" @click="handleMenuItemClick(item.path ?? JSON.stringify(item))" />
|
||||
</template>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
<script setup lang="ts">
|
||||
import type { SubMenuItemProps } from './types'
|
||||
import { cn } from '@/utils'
|
||||
import { rootMenuInjectionKey } from './types'
|
||||
|
||||
defineOptions({
|
||||
name: 'SubMenuItem',
|
||||
})
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<SubMenuItemProps>(),
|
||||
{
|
||||
@@ -25,13 +30,6 @@ const isItemActive = computed(() => {
|
||||
return isActived.value && (!props.subMenu || rootMenu.isMenuPopup)
|
||||
})
|
||||
|
||||
// 缩进样式
|
||||
const indentStyle = computed(() => {
|
||||
return !rootMenu.isMenuPopup
|
||||
? `padding-left: ${20 * (props.level ?? 0)}px`
|
||||
: ''
|
||||
})
|
||||
|
||||
defineExpose({
|
||||
ref: itemRef,
|
||||
})
|
||||
@@ -39,49 +37,58 @@ defineExpose({
|
||||
|
||||
<template>
|
||||
<div
|
||||
ref="itemRef" class="menu-item relative transition-all" :class="{
|
||||
active: isItemActive,
|
||||
}"
|
||||
ref="itemRef" :class="cn('menu-item relative transition-all', {
|
||||
'active': isItemActive,
|
||||
'py-1 px-2': (rootMenu.isMenuPopup && rootMenu.props.mode === 'vertical') || (rootMenu.isMenuPopup && level !== 0 && rootMenu.props.mode === 'horizontal') || !rootMenu.isMenuPopup,
|
||||
'px-1 py-2': rootMenu.isMenuPopup && level === 0 && rootMenu.props.mode === 'horizontal',
|
||||
})"
|
||||
>
|
||||
<router-link v-slot="{ href }" custom :to="uniqueKey.at(-1) ?? ''">
|
||||
<component
|
||||
:is="subMenu ? 'div' : 'a'" v-bind="{
|
||||
...(!subMenu && {
|
||||
href: item.meta?.link ? item.meta.link : href,
|
||||
target: item.meta?.link ? '_blank' : '_self',
|
||||
class: 'no-underline',
|
||||
}),
|
||||
}" class="group menu-item-container h-full w-full flex cursor-pointer items-center justify-between gap-1 px-5 py-4 text-[var(--g-sub-sidebar-menu-color)] transition-all hover:(bg-[var(--g-sub-sidebar-menu-hover-bg)] text-[var(--g-sub-sidebar-menu-hover-color)])" :class="{
|
||||
'text-[var(--g-sub-sidebar-menu-active-color)]! bg-[var(--g-sub-sidebar-menu-active-bg)]!': isItemActive,
|
||||
'px-3!': rootMenu.isMenuPopup && level === 0,
|
||||
}" :title="typeof item.meta?.title === 'function' ? item.meta?.title() : item.meta?.title"
|
||||
>
|
||||
<div
|
||||
class="inline-flex flex-1 items-center justify-center gap-[12px]" :class="{
|
||||
'flex-col': rootMenu.isMenuPopup && level === 0 && rootMenu.props.mode === 'vertical',
|
||||
'gap-1!': rootMenu.isMenuPopup && level === 0 && rootMenu.props.showCollapseName,
|
||||
'w-full': rootMenu.isMenuPopup && level === 0 && rootMenu.props.showCollapseName && rootMenu.props.mode === 'vertical',
|
||||
}" :style="indentStyle"
|
||||
<router-link v-slot="{ href, navigate }" custom :to="uniqueKey.at(-1) ?? ''">
|
||||
<FaTooltip :disabled="!rootMenu.isMenuPopup || level !== 0 || subMenu" :text="typeof item.meta?.title === 'function' ? item.meta?.title() : item.meta?.title" :side="rootMenu.props.mode === 'vertical' ? 'right' : 'bottom'" class="h-full w-full">
|
||||
<component
|
||||
:is="subMenu ? 'div' : 'a'" v-bind="{
|
||||
...(!subMenu && {
|
||||
href: item.meta?.link ? item.meta.link : href,
|
||||
target: item.meta?.link ? '_blank' : '_self',
|
||||
class: 'no-underline',
|
||||
}),
|
||||
}" :class="cn('group menu-item-container relative h-full w-full flex cursor-pointer items-center justify-between gap-1 rounded-lg px-4 py-3 text-[var(--g-sub-sidebar-menu-color)] transition-all hover-(bg-[var(--g-sub-sidebar-menu-hover-bg)] text-[var(--g-sub-sidebar-menu-hover-color)])', {
|
||||
'text-[var(--g-sub-sidebar-menu-active-color)]! bg-[var(--g-sub-sidebar-menu-active-bg)]!': isItemActive,
|
||||
'px-3': rootMenu.isMenuPopup && level === 0,
|
||||
})" :title="typeof item.meta?.title === 'function' ? item.meta?.title() : item.meta?.title" v-on="{
|
||||
...(!subMenu && {
|
||||
click: navigate,
|
||||
}),
|
||||
}"
|
||||
>
|
||||
<SvgIcon v-if="props.item.meta?.icon" :name="props.item.meta.icon" :size="20" class="menu-item-container-icon transition-transform group-hover:scale-120" async />
|
||||
<span
|
||||
v-if="!(rootMenu.isMenuPopup && level === 0 && !rootMenu.props.showCollapseName)" class="w-0 flex-1 truncate text-sm transition-height transition-opacity transition-width"
|
||||
:class="{
|
||||
'opacity-0 w-0 h-0': rootMenu.isMenuPopup && level === 0 && !rootMenu.props.showCollapseName,
|
||||
'w-full text-center': rootMenu.isMenuPopup && level === 0 && rootMenu.props.showCollapseName,
|
||||
<div
|
||||
:class="cn('inline-flex flex-1 items-center justify-center gap-[12px] pl-[calc(var(--indent-level)*20px)]', {
|
||||
'flex-col': rootMenu.isMenuPopup && level === 0 && rootMenu.props.mode === 'vertical',
|
||||
'gap-1': rootMenu.isMenuPopup && level === 0 && rootMenu.props.showCollapseName,
|
||||
'w-full': rootMenu.isMenuPopup && level === 0 && rootMenu.props.showCollapseName && rootMenu.props.mode === 'vertical',
|
||||
})" :style="{
|
||||
'--indent-level': !rootMenu.isMenuPopup ? props.level ?? 0 : 0,
|
||||
}"
|
||||
>
|
||||
{{ typeof item.meta?.title === 'function' ? item.meta?.title() : item.meta?.title }}
|
||||
</span>
|
||||
</div>
|
||||
<i
|
||||
v-if="subMenu && !(rootMenu.isMenuPopup && level === 0)" class="relative ml-1 w-[10px] after:(absolute h-[1.5px] w-[6px] bg-current transition-transform-200 content-empty -translate-y-[1px]) before:(absolute h-[1.5px] w-[6px] bg-current transition-transform-200 content-empty -translate-y-[1px])" :class="[
|
||||
expand ? 'before:(-rotate-45 -translate-x-[2px]) after:(rotate-45 translate-x-[2px])' : 'before:(rotate-45 -translate-x-[2px]) after:(-rotate-45 translate-x-[2px])',
|
||||
rootMenu.isMenuPopup && level === 0 && 'opacity-0',
|
||||
rootMenu.isMenuPopup && level !== 0 && '-rotate-90 -top-[1.5px]',
|
||||
]"
|
||||
/>
|
||||
</component>
|
||||
<FaIcon v-if="props.item.meta?.icon" :name="props.item.meta.icon" class="menu-item-container-icon size-5 transition-transform group-hover-scale-120" />
|
||||
<span
|
||||
v-if="!(rootMenu.isMenuPopup && level === 0 && !rootMenu.props.showCollapseName)" :class="cn('w-0 flex-1 truncate text-sm transition-height transition-opacity transition-width', {
|
||||
'opacity-0 w-0 h-0': rootMenu.isMenuPopup && level === 0 && !rootMenu.props.showCollapseName,
|
||||
'w-full text-center': rootMenu.isMenuPopup && level === 0 && rootMenu.props.showCollapseName,
|
||||
})"
|
||||
>
|
||||
{{ typeof item.meta?.title === 'function' ? item.meta?.title() : item.meta?.title }}
|
||||
</span>
|
||||
</div>
|
||||
<i
|
||||
v-if="subMenu && !(rootMenu.isMenuPopup && level === 0)" :class="cn('relative ms-1 w-[10px] after:absolute before:absolute after:h-[1.5px] after:w-[6px] before:h-[1.5px] before:w-[6px] after:bg-current before:bg-current after:transition-transform-200 before:transition-transform-200 after:content-empty before:content-empty after:-translate-y-[1px] before:-translate-y-[1px]', {
|
||||
[expand ? 'before:-rotate-45 before:-translate-x-[2px] after:rotate-45 after:translate-x-[2px]' : 'before:rotate-45 before:-translate-x-[2px] after:-rotate-45 after:translate-x-[2px]']: true,
|
||||
'opacity-0': rootMenu.isMenuPopup && level === 0,
|
||||
'-rotate-90 -top-[1.5px]': rootMenu.isMenuPopup && level !== 0,
|
||||
})"
|
||||
/>
|
||||
</component>
|
||||
</FaTooltip>
|
||||
</router-link>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import { useTimeoutFn } from '@vueuse/core'
|
||||
import type { OverlayScrollbarsComponentRef } from 'overlayscrollbars-vue'
|
||||
import { OverlayScrollbarsComponent } from 'overlayscrollbars-vue'
|
||||
import Item from './item.vue'
|
||||
import type { SubMenuProps } from './types'
|
||||
import { cn } from '@/utils'
|
||||
import { useTimeoutFn } from '@vueuse/core'
|
||||
import Item from './item.vue'
|
||||
import { rootMenuInjectionKey } from './types'
|
||||
|
||||
defineOptions({
|
||||
@@ -18,8 +17,8 @@ const props = withDefaults(
|
||||
)
|
||||
|
||||
const index = props.menu.path ?? JSON.stringify(props.menu)
|
||||
const itemRef = shallowRef()
|
||||
const subMenuRef = shallowRef<OverlayScrollbarsComponentRef>()
|
||||
const itemRef = useTemplateRef('itemRef')
|
||||
const subMenuRef = useTemplateRef('subMenuRef')
|
||||
const rootMenu = inject(rootMenuInjectionKey)!
|
||||
|
||||
const opened = computed(() => {
|
||||
@@ -36,41 +35,53 @@ const transitionEvent = computed(() => {
|
||||
},
|
||||
afterEnter: () => {},
|
||||
beforeLeave: (el: HTMLElement) => {
|
||||
el.style.overflow = 'hidden'
|
||||
el.style.maxHeight = `${el.offsetHeight}px`
|
||||
el.style.overflow = 'hidden'
|
||||
},
|
||||
leave: (el: HTMLElement) => {
|
||||
el.style.maxHeight = '0'
|
||||
},
|
||||
afterLeave(el: HTMLElement) {
|
||||
el.style.overflow = ''
|
||||
el.style.maxHeight = ''
|
||||
},
|
||||
}
|
||||
: {
|
||||
enter(el: HTMLElement) {
|
||||
const memorizedHeight = el.offsetHeight
|
||||
el.style.maxHeight = '0'
|
||||
el.style.overflow = 'hidden'
|
||||
void el.offsetHeight
|
||||
el.style.maxHeight = `${memorizedHeight}px`
|
||||
},
|
||||
afterEnter(el: HTMLElement) {
|
||||
el.style.overflow = ''
|
||||
el.style.maxHeight = ''
|
||||
},
|
||||
beforeLeave(el: HTMLElement) {
|
||||
el.style.overflow = 'hidden'
|
||||
el.style.maxHeight = `${el.offsetHeight}px`
|
||||
},
|
||||
leave(el: HTMLElement) {
|
||||
el.style.maxHeight = '0'
|
||||
},
|
||||
afterLeave(el: HTMLElement) {
|
||||
el.style.overflow = ''
|
||||
el.style.maxHeight = ''
|
||||
el.style.overflow = ''
|
||||
},
|
||||
}
|
||||
: CSS.supports('height', 'calc-size(auto, size)')
|
||||
? {}
|
||||
: {
|
||||
enter(el: HTMLElement) {
|
||||
requestAnimationFrame(() => {
|
||||
el.dataset.height = el.offsetHeight.toString()
|
||||
el.style.maxHeight = '0'
|
||||
void el.offsetHeight
|
||||
el.style.maxHeight = `${el.dataset.height}px`
|
||||
el.style.overflow = 'hidden'
|
||||
})
|
||||
},
|
||||
afterEnter(el: HTMLElement) {
|
||||
el.style.maxHeight = ''
|
||||
el.style.overflow = ''
|
||||
},
|
||||
enterCancelled(el: HTMLElement) {
|
||||
el.style.maxHeight = ''
|
||||
el.style.overflow = ''
|
||||
},
|
||||
beforeLeave(el: HTMLElement) {
|
||||
el.style.maxHeight = `${el.offsetHeight}px`
|
||||
el.style.overflow = 'hidden'
|
||||
},
|
||||
leave(el: HTMLElement) {
|
||||
el.style.maxHeight = '0'
|
||||
},
|
||||
afterLeave(el: HTMLElement) {
|
||||
el.style.maxHeight = ''
|
||||
el.style.overflow = ''
|
||||
},
|
||||
leaveCancelled(el: HTMLElement) {
|
||||
el.style.maxHeight = ''
|
||||
el.style.overflow = ''
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
const transitionClass = computed(() => {
|
||||
@@ -85,25 +96,16 @@ const transitionClass = computed(() => {
|
||||
}
|
||||
: {
|
||||
enterActiveClass: 'ease-in-out duration-300',
|
||||
enterFromClass: 'opacity-0',
|
||||
enterToClass: 'opacity-100',
|
||||
enterFromClass: cn('opacity-0 translate-y-4 scale-95 blur-4', CSS.supports('height', 'calc-size(auto, size)') && 'h-0'),
|
||||
enterToClass: 'opacity-100 translate-y-0 scale-100 blur-0',
|
||||
leaveActiveClass: 'ease-in-out duration-300',
|
||||
leaveFromClass: 'opacity-100',
|
||||
leaveToClass: 'opacity-0',
|
||||
leaveFromClass: 'opacity-100 translate-y-0 scale-100 blur-0',
|
||||
leaveToClass: cn('opacity-0 translate-y-4 scale-95 blur-4', CSS.supports('height', 'calc-size(auto, size)') && 'h-0'),
|
||||
}
|
||||
})
|
||||
|
||||
const hasChildren = computed(() => {
|
||||
let flag = true
|
||||
if (props.menu.children) {
|
||||
if (props.menu.children.every((item: any) => item.meta?.sidebar === false)) {
|
||||
flag = false
|
||||
}
|
||||
}
|
||||
else {
|
||||
flag = false
|
||||
}
|
||||
return flag
|
||||
return props.menu.children?.some((item: any) => item.meta?.menu !== false) ?? false
|
||||
})
|
||||
|
||||
function handleClick() {
|
||||
@@ -130,25 +132,32 @@ function handleMouseenter() {
|
||||
if (hasChildren.value) {
|
||||
rootMenu.openMenu(index, props.uniqueKey)
|
||||
nextTick(() => {
|
||||
const el = itemRef.value.ref
|
||||
const el = itemRef.value?.ref
|
||||
const subMenuEl = subMenuRef.value?.$el
|
||||
if (!el || !subMenuEl) {
|
||||
return
|
||||
}
|
||||
let top = 0
|
||||
let left = 0
|
||||
if (rootMenu.props.mode === 'vertical' || props.level !== 0) {
|
||||
top = el.getBoundingClientRect().top + el.scrollTop
|
||||
left = el.getBoundingClientRect().left + el.getBoundingClientRect().width
|
||||
if (top + subMenuRef.value!.getElement()!.offsetHeight > window.innerHeight) {
|
||||
top = window.innerHeight - subMenuRef.value!.getElement()!.offsetHeight
|
||||
if (top + subMenuEl.offsetHeight > window.innerHeight) {
|
||||
top = Math.max(0, window.innerHeight - subMenuEl.offsetHeight)
|
||||
}
|
||||
}
|
||||
else {
|
||||
top = el.getBoundingClientRect().top + el.getBoundingClientRect().height
|
||||
left = el.getBoundingClientRect().left
|
||||
if (top + subMenuRef.value!.getElement()!.offsetHeight > window.innerHeight) {
|
||||
subMenuRef.value!.getElement()!.style.height = `${window.innerHeight - top}px`
|
||||
if (top + subMenuEl.offsetHeight > window.innerHeight) {
|
||||
subMenuEl.style.height = `${window.innerHeight - top}px`
|
||||
}
|
||||
}
|
||||
subMenuRef.value!.getElement()!.style.top = `${top}px`
|
||||
subMenuRef.value!.getElement()!.style.left = `${left}px`
|
||||
if (left + subMenuEl.offsetWidth > document.documentElement.clientWidth) {
|
||||
left = el.getBoundingClientRect().left - el.getBoundingClientRect().width
|
||||
}
|
||||
subMenuEl.style.top = `${top}px`
|
||||
subMenuEl.style.insetInlineStart = `${left}px`
|
||||
})
|
||||
}
|
||||
else {
|
||||
@@ -181,17 +190,18 @@ function handleMouseleave() {
|
||||
<Item ref="itemRef" :unique-key="uniqueKey" :item="menu" :level="level" :sub-menu="hasChildren" :expand="opened" @click="handleClick" @mouseenter="handleMouseenter" @mouseleave="handleMouseleave" />
|
||||
<Teleport v-if="hasChildren" to="body" :disabled="!rootMenu.isMenuPopup">
|
||||
<Transition v-bind="transitionClass" v-on="transitionEvent">
|
||||
<OverlayScrollbarsComponent
|
||||
v-if="opened" ref="subMenuRef" :options="{ scrollbars: { visibility: 'hidden' } }" defer class="sub-menu" :class="{
|
||||
<FaScrollArea
|
||||
v-if="opened" ref="subMenuRef" :scrollbar="false" :mask="rootMenu.isMenuPopup" :class="cn('sub-menu static h-[calc-size(auto,size)] rounded-lg', {
|
||||
'bg-[var(--g-sub-sidebar-bg)]': rootMenu.isMenuPopup,
|
||||
'ring-1 ring-stone-2 dark:ring-stone-8 shadow-xl fixed z-3000 w-[200px]': rootMenu.isMenuPopup,
|
||||
'mx-2': rootMenu.isMenuPopup && (rootMenu.props.mode === 'vertical' || level !== 0),
|
||||
}"
|
||||
'border shadow-xl fixed z-3000 w-[200px]': rootMenu.isMenuPopup,
|
||||
'mx-1': rootMenu.isMenuPopup && (rootMenu.props.mode === 'vertical' || level !== 0),
|
||||
'py-1': rootMenu.isMenuPopup,
|
||||
})"
|
||||
>
|
||||
<template v-for="item in menu.children" :key="item.path ?? JSON.stringify(item)">
|
||||
<SubMenu v-if="item.meta?.sidebar !== false" :unique-key="[...uniqueKey, item.path ?? JSON.stringify(item)]" :menu="item" :level="level + 1" />
|
||||
<SubMenu v-if="item.meta?.menu !== false" :unique-key="[...uniqueKey, item.path ?? JSON.stringify(item)]" :menu="item" :level="level + 1" />
|
||||
</template>
|
||||
</OverlayScrollbarsComponent>
|
||||
</FaScrollArea>
|
||||
</Transition>
|
||||
</Teleport>
|
||||
</template>
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { createInjectionKey } from '@/utils/injectionKeys'
|
||||
import type { Menu } from '#/global'
|
||||
|
||||
export interface MenuItem {
|
||||
@@ -31,7 +30,7 @@ export interface MenuInjection {
|
||||
handleSubMenuClick: (index: string, indexPath: string[]) => void
|
||||
}
|
||||
|
||||
export const rootMenuInjectionKey = createInjectionKey<MenuInjection>('rootMenu')
|
||||
export const rootMenuInjectionKey = Symbol('rootMenu') as InjectionKey<MenuInjection>
|
||||
|
||||
export interface SubMenuProps {
|
||||
uniqueKey: string[]
|
||||
|
||||
@@ -1,348 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { Dialog, DialogDescription, DialogPanel, TransitionChild, TransitionRoot } from '@headlessui/vue'
|
||||
import type { OverlayScrollbarsComponentRef } from 'overlayscrollbars-vue'
|
||||
import { OverlayScrollbarsComponent } from 'overlayscrollbars-vue'
|
||||
import { cloneDeep } from 'lodash-es'
|
||||
import hotkeys from 'hotkeys-js'
|
||||
import type { RouteRecordRaw } from 'vue-router'
|
||||
import Breadcrumb from '../Breadcrumb/index.vue'
|
||||
import BreadcrumbItem from '../Breadcrumb/item.vue'
|
||||
import { resolveRoutePath } from '@/utils'
|
||||
import eventBus from '@/utils/eventBus'
|
||||
import useSettingsStore from '@/store/modules/settings'
|
||||
import useRouteStore from '@/store/modules/route'
|
||||
import useMenuStore from '@/store/modules/menu'
|
||||
import type { Menu } from '@/types/global'
|
||||
|
||||
defineOptions({
|
||||
name: 'Search',
|
||||
})
|
||||
|
||||
const overlayTransitionClass = ref({
|
||||
enter: 'ease-in-out duration-500',
|
||||
enterFrom: 'opacity-0',
|
||||
enterTo: 'opacity-100',
|
||||
leave: 'ease-in-out duration-500',
|
||||
leaveFrom: 'opacity-100',
|
||||
leaveTo: 'opacity-0',
|
||||
})
|
||||
|
||||
const transitionClass = computed(() => {
|
||||
return {
|
||||
enter: 'ease-out duration-300',
|
||||
enterFrom: 'opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95',
|
||||
enterTo: 'opacity-100 translate-y-0 sm:scale-100',
|
||||
leave: 'ease-in duration-200',
|
||||
leaveFrom: 'opacity-100 translate-y-0 sm:scale-100',
|
||||
leaveTo: 'opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95',
|
||||
}
|
||||
})
|
||||
|
||||
const router = useRouter()
|
||||
const settingsStore = useSettingsStore()
|
||||
const routeStore = useRouteStore()
|
||||
const menuStore = useMenuStore()
|
||||
|
||||
interface listTypes {
|
||||
path: string
|
||||
icon?: string
|
||||
title?: string | (() => string)
|
||||
link?: string
|
||||
breadcrumb: {
|
||||
title?: string | (() => string)
|
||||
}[]
|
||||
}
|
||||
|
||||
const isShow = ref(false)
|
||||
const searchInput = ref('')
|
||||
const sourceList = ref<listTypes[]>([])
|
||||
const actived = ref(-1)
|
||||
|
||||
const searchInputRef = ref()
|
||||
const searchResultRef = ref<OverlayScrollbarsComponentRef>()
|
||||
const searchResultItemRef = ref<HTMLElement[]>([])
|
||||
onBeforeUpdate(() => {
|
||||
searchResultItemRef.value = []
|
||||
})
|
||||
|
||||
const resultList = computed(() => {
|
||||
let result = []
|
||||
result = sourceList.value.filter((item) => {
|
||||
let flag = false
|
||||
if (item.title) {
|
||||
if (typeof item.title === 'function') {
|
||||
if (item.title().includes(searchInput.value)) {
|
||||
flag = true
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (item.title.includes(searchInput.value)) {
|
||||
flag = true
|
||||
}
|
||||
}
|
||||
}
|
||||
if (item.path.includes(searchInput.value)) {
|
||||
flag = true
|
||||
}
|
||||
if (item.breadcrumb.some((b) => {
|
||||
if (typeof b.title === 'function') {
|
||||
if (b.title().includes(searchInput.value)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (b.title?.includes(searchInput.value)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
})) {
|
||||
flag = true
|
||||
}
|
||||
return flag
|
||||
})
|
||||
return result
|
||||
})
|
||||
|
||||
watch(() => isShow.value, (val) => {
|
||||
if (val) {
|
||||
searchInput.value = ''
|
||||
actived.value = -1
|
||||
// 当搜索显示的时候绑定上、下、回车快捷键,隐藏的时候再解绑。另外当 input 处于 focus 状态时,采用 vue 来绑定键盘事件
|
||||
hotkeys('up', keyUp)
|
||||
hotkeys('down', keyDown)
|
||||
hotkeys('enter', keyEnter)
|
||||
}
|
||||
else {
|
||||
hotkeys.unbind('up', keyUp)
|
||||
hotkeys.unbind('down', keyDown)
|
||||
hotkeys.unbind('enter', keyEnter)
|
||||
}
|
||||
})
|
||||
watch(() => resultList.value, () => {
|
||||
actived.value = -1
|
||||
handleScroll()
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
eventBus.on('global-search-toggle', () => {
|
||||
if (!isShow.value) {
|
||||
initSourceList()
|
||||
}
|
||||
isShow.value = !isShow.value
|
||||
})
|
||||
hotkeys('alt+s', (e) => {
|
||||
if (settingsStore.settings.navSearch.enable && settingsStore.settings.navSearch.enableHotkeys) {
|
||||
e.preventDefault()
|
||||
initSourceList()
|
||||
isShow.value = true
|
||||
}
|
||||
})
|
||||
hotkeys('esc', (e) => {
|
||||
if (settingsStore.settings.navSearch.enable && settingsStore.settings.navSearch.enableHotkeys) {
|
||||
e.preventDefault()
|
||||
isShow.value = false
|
||||
}
|
||||
})
|
||||
initSourceList()
|
||||
})
|
||||
|
||||
function initSourceList() {
|
||||
sourceList.value = []
|
||||
if (settingsStore.settings.app.routeBaseOn !== 'filesystem') {
|
||||
routeStore.routes.forEach((item) => {
|
||||
item.children && getSourceList(item.children as RouteRecordRaw[])
|
||||
})
|
||||
}
|
||||
else {
|
||||
menuStore.menus.forEach((item) => {
|
||||
getSourceListByMenus(item.children)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function hasChildren(item: RouteRecordRaw) {
|
||||
let flag = true
|
||||
if (item.children?.every(i => i.meta?.sidebar === false)) {
|
||||
flag = false
|
||||
}
|
||||
return flag
|
||||
}
|
||||
function getSourceList(arr: RouteRecordRaw[], basePath?: string, icon?: string, breadcrumb?: { title?: string | (() => string) }[]) {
|
||||
arr.forEach((item) => {
|
||||
if (item.meta?.sidebar !== false) {
|
||||
const breadcrumbTemp = cloneDeep(breadcrumb) || []
|
||||
if (item.children && hasChildren(item)) {
|
||||
breadcrumbTemp.push({
|
||||
title: item.meta?.title,
|
||||
})
|
||||
getSourceList(item.children, resolveRoutePath(basePath, item.path), item.meta?.icon ?? icon, breadcrumbTemp)
|
||||
}
|
||||
else {
|
||||
breadcrumbTemp.push({
|
||||
title: item.meta?.title,
|
||||
})
|
||||
sourceList.value.push({
|
||||
path: resolveRoutePath(basePath, item.path),
|
||||
icon: item.meta?.icon ?? icon,
|
||||
title: item.meta?.title,
|
||||
link: item.meta?.link,
|
||||
breadcrumb: breadcrumbTemp,
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
function getSourceListByMenus(arr: Menu.recordRaw[], icon?: string, breadcrumb?: { title?: string | (() => string) }[]) {
|
||||
arr.forEach((item) => {
|
||||
const breadcrumbTemp = cloneDeep(breadcrumb) || []
|
||||
if (item.children && item.children.length > 0) {
|
||||
breadcrumbTemp.push({
|
||||
title: item.meta?.title,
|
||||
})
|
||||
getSourceListByMenus(item.children, item.meta?.icon ?? icon, breadcrumbTemp)
|
||||
}
|
||||
else {
|
||||
breadcrumbTemp.push({
|
||||
title: item.meta?.title,
|
||||
})
|
||||
sourceList.value.push({
|
||||
icon: item.meta?.icon ?? icon,
|
||||
title: item.meta?.title,
|
||||
path: item.path as string,
|
||||
breadcrumb: breadcrumbTemp,
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function keyUp() {
|
||||
if (resultList.value.length) {
|
||||
actived.value -= 1
|
||||
if (actived.value < 0) {
|
||||
actived.value = resultList.value.length - 1
|
||||
}
|
||||
handleScroll()
|
||||
}
|
||||
}
|
||||
function keyDown() {
|
||||
if (resultList.value.length) {
|
||||
actived.value += 1
|
||||
if (actived.value > resultList.value.length - 1) {
|
||||
actived.value = 0
|
||||
}
|
||||
handleScroll()
|
||||
}
|
||||
}
|
||||
function keyEnter() {
|
||||
if (actived.value !== -1) {
|
||||
searchResultItemRef.value.find(item => Number.parseInt(item.dataset.index!) === actived.value)?.click()
|
||||
}
|
||||
}
|
||||
function handleScroll() {
|
||||
if (searchResultRef.value) {
|
||||
const contentDom = searchResultRef.value.osInstance()!.elements().content
|
||||
let scrollTo = 0
|
||||
if (actived.value !== -1) {
|
||||
scrollTo = contentDom.scrollTop
|
||||
const activedOffsetTop = searchResultItemRef.value.find(item => Number.parseInt(item.dataset.index!) === actived.value)?.offsetTop ?? 0
|
||||
const activedClientHeight = searchResultItemRef.value.find(item => Number.parseInt(item.dataset.index!) === actived.value)?.clientHeight ?? 0
|
||||
const searchScrollTop = contentDom.scrollTop
|
||||
const searchClientHeight = contentDom.clientHeight
|
||||
if (activedOffsetTop + activedClientHeight > searchScrollTop + searchClientHeight) {
|
||||
scrollTo = activedOffsetTop + activedClientHeight - searchClientHeight
|
||||
}
|
||||
else if (activedOffsetTop <= searchScrollTop) {
|
||||
scrollTo = activedOffsetTop
|
||||
}
|
||||
}
|
||||
contentDom.scrollTo({
|
||||
top: scrollTo,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function pageJump(path: listTypes['path'], link: listTypes['link']) {
|
||||
if (link) {
|
||||
window.open(link, '_blank')
|
||||
}
|
||||
else {
|
||||
router.push(path)
|
||||
}
|
||||
isShow.value = false
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<TransitionRoot as="template" :show="isShow">
|
||||
<Dialog :initial-focus="searchInputRef" class="fixed inset-0 z-2000 flex" @close="isShow && eventBus.emit('global-search-toggle')">
|
||||
<TransitionChild as="template" v-bind="overlayTransitionClass">
|
||||
<div class="fixed inset-0 bg-stone-200/75 backdrop-blur-sm transition-opacity dark:bg-stone-8/75" />
|
||||
</TransitionChild>
|
||||
<div class="fixed inset-0">
|
||||
<div class="h-full flex items-end justify-center p-4 text-center sm:items-center sm:p-0">
|
||||
<TransitionChild as="template" v-bind="transitionClass">
|
||||
<DialogPanel class="relative h-full max-h-4/5 w-full flex flex-col text-left sm:max-w-2xl">
|
||||
<div class="flex flex-col overflow-y-auto rounded-xl bg-white shadow-xl dark:bg-stone-8">
|
||||
<div class="flex items-center px-4 py-3" border-b="~ solid stone-2 dark:stone-7">
|
||||
<SvgIcon name="ep:search" :size="18" class="text-stone-5" />
|
||||
<input ref="searchInputRef" v-model="searchInput" placeholder="搜索页面,支持标题、URL模糊查询" class="w-full border-0 rounded-md bg-transparent px-3 text-base text-dark dark:text-white focus:outline-none placeholder-stone-4 dark:placeholder-stone-5" @keydown.esc="eventBus.emit('global-search-toggle')" @keydown.up.prevent="keyUp" @keydown.down.prevent="keyDown" @keydown.enter.prevent="keyEnter">
|
||||
</div>
|
||||
<DialogDescription class="relative m-0 of-y-hidden">
|
||||
<OverlayScrollbarsComponent ref="searchResultRef" :options="{ scrollbars: { autoHide: 'leave', autoHideDelay: 300 } }" defer class="h-full">
|
||||
<template v-if="resultList.length > 0">
|
||||
<a v-for="(item, index) in resultList" ref="searchResultItemRef" :key="item.path" class="flex cursor-pointer items-center" :class="{ 'bg-stone-2/40 dark:bg-stone-7/40': index === actived }" :data-index="index" @click="pageJump(item.path, item.link)" @mouseover="actived = index">
|
||||
<SvgIcon v-if="item.icon" :name="item.icon" :size="20" class="basis-16 transition" :class="{ 'scale-120 text-ui-primary': index === actived }" />
|
||||
<div class="flex flex-1 flex-col gap-1 truncate px-4 py-3" border-l="~ solid stone-2 dark:stone-7">
|
||||
<div class="truncate text-base font-bold">{{ (typeof item.title === 'function' ? item.title() : item.title) ?? '[ 无标题 ]' }}</div>
|
||||
<Breadcrumb v-if="item.breadcrumb.length" class="truncate">
|
||||
<BreadcrumbItem v-for="(bc, bcIndex) in item.breadcrumb" :key="bcIndex" class="text-xs">
|
||||
{{ (typeof bc.title === 'function' ? bc.title() : bc.title) ?? '[ 无标题 ]' }}
|
||||
</BreadcrumbItem>
|
||||
</Breadcrumb>
|
||||
</div>
|
||||
</a>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div flex="center col" py-6 text-stone-5>
|
||||
<SvgIcon name="tabler:mood-empty" :size="40" />
|
||||
<p m-2 text-base>
|
||||
没有找到你想要的
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
</OverlayScrollbarsComponent>
|
||||
</DialogDescription>
|
||||
<div v-if="settingsStore.mode === 'pc'" class="flex justify-between px-4 py-3" border-t="~ solid stone-2 dark:stone-7">
|
||||
<div class="flex gap-8">
|
||||
<div class="inline-flex items-center gap-1 text-xs">
|
||||
<HKbd>
|
||||
<SvgIcon name="ion:md-return-left" :size="14" />
|
||||
</HKbd>
|
||||
<span>访问</span>
|
||||
</div>
|
||||
<div class="inline-flex items-center gap-1 text-xs">
|
||||
<HKbd>
|
||||
<SvgIcon name="ant-design:caret-up-filled" :size="14" />
|
||||
</HKbd>
|
||||
<HKbd>
|
||||
<SvgIcon name="ant-design:caret-down-filled" :size="14" />
|
||||
</HKbd>
|
||||
<span>切换</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="settingsStore.settings.navSearch.enableHotkeys" class="inline-flex items-center gap-1 text-xs">
|
||||
<HKbd>
|
||||
ESC
|
||||
</HKbd>
|
||||
<span>退出</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</DialogPanel>
|
||||
</TransitionChild>
|
||||
</div>
|
||||
</div>
|
||||
</Dialog>
|
||||
</TransitionRoot>
|
||||
</template>
|
||||
@@ -1,8 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import { useSlots } from '@/slots'
|
||||
import useMenuStore from '@/store/modules/menu'
|
||||
import useSettingsStore from '@/store/modules/settings'
|
||||
import Logo from '../Logo/index.vue'
|
||||
import Menu from '../Menu/index.vue'
|
||||
import useSettingsStore from '@/store/modules/settings'
|
||||
import useMenuStore from '@/store/modules/menu'
|
||||
|
||||
defineOptions({
|
||||
name: 'SubSidebar',
|
||||
@@ -13,57 +14,93 @@ const route = useRoute()
|
||||
const settingsStore = useSettingsStore()
|
||||
const menuStore = useMenuStore()
|
||||
|
||||
const sidebarScrollTop = ref(0)
|
||||
const enableSidebar = computed(() => {
|
||||
return settingsStore.mode === 'mobile' || (
|
||||
menuStore.sidebarMenus.length !== 0
|
||||
&& !menuStore.sidebarMenus.every(item => item.meta?.menu === false)
|
||||
)
|
||||
})
|
||||
|
||||
function onSidebarScroll(e: Event) {
|
||||
sidebarScrollTop.value = (e.target as HTMLElement).scrollTop
|
||||
}
|
||||
const transitionName = ref('')
|
||||
watch(() => menuStore.actived, (val, oldVal) => {
|
||||
if (settingsStore.mode === 'mobile' || settingsStore.settings.menu.mode === 'side') {
|
||||
if (val > oldVal) {
|
||||
transitionName.value = 'sub-sidebar-y-start'
|
||||
}
|
||||
else {
|
||||
transitionName.value = 'sub-sidebar-y-end'
|
||||
}
|
||||
}
|
||||
else if (settingsStore.settings.menu.mode === 'head') {
|
||||
if (val > oldVal) {
|
||||
transitionName.value = 'sub-sidebar-x-start'
|
||||
}
|
||||
else {
|
||||
transitionName.value = 'sub-sidebar-x-end'
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
class="sub-sidebar-container" :class="{
|
||||
'is-collapse': settingsStore.mode === 'pc' && settingsStore.settings.menu.subMenuCollapse,
|
||||
}"
|
||||
>
|
||||
<Logo
|
||||
:show-logo="settingsStore.settings.menu.menuMode === 'single'" class="sidebar-logo" :class="{
|
||||
'sidebar-logo-bg': settingsStore.settings.menu.menuMode === 'single',
|
||||
}"
|
||||
/>
|
||||
<Transition name="sub-sidebar">
|
||||
<div
|
||||
class="sub-sidebar flex-1 transition-shadow-300" :class="{
|
||||
shadow: sidebarScrollTop,
|
||||
}" @scroll="onSidebarScroll"
|
||||
v-if="enableSidebar" class="sub-sidebar-container" :class="{
|
||||
'is-collapse': settingsStore.mode === 'pc' && settingsStore.settings.menu.subMenuCollapse,
|
||||
}"
|
||||
>
|
||||
<TransitionGroup name="sub-sidebar">
|
||||
<template v-for="(mainItem, mainIndex) in menuStore.allMenus" :key="mainIndex">
|
||||
<div v-show="mainIndex === menuStore.actived">
|
||||
<Menu :menu="mainItem.children" :value="route.meta.activeMenu || route.path" :default-openeds="menuStore.defaultOpenedPaths" :accordion="settingsStore.settings.menu.subMenuUniqueOpened" :collapse="settingsStore.mode === 'pc' && settingsStore.settings.menu.subMenuCollapse" class="menu" />
|
||||
</div>
|
||||
</template>
|
||||
</TransitionGroup>
|
||||
<component :is="useSlots('sub-sidebar-top')" />
|
||||
<Logo
|
||||
v-if="['side', 'single'].includes(settingsStore.settings.menu.mode)" :show-logo="settingsStore.settings.menu.mode === 'single'" class="sidebar-logo" :class="{
|
||||
single: settingsStore.settings.menu.mode === 'single',
|
||||
}"
|
||||
/>
|
||||
<component :is="useSlots('sub-sidebar-after-logo')" />
|
||||
<FaScrollArea :scrollbar="false" mask gradient-color="var(--g-sub-sidebar-bg)" class="flex-1">
|
||||
<TransitionGroup :name="transitionName">
|
||||
<template v-for="(mainItem, mainIndex) in menuStore.allMenus" :key="mainIndex">
|
||||
<div v-show="mainIndex === menuStore.actived">
|
||||
<Menu
|
||||
:menu="mainItem.children" :value="route.meta.activeMenu || route.path" :default-openeds="menuStore.defaultOpenedPaths" :accordion="settingsStore.settings.menu.subMenuUniqueOpened" :collapse="settingsStore.mode === 'pc' && settingsStore.settings.menu.subMenuCollapse" class="menu" :class="{
|
||||
'-mt-2': !((settingsStore.mode === 'pc' && settingsStore.settings.menu.subMenuCollapse) || ['head', 'single'].includes(settingsStore.settings.menu.mode)),
|
||||
}"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</TransitionGroup>
|
||||
</FaScrollArea>
|
||||
<div v-if="settingsStore.mode === 'pc'" class="relative flex items-center px-4 py-3" :class="[settingsStore.settings.menu.subMenuCollapse ? 'justify-center' : 'justify-end']">
|
||||
<FaButton v-show="settingsStore.settings.menu.enableSubMenuCollapseButton" variant="secondary" size="icon" class="h-8 w-8 transition" :class="{ '-rotate-z-180': settingsStore.settings.menu.subMenuCollapse }" @click="settingsStore.toggleSidebarCollapse()">
|
||||
<FaIcon name="toolbar-collapse" class="size-4" />
|
||||
</FaButton>
|
||||
</div>
|
||||
<component :is="useSlots('sub-sidebar-after-menu')" />
|
||||
<div v-if="settingsStore.settings.menu.mode === 'single'" class="flex-center px-4 pb-3">
|
||||
<AccountButton :only-avatar="settingsStore.settings.menu.subMenuCollapse" dropdown-align="center" :dropdown-side="settingsStore.settings.menu.subMenuCollapse ? 'right' : 'top'" button-variant="secondary" :class="{ 'w-full': !settingsStore.settings.menu.subMenuCollapse }" />
|
||||
</div>
|
||||
<component :is="useSlots('sub-sidebar-bottom')" />
|
||||
</div>
|
||||
</div>
|
||||
</Transition>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped>
|
||||
.sub-sidebar-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
inset-inline-start: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: var(--g-sub-sidebar-width);
|
||||
background-color: var(--g-sub-sidebar-bg);
|
||||
transition: background-color 0.3s, left 0.3s, width 0.3s;
|
||||
box-shadow: -1px 0 0 0 hsl(var(--border)), 1px 0 0 0 hsl(var(--border));
|
||||
transition: background-color 0.3s, inset-inline-start 0.3s, width 0.3s, box-shadow 0.3s;
|
||||
|
||||
&.is-collapse {
|
||||
width: var(--g-sub-sidebar-collapse-width);
|
||||
|
||||
.sidebar-logo {
|
||||
&:not(.sidebar-logo-bg) {
|
||||
&:not(.single) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@@ -73,53 +110,58 @@ function onSidebarScroll(e: Event) {
|
||||
}
|
||||
}
|
||||
|
||||
.sidebar-logo {
|
||||
background-color: var(--g-sub-sidebar-bg);
|
||||
transition: background-color 0.3s;
|
||||
|
||||
&.sidebar-logo-bg {
|
||||
background-color: var(--g-sub-sidebar-logo-bg);
|
||||
|
||||
:deep(span) {
|
||||
color: var(--g-sub-sidebar-logo-color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.sub-sidebar {
|
||||
overflow: hidden auto;
|
||||
overscroll-behavior: contain;
|
||||
|
||||
// firefox隐藏滚动条
|
||||
scrollbar-width: none;
|
||||
|
||||
// chrome隐藏滚动条
|
||||
&::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&.shadow {
|
||||
box-shadow: inset 0 10px 10px -10px var(--g-box-shadow-color);
|
||||
}
|
||||
}
|
||||
|
||||
.menu {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
// 次侧边栏动画
|
||||
.sub-sidebar-enter-active {
|
||||
/* 次侧边栏动画 */
|
||||
.sub-sidebar-x-start-enter-active,
|
||||
.sub-sidebar-x-end-enter-active,
|
||||
.sub-sidebar-y-start-enter-active,
|
||||
.sub-sidebar-y-end-enter-active {
|
||||
transition: 0.2s;
|
||||
}
|
||||
|
||||
.sub-sidebar-enter-from,
|
||||
.sub-sidebar-leave-active {
|
||||
.sub-sidebar-x-start-enter-from,
|
||||
.sub-sidebar-x-start-leave-active {
|
||||
opacity: 0;
|
||||
transform: translateY(30px) skewY(10deg);
|
||||
transform: translateX(30px);
|
||||
}
|
||||
|
||||
.sub-sidebar-leave-active {
|
||||
.sub-sidebar-x-end-enter-from,
|
||||
.sub-sidebar-x-end-leave-active {
|
||||
opacity: 0;
|
||||
transform: translateX(-30px);
|
||||
}
|
||||
|
||||
.sub-sidebar-y-start-enter-from,
|
||||
.sub-sidebar-y-start-leave-active {
|
||||
opacity: 0;
|
||||
transform: translateY(30px);
|
||||
}
|
||||
|
||||
.sub-sidebar-y-end-enter-from,
|
||||
.sub-sidebar-y-end-leave-active {
|
||||
opacity: 0;
|
||||
transform: translateY(-30px);
|
||||
}
|
||||
|
||||
.sub-sidebar-x-start-leave-active,
|
||||
.sub-sidebar-x-end-leave-active,
|
||||
.sub-sidebar-y-start-leave-active,
|
||||
.sub-sidebar-y-end-leave-active {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
/* 次侧边栏动画 */
|
||||
.sub-sidebar-enter-active,
|
||||
.sub-sidebar-leave-active {
|
||||
transition: 0.3s;
|
||||
}
|
||||
|
||||
.sub-sidebar-enter-from,
|
||||
.sub-sidebar-leave-to {
|
||||
transform: translateX(calc(var(--g-sub-sidebar-width) * -1));
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,104 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { useFullscreen } from '@vueuse/core'
|
||||
import eventBus from '@/utils/eventBus'
|
||||
import useSettingsStore from '@/store/modules/settings'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
|
||||
defineOptions({
|
||||
name: 'Tools',
|
||||
})
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
const settingsStore = useSettingsStore()
|
||||
const userStore = useUserStore()
|
||||
|
||||
const mainPage = useMainPage()
|
||||
const { isFullscreen, toggle } = useFullscreen()
|
||||
|
||||
function toggleColorScheme(event: MouseEvent) {
|
||||
const { startViewTransition } = useViewTransition(() => {
|
||||
settingsStore.setColorScheme(settingsStore.settings.app.colorScheme === 'dark' ? 'light' : 'dark')
|
||||
})
|
||||
startViewTransition()?.ready.then(() => {
|
||||
const x = event.clientX
|
||||
const y = event.clientY
|
||||
const endRadius = Math.hypot(
|
||||
Math.max(x, innerWidth - x),
|
||||
Math.max(y, innerHeight - y),
|
||||
)
|
||||
const clipPath = [
|
||||
`circle(0px at ${x}px ${y}px)`,
|
||||
`circle(${endRadius}px at ${x}px ${y}px)`,
|
||||
]
|
||||
document.documentElement.animate(
|
||||
{
|
||||
clipPath: settingsStore.settings.app.colorScheme !== 'dark' ? clipPath : clipPath.reverse(),
|
||||
},
|
||||
{
|
||||
duration: 300,
|
||||
easing: 'ease-out',
|
||||
pseudoElement: settingsStore.settings.app.colorScheme !== 'dark' ? '::view-transition-new(root)' : '::view-transition-old(root)',
|
||||
},
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
const avatarError = ref(false)
|
||||
watch(() => userStore.avatar, () => {
|
||||
if (avatarError.value) {
|
||||
avatarError.value = false
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="tools flex items-center gap-4 whitespace-nowrap px-4">
|
||||
<span v-if="settingsStore.settings.navSearch.enable && settingsStore.mode === 'pc'" class="group inline-flex cursor-pointer items-center gap-1 rounded-2 bg-stone-1 px-2 py-1.5 text-dark ring-stone-3 ring-inset transition dark:bg-stone-9 dark:text-white hover:ring-1 dark:ring-stone-7" @click="eventBus.emit('global-search-toggle')">
|
||||
<SvgIcon name="ri:search-line" />
|
||||
<span class="text-sm text-stone-5 transition group-hover:text-dark dark:group-hover:text-white">搜索</span>
|
||||
<HKbd v-if="settingsStore.settings.navSearch.enableHotkeys" class="ml-2">{{ settingsStore.os === 'mac' ? '⌥' : 'Alt' }} S</HKbd>
|
||||
</span>
|
||||
<div class="flex items-center empty:hidden">
|
||||
<span v-if="settingsStore.settings.navSearch.enable && settingsStore.mode === 'mobile'" class="item" @click="eventBus.emit('global-search-toggle')">
|
||||
<SvgIcon name="ri:search-line" />
|
||||
</span>
|
||||
<span v-if="settingsStore.mode === 'pc' && settingsStore.settings.toolbar.enableFullscreen" class="item" @click="toggle">
|
||||
<SvgIcon :name="isFullscreen ? 'ri:fullscreen-exit-line' : 'ri:fullscreen-line'" />
|
||||
</span>
|
||||
<span v-if="settingsStore.settings.toolbar.enablePageReload" class="item" @click="mainPage.reload()">
|
||||
<SvgIcon name="iconoir:refresh-double" />
|
||||
</span>
|
||||
<span v-if="settingsStore.settings.toolbar.enableColorScheme" class="item" @click="toggleColorScheme">
|
||||
<SvgIcon :name="settingsStore.settings.app.colorScheme === 'light' ? 'ri:sun-line' : 'ri:moon-line'" />
|
||||
</span>
|
||||
</div>
|
||||
<HDropdownMenu
|
||||
:items="[
|
||||
[
|
||||
{ label: settingsStore.settings.home.title, handle: () => router.push({ path: settingsStore.settings.home.fullPath }), hide: !settingsStore.settings.home.enable },
|
||||
{ label: '个人设置', handle: () => router.push({ name: 'personalSetting' }) },
|
||||
],
|
||||
[
|
||||
{ label: '快捷键介绍', handle: () => eventBus.emit('global-hotkeys-intro-toggle'), hide: settingsStore.mode !== 'pc' },
|
||||
],
|
||||
[
|
||||
{ label: '退出登录', handle: () => userStore.logout() },
|
||||
],
|
||||
]"
|
||||
>
|
||||
<div flex-center cursor-pointer gap-1>
|
||||
<img v-if="userStore.avatar && !avatarError" :src="userStore.avatar" :onerror="() => (avatarError = true)" class="h-[24px] w-[24px] rounded-full">
|
||||
<SvgIcon v-else name="carbon:user-avatar-filled-alt" :size="24" class="text-gray-400" />
|
||||
{{ userStore.account }}
|
||||
<SvgIcon name="ep:caret-bottom" />
|
||||
</div>
|
||||
</HDropdownMenu>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.item {
|
||||
--at-apply: flex px-2 py-1 cursor-pointer;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,389 @@
|
||||
<script setup lang="ts">
|
||||
import type { Tabbar } from '#/global'
|
||||
import { useSlots } from '@/slots'
|
||||
import useSettingsStore from '@/store/modules/settings'
|
||||
import useTabbarStore from '@/store/modules/tabbar'
|
||||
import { useMagicKeys } from '@vueuse/core'
|
||||
import hotkeys from 'hotkeys-js'
|
||||
import { toast } from 'vue-sonner'
|
||||
|
||||
defineOptions({
|
||||
name: 'Tabbar',
|
||||
})
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
const settingsStore = useSettingsStore()
|
||||
const tabbarStore = useTabbarStore()
|
||||
|
||||
const tabbar = useTabbar()
|
||||
const mainPage = useMainPage()
|
||||
|
||||
const keys = useMagicKeys({ reactive: true })
|
||||
|
||||
const activedTabId = computed(() => tabbar.getId())
|
||||
|
||||
const tabsRef = useTemplateRef('tabsRef')
|
||||
const tabContainerRef = useTemplateRef('tabContainerRef')
|
||||
const tabRef = useTemplateRef<HTMLElement[]>('tabRef')
|
||||
|
||||
watch(() => route, (val) => {
|
||||
if (settingsStore.settings.tabbar.enable) {
|
||||
tabbarStore.add(val).then(() => {
|
||||
const index = tabbarStore.list.findIndex(item => item.tabId === activedTabId.value)
|
||||
if (index !== -1) {
|
||||
tabRef.value && tabsRef.value?.scrollTo(tabRef.value[index].offsetLeft - tabsRef.value.ref?.$el.clientWidth * 0.4)
|
||||
tabbarScrollTip()
|
||||
}
|
||||
})
|
||||
}
|
||||
}, {
|
||||
immediate: true,
|
||||
deep: true,
|
||||
})
|
||||
function tabbarScrollTip() {
|
||||
if (tabContainerRef.value?.$el.clientWidth > (tabsRef.value?.ref?.$el.clientWidth ?? 0) && localStorage.getItem('tabbarScrollTip') === undefined) {
|
||||
localStorage.setItem('tabbarScrollTip', '')
|
||||
const tips = toast.info('温馨提示', {
|
||||
description: '标签栏数量超过展示区域范围,可以将鼠标移到标签栏上,通过鼠标滚轮滑动浏览',
|
||||
position: 'top-center',
|
||||
duration: Infinity,
|
||||
action: {
|
||||
label: '知道了',
|
||||
onClick: () => toast.dismiss(tips),
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
function contextMenuItems(routeItem: Tabbar.recordRaw) {
|
||||
return [
|
||||
[
|
||||
{
|
||||
label: '重新加载',
|
||||
icon: 'i-ri:refresh-line',
|
||||
disabled: routeItem.tabId !== activedTabId.value,
|
||||
handle: () => mainPage.reload(),
|
||||
},
|
||||
{
|
||||
label: '关闭标签页',
|
||||
icon: 'i-ri:close-line',
|
||||
disabled: tabbarStore.list.length <= 1,
|
||||
handle: () => tabbar.closeById(routeItem.tabId),
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
label: '关闭其他标签页',
|
||||
disabled: !tabbar.checkCloseOtherSide(routeItem.tabId),
|
||||
handle: () => tabbar.closeOtherSide(routeItem.tabId),
|
||||
},
|
||||
{
|
||||
label: '关闭左侧标签页',
|
||||
disabled: !tabbar.checkCloseLeftSide(routeItem.tabId),
|
||||
handle: () => tabbar.closeLeftSide(routeItem.tabId),
|
||||
},
|
||||
{
|
||||
label: '关闭右侧标签页',
|
||||
disabled: !tabbar.checkCloseRightSide(routeItem.tabId),
|
||||
handle: () => tabbar.closeRightSide(routeItem.tabId),
|
||||
},
|
||||
],
|
||||
]
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
hotkeys('alt+left,alt+right,alt+w,alt+1,alt+2,alt+3,alt+4,alt+5,alt+6,alt+7,alt+8,alt+9,alt+0', (e, handle) => {
|
||||
if (settingsStore.settings.tabbar.enable && settingsStore.settings.tabbar.enableHotkeys) {
|
||||
e.preventDefault()
|
||||
switch (handle.key) {
|
||||
// 切换到当前标签页紧邻的上一个标签页
|
||||
case 'alt+left':
|
||||
if (tabbarStore.list[0].tabId !== activedTabId.value) {
|
||||
const index = tabbarStore.list.findIndex(item => item.tabId === activedTabId.value)
|
||||
router.push(tabbarStore.list[index - 1].fullPath)
|
||||
}
|
||||
break
|
||||
// 切换到当前标签页紧邻的下一个标签页
|
||||
case 'alt+right':
|
||||
if (tabbarStore.list.at(-1)?.tabId !== activedTabId.value) {
|
||||
const index = tabbarStore.list.findIndex(item => item.tabId === activedTabId.value)
|
||||
router.push(tabbarStore.list[index + 1].fullPath)
|
||||
}
|
||||
break
|
||||
// 关闭当前标签页
|
||||
case 'alt+w':
|
||||
tabbar.closeById(activedTabId.value)
|
||||
break
|
||||
// 切换到第 n 个标签页
|
||||
case 'alt+1':
|
||||
case 'alt+2':
|
||||
case 'alt+3':
|
||||
case 'alt+4':
|
||||
case 'alt+5':
|
||||
case 'alt+6':
|
||||
case 'alt+7':
|
||||
case 'alt+8':
|
||||
case 'alt+9':
|
||||
{
|
||||
const number = Number(handle.key.split('+')[1])
|
||||
tabbarStore.list[number - 1]?.fullPath && router.push(tabbarStore.list[number - 1].fullPath)
|
||||
break
|
||||
}
|
||||
// 切换到最后一个标签页
|
||||
case 'alt+0':
|
||||
router.push(tabbarStore.list[tabbarStore.list.length - 1].fullPath)
|
||||
break
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
onUnmounted(() => {
|
||||
hotkeys.unbind('alt+left,alt+right,alt+w,alt+1,alt+2,alt+3,alt+4,alt+5,alt+6,alt+7,alt+8,alt+9,alt+0')
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="tabbar">
|
||||
<component :is="useSlots('tabbar-start')" />
|
||||
<div class="tabbar-container">
|
||||
<FaScrollArea ref="tabsRef" horizontal :scrollbar="false" mask gradient-color="var(--g-tabbar-bg)" class="tabs">
|
||||
<TransitionGroup ref="tabContainerRef" name="tabbar" tag="div" class="tab-container">
|
||||
<div
|
||||
v-for="(element, index) in tabbarStore.list" :key="element.tabId"
|
||||
ref="tabRef" :data-index="index" class="tab" :class="{
|
||||
actived: element.tabId === activedTabId,
|
||||
}" @click="router.push(element.fullPath)"
|
||||
>
|
||||
<FaContextMenu :items="contextMenuItems(element)">
|
||||
<div class="size-full">
|
||||
<div class="tab-dividers" />
|
||||
<div class="tab-background" />
|
||||
<FaTooltip :delay="1000" side="bottom">
|
||||
<div class="tab-content">
|
||||
<div :key="element.tabId" class="title">
|
||||
<FaIcon v-if="settingsStore.settings.tabbar.enableIcon && element.icon" :name="element.icon" class="icon" />
|
||||
{{ typeof element?.title === 'function' ? element.title() : element.title }}
|
||||
</div>
|
||||
<div v-if="tabbarStore.list.length > 1" class="action-icon" @click.stop="tabbar.closeById(element.tabId)">
|
||||
<FaIcon name="i-ri:close-fill" />
|
||||
</div>
|
||||
<div v-show="keys.alt && index < 9" class="hotkey-number">
|
||||
{{ index + 1 }}
|
||||
</div>
|
||||
</div>
|
||||
<template #content>
|
||||
<div class="text-sm">
|
||||
{{ typeof element?.title === 'function' ? element.title() : element.title }}
|
||||
</div>
|
||||
<div class="text-accent-foreground/50">
|
||||
{{ element.fullPath }}
|
||||
</div>
|
||||
</template>
|
||||
</FaTooltip>
|
||||
</div>
|
||||
</FaContextMenu>
|
||||
</div>
|
||||
</TransitionGroup>
|
||||
</FaScrollArea>
|
||||
</div>
|
||||
<component :is="useSlots('tabbar-end')" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.tabbar {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: var(--g-tabbar-height);
|
||||
background-color: var(--g-tabbar-bg);
|
||||
transition: background-color 0.3s, box-shadow 0.3s;
|
||||
|
||||
.dark & {
|
||||
box-shadow: 0 1px 0 0 hsl(var(--border)), 0 -1px 0 0 hsl(var(--border));
|
||||
}
|
||||
|
||||
.tabbar-container {
|
||||
position: relative;
|
||||
flex: 1;
|
||||
height: 100%;
|
||||
|
||||
.tabs {
|
||||
position: absolute;
|
||||
inset-inline: 0;
|
||||
white-space: nowrap;
|
||||
|
||||
.tab-container {
|
||||
display: inline-block;
|
||||
|
||||
.tab {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 150px;
|
||||
height: var(--g-tabbar-height);
|
||||
font-size: 14px;
|
||||
line-height: calc(var(--g-tabbar-height) - 2px);
|
||||
vertical-align: bottom;
|
||||
pointer-events: none;
|
||||
cursor: pointer;
|
||||
|
||||
&:not(.actived):hover {
|
||||
z-index: 3;
|
||||
|
||||
&::before,
|
||||
&::after {
|
||||
content: none;
|
||||
}
|
||||
|
||||
& + .tab .tab-dividers::before {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.tab-content {
|
||||
.title,
|
||||
.action-icon {
|
||||
color: var(--g-tabbar-tab-hover-color);
|
||||
}
|
||||
}
|
||||
|
||||
.tab-background {
|
||||
background-color: var(--g-tabbar-tab-hover-bg);
|
||||
}
|
||||
}
|
||||
|
||||
* {
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
& + .tab:hover,
|
||||
& + .tab.actived {
|
||||
.tab-dividers::before {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&.actived {
|
||||
z-index: 5;
|
||||
|
||||
&::before,
|
||||
&::after {
|
||||
content: none;
|
||||
}
|
||||
|
||||
& + .tab .tab-dividers::before {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.tab-content {
|
||||
.title,
|
||||
.action-icon {
|
||||
color: var(--g-tabbar-tab-active-color);
|
||||
}
|
||||
}
|
||||
|
||||
.tab-background {
|
||||
background-color: var(--g-tabbar-tab-active-bg);
|
||||
}
|
||||
}
|
||||
|
||||
.tab-dividers {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: -1px;
|
||||
left: -1px;
|
||||
z-index: 0;
|
||||
height: 14px;
|
||||
transform: translateY(-50%);
|
||||
|
||||
&::before {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 1px;
|
||||
display: block;
|
||||
width: 1px;
|
||||
content: "";
|
||||
background-color: var(--g-tabbar-dividers-bg);
|
||||
opacity: 1;
|
||||
transition: opacity 0.3s, background-color 0.3s;
|
||||
}
|
||||
}
|
||||
|
||||
&:first-child .tab-dividers::before {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.tab-background {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
pointer-events: none;
|
||||
transition: opacity 0.3s, background-color 0.3s;
|
||||
}
|
||||
|
||||
.tab-content {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
pointer-events: all;
|
||||
|
||||
.title {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
gap: 5px;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
padding: 0 10px;
|
||||
margin-right: 10px;
|
||||
overflow: hidden;
|
||||
color: var(--g-tabbar-tab-color);
|
||||
white-space: nowrap;
|
||||
mask-image: linear-gradient(to right, #000 calc(100% - 20px), transparent);
|
||||
transition: margin-right 0.3s;
|
||||
|
||||
&:has(+ .action-icon) {
|
||||
margin-right: 28px;
|
||||
}
|
||||
|
||||
.icon {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.action-icon {
|
||||
--uno: transition absolute inset-e-2 top-1/2 -translate-y-1/2 rounded-full z-10 w-5 h-5 flex-center text-xs "text-[var(--g-tabbar-tab-color)]" hover:(border bg-secondary);
|
||||
}
|
||||
|
||||
.hotkey-number {
|
||||
--uno: border bg-secondary absolute inset-e-2 top-1/2 -translate-y-1/2 rounded-full z-10 w-5 h-5 flex-center text-xs "text-[var(--g-tabbar-tab-color)]";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 标签栏动画 */
|
||||
.tabs {
|
||||
.tabbar-move,
|
||||
.tabbar-enter-active,
|
||||
.tabbar-leave-active {
|
||||
transition: all 0.3s;
|
||||
}
|
||||
|
||||
.tabbar-enter-from,
|
||||
.tabbar-leave-to {
|
||||
opacity: 0;
|
||||
transform: translateY(30px);
|
||||
}
|
||||
|
||||
.tabbar-leave-active {
|
||||
position: absolute !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,62 @@
|
||||
<script setup lang="ts">
|
||||
import useSettingsStore from '@/store/modules/settings'
|
||||
import { compile } from 'path-to-regexp'
|
||||
import Breadcrumb from '../../../Breadcrumb/index.vue'
|
||||
import BreadcrumbItem from '../../../Breadcrumb/item.vue'
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
const settingsStore = useSettingsStore()
|
||||
|
||||
// 面包屑备份
|
||||
let breadcrumbListBackup: any = []
|
||||
const breadcrumbList = computed(() => {
|
||||
if (route.name === 'reload') {
|
||||
return breadcrumbListBackup
|
||||
}
|
||||
const list = []
|
||||
if (settingsStore.settings.home.enable) {
|
||||
list.push({
|
||||
path: settingsStore.settings.home.fullPath,
|
||||
title: settingsStore.settings.home.title,
|
||||
})
|
||||
}
|
||||
route.matched.forEach((item) => {
|
||||
if (item.meta?.breadcrumb !== false) {
|
||||
list.push({
|
||||
path: item.path,
|
||||
title: item.meta?.title,
|
||||
})
|
||||
}
|
||||
})
|
||||
breadcrumbListBackup = list
|
||||
return list
|
||||
})
|
||||
|
||||
function pathCompile(path: string) {
|
||||
const toPath = compile(path)
|
||||
return toPath(route.params)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Breadcrumb v-if="settingsStore.mode === 'pc' && settingsStore.settings.app.routeBaseOn !== 'filesystem'" class="breadcrumb whitespace-nowrap px-2">
|
||||
<TransitionGroup name="breadcrumb">
|
||||
<BreadcrumbItem v-for="(item, index) in breadcrumbList" :key="`${index}_${item.path}_${item.title}`" :to="index < breadcrumbList.length - 1 && item.path !== '' ? pathCompile(item.path) : ''">
|
||||
{{ item.title }}
|
||||
</BreadcrumbItem>
|
||||
</TransitionGroup>
|
||||
</Breadcrumb>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
/* 面包屑动画 */
|
||||
.breadcrumb-enter-active {
|
||||
transition: transform 0.3s, opacity 0.3s;
|
||||
}
|
||||
|
||||
.breadcrumb-enter-from {
|
||||
opacity: 0;
|
||||
transform: translateX(30px) skewX(-50deg);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,48 @@
|
||||
<script setup lang="ts">
|
||||
import useSettingsStore from '@/store/modules/settings'
|
||||
|
||||
defineOptions({
|
||||
name: 'ColorScheme',
|
||||
})
|
||||
|
||||
const settingsStore = useSettingsStore()
|
||||
|
||||
function toggleColorScheme(event: MouseEvent) {
|
||||
const { startViewTransition } = useViewTransition(() => {
|
||||
settingsStore.currentColorScheme && settingsStore.setColorScheme(settingsStore.currentColorScheme === 'dark' ? 'light' : 'dark')
|
||||
})
|
||||
startViewTransition()?.ready.then(() => {
|
||||
const x = event.clientX
|
||||
const y = event.clientY
|
||||
const endRadius = Math.hypot(
|
||||
Math.max(x, innerWidth - x),
|
||||
Math.max(y, innerHeight - y),
|
||||
)
|
||||
const clipPath = [
|
||||
`circle(0px at ${x}px ${y}px)`,
|
||||
`circle(${endRadius}px at ${x}px ${y}px)`,
|
||||
]
|
||||
document.documentElement.animate(
|
||||
{
|
||||
clipPath: settingsStore.settings.app.colorScheme !== 'dark' ? clipPath : clipPath.reverse(),
|
||||
},
|
||||
{
|
||||
duration: 300,
|
||||
easing: 'ease-out',
|
||||
pseudoElement: settingsStore.settings.app.colorScheme !== 'dark' ? '::view-transition-new(root)' : '::view-transition-old(root)',
|
||||
},
|
||||
)
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FaButton variant="ghost" size="icon" class="size-9" @click="toggleColorScheme">
|
||||
<FaIcon
|
||||
:name="{
|
||||
light: 'i-ri:sun-line',
|
||||
dark: 'i-ri:moon-line',
|
||||
}[settingsStore.currentColorScheme!]" class="size-4"
|
||||
/>
|
||||
</FaButton>
|
||||
</template>
|
||||
@@ -0,0 +1,18 @@
|
||||
<script setup lang="ts">
|
||||
import useSettingsStore from '@/store/modules/settings'
|
||||
import { useFullscreen } from '@vueuse/core'
|
||||
|
||||
defineOptions({
|
||||
name: 'Fullscreen',
|
||||
})
|
||||
|
||||
const settingsStore = useSettingsStore()
|
||||
|
||||
const { isFullscreen, toggle } = useFullscreen()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FaButton v-if="settingsStore.mode === 'pc'" variant="ghost" size="icon" class="size-9" @click="toggle">
|
||||
<FaIcon :name="isFullscreen ? 'i-ri:fullscreen-exit-line' : 'i-ri:fullscreen-line'" class="size-4" />
|
||||
</FaButton>
|
||||
</template>
|
||||
@@ -0,0 +1,25 @@
|
||||
<script setup lang="ts">
|
||||
import useSettingsStore from '@/store/modules/settings'
|
||||
import Search from './search.vue'
|
||||
|
||||
defineOptions({
|
||||
name: 'NavSearch',
|
||||
})
|
||||
|
||||
const settingsStore = useSettingsStore()
|
||||
|
||||
const isShow = ref(false)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FaButton :variant="settingsStore.mode === 'pc' ? 'outline' : 'ghost'" :size="settingsStore.mode === 'pc' ? undefined : 'icon'" :class="{ 'mx-2 px-3 h-9': settingsStore.mode === 'pc', 'size-9': settingsStore.mode !== 'pc' }" @click="isShow = true">
|
||||
<FaIcon name="i-ri:search-line" class="size-4" />
|
||||
<template v-if="settingsStore.mode === 'pc'">
|
||||
<span class="text-sm text-muted-foreground/60 transition group-hover-text-muted-foreground">搜索</span>
|
||||
<FaKbd v-if="settingsStore.settings.navSearch.enableHotkeys" class="-me-1">
|
||||
{{ settingsStore.os === 'mac' ? '⌘' : 'Ctrl' }} K
|
||||
</FaKbd>
|
||||
</template>
|
||||
</FaButton>
|
||||
<Search v-model="isShow" />
|
||||
</template>
|
||||
@@ -0,0 +1,276 @@
|
||||
<script setup lang="ts">
|
||||
import type { Menu } from '@/types/global'
|
||||
import Breadcrumb from '@/layouts/components/Breadcrumb/index.vue'
|
||||
import BreadcrumbItem from '@/layouts/components/Breadcrumb/item.vue'
|
||||
import useMenuStore from '@/store/modules/menu'
|
||||
import useRouteStore from '@/store/modules/route'
|
||||
import useSettingsStore from '@/store/modules/settings'
|
||||
import { resolveRoutePath } from '@/utils'
|
||||
import { useFocus } from '@vueuse/core'
|
||||
import hotkeys from 'hotkeys-js'
|
||||
|
||||
defineOptions({
|
||||
name: 'Search',
|
||||
})
|
||||
|
||||
const isShow = defineModel<boolean>({
|
||||
default: false,
|
||||
})
|
||||
|
||||
const router = useRouter()
|
||||
const settingsStore = useSettingsStore()
|
||||
const routeStore = useRouteStore()
|
||||
const menuStore = useMenuStore()
|
||||
|
||||
interface listTypes {
|
||||
path: string
|
||||
icon?: string
|
||||
title?: string | (() => string)
|
||||
link?: string
|
||||
}
|
||||
|
||||
const searchInput = ref('')
|
||||
const searchInputRef = useTemplateRef('searchInputRef')
|
||||
const { focused: searchInputFocused } = useFocus(searchInputRef)
|
||||
const sourceList = ref<listTypes[]>([])
|
||||
const actived = ref(-1)
|
||||
|
||||
const searchResultRef = useTemplateRef('searchResultRef')
|
||||
const searchResultItemRef = useTemplateRef<HTMLElement[]>('searchResultItemRef')
|
||||
|
||||
const resultList = computed(() => {
|
||||
let result = []
|
||||
result = sourceList.value.filter((item) => {
|
||||
let flag = false
|
||||
if (searchInput.value !== '') {
|
||||
if (item.title) {
|
||||
if (typeof item.title === 'function') {
|
||||
if (item.title().includes(searchInput.value)) {
|
||||
flag = true
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (item.title.includes(searchInput.value)) {
|
||||
flag = true
|
||||
}
|
||||
}
|
||||
}
|
||||
if (item.path.includes(searchInput.value)) {
|
||||
flag = true
|
||||
}
|
||||
if (routeStore.getRouteMatchedByPath(item.path).some((b) => {
|
||||
return typeof b.meta?.title === 'function' ? b.meta?.title().includes(searchInput.value) : b.meta?.title?.includes(searchInput.value)
|
||||
})) {
|
||||
flag = true
|
||||
}
|
||||
}
|
||||
return flag
|
||||
})
|
||||
return result
|
||||
})
|
||||
|
||||
watch(() => isShow.value, (val) => {
|
||||
if (val) {
|
||||
searchInput.value = ''
|
||||
actived.value = -1
|
||||
// 当搜索显示的时候绑定上、下、回车快捷键,隐藏的时候再解绑。另外当 input 处于 focus 状态时,采用 vue 来绑定键盘事件
|
||||
hotkeys('up', keyUp)
|
||||
hotkeys('down', keyDown)
|
||||
hotkeys('enter', keyEnter)
|
||||
hotkeys('esc', (e) => {
|
||||
if (settingsStore.settings.navSearch.enableHotkeys) {
|
||||
e.preventDefault()
|
||||
isShow.value = false
|
||||
}
|
||||
})
|
||||
}
|
||||
else {
|
||||
hotkeys.unbind('up', keyUp)
|
||||
hotkeys.unbind('down', keyDown)
|
||||
hotkeys.unbind('enter', keyEnter)
|
||||
hotkeys.unbind('esc')
|
||||
}
|
||||
})
|
||||
watch(() => resultList.value, () => {
|
||||
actived.value = -1
|
||||
handleScroll()
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
initSourceList()
|
||||
hotkeys('command+k, ctrl+k', (e) => {
|
||||
if (settingsStore.settings.navSearch.enableHotkeys) {
|
||||
e.preventDefault()
|
||||
isShow.value = true
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
hotkeys.unbind('command+k, ctrl+k')
|
||||
})
|
||||
|
||||
function initSourceList() {
|
||||
sourceList.value = []
|
||||
menuStore.allMenus.forEach((item) => {
|
||||
getSourceList(item.children)
|
||||
})
|
||||
}
|
||||
|
||||
function hasChildren(item: Menu.recordRaw) {
|
||||
let flag = true
|
||||
if (item.children?.every(i => i.meta?.menu === false)) {
|
||||
flag = false
|
||||
}
|
||||
return flag
|
||||
}
|
||||
function getSourceList(arr: Menu.recordRaw[], basePath?: string, icon?: string) {
|
||||
arr.forEach((item) => {
|
||||
if (item.meta?.menu !== false) {
|
||||
if (item.children && hasChildren(item)) {
|
||||
getSourceList(item.children, resolveRoutePath(basePath, item.path), item.meta?.icon ?? icon)
|
||||
}
|
||||
else {
|
||||
sourceList.value.push({
|
||||
path: resolveRoutePath(basePath, item.path),
|
||||
icon: item.meta?.icon ?? icon,
|
||||
title: item.meta?.title,
|
||||
link: item.meta?.link,
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function keyUp() {
|
||||
if (resultList.value.length) {
|
||||
actived.value -= 1
|
||||
if (actived.value < 0) {
|
||||
actived.value = resultList.value.length - 1
|
||||
}
|
||||
handleScroll()
|
||||
}
|
||||
}
|
||||
function keyDown() {
|
||||
if (resultList.value.length) {
|
||||
actived.value += 1
|
||||
if (actived.value > resultList.value.length - 1) {
|
||||
actived.value = 0
|
||||
}
|
||||
handleScroll()
|
||||
}
|
||||
}
|
||||
function keyEnter() {
|
||||
if (actived.value !== -1) {
|
||||
searchResultItemRef.value?.find(item => Number.parseInt(item.dataset.index!) === actived.value)?.click()
|
||||
}
|
||||
}
|
||||
function handleScroll() {
|
||||
if (searchResultRef.value?.areaRef?.ref?.el?.viewportElement) {
|
||||
const contentDom = searchResultRef.value.areaRef.ref.el.viewportElement
|
||||
let scrollTo = 0
|
||||
if (actived.value !== -1) {
|
||||
scrollTo = contentDom.scrollTop
|
||||
const activedOffsetTop = searchResultItemRef.value?.find(item => Number.parseInt(item.dataset.index!) === actived.value)?.offsetTop ?? 0
|
||||
const activedClientHeight = searchResultItemRef.value?.find(item => Number.parseInt(item.dataset.index!) === actived.value)?.clientHeight ?? 0
|
||||
const searchScrollTop = contentDom.scrollTop
|
||||
const searchClientHeight = contentDom.clientHeight
|
||||
if (activedOffsetTop + activedClientHeight > searchScrollTop + searchClientHeight) {
|
||||
scrollTo = activedOffsetTop + activedClientHeight - searchClientHeight
|
||||
}
|
||||
else if (activedOffsetTop <= searchScrollTop) {
|
||||
scrollTo = activedOffsetTop - 16
|
||||
}
|
||||
}
|
||||
contentDom.scrollTo({
|
||||
top: scrollTo,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function pageJump(path: listTypes['path'], link: listTypes['link']) {
|
||||
if (link) {
|
||||
window.open(link, '_blank')
|
||||
}
|
||||
else {
|
||||
router.push(path)
|
||||
}
|
||||
isShow.value = false
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FaModal ref="searchResultRef" v-model="isShow" border :footer="settingsStore.mode === 'pc'" :closable="false" class="w-full lg-max-w-2xl" content-class="flex flex-col p-0 min-h-auto" header-class="p-0" footer-class="p-0" @opened="searchInputFocused = true">
|
||||
<template #header>
|
||||
<div class="h-12 flex flex-shrink-0 items-center">
|
||||
<div class="h-full w-14 flex-center">
|
||||
<FaIcon name="i-ri:search-line" class="size-4 text-foreground/30" />
|
||||
</div>
|
||||
<input ref="searchInputRef" v-model="searchInput" placeholder="搜索页面,支持标题、URL模糊查询" class="h-full w-full border-0 rounded-md bg-transparent text-base text-foreground focus-outline-none placeholder-foreground/30" @keydown.esc.prevent="isShow = false" @keydown.up.prevent="keyUp" @keydown.down.prevent="keyDown" @keydown.enter.prevent="keyEnter">
|
||||
<div v-if="settingsStore.mode === 'mobile'" class="h-full w-14 flex-center border-s">
|
||||
<FaIcon name="i-carbon:close" class="size-4" @click="isShow = false" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template #footer>
|
||||
<div class="w-full flex justify-between px-4 py-3">
|
||||
<div class="flex gap-8">
|
||||
<div class="inline-flex items-center gap-1 text-xs">
|
||||
<FaKbd>
|
||||
<FaIcon name="i-ion:md-return-left" class="size-4" />
|
||||
</FaKbd>
|
||||
<span>访问</span>
|
||||
</div>
|
||||
<div class="inline-flex items-center gap-1 text-xs">
|
||||
<FaKbd>
|
||||
<FaIcon name="i-ant-design:caret-up-filled" class="size-4" />
|
||||
</FaKbd>
|
||||
<FaKbd>
|
||||
<FaIcon name="i-ant-design:caret-down-filled" class="size-4" />
|
||||
</FaKbd>
|
||||
<span>切换</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="settingsStore.settings.navSearch.enableHotkeys" class="inline-flex items-center gap-1 text-xs">
|
||||
<FaKbd>
|
||||
ESC
|
||||
</FaKbd>
|
||||
<span>退出</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<div>
|
||||
<template v-if="resultList.length > 0">
|
||||
<div v-for="(item, index) in resultList" ref="searchResultItemRef" :key="item.path" class="p-4" :data-index="index" @click="pageJump(item.path, item.link)" @mouseover="actived = index">
|
||||
<a class="flex cursor-pointer items-center border rounded-lg" :class="{ '-mt-4': index !== 0, 'bg-accent': index === actived }">
|
||||
<FaIcon v-if="item.icon" :name="item.icon" class="size-5 basis-16 transition" :class="{ 'scale-120 text-primary': index === actived }" />
|
||||
<div class="flex flex-1 flex-col gap-1 truncate border-s px-4 py-3">
|
||||
<div class="truncate text-start text-base font-bold">{{ (typeof item.title === 'function' ? item.title() : item.title) ?? '[ 无标题 ]' }}</div>
|
||||
<Breadcrumb v-if="routeStore.getRouteMatchedByPath(item.path).length" class="truncate">
|
||||
<BreadcrumbItem v-for="(bc, bcIndex) in routeStore.getRouteMatchedByPath(item.path)" :key="bcIndex" class="text-xs">
|
||||
{{ (typeof bc.meta?.title === 'function' ? bc.meta?.title() : bc.meta?.title) ?? '[ 无标题 ]' }}
|
||||
</BreadcrumbItem>
|
||||
</Breadcrumb>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="searchInput === ''">
|
||||
<div class="h-full flex-col-center py-6 text-secondary-foreground/50">
|
||||
<FaIcon name="i-tabler:mood-smile" class="size-10" />
|
||||
<p class="m-2 text-base">
|
||||
输入你要搜索的导航
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div class="h-full flex-col-center py-6 text-secondary-foreground/50">
|
||||
<FaIcon name="i-tabler:mood-empty" class="size-10" />
|
||||
<p class="m-2 text-base">
|
||||
没有找到你想要的
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</FaModal>
|
||||
</template>
|
||||
@@ -0,0 +1,64 @@
|
||||
<script setup lang="ts">
|
||||
import useSettingsStore from '@/store/modules/settings'
|
||||
import hotkeys from 'hotkeys-js'
|
||||
|
||||
defineOptions({
|
||||
name: 'PageReload',
|
||||
})
|
||||
|
||||
const settingsStore = useSettingsStore()
|
||||
const mainPage = useMainPage()
|
||||
|
||||
const isAnimating = ref(false)
|
||||
|
||||
onMounted(() => {
|
||||
hotkeys('f5', (e) => {
|
||||
if (settingsStore.settings.toolbar.pageReload) {
|
||||
e.preventDefault()
|
||||
mainPage.reload()
|
||||
}
|
||||
})
|
||||
})
|
||||
onUnmounted(() => {
|
||||
hotkeys.unbind('f5')
|
||||
})
|
||||
|
||||
function handleClick() {
|
||||
isAnimating.value = true
|
||||
mainPage.reload()
|
||||
}
|
||||
|
||||
function handleCtrlClick() {
|
||||
location.reload()
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FaTooltip side="bottom" :disabled="settingsStore.os === 'mac'">
|
||||
<template #content>
|
||||
<div class="flex-col-center gap-2">
|
||||
<p>按住 <FaKbd>Ctrl</FaKbd> 键并点击</p>
|
||||
<p>可切换为浏览器原生刷新</p>
|
||||
</div>
|
||||
</template>
|
||||
<FaButton variant="ghost" size="icon" class="size-9" @click.exact="handleClick" @click.ctrl.exact="handleCtrlClick" @animationend="isAnimating = false">
|
||||
<FaIcon name="i-iconoir:refresh-double" class="size-4" :class="{ animation: isAnimating }" />
|
||||
</FaButton>
|
||||
</FaTooltip>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.animation {
|
||||
animation: animation 1s;
|
||||
}
|
||||
|
||||
@keyframes animation {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,98 +1,31 @@
|
||||
<script setup lang="ts">
|
||||
import { compile } from 'path-to-regexp'
|
||||
import Breadcrumb from '../../Breadcrumb/index.vue'
|
||||
import BreadcrumbItem from '../../Breadcrumb/item.vue'
|
||||
import Tools from '../../Tools/index.vue'
|
||||
import useSettingsStore from '@/store/modules/settings'
|
||||
import LeftSide from './leftSide.vue'
|
||||
import RightSide from './rightSide.vue'
|
||||
|
||||
defineOptions({
|
||||
name: 'Toolbar',
|
||||
})
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
const settingsStore = useSettingsStore()
|
||||
|
||||
const enableSubMenuCollapseButton = computed(() => {
|
||||
return settingsStore.mode === 'mobile' || settingsStore.settings.menu.enableSubMenuCollapseButton
|
||||
})
|
||||
|
||||
const breadcrumbList = computed(() => {
|
||||
const breadcrumbList = []
|
||||
if (settingsStore.settings.home.enable) {
|
||||
breadcrumbList.push({
|
||||
path: settingsStore.settings.home.fullPath,
|
||||
title: settingsStore.settings.home.title,
|
||||
})
|
||||
}
|
||||
if (route.meta.breadcrumbNeste) {
|
||||
route.meta.breadcrumbNeste.forEach((item) => {
|
||||
if (item.hide === false) {
|
||||
breadcrumbList.push({
|
||||
path: item.path,
|
||||
title: item.title,
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
return breadcrumbList
|
||||
})
|
||||
|
||||
function pathCompile(path: string) {
|
||||
const toPath = compile(path)
|
||||
return toPath(route.params)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="toolbar-container">
|
||||
<div class="left-box">
|
||||
<div v-if="enableSubMenuCollapseButton" class="flex-center cursor-pointer px-2 py-1 transition-transform" :class="{ '-rotate-z-180': settingsStore.settings.menu.subMenuCollapse }" @click="settingsStore.toggleSidebarCollapse()">
|
||||
<SvgIcon name="toolbar-collapse" />
|
||||
</div>
|
||||
<Breadcrumb v-if="settingsStore.mode === 'pc' && settingsStore.settings.breadcrumb.enable && settingsStore.settings.app.routeBaseOn !== 'filesystem'" class="breadcrumb">
|
||||
<TransitionGroup name="breadcrumb">
|
||||
<BreadcrumbItem v-for="(item, index) in breadcrumbList" :key="`${index}_${item.path}_${item.title}`" :to="index < breadcrumbList.length - 1 && item.path !== '' ? pathCompile(item.path) : ''">
|
||||
{{ item.title }}
|
||||
</BreadcrumbItem>
|
||||
</TransitionGroup>
|
||||
</Breadcrumb>
|
||||
<div class="toolbar-container flex items-center justify-between">
|
||||
<div class="left-side h-full flex items-center of-hidden pe-16 ps-2">
|
||||
<LeftSide />
|
||||
</div>
|
||||
<div class="h-full flex flex-shrink-0 items-center justify-end px-2">
|
||||
<RightSide />
|
||||
</div>
|
||||
<Tools />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped>
|
||||
.toolbar-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
height: var(--g-toolbar-height);
|
||||
background-color: var(--g-container-bg);
|
||||
background-color: var(--g-toolbar-bg);
|
||||
transition: background-color 0.3s;
|
||||
|
||||
.left-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding-left: 10px;
|
||||
padding-right: 50px;
|
||||
overflow: hidden;
|
||||
mask-image: linear-gradient(90deg, #000 0%, #000 calc(100% - 50px), transparent);
|
||||
|
||||
.breadcrumb {
|
||||
padding-left: 10px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.left-side {
|
||||
mask-image: linear-gradient(to right, #000 0%, #000 calc(100% - 50px), transparent);
|
||||
}
|
||||
}
|
||||
|
||||
// 面包屑动画
|
||||
.breadcrumb-enter-active {
|
||||
transition: transform 0.3s, opacity 0.3s;
|
||||
}
|
||||
|
||||
.breadcrumb-enter-from {
|
||||
opacity: 0;
|
||||
transform: translateX(30px) skewX(-50deg);
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<script setup lang="ts">
|
||||
import { useSlots } from '@/slots'
|
||||
import useSettingsStore from '@/store/modules/settings'
|
||||
import Breadcrumb from './Breadcrumb/index.vue'
|
||||
|
||||
defineOptions({
|
||||
name: 'ToolbarLeftSide',
|
||||
})
|
||||
|
||||
const settingsStore = useSettingsStore()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex items-center">
|
||||
<FaButton v-if="settingsStore.mode === 'mobile'" variant="ghost" size="icon" class="h-9 w-9 -rotate-z-180" @click="settingsStore.toggleSidebarCollapse()">
|
||||
<FaIcon name="toolbar-collapse" class="size-4" />
|
||||
</FaButton>
|
||||
<component :is="useSlots('toolbar-start')" />
|
||||
<Breadcrumb v-if="settingsStore.settings.toolbar.breadcrumb" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,24 @@
|
||||
<script setup lang="ts">
|
||||
import { useSlots } from '@/slots'
|
||||
import useSettingsStore from '@/store/modules/settings'
|
||||
import ColorScheme from './ColorScheme/index.vue'
|
||||
import Fullscreen from './Fullscreen/index.vue'
|
||||
import NavSearch from './NavSearch/index.vue'
|
||||
import PageReload from './PageReload/index.vue'
|
||||
|
||||
defineOptions({
|
||||
name: 'ToolbarRightSide',
|
||||
})
|
||||
|
||||
const settingsStore = useSettingsStore()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex items-center">
|
||||
<NavSearch v-if="settingsStore.settings.toolbar.navSearch" />
|
||||
<Fullscreen v-if="settingsStore.settings.toolbar.fullscreen" />
|
||||
<PageReload v-if="settingsStore.settings.toolbar.pageReload" />
|
||||
<ColorScheme v-if="settingsStore.settings.toolbar.colorScheme" />
|
||||
<component :is="useSlots('toolbar-end')" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,6 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import Toolbar from './Toolbar/index.vue'
|
||||
import useSettingsStore from '@/store/modules/settings'
|
||||
import Tabbar from './Tabbar/index.vue'
|
||||
import Toolbar from './Toolbar/index.vue'
|
||||
|
||||
defineOptions({
|
||||
name: 'Topbar',
|
||||
@@ -9,17 +10,20 @@ defineOptions({
|
||||
const settingsStore = useSettingsStore()
|
||||
|
||||
const enableToolbar = computed(() => {
|
||||
return !(
|
||||
settingsStore.settings.menu.menuMode === 'head' && !settingsStore.settings.menu.enableSubMenuCollapseButton && (
|
||||
!settingsStore.settings.breadcrumb.enable || settingsStore.settings.app.routeBaseOn === 'filesystem'
|
||||
)
|
||||
)
|
||||
return settingsStore.settings.toolbar.enable && Object.keys(settingsStore.settings.toolbar).some((key) => {
|
||||
if (settingsStore.settings.app.routeBaseOn === 'filesystem' && key === 'breadcrumb') {
|
||||
return false
|
||||
}
|
||||
return settingsStore.settings.toolbar[key as keyof typeof settingsStore.settings.toolbar]
|
||||
})
|
||||
})
|
||||
|
||||
const scrollTop = ref(0)
|
||||
const scrollOnHide = ref(false)
|
||||
const topbarHeight = computed(() => {
|
||||
return enableToolbar.value ? Number.parseInt(getComputedStyle(document.documentElement || document.body).getPropertyValue('--g-toolbar-height')) : 0
|
||||
const tabbarHeight = settingsStore.settings.tabbar.enable ? Number.parseInt(getComputedStyle(document.documentElement || document.body).getPropertyValue('--g-tabbar-height')) : 0
|
||||
const toolbarHeight = enableToolbar.value ? Number.parseInt(getComputedStyle(document.documentElement || document.body).getPropertyValue('--g-toolbar-height')) : 0
|
||||
return tabbarHeight + toolbarHeight
|
||||
})
|
||||
onMounted(() => {
|
||||
window.addEventListener('scroll', onScroll)
|
||||
@@ -36,39 +40,55 @@ watch(scrollTop, (val, oldVal) => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
class="topbar-container" :class="{
|
||||
'has-toolbar': enableToolbar,
|
||||
[`topbar-${settingsStore.settings.topbar.mode}`]: true,
|
||||
'shadow': scrollTop,
|
||||
'hide': scrollOnHide,
|
||||
}" data-fixed-calc-width
|
||||
>
|
||||
<Toolbar v-if="enableToolbar" />
|
||||
</div>
|
||||
<FaSmartFixedBlock position="top" :class="{ 'absolute!': settingsStore.settings.topbar.mode === 'static' }">
|
||||
<div
|
||||
class="topbar-container transition-[transform,box-shadow]-300" :class="{
|
||||
[`topbar-${settingsStore.settings.topbar.mode}`]: true,
|
||||
mask: scrollTop,
|
||||
hide: scrollOnHide,
|
||||
}"
|
||||
>
|
||||
<Tabbar v-if="settingsStore.settings.tabbar.enable" />
|
||||
<Toolbar v-if="enableToolbar" />
|
||||
</div>
|
||||
</FaSmartFixedBlock>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped>
|
||||
.topbar-container {
|
||||
position: absolute;
|
||||
z-index: 999;
|
||||
top: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
box-shadow: 0 1px 0 0 var(--g-border-color);
|
||||
transition: width 0.3s, top 0.3s, transform 0.3s, box-shadow 0.3s;
|
||||
width: calc(100% - var(--scrollbar-width, 0px));
|
||||
box-shadow: 0 1px 0 0 hsl(var(--border));
|
||||
transition: transform 0.3s, box-shadow 0.3s;
|
||||
|
||||
&::before {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
z-index: 1;
|
||||
width: 100%;
|
||||
height: 50px;
|
||||
pointer-events: none;
|
||||
content: "";
|
||||
background-image: linear-gradient(0deg, transparent, var(--g-main-area-bg));
|
||||
box-shadow: 0 -1px 0 0 hsl(var(--border));
|
||||
opacity: 0;
|
||||
transform: translateY(100%);
|
||||
transition: opacity 0.3s;
|
||||
}
|
||||
|
||||
&.topbar-fixed,
|
||||
&.topbar-sticky {
|
||||
position: fixed;
|
||||
|
||||
&.shadow {
|
||||
box-shadow: 0 10px 10px -10px var(--g-box-shadow-color);
|
||||
&.mask::before {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
&.topbar-sticky.hide {
|
||||
top: calc(var(--g-toolbar-height) * -1) !important;
|
||||
transform: translateY(-100%);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { useClipboard } from '@vueuse/core'
|
||||
import Message from 'vue-m-message'
|
||||
import { toast } from 'vue-sonner'
|
||||
|
||||
defineOptions({
|
||||
name: 'LinkView',
|
||||
@@ -10,7 +10,7 @@ const route = useRoute()
|
||||
|
||||
const { copy, copied } = useClipboard()
|
||||
watch(copied, (val) => {
|
||||
val && Message.success('复制成功')
|
||||
val && toast.success('复制成功')
|
||||
})
|
||||
|
||||
function open() {
|
||||
@@ -21,30 +21,30 @@ function open() {
|
||||
<template>
|
||||
<div class="absolute h-full w-full flex flex-col">
|
||||
<Transition name="slide-right" mode="out-in" appear>
|
||||
<PageMain :key="route.meta.link" class="flex flex-1 flex-col justify-center">
|
||||
<FaPageMain :key="route.meta.link" class="flex flex-1 flex-col justify-center">
|
||||
<div class="flex flex-col items-center">
|
||||
<SvgIcon name="icon-park-twotone:planet" :size="120" class="text-ui-primary/80" />
|
||||
<div class="my-2 text-xl text-dark dark:text-white">
|
||||
<FaIcon name="i-icon-park-twotone:planet" class="size-30 text-primary/80" />
|
||||
<div class="my-2 text-xl text-dark dark-text-white">
|
||||
是否访问此链接
|
||||
</div>
|
||||
<div class="my-2 max-w-[300px] cursor-pointer text-center text-[14px] text-stone-5" @click="route.meta.link && copy(route.meta.link)">
|
||||
<HTooltip text="复制链接">
|
||||
<div class="my-2 max-w-[300px] cursor-pointer text-center text-[14px] text-secondary-foreground/50" @click="route.meta.link && copy(route.meta.link)">
|
||||
<FaTooltip text="复制链接">
|
||||
<div class="line-clamp-3">
|
||||
{{ route.meta.link }}
|
||||
</div>
|
||||
</HTooltip>
|
||||
</FaTooltip>
|
||||
</div>
|
||||
<HButton class="my-4" @click="open">
|
||||
<SvgIcon name="ri:external-link-fill" />
|
||||
<FaButton class="my-4" @click="open">
|
||||
<FaIcon name="i-ri:external-link-fill" />
|
||||
立即访问
|
||||
</HButton>
|
||||
</FaButton>
|
||||
</div>
|
||||
</PageMain>
|
||||
</FaPageMain>
|
||||
</Transition>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped>
|
||||
.slide-right-enter-active {
|
||||
transition: 0.2s;
|
||||
}
|
||||
@@ -54,12 +54,12 @@ function open() {
|
||||
}
|
||||
|
||||
.slide-right-enter-from {
|
||||
opacity: 0;
|
||||
margin-left: -20px;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.slide-right-leave-to {
|
||||
opacity: 0;
|
||||
margin-left: 20px;
|
||||
opacity: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
+89
-101
@@ -1,19 +1,16 @@
|
||||
<script setup lang="ts">
|
||||
import hotkeys from 'hotkeys-js'
|
||||
import { useSlots } from '@/slots'
|
||||
import useKeepAliveStore from '@/store/modules/keepAlive'
|
||||
import useMenuStore from '@/store/modules/menu'
|
||||
import useSettingsStore from '@/store/modules/settings'
|
||||
import eventBus from '@/utils/eventBus'
|
||||
import AppSetting from './components/AppSetting/index.vue'
|
||||
import Header from './components/Header/index.vue'
|
||||
import HotkeysIntro from './components/HotkeysIntro/index.vue'
|
||||
import MainSidebar from './components/MainSidebar/index.vue'
|
||||
import SubSidebar from './components/SubSidebar/index.vue'
|
||||
import Topbar from './components/Topbar/index.vue'
|
||||
import Search from './components/Search/index.vue'
|
||||
import HotkeysIntro from './components/HotkeysIntro/index.vue'
|
||||
import AppSetting from './components/AppSetting/index.vue'
|
||||
import LinkView from './components/views/link.vue'
|
||||
import Copyright from './components/Copyright/index.vue'
|
||||
import BackTop from './components/BackTop/index.vue'
|
||||
import useSettingsStore from '@/store/modules/settings'
|
||||
import useKeepAliveStore from '@/store/modules/keepAlive'
|
||||
import useMenuStore from '@/store/modules/menu'
|
||||
import eventBus from '@/utils/eventBus'
|
||||
|
||||
defineOptions({
|
||||
name: 'Layout',
|
||||
@@ -25,8 +22,52 @@ const settingsStore = useSettingsStore()
|
||||
const keepAliveStore = useKeepAliveStore()
|
||||
const menuStore = useMenuStore()
|
||||
|
||||
const mainPage = useMainPage()
|
||||
const menu = useMenu()
|
||||
// 头部当前实际高度
|
||||
const headerActualHeight = computed(() => {
|
||||
let actualHeight = Number.parseInt(getComputedStyle(document.documentElement).getPropertyValue('--g-header-height'))
|
||||
if (['single', 'side'].includes(settingsStore.settings.menu.mode) || settingsStore.mode === 'mobile') {
|
||||
actualHeight = 0
|
||||
}
|
||||
return actualHeight
|
||||
})
|
||||
|
||||
// 侧边栏主导航当前实际宽度
|
||||
const mainSidebarActualWidth = computed(() => {
|
||||
let actualWidth = Number.parseInt(getComputedStyle(document.documentElement).getPropertyValue('--g-main-sidebar-width'))
|
||||
if (settingsStore.settings.menu.mode === 'single' || (settingsStore.settings.menu.mode === 'head' && settingsStore.mode !== 'mobile')) {
|
||||
actualWidth = 0
|
||||
}
|
||||
return actualWidth
|
||||
})
|
||||
|
||||
// 侧边栏次导航当前实际宽度
|
||||
const subSidebarActualWidth = computed(() => {
|
||||
let actualWidth = Number.parseInt(getComputedStyle(document.documentElement).getPropertyValue('--g-sub-sidebar-width'))
|
||||
if (settingsStore.settings.menu.subMenuCollapse && settingsStore.mode !== 'mobile') {
|
||||
actualWidth = Number.parseInt(getComputedStyle(document.documentElement).getPropertyValue('--g-sub-sidebar-collapse-width'))
|
||||
}
|
||||
if (menuStore.sidebarMenus.every(item => item.meta?.menu === false)) {
|
||||
actualWidth = 0
|
||||
}
|
||||
return actualWidth
|
||||
})
|
||||
|
||||
// 顶栏当前实际高度
|
||||
const topbarActualHeight = computed(() => {
|
||||
let actualHeight = 0
|
||||
if (settingsStore.settings.tabbar.enable) {
|
||||
actualHeight += Number.parseInt(getComputedStyle(document.documentElement).getPropertyValue('--g-tabbar-height'))
|
||||
}
|
||||
if (settingsStore.settings.toolbar.enable && Object.keys(settingsStore.settings.toolbar).some((key) => {
|
||||
if (settingsStore.settings.app.routeBaseOn === 'filesystem' && key === 'breadcrumb') {
|
||||
return false
|
||||
}
|
||||
return settingsStore.settings.toolbar[key as keyof typeof settingsStore.settings.toolbar]
|
||||
})) {
|
||||
actualHeight += Number.parseInt(getComputedStyle(document.documentElement).getPropertyValue('--g-toolbar-height'))
|
||||
}
|
||||
return actualHeight
|
||||
})
|
||||
|
||||
const isLink = computed(() => !!routeInfo.meta.link)
|
||||
|
||||
@@ -49,30 +90,18 @@ watch(() => routeInfo.path, () => {
|
||||
}
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
hotkeys('f5', (e) => {
|
||||
if (settingsStore.settings.toolbar.enablePageReload) {
|
||||
e.preventDefault()
|
||||
mainPage.reload()
|
||||
}
|
||||
})
|
||||
hotkeys('alt+`', (e) => {
|
||||
if (settingsStore.settings.menu.enableHotkeys) {
|
||||
e.preventDefault()
|
||||
menu.switchTo(menuStore.actived + 1 < menuStore.allMenus.length ? menuStore.actived + 1 : 0)
|
||||
}
|
||||
})
|
||||
})
|
||||
onUnmounted(() => {
|
||||
hotkeys.unbind('f5')
|
||||
hotkeys.unbind('alt+`')
|
||||
})
|
||||
|
||||
const enableAppSetting = import.meta.env.VITE_APP_SETTING === 'true'
|
||||
const enableAppSetting = import.meta.env.VITE_APP_SETTING
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="layout">
|
||||
<div
|
||||
class="layout" :style="{
|
||||
'--g-header-actual-height': `${headerActualHeight}px`,
|
||||
'--g-main-sidebar-actual-width': `${mainSidebarActualWidth}px`,
|
||||
'--g-sub-sidebar-actual-width': `${subSidebarActualWidth}px`,
|
||||
'--g-topbar-actual-height': `${topbarActualHeight}px`,
|
||||
}"
|
||||
>
|
||||
<div id="app-main">
|
||||
<Header />
|
||||
<div class="wrapper">
|
||||
@@ -80,12 +109,12 @@ const enableAppSetting = import.meta.env.VITE_APP_SETTING === 'true'
|
||||
<MainSidebar />
|
||||
<SubSidebar />
|
||||
</div>
|
||||
<div class="sidebar-mask" :class="{ show: settingsStore.mode === 'mobile' && !settingsStore.settings.menu.subMenuCollapse }" @click="settingsStore.toggleSidebarCollapse()" />
|
||||
<div class="main-container">
|
||||
<div class="invisible fixed inset-0 z-1009 bg-black/50 op-0 backdrop-blur-sm transition-opacity" :class="{ 'op-100! visible!': settingsStore.mode === 'mobile' && !settingsStore.settings.menu.subMenuCollapse }" @click="settingsStore.toggleSidebarCollapse()" />
|
||||
<div class="main-container pb-[var(--g-main-container-padding-bottom)]">
|
||||
<Topbar />
|
||||
<div class="main">
|
||||
<RouterView v-slot="{ Component, route }">
|
||||
<Transition name="slide-right" mode="out-in" appear>
|
||||
<Transition :name="!settingsStore.isReloading ? 'slide-right' : ''" mode="out-in">
|
||||
<KeepAlive :include="keepAliveStore.list">
|
||||
<component :is="Component" v-show="!isLink" :key="route.fullPath" />
|
||||
</KeepAlive>
|
||||
@@ -93,23 +122,22 @@ const enableAppSetting = import.meta.env.VITE_APP_SETTING === 'true'
|
||||
</RouterView>
|
||||
<LinkView v-if="isLink" />
|
||||
</div>
|
||||
<Copyright />
|
||||
<FaCopyright />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<Search />
|
||||
<HotkeysIntro />
|
||||
<template v-if="enableAppSetting">
|
||||
<div class="app-setting" @click="eventBus.emit('global-app-setting-toggle')">
|
||||
<SvgIcon name="uiw:setting-o" class="icon" />
|
||||
<FaIcon name="i-uiw:setting-o" class="icon" />
|
||||
</div>
|
||||
<AppSetting />
|
||||
</template>
|
||||
<BackTop />
|
||||
<component :is="useSlots('free-position')" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped>
|
||||
[data-mode="mobile"] {
|
||||
.sidebar-container {
|
||||
transform: translateX(calc((var(--g-main-sidebar-width) + var(--g-sub-sidebar-width)) * -1));
|
||||
@@ -148,36 +176,24 @@ const enableAppSetting = import.meta.env.VITE_APP_SETTING === 'true'
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding-top: var(--g-header-actual-height);
|
||||
transition: padding-top 0.3s;
|
||||
|
||||
.sidebar-container {
|
||||
position: fixed;
|
||||
z-index: 1010;
|
||||
top: 0;
|
||||
top: var(--g-header-actual-height);
|
||||
bottom: 0;
|
||||
z-index: 1010;
|
||||
display: flex;
|
||||
width: calc(var(--g-main-sidebar-actual-width) + var(--g-sub-sidebar-actual-width));
|
||||
box-shadow: -1px 0 0 0 var(--g-border-color), 1px 0 0 0 var(--g-border-color);
|
||||
box-shadow: -1px 0 0 0 hsl(var(--border)), 1px 0 0 0 hsl(var(--border));
|
||||
transition: width 0.3s, transform 0.3s, box-shadow 0.3s, top 0.3s;
|
||||
}
|
||||
|
||||
.sidebar-mask {
|
||||
position: fixed;
|
||||
z-index: 1000;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-image: radial-gradient(transparent 1px, rgb(0 0 0 / 30%) 1px);
|
||||
background-size: 4px 4px;
|
||||
backdrop-filter: saturate(50%) blur(4px);
|
||||
transition: all 0.2s;
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
|
||||
&.show {
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
&:has(> .main-sidebar-container.main-sidebar-enter-active),
|
||||
&:has(> .main-sidebar-container.main-sidebar-leave-active),
|
||||
&:has(> .sub-sidebar-container.sub-sidebar-enter-active),
|
||||
&:has(> .sub-sidebar-container.sub-sidebar-leave-active) {
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,60 +206,32 @@ const enableAppSetting = import.meta.env.VITE_APP_SETTING === 'true'
|
||||
flex-direction: column;
|
||||
min-height: 100%;
|
||||
margin-left: calc(var(--g-main-sidebar-actual-width) + var(--g-sub-sidebar-actual-width));
|
||||
background-color: var(--g-bg);
|
||||
box-shadow: -1px 0 0 0 var(--g-border-color), 1px 0 0 0 var(--g-border-color);
|
||||
background-color: var(--g-main-area-bg);
|
||||
box-shadow: -1px 0 0 0 hsl(var(--border)), 1px 0 0 0 hsl(var(--border));
|
||||
transition: margin-left 0.3s, background-color 0.3s, box-shadow 0.3s;
|
||||
|
||||
.main {
|
||||
height: 100%;
|
||||
flex: auto;
|
||||
position: relative;
|
||||
flex: auto;
|
||||
height: 100%;
|
||||
margin: var(--g-topbar-actual-height) 0 0;
|
||||
overflow: hidden;
|
||||
transition: 0.3s;
|
||||
}
|
||||
|
||||
.topbar-container.has-toolbar + .main {
|
||||
margin: var(--g-toolbar-height) 0 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
header:not(.header-leave-active) + .wrapper {
|
||||
padding-top: var(--g-header-height);
|
||||
|
||||
.sidebar-container {
|
||||
top: var(--g-header-height);
|
||||
|
||||
:deep(.sidebar-logo) {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.main-container {
|
||||
.topbar-container {
|
||||
top: var(--g-header-height);
|
||||
|
||||
:deep(.tools) {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.app-setting {
|
||||
--at-apply: text-white dark:text-dark bg-ui-primary;
|
||||
--uno: bg-primary text-primary-foreground rounded-l-md;
|
||||
|
||||
position: fixed;
|
||||
z-index: 10;
|
||||
right: 0;
|
||||
top: calc(50% + 250px);
|
||||
right: 0;
|
||||
z-index: 10;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border-top-left-radius: 5px;
|
||||
border-bottom-left-radius: 5px;
|
||||
font-size: 24px;
|
||||
cursor: pointer;
|
||||
|
||||
@@ -262,7 +250,7 @@ header:not(.header-leave-active) + .wrapper {
|
||||
}
|
||||
}
|
||||
|
||||
// 主内容区动画
|
||||
/* 主内容区动画 */
|
||||
.slide-right-enter-active {
|
||||
transition: 0.2s;
|
||||
}
|
||||
@@ -272,12 +260,12 @@ header:not(.header-leave-active) + .wrapper {
|
||||
}
|
||||
|
||||
.slide-right-enter-from {
|
||||
opacity: 0;
|
||||
margin-left: -20px;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.slide-right-leave-to {
|
||||
opacity: 0;
|
||||
margin-left: 20px;
|
||||
opacity: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
block?: boolean
|
||||
outline?: boolean
|
||||
disabled?: boolean
|
||||
}>(),
|
||||
{
|
||||
block: false,
|
||||
outline: false,
|
||||
disabled: false,
|
||||
},
|
||||
)
|
||||
|
||||
const buttonClass = computed(() => [
|
||||
'focus:outline-none focus-visible:outline-0 cursor-pointer disabled:cursor-not-allowed disabled:opacity-75 flex-shrink-0 gap-x-1.5 px-2.5 py-1.5 border-size-0 font-medium text-sm rounded-md select-none',
|
||||
props.block ? 'w-full flex justify-center items-center' : 'inline-flex items-center',
|
||||
props.outline
|
||||
? 'shadow-sm ring-1 ring-inset ring-ui-primary text-ui-primary bg-white dark:bg-dark hover:not-disabled:bg-ui-primary/10 dark:hover:not-disabled:bg-ui-primary/10 focus-visible:ring-2'
|
||||
: 'shadow-sm text-ui-text bg-ui-primary hover:bg-ui-primary/75 disabled:bg-ui-primary/90 focus-visible:ring-inset focus-visible:ring-2',
|
||||
])
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<button :disabled="disabled" :class="buttonClass">
|
||||
<slot />
|
||||
</button>
|
||||
</template>
|
||||
@@ -1,37 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
modelValue: string | number | undefined
|
||||
options: {
|
||||
label?: string | number
|
||||
icon?: string
|
||||
value: string | number
|
||||
disabled?: boolean
|
||||
}[]
|
||||
disabled?: boolean
|
||||
}>(),
|
||||
{
|
||||
disabled: false,
|
||||
},
|
||||
)
|
||||
|
||||
const emits = defineEmits<{
|
||||
'update:modelValue': [string | number]
|
||||
'change': [string | number | undefined]
|
||||
}>()
|
||||
|
||||
watch(() => props.modelValue, (val) => {
|
||||
emits('change', val)
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="inline-flex select-none items-center justify-center of-hidden rounded-md bg-stone-3 dark:bg-stone-7">
|
||||
<button v-for="option in options" :key="option.value" :disabled="disabled || option.disabled" class="flex cursor-pointer items-center truncate border-size-0 bg-inherit px-2 py-1.5 text-sm disabled:cursor-not-allowed disabled:opacity-50 hover:not-disabled:(bg-ui-primary text-ui-text)" :class="{ 'text-ui-text bg-ui-primary': modelValue === option.value }" @click="emits('update:modelValue', option.value)">
|
||||
<SvgIcon v-if="option.icon" :name="option.icon" />
|
||||
<template v-else>
|
||||
{{ option.label }}
|
||||
</template>
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,90 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { Dialog, DialogDescription, DialogPanel, DialogTitle, TransitionChild, TransitionRoot } from '@headlessui/vue'
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
modelValue: boolean
|
||||
appear?: boolean
|
||||
title?: string
|
||||
preventClose?: boolean
|
||||
overlay?: boolean
|
||||
}>(),
|
||||
{
|
||||
modelValue: false,
|
||||
appear: false,
|
||||
preventClose: false,
|
||||
overlay: false,
|
||||
},
|
||||
)
|
||||
|
||||
const emits = defineEmits<{
|
||||
'update:modelValue': [boolean]
|
||||
'close': []
|
||||
}>()
|
||||
|
||||
const slots = useSlots()
|
||||
|
||||
const overlayTransitionClass = ref({
|
||||
enter: 'ease-in-out duration-500',
|
||||
enterFrom: 'opacity-0',
|
||||
enterTo: 'opacity-100',
|
||||
leave: 'ease-in-out duration-500',
|
||||
leaveFrom: 'opacity-100',
|
||||
leaveTo: 'opacity-0',
|
||||
})
|
||||
|
||||
const transitionClass = computed(() => {
|
||||
return {
|
||||
enter: 'ease-out duration-300',
|
||||
enterFrom: 'opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95',
|
||||
enterTo: 'opacity-100 translate-y-0 sm:scale-100',
|
||||
leave: 'ease-in duration-200',
|
||||
leaveFrom: 'opacity-100 translate-y-0 sm:scale-100',
|
||||
leaveTo: 'opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95',
|
||||
}
|
||||
})
|
||||
|
||||
const isOpen = computed({
|
||||
get() {
|
||||
return props.modelValue
|
||||
},
|
||||
set(value) {
|
||||
emits('update:modelValue', value)
|
||||
},
|
||||
})
|
||||
|
||||
function close() {
|
||||
isOpen.value = false
|
||||
emits('close')
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<TransitionRoot as="template" :appear="appear" :show="isOpen">
|
||||
<Dialog class="fixed inset-0 z-2000 flex" @close="!preventClose && close()">
|
||||
<TransitionChild as="template" :appear="appear" v-bind="overlayTransitionClass">
|
||||
<div class="fixed inset-0 bg-stone-2/75 transition-opacity dark:bg-stone-8/75" :class="{ 'backdrop-blur-sm': overlay }" />
|
||||
</TransitionChild>
|
||||
<div class="fixed inset-0 overflow-y-auto">
|
||||
<div class="min-h-full flex items-end justify-center p-4 text-center sm:items-center sm:p-0">
|
||||
<TransitionChild as="template" :appear="appear" v-bind="transitionClass">
|
||||
<DialogPanel class="relative w-full flex flex-col overflow-hidden rounded-xl bg-white text-left shadow-xl sm:my-8 sm:max-w-lg dark:bg-stone-8">
|
||||
<div flex="~ items-center justify-between" px-4 py-3 border-b="~ solid stone/15" text-6>
|
||||
<DialogTitle m-0 text-lg text-dark dark:text-white>
|
||||
{{ title }}
|
||||
</DialogTitle>
|
||||
<SvgIcon name="carbon:close" cursor-pointer @click="close" />
|
||||
</div>
|
||||
<DialogDescription m-0 overflow-y-auto p-4>
|
||||
<slot />
|
||||
</DialogDescription>
|
||||
<div v-if="!!slots.footer" flex="~ items-center justify-end" px-4 py-3 border-t="~ solid stone/15">
|
||||
<slot name="footer" />
|
||||
</div>
|
||||
</DialogPanel>
|
||||
</TransitionChild>
|
||||
</div>
|
||||
</div>
|
||||
</Dialog>
|
||||
</TransitionRoot>
|
||||
</template>
|
||||
@@ -1,8 +0,0 @@
|
||||
<template>
|
||||
<VDropdown :triggers="['hover']" :popper-triggers="['hover']" :delay="200" v-bind="$attrs">
|
||||
<slot />
|
||||
<template #popper>
|
||||
<slot name="dropdown" />
|
||||
</template>
|
||||
</VDropdown>
|
||||
</template>
|
||||
@@ -1,29 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
const props = defineProps<{
|
||||
items: {
|
||||
label: string
|
||||
disabled?: boolean
|
||||
hide?: boolean
|
||||
handle?: () => void
|
||||
}[][]
|
||||
}>()
|
||||
|
||||
const myItems = computed(() => {
|
||||
return props.items.map((item) => {
|
||||
return item.filter(v => !v.hide)
|
||||
}).filter(v => v.length)
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VMenu :delay="200" v-bind="$attrs">
|
||||
<slot />
|
||||
<template #popper>
|
||||
<div v-for="(item, index) in myItems" :key="index" class="p-1" border-b="~ solid stone-2 dark:stone-7 last:size-0">
|
||||
<button v-for="(v, i) in item" :key="i" :disabled="v.disabled" class="w-full flex cursor-pointer items-center gap-2 border-size-0 rounded-md bg-inherit px-2 py-1.5 text-sm text-dark disabled:cursor-not-allowed dark:text-white disabled:opacity-50 hover:not-disabled:bg-stone-1 dark:hover:not-disabled:bg-stone-9" @click="v.handle">
|
||||
{{ v.label }}
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
</VMenu>
|
||||
</template>
|
||||
@@ -1,32 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
modelValue: string
|
||||
placeholder?: string
|
||||
disabled?: boolean
|
||||
}>(),
|
||||
{
|
||||
disabled: false,
|
||||
},
|
||||
)
|
||||
|
||||
const emits = defineEmits<{
|
||||
'update:modelValue': [string]
|
||||
}>()
|
||||
|
||||
const inputRef = ref()
|
||||
|
||||
function handleInput(event: Event) {
|
||||
emits('update:modelValue', (event.target as HTMLInputElement).value)
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
ref: inputRef,
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="relative w-full lg:w-48">
|
||||
<input ref="inputRef" type="text" :value="modelValue" :placeholder="placeholder" :disabled="disabled" class="relative block w-full border-0 rounded-md bg-white px-2.5 py-1.5 text-sm shadow-sm ring-1 ring-stone-2 ring-inset disabled:cursor-not-allowed dark:bg-dark disabled:opacity-50 focus:outline-none focus:ring-2 dark:ring-stone-8 focus:ring-ui-primary placeholder-stone-4 dark:placeholder-stone-5" @input="handleInput">
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,5 +0,0 @@
|
||||
<template>
|
||||
<kbd class="mr-[4px] h-6 min-w-[24px] inline-flex items-center justify-center rounded bg-stone-1 px-1 text-[12px] text-dark font-medium font-sans ring-1 ring-stone-3 ring-inset last:mr-0 dark:bg-dark-9 dark:text-white dark:ring-stone-7">
|
||||
<slot />
|
||||
</kbd>
|
||||
</template>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user