Skip to content

BillionMail gives you open-source MailServer, NewsLetter, Email Marketing — fully self-hosted, dev-friendly, and free from monthly fees. Join the discord: https://discord.gg/asfXzBUhZr

New Confirm box method

zdm5ed91fb1499d
diff --git a/core/frontend/build/config.ts b/core/frontend/build/config.ts
index 976c069c..63e39354 100644
--- a/core/frontend/build/config.ts
+++ b/core/frontend/build/config.ts
@@ -5,6 +5,9 @@ const serverConfig: Record<string, ServerConfig> = {
https: false,
ip: '192.168.66.66',
port: 64325,
+ sshPort: 22,
+ username: 'root',
+ password: 'www.bt.cn',
},
}
diff --git a/core/frontend/build/interface.ts b/core/frontend/build/interface.ts
index 99ec81b6..2f4fcdb3 100644
--- a/core/frontend/build/interface.ts
+++ b/core/frontend/build/interface.ts
@@ -2,4 +2,7 @@ export interface ServerConfig {
https: boolean
ip: string
port: number
+ sshPort: number
+ username: string
+ password: string
}
diff --git a/core/frontend/build/plugin/deploy.ts b/core/frontend/build/plugin/deploy.ts
new file mode 100644
index 00000000..5af98359
--- /dev/null
+++ b/core/frontend/build/plugin/deploy.ts
@@ -0,0 +1,54 @@
+import { RsbuildPlugin } from '@rsbuild/core'
+import SftpClient from 'ssh2-sftp-client'
+import chalk from 'chalk'
+import ora from 'ora'
+
+interface DeployPluginOptions {
+ host: string
+ port?: number
+ username: string
+ password: string
+ localDistPath?: string
+ remoteDistPath: string
+}
+
+export function deployPlugin(options: DeployPluginOptions): RsbuildPlugin {
+ const { host, port = 22, username, password, localDistPath = './dist', remoteDistPath } = options
+
+ return {
+ name: 'rsbuild-deploy-plugin',
+ setup(build) {
+ build.onAfterBuild(async () => {
+ const sftp = new SftpClient()
+ let spinner
+
+ try {
+ spinner = ora(chalk.cyan('正在连接到服务器...')).start()
+ await sftp.connect({ host, port, username, password })
+ spinner.succeed(chalk.green('已连接到服务器。'))
+
+ spinner = ora(chalk.cyan('正在删除服务器上的旧文件...')).start()
+ await sftp.rmdir(remoteDistPath, true)
+ spinner.succeed(chalk.green('服务器上的旧文件已删除。'))
+
+ spinner = ora(chalk.cyan('正在创建新的目标目录...')).start()
+ await sftp.mkdir(remoteDistPath, true)
+ spinner.succeed(chalk.green('新的目标目录已创建。'))
+
+ spinner = ora(chalk.cyan('正在上传新的打包文件...')).start()
+ await sftp.uploadDir(localDistPath, remoteDistPath)
+ spinner.succeed(chalk.green('新的打包文件已上传完成。'))
+
+ sftp.end()
+ spinner.succeed(chalk.green('部署完成。'))
+ } catch (error) {
+ if (spinner) {
+ spinner.fail(chalk.red('部署过程中出现错误'))
+ }
+ spinner.fail(chalk.red('错误详情:'), error)
+ sftp.end()
+ }
+ })
+ },
+ }
+}
diff --git a/core/frontend/package.json b/core/frontend/package.json
index b0726ac1..61be802f 100644
--- a/core/frontend/package.json
+++ b/core/frontend/package.json
@@ -43,14 +43,17 @@
"@unocss/preset-uno": "66.1.0-beta.7",
"@unocss/transformer-directives": "66.1.0-beta.7",
"@unocss/webpack": "66.1.0-beta.7",
+ "chalk": "^5.4.1",
"eslint": "^9.21.0",
"eslint-config-prettier": "^10.1.1",
"eslint-plugin-prettier": "^5.2.5",
"eslint-plugin-vue": "^10.0.0",
"globals": "^16.0.0",
"naive-ui": "^2.41.0",
+ "ora": "^8.2.0",
"prettier": "^3.5.2",
"sass": "^1.86.1",
+ "ssh2-sftp-client": "^12.0.0",
"typescript": "^5.8.2",
"typescript-eslint": "^8.25.0",
"unocss": "66.1.0-beta.7",
diff --git a/core/frontend/pnpm-lock.yaml b/core/frontend/pnpm-lock.yaml
index 55c4fc80..1c82e8a7 100644
--- a/core/frontend/pnpm-lock.yaml
+++ b/core/frontend/pnpm-lock.yaml
@@ -96,6 +96,9 @@ importers:
'@unocss/webpack':
specifier: 66.1.0-beta.7
version: 66.1.0-beta.7([email protected])
+ chalk:
+ specifier: ^5.4.1
+ version: 5.4.1
eslint:
specifier: ^9.21.0
version: 9.23.0([email protected])
@@ -114,12 +117,18 @@ importers:
naive-ui:
specifier: ^2.41.0
+ ora:
+ specifier: ^8.2.0
+ version: 8.2.0
prettier:
specifier: ^3.5.2
version: 3.5.3
sass:
specifier: ^1.86.1
version: 1.86.1
+ ssh2-sftp-client:
+ specifier: ^12.0.0
+ version: 12.0.0
typescript:
specifier: ^5.8.2
version: 5.8.2
@@ -1292,6 +1301,10 @@ packages:
resolution: {integrity: sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==}
+ resolution: {integrity: sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==}
+ engines: {node: '>=12'}
+
resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==}
engines: {node: '>=8'}
@@ -1303,6 +1316,9 @@ packages:
resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==}
+ resolution: {integrity: sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==}
+
resolution: {integrity: sha512-7HhHjtERjqlNbZtqNqy2rckN/SpOOlmDliet+lP7k+eKZEjPk3DgyeU9lIXLdeLz0uBbbVp+9Qdow9wJWgwwfg==}
@@ -1318,6 +1334,9 @@ packages:
resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==}
+ resolution: {integrity: sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==}
+
resolution: {integrity: sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==}
@@ -1352,6 +1371,10 @@ packages:
resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==}
+ resolution: {integrity: sha512-8f9ZJCUXyT1M35Jx7MkBgmBMo3oHTTBIPLiY9xyL0pl3T5RwcPEY8cUHr5LBNfu/fk6c2T4DJZuVM/8ZZT2D2A==}
+ engines: {node: '>=10.0.0'}
+
resolution: {integrity: sha512-6Tzk1/TNeI3WBPpK0j/Ss4+gPj3PUJYbWl/MWDJBThFvwNGNkXtd7Cz8BJtD4aRwoGHtzQD0SnxamgUiBH0/Nw==}
peerDependencies:
@@ -1379,6 +1402,10 @@ packages:
resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==}
engines: {node: '>=10'}
+ resolution: {integrity: sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w==}
+ engines: {node: ^12.17.0 || ^14.13 || >=16.0.0}
+
resolution: {integrity: sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==}
engines: {node: '>= 8.10.0'}
@@ -1398,6 +1425,14 @@ packages:
resolution: {integrity: sha512-tskPPKEs8D2KPafUypv2gxwJP8h/OaJmC82QQGGDQcHvXX43xF2VDACcJVmZ0EuSxkpO9Kc4MlrA3q0+FG58AQ==}
+ resolution: {integrity: sha512-aCj4O5wKyszjMmDT4tZj93kxyydN/K5zPWSCe6/0AV/AA1pqe5ZBIw0a2ZfPQV7lL5/yb5HsUreJ6UFAF1tEQw==}
+ engines: {node: '>=18'}
+
+ resolution: {integrity: sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==}
+ engines: {node: '>=6'}
+
resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==}
engines: {node: '>=7.0.0'}
@@ -1421,6 +1456,10 @@ packages:
resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==}
+ resolution: {integrity: sha512-MWufYdFw53ccGjCA+Ol7XJYpAlW6/prSMzuPOTRnJGcGzuhLn4Scrz7qf6o8bROZ514ltazcIFJZevcfbo0x7A==}
+ engines: {'0': node >= 6.0}
+
resolution: {integrity: sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w==}
@@ -1441,6 +1480,10 @@ packages:
resolution: {integrity: sha512-SJ4/EHwS36QMJd6h/Rg+GyR4A5xE0FSI3eZ+iBVpfqf1x0eTSg1smWLHrA+2jQThZSh97fmSgFSU8B61nxosxA==}
+ resolution: {integrity: sha512-9IkYqtX3YHPCzoVg1Py+o9057a3i0fp7S530UWokCSaFVTc7CwXPRiOjRjBQQ18ZCNafx78YfnG+HALxtVmOGA==}
+ engines: {node: '>=10.0.0'}
+
resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==}
engines: {node: '>= 8'}
@@ -1525,6 +1568,9 @@ packages:
resolution: {integrity: sha512-refir3NlutEZqlKaBLK0tzlVLe5P2wDKS7UQt/3SpibizgsRAPOsqQC3ffw1nlv3ze5gjRQZYHoPymgVZkplFA==}
+ resolution: {integrity: sha512-EC+0oUMY1Rqm4O6LLrgjtYDvcVYTy7chDnM4Q7030tP4Kwj3u/pR6gP9ygnp2CJMK5Gq+9Q2oqmrFJAz01DXjw==}
+
resolution: {integrity: sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==}
engines: {node: '>= 4'}
@@ -1749,6 +1795,10 @@ packages:
resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==}
engines: {node: '>=6.9.0'}
+ resolution: {integrity: sha512-vpeMIQKxczTD/0s2CdEWHcb0eeJe6TFjxb+J5xgX7hScxqrGuyjmv4c1D4A/gelKfyox0gJJwIHF+fLjeaM8kQ==}
+ engines: {node: '>=18'}
+
resolution: {integrity: sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==}
engines: {node: '>= 0.4'}
@@ -1851,6 +1901,9 @@ packages:
resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==}
engines: {node: '>=0.8.19'}
+ resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==}
+
resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==}
engines: {node: '>=8'}
@@ -1863,10 +1916,22 @@ packages:
resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==}
engines: {node: '>=0.10.0'}
+ resolution: {integrity: sha512-qP1vozQRI+BMOPcjFzrjXuQvdak2pHNUMZoeG2eRbiSqyvbEf/wQtEOTOX1guk6E3t36RkaqiSt8A/6YElNxLQ==}
+ engines: {node: '>=12'}
+
resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==}
engines: {node: '>=0.12.0'}
+ resolution: {integrity: sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ==}
+ engines: {node: '>=12'}
+
+ resolution: {integrity: sha512-mE00Gnza5EEB3Ds0HfMyllZzbBrmLOX3vfWoj9A9PEnTfratQ/BcaJOuMhnkhjXvb2+FkY3VuHqtAGpTPmglFQ==}
+ engines: {node: '>=18'}
+
resolution: {integrity: sha512-ZhMwEosbFJkA0YhFnNDgTM4ZxDRsS6HqTo7qsZM08fehyRYIYa0yHu5R6mgo1n/8MgaPBXiPimPD77baVFYg+A==}
engines: {node: '>=12.13'}
@@ -1971,6 +2036,10 @@ packages:
resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==}
+ resolution: {integrity: sha512-i24m8rpwhmPIS4zscNzK6MSEhk0DUWa/8iYQWxhffV8jkI4Phvs3F+quL5xvS0gdQR0FyTCMMH33Y78dDTzzIw==}
+ engines: {node: '>=18'}
+
resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==}
@@ -2003,6 +2072,10 @@ packages:
resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==}
engines: {node: '>= 0.6'}
+ resolution: {integrity: sha512-VP79XUPxV2CigYP3jWwAUFSku2aKqBH7uTAapFWCBqutsbmDo96KY5o8uh6U+/YSIn5OxJnXp73beVkpqMIGhA==}
+ engines: {node: '>=18'}
+
resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==}
@@ -2028,6 +2101,9 @@ packages:
peerDependencies:
vue: ^3.0.0
+ resolution: {integrity: sha512-DANghxFkS1plDdRsX0X9pm0Z6SJNN6gBdtXfanwoZ8hooC5gosGFSBGRYHUVPz1asKA/kMRqDRdHrluZ61SpBQ==}
+
resolution: {integrity: sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==}
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
@@ -2070,10 +2146,18 @@ packages:
resolution: {integrity: sha512-RdR9FQrFwNBNXAr4GixM8YaRZRJ5PUWbKYbE5eOsrwAjJW0q2REGcf79oYPsLyskQCZG1PLN+S/K1V00joZAoQ==}
+ resolution: {integrity: sha512-VXJjc87FScF88uafS3JllDgvAm+c/Slfz06lorj2uAY34rlUu0Nt+v8wreiImcrgAjjIHp1rXpTDlLOGw29WwQ==}
+ engines: {node: '>=18'}
+
resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==}
engines: {node: '>= 0.8.0'}
+ resolution: {integrity: sha512-weP+BZ8MVNnlCm8c0Qdc1WSWq4Qn7I+9CJGm7Qali6g44e/PUzbjNqJX5NJ9ljlNMosfJvg1fKEGILklK9cwnw==}
+ engines: {node: '>=18'}
+
resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==}
engines: {node: '>=10'}
@@ -2184,6 +2268,10 @@ packages:
resolution: {integrity: sha512-btXCnMmRIBINM2LDZoEmOogIZU7Qe7zn4BpomSKZ/ykbLObuBdvG+mFq11DL6fjH1DRwHhrlgtYWG96bJiC7Cg==}
+ resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==}
+ engines: {node: '>= 6'}
+
resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==}
engines: {node: '>=8.10.0'}
@@ -2206,6 +2294,10 @@ packages:
resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==}
engines: {node: '>=4'}
+ resolution: {integrity: sha512-oMA2dcrw6u0YfxJQXm342bFKX/E4sG9rbTzO9ptUcR/e8A33cHuvStiYOwH7fszkZlZ1z/ta9AAoPk2F4qIOHA==}
+ engines: {node: '>=18'}
+
resolution: {integrity: sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==}
engines: {iojs: '>=1.0.0', node: '>=0.10.0'}
@@ -2227,6 +2319,9 @@ packages:
resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==}
+ resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==}
+
resolution: {integrity: sha512-r7MZtlAI2VFUnKE8B5UOrpoE6OGpdf1dIB6ndoxb3oiURgMyfTVU7yvJcL12GGvtVwQ2boCj6dq//Lqq9CXPlQ==}
engines: {node: '>=14.0.0'}
@@ -2391,6 +2486,10 @@ packages:
resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==}
engines: {node: '>=8'}
+ resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==}
+ engines: {node: '>=14'}
+
resolution: {integrity: sha512-FoqMu0NCGBLCcAkS1qA+XJIQTR6/JHfQXl+uGteNCQ76T91DMUjPa9xfmeqMY3z80nLSg9yQmNjK0Px6RWsH/A==}
engines: {node: '>=18'}
@@ -2414,9 +2513,32 @@ packages:
resolution: {integrity: sha512-1POYv7uv2gXoyGFpBCmpDVSNV74IfsWlDW216UPjbWufNf+bSU6GdbDsxdcxtfwb4xlI3yxzOTKClUosxARYrQ==}
engines: {node: '>=0.10.0'}
+ resolution: {integrity: sha512-k+ocDsx6N2eDwQlIRwJFa0I1bkQpFPhIc+cv1iplaQaIPXFt9YM1ZnXCJOW4OILS5dzE+12OlhYIF5g0AzgVfg==}
+ engines: {node: '>=18.20.4'}
+
+ resolution: {integrity: sha512-r1X4KsBGedJqo7h8F5c4Ybpcr5RjyP+aWIG007uBPRjmdQWfEiVLzSK71Zji1B9sKxwaCvD8y8cwSkYrlLiRRg==}
+ engines: {node: '>=10.16.0'}
+
resolution: {integrity: sha512-vj5lIj3Mwf9D79hBkltk5qmkFI+biIKWS2IBxEyEU3AX1tUf7AoL8nSazCOiiqQsGKIq01SClsKEzweu34uwvA==}
+ resolution: {integrity: sha512-UhDfHmA92YAlNnCfhmq0VeNL5bDbiZGg7sZ2IvPsXubGkiNa9EC+tUTsjBRsYUAz87btI6/1wf4XoVvQ3uRnmQ==}
+ engines: {node: '>=18'}
+
+ resolution: {integrity: sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==}
+ engines: {node: '>=18'}
+
+ resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==}
+
+ resolution: {integrity: sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==}
+ engines: {node: '>=12'}
+
resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==}
engines: {node: '>=8'}
@@ -2503,10 +2625,16 @@ packages:
resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==}
+ resolution: {integrity: sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==}
+
resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==}
engines: {node: '>= 0.8.0'}
+ resolution: {integrity: sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==}
+
resolution: {integrity: sha512-jfZtxJoHm59bvoCMYCe2BM0/baMswRhMmYhy+w6VfcyHrjxZ0OJe0tGasydCpIpA+A/WIJhTyZfb3EtwNC/kHQ==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
@@ -4046,6 +4174,8 @@ snapshots:
json-schema-traverse: 1.0.0
require-from-string: 2.0.2
+
dependencies:
color-convert: 2.0.1
@@ -4057,6 +4187,10 @@ snapshots:
+ dependencies:
+ safer-buffer: 2.1.2
+
@@ -4078,6 +4212,10 @@ snapshots:
+ dependencies:
+ tweetnacl: 0.14.5
+
@@ -4110,6 +4248,9 @@ snapshots:
+ optional: true
+
dependencies:
chokidar: 4.0.3
@@ -4141,6 +4282,8 @@ snapshots:
ansi-styles: 4.3.0
supports-color: 7.2.0
+
dependencies:
anymatch: 3.1.3
@@ -4165,6 +4308,12 @@ snapshots:
dependencies:
consola: 3.4.2
+ dependencies:
+ restore-cursor: 5.1.0
+
+
dependencies:
color-name: 1.1.4
@@ -4183,6 +4332,13 @@ snapshots:
+ dependencies:
+ buffer-from: 1.1.2
+ inherits: 2.0.4
+ readable-stream: 3.6.2
+ typedarray: 0.0.6
+
@@ -4197,6 +4353,12 @@ snapshots:
+ dependencies:
+ buildcheck: 0.0.6
+ nan: 2.22.2
+ optional: true
+
dependencies:
path-key: 3.1.1
@@ -4263,6 +4425,8 @@ snapshots:
+
@@ -4509,6 +4673,8 @@ snapshots:
+
dependencies:
call-bind-apply-helpers: 1.0.2
@@ -4604,6 +4770,8 @@ snapshots:
+
dependencies:
binary-extensions: 2.3.0
@@ -4614,8 +4782,14 @@ snapshots:
dependencies:
is-extglob: 2.1.1
+
+
+
@@ -4707,6 +4881,11 @@ snapshots:
+ dependencies:
+ chalk: 5.4.1
+ is-unicode-supported: 1.3.0
+
dependencies:
yallist: 3.1.1
@@ -4734,6 +4913,8 @@ snapshots:
dependencies:
mime-db: 1.52.0
+
dependencies:
brace-expansion: 1.1.11
@@ -4778,6 +4959,9 @@ snapshots:
vue: 3.5.13([email protected])
+ optional: true
+
@@ -4815,6 +4999,10 @@ snapshots:
+ dependencies:
+ mimic-function: 5.0.1
+
dependencies:
deep-is: 0.1.4
@@ -4824,6 +5012,18 @@ snapshots:
type-check: 0.4.0
word-wrap: 1.2.5
+ dependencies:
+ chalk: 5.4.1
+ cli-cursor: 5.0.0
+ cli-spinners: 2.9.2
+ is-interactive: 2.0.0
+ is-unicode-supported: 2.1.0
+ log-symbols: 6.0.0
+ stdin-discarder: 0.2.2
+ string-width: 7.2.0
+ strip-ansi: 7.1.0
+
dependencies:
yocto-queue: 0.1.0
@@ -4922,6 +5122,12 @@ snapshots:
defu: 6.1.4
destr: 2.0.3
+ dependencies:
+ inherits: 2.0.4
+ string_decoder: 1.3.0
+ util-deprecate: 1.0.2
+
dependencies:
picomatch: 2.3.1
@@ -4936,6 +5142,11 @@ snapshots:
+ dependencies:
+ onetime: 7.0.0
+ signal-exit: 4.1.0
+
@@ -4976,6 +5187,8 @@ snapshots:
+
optional: true
@@ -5106,6 +5319,8 @@ snapshots:
+
dependencies:
'@polka/url': 1.0.0-next.28
@@ -5125,8 +5340,37 @@ snapshots:
+ dependencies:
+ concat-stream: 2.0.0
+ ssh2: 1.16.0
+
+ dependencies:
+ asn1: 0.2.6
+ bcrypt-pbkdf: 1.0.2
+ optionalDependencies:
+ cpu-features: 0.0.10
+ nan: 2.22.2
+
+
+ dependencies:
+ emoji-regex: 10.4.0
+ get-east-asian-width: 1.3.0
+ strip-ansi: 7.1.0
+
+ dependencies:
+ safe-buffer: 5.2.1
+
+ dependencies:
+ ansi-regex: 6.1.0
+
@@ -5197,10 +5441,14 @@ snapshots:
+
dependencies:
prelude-ls: 1.2.1
+
dependencies:
diff --git a/core/frontend/rsbuild.config.ts b/core/frontend/rsbuild.config.ts
index 8e9d0475..7cc0e9bf 100644
--- a/core/frontend/rsbuild.config.ts
+++ b/core/frontend/rsbuild.config.ts
@@ -6,10 +6,13 @@ import { pluginSass } from '@rsbuild/plugin-sass'
import { pluginEslint } from '@rsbuild/plugin-eslint'
import { UnoCSSRspackPlugin } from '@unocss/webpack/rspack'
import { NaiveUiResolver } from 'unplugin-vue-components/resolvers'
-// import { pluginBasicSsl } from '@rsbuild/plugin-basic-ssl'
+import { pluginBasicSsl } from '@rsbuild/plugin-basic-ssl'
import Components from 'unplugin-vue-components/rspack'
import AutoImport from 'unplugin-auto-import/rspack'
-import { getProxyAddress, getServer, getEnv } from './build/utils'
+import { deployPlugin } from './build/plugin/deploy'
+import { getHttps, getProxyAddress, getServer, getEnv } from './build/utils'
+
+const server = getServer()
export default defineConfig({
plugins: [
@@ -19,7 +22,7 @@ export default defineConfig({
pluginVue(),
pluginVueJsx(),
pluginSass(),
- // ...(getHttps() ? [pluginBasicSsl()] : []),
+ ...(getHttps() ? [pluginBasicSsl()] : []),
pluginEslint({
eslintPluginOptions: {
cwd: __dirname,
@@ -27,6 +30,13 @@ export default defineConfig({
extensions: ['.js', '.jsx', '.ts', '.tsx', '.vue'],
},
}),
+ deployPlugin({
+ host: server.ip,
+ port: server.sshPort,
+ username: server.username,
+ password: server.password,
+ remoteDistPath: '/opt/billion-mail/core/public/dist',
+ }),
],
tools: {
rspack: {
@@ -61,7 +71,7 @@ export default defineConfig({
},
define: {
'import.meta.env': JSON.stringify({
- SERVER: getServer(),
+ SERVER: server,
API_URL_PREFIX: getEnv('API_URL_PREFIX'),
}),
},
diff --git a/core/frontend/src/api/index.ts b/core/frontend/src/api/index.ts
index 022dd430..3731c670 100644
--- a/core/frontend/src/api/index.ts
+++ b/core/frontend/src/api/index.ts
@@ -1,8 +1,7 @@
import axios from 'axios'
import router from '@/router'
import { useUserStore } from '@/store'
-import { apiUrlPrefix, isObject } from '@/utils'
-import { Message } from '@/utils/message'
+import { apiUrlPrefix, isObject, Message } from '@/utils'
interface FetchOptions {
prefix: string
diff --git a/core/frontend/src/api/modules/user.ts b/core/frontend/src/api/modules/user.ts
index a766d135..0c72ee29 100644
--- a/core/frontend/src/api/modules/user.ts
+++ b/core/frontend/src/api/modules/user.ts
@@ -12,3 +12,21 @@ export const login = (params: { username: string; password: string }) => {
},
})
}
+
+/**
+ * @description 退出登录
+ * @param params
+ * @returns
+ */
+export const logout = () => {
+ return instance.post(
+ '/logout',
+ {},
+ {
+ fetchOptions: {
+ loading: 'Logging out, please wait...',
+ successMessage: true,
+ },
+ }
+ )
+}
diff --git a/core/frontend/src/components/ui/bt-config-provider/index.vue b/core/frontend/src/components/ui/bt-config-provider/index.vue
index 6964581e..d63d4ddc 100644
--- a/core/frontend/src/components/ui/bt-config-provider/index.vue
+++ b/core/frontend/src/components/ui/bt-config-provider/index.vue
@@ -17,6 +17,10 @@ const themeOverrides = {
primaryColorHover: '#1D9534',
successColor: '#20A53A',
successColorHover: '#1D9534',
+ warningColor: '#F0AD4E',
+ warningColorHover: '#C6892E',
+ errorColor: '#ef0808',
+ errorColorHover: '#C9302C',
},
Layout: {
color: '#f4f7fa',
diff --git a/core/frontend/src/components/ui/bt-modal/index.vue b/core/frontend/src/components/ui/bt-modal/index.vue
index 2d649074..6321f9b3 100644
--- a/core/frontend/src/components/ui/bt-modal/index.vue
+++ b/core/frontend/src/components/ui/bt-modal/index.vue
@@ -10,14 +10,15 @@
:internal-appear="true"
:internal-dialog="true"
:transform-origin="transformOrigin"
- :style="{ width: formatLength(width) }">
+ :style="{ width: formatLength(width) }"
+ @after-leave="onAfterLeave">
<template #header>{{ title }}</template>
<div :style="{ maxHeight: maxScrollHeight, overflow: 'auto' }">
<slot></slot>
</div>
<template v-if="footer" #action>
<n-button class="cancel-btn" color="#cbcbcb" @click="onCancel">取消</n-button>
- <n-button type="primary" @click="onConfirm">确定</n-button>
+ <n-button :type="confirmType" @click="onConfirm">{{ confirmText || '确定' }}</n-button>
</template>
</n-modal>
</template>
@@ -25,9 +26,11 @@
<script lang="ts" setup>
import { useWindowSize } from '@vueuse/core'
import { formatLength } from 'naive-ui/es/_utils'
+import { Type } from 'naive-ui/es/button/src/interface'
const props = defineProps({
zIndex: Number,
+ onAfterLeave: Function as PropType<() => void>,
title: {
type: String,
default: '',
@@ -48,12 +51,20 @@ const props = defineProps({
type: String as PropType<'mouse' | 'center'>,
default: 'center',
},
+ confirmText: {
+ type: String,
+ default: '',
+ },
+ confirmType: {
+ type: String as PropType<Type>,
+ default: 'primary',
+ },
onCancel: {
- type: Function as PropType<() => boolean | void>,
+ type: Function as PropType<() => unknown>,
default: () => true,
},
onConfirm: {
- type: Function as PropType<() => void | Promise<unknown>>,
+ type: Function as PropType<() => void | boolean | Promise<unknown>>,
default: () => true,
},
})
@@ -85,6 +96,10 @@ const onConfirm = () => {
closeModal()
})
}
+
+const onAfterLeave = () => {
+ props.onAfterLeave?.()
+}
</script>
<style lang="scss" scoped>
diff --git a/core/frontend/src/components/utils/confirm/interface.ts b/core/frontend/src/components/utils/confirm/interface.ts
new file mode 100644
index 00000000..890234fc
--- /dev/null
+++ b/core/frontend/src/components/utils/confirm/interface.ts
@@ -0,0 +1,10 @@
+import { Type } from 'naive-ui/es/button/src/interface'
+
+export interface ConfirmOptions {
+ title?: string
+ content?: string
+ confirmText?: string
+ confirmType?: Type
+ onCancel?: () => unknown
+ onConfirm?: () => void | boolean | Promise<unknown>
+}
diff --git a/core/frontend/src/components/utils/confirm/method.tsx b/core/frontend/src/components/utils/confirm/method.tsx
new file mode 100644
index 00000000..ce6963df
--- /dev/null
+++ b/core/frontend/src/components/utils/confirm/method.tsx
@@ -0,0 +1,52 @@
+import { createVNode, render } from 'vue'
+import { ConfirmOptions } from './interface'
+
+import Modal from '@/components/ui/bt-modal/index.vue'
+import ConfigProvider from '@/components/ui/bt-config-provider/index.vue'
+
+/**
+ * @description 命令式调用确认对话框
+ * @param options 确认对话框选项
+ */
+export function confirm(options: ConfirmOptions) {
+ const container = document.createElement('div')
+
+ const removeModalElement = () => {
+ render(null, container)
+ if (container.parentNode) {
+ container.parentNode.removeChild(container)
+ }
+ }
+
+ // 创建虚拟节点
+ const modalNode = createVNode(
+ Modal,
+ {
+ show: true,
+ width: 420,
+ title: options.title,
+ onCancel: options.onCancel,
+ onConfirm: options.onConfirm,
+ confirmText: options.confirmText,
+ confirmType: options.confirmType,
+ onAfterLeave: () => {
+ removeModalElement()
+ },
+ },
+ {
+ default: () => <div class="text-14px">{options.content}</div>,
+ }
+ )
+
+ // 创建配置提供者节点
+ const configNode = createVNode(
+ ConfigProvider,
+ {},
+ {
+ default: modalNode,
+ }
+ )
+
+ // 渲染到 Modal
+ render(configNode, container)
+}
diff --git a/core/frontend/src/components/utils/message/method.ts b/core/frontend/src/components/utils/message/method.ts
index 24578cbe..aabffac6 100644
--- a/core/frontend/src/components/utils/message/method.ts
+++ b/core/frontend/src/components/utils/message/method.ts
@@ -105,7 +105,7 @@ class MessageManger {
const messageInstance: { center?: MessageManger } = {}
-const message = MESSAGE_TYPES.reduce((pre, value) => {
+export const Message = MESSAGE_TYPES.reduce((pre, value) => {
pre[value] = (content, config) => {
if (isString(content) || isFunction(content)) {
if (config) {
@@ -135,12 +135,10 @@ const message = MESSAGE_TYPES.reduce((pre, value) => {
return pre
}, {} as MessageMethod)
-message.clear = (position?: MessagePosition) => {
+Message.clear = (position?: MessagePosition) => {
if (position) {
messageInstance[position]?.clear()
} else {
Object.values(messageInstance).forEach(item => item?.clear())
}
}
-
-export default message
diff --git a/core/frontend/src/components/utils/modal/index.vue b/core/frontend/src/components/utils/modal/index.vue
deleted file mode 100644
index e9c6f77a..00000000
--- a/core/frontend/src/components/utils/modal/index.vue
+++ /dev/null
@@ -1,100 +0,0 @@
-<template>
- <n-modal
- v-model:show="show"
- preset="dialog"
- :z-index="zIndex"
- :draggable="true"
- :auto-focus="false"
- :show-icon="false"
- :mask-closable="false"
- :internal-appear="true"
- :internal-dialog="true"
- :transform-origin="transformOrigin"
- :style="{ width: formatLength(width) }"
- @after-leave="onAfterLeave">
- <template #header>{{ title }}</template>
- <div :style="{ maxHeight: maxScrollHeight, overflow: 'auto' }">
- <slot></slot>
- </div>
- <template v-if="footer" #action>
- <n-button class="cancel-btn" color="#cbcbcb" @click="onCancel">取消</n-button>
- <n-button type="primary" @click="onConfirm">确定</n-button>
- </template>
- </n-modal>
-</template>
-
-<script lang="ts" setup>
-import { useWindowSize } from '@vueuse/core'
-import { formatLength } from 'naive-ui/es/_utils'
-
-const props = defineProps({
- zIndex: Number,
- onAfterLeave: Function as PropType<() => void>,
- title: {
- type: String,
- default: '',
- },
- width: {
- type: [String, Number],
- default: 'auto',
- },
- minHeight: {
- type: [Number, String],
- default: 'auto',
- },
- footer: {
- type: Boolean,
- default: true,
- },
- transformOrigin: {
- type: String as PropType<'mouse' | 'center'>,
- default: 'center',
- },
- onCancel: {
- type: Function as PropType<() => boolean | void>,
- default: () => true,
- },
- onConfirm: {
- type: Function as PropType<() => void | Promise<unknown>>,
- default: () => true,
- },
-})
-
-const show = defineModel<boolean>('show')
-
-// 窗口高度
-const { height } = useWindowSize()
-
-// 最大滚动高度
-const maxScrollHeight = computed(() => {
- if (height.value) return `${height.value - 32}px`
- return 'auto'
-})
-
-const closeModal = () => {
- show.value = false
-}
-
-const onCancel = () => {
- const result = props.onCancel()
- if (result === false) return
- show.value = false
-}
-
-const onConfirm = () => {
- void Promise.resolve(props.onConfirm()).then(value => {
- if (value === false) return
- closeModal()
- })
-}
-
-const onAfterLeave = () => {
- props.onAfterLeave?.()
-}
-</script>
-
-<style lang="scss" scoped>
-.cancel-btn {
- --n-color-hover: #c9302c;
-}
-</style>
diff --git a/core/frontend/src/components/utils/modal/method.tsx b/core/frontend/src/components/utils/modal/method.tsx
deleted file mode 100644
index 10c5bf88..00000000
--- a/core/frontend/src/components/utils/modal/method.tsx
+++ /dev/null
@@ -1,37 +0,0 @@
-import { createVNode, render, VNodeChild } from 'vue'
-import { render as renderContent } from 'naive-ui/es/_utils'
-import Modal from './index.vue'
-
-interface ModalConfig {
- title?: string
- content?: string | (() => VNodeChild)
- component?: () => VNodeChild
-}
-
-/**
- * @description 弹出模态框
- * @param option
- */
-export const openModal = (option: ModalConfig) => {
- const container = document.createElement('div')
- container.className = 'bt-modal-container'
-
- const vNode = createVNode(
- Modal,
- {
- show: true,
- title: option.title,
- width: 384,
- onAfterLeave: () => {
- render(null, container)
- document.body.removeChild(container)
- },
- },
- {
- default: () => <>{renderContent(option.content)}</>,
- }
- )
-
- render(vNode, container)
- document.body.appendChild(container)
-}
diff --git a/core/frontend/src/router/index.ts b/core/frontend/src/router/index.ts
index b6ac3e67..5619244a 100644
--- a/core/frontend/src/router/index.ts
+++ b/core/frontend/src/router/index.ts
@@ -9,7 +9,6 @@ router.beforeEach(async (to, from, next) => {
loadingBar.start()
const userStore = useUserStore()
-
// 用户已登录
if (userStore.isLogin) {
// 如果访问的是白名单中的路由,则跳转到主页
diff --git a/core/frontend/src/router/router.ts b/core/frontend/src/router/router.ts
index 05421751..24e09694 100644
--- a/core/frontend/src/router/router.ts
+++ b/core/frontend/src/router/router.ts
@@ -56,6 +56,11 @@ export const routes: RouteRecordRaw[] = [
name: 'Login',
component: () => import('@/views/login/index.vue'),
},
+ {
+ path: '/test',
+ name: 'Test',
+ component: () => import('@/views/test/index.vue'),
+ },
...menuList,
]
diff --git a/core/frontend/src/store/modules/user.ts b/core/frontend/src/store/modules/user.ts
index 47b0073e..c0fcca9d 100644
--- a/core/frontend/src/store/modules/user.ts
+++ b/core/frontend/src/store/modules/user.ts
@@ -1,5 +1,7 @@
-import router from '@/router'
import { defineStore } from 'pinia'
+import { confirm } from '@/utils'
+import { logout as logoutApi } from '@/api/modules/user'
+import router from '@/router'
export default defineStore(
'UserStore',
@@ -37,8 +39,15 @@ export default defineStore(
}
const logout = () => {
- resetLoginInfo()
- router.push('/login')
+ confirm({
+ title: '提示',
+ content: '是否确认退出登录?',
+ onConfirm: async () => {
+ await logoutApi()
+ resetLoginInfo()
+ router.push('/login')
+ },
+ })
}
return {
diff --git a/core/frontend/src/utils/base.ts b/core/frontend/src/utils/base.ts
index 6c9265f6..83848e22 100644
--- a/core/frontend/src/utils/base.ts
+++ b/core/frontend/src/utils/base.ts
@@ -1,6 +1,6 @@
import { useClipboard } from '@vueuse/core'
+import { Message } from './'
import { isNumber } from './is'
-import { Message } from './message'
// 服务器前缀
export const apiUrlPrefix: string = import.meta.env.API_URL_PREFIX
diff --git a/core/frontend/src/utils/index.ts b/core/frontend/src/utils/index.ts
index 99874238..393566c6 100644
--- a/core/frontend/src/utils/index.ts
+++ b/core/frontend/src/utils/index.ts
@@ -1,3 +1,6 @@
+export * from '@/components/utils/confirm/method'
+export * from '@/components/utils/message/method'
+
export * from './is'
export * from './base'
export * from './data'
diff --git a/core/frontend/src/utils/message.ts b/core/frontend/src/utils/message.ts
deleted file mode 100644
index d40b2167..00000000
--- a/core/frontend/src/utils/message.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import Message from '@/components/utils/message/method'
-
-export { Message }
diff --git a/core/frontend/src/views/domain/index.vue b/core/frontend/src/views/domain/index.vue
index e241cf5c..5bd5ccc2 100644
--- a/core/frontend/src/views/domain/index.vue
+++ b/core/frontend/src/views/domain/index.vue
@@ -28,7 +28,7 @@
<script lang="tsx" setup>
import { DataTableColumns, NFlex, NButton } from 'naive-ui'
-import { getByteUnit } from '@/utils'
+import { confirm, getByteUnit } from '@/utils'
import { useModal } from '@/hooks/modal/useModal'
import { useTableData } from '@/hooks/useTableData'
import { deleteDomain, getDomainList } from '@/api/modules/domain'
@@ -224,9 +224,17 @@ const handleEdit = (row: MailDomain) => {
}
// Handle delete
-const handleDelete = async (row: MailDomain) => {
- await deleteDomain({ domain: row.domain })
- getTableData()
+const handleDelete = (row: MailDomain) => {
+ confirm({
+ title: '删除域名',
+ content: `确定要删除域名【${row.domain}】吗?`,
+ confirmText: '删除',
+ confirmType: 'error',
+ onConfirm: async () => {
+ await deleteDomain({ domain: row.domain })
+ getTableData()
+ },
+ })
}
</script>
diff --git a/core/frontend/src/views/mailbox/index.vue b/core/frontend/src/views/mailbox/index.vue
index 599c5cac..706db38c 100644
--- a/core/frontend/src/views/mailbox/index.vue
+++ b/core/frontend/src/views/mailbox/index.vue
@@ -1,46 +1,45 @@
<template>
- <div class="py-16px px-24px">
- <n-card :bordered="false">
- <bt-table-layout>
- <template #toolsLeft>
- <n-button type="primary" @click="handleAdd">添加邮箱</n-button>
- </template>
- <template #toolsRight>
- <div class="w-220px">
- <domain-select
- v-model:value="tableParams.domain"
- @update:value="() => getTableData(true)">
- </domain-select>
- </div>
- <bt-search
- v-model:value="tableParams.keyword"
- width="280"
- placeholder="搜索用户名"
- @search="() => getTableData(true)">
- </bt-search>
- </template>
- <template #table>
- <n-data-table :loading="loading" :columns="columns" :data="tableList"> </n-data-table>
- </template>
- <template #pageRight>
- <bt-table-page
- v-model:page="tableParams.page"
- v-model:page-size="tableParams.page_size"
- :item-count="tableTotal"
- @refresh="() => getTableData(true)">
- </bt-table-page>
- </template>
- <template #modal>
- <form-modal />
- </template>
- </bt-table-layout>
- </n-card>
+ <div class="p-24px">
+ <div class="mb-20px text-24px font-bold">MailBoxes</div>
+ <bt-table-layout>
+ <template #toolsLeft>
+ <n-button type="primary" @click="handleAdd">添加邮箱</n-button>
+ </template>
+ <template #toolsRight>
+ <div class="w-220px">
+ <domain-select
+ v-model:value="tableParams.domain"
+ @update:value="() => getTableData(true)">
+ </domain-select>
+ </div>
+ <bt-search
+ v-model:value="tableParams.keyword"
+ width="280"
+ placeholder="搜索用户名"
+ @search="() => getTableData(true)">
+ </bt-search>
+ </template>
+ <template #table>
+ <n-data-table :loading="loading" :columns="columns" :data="tableList"> </n-data-table>
+ </template>
+ <template #pageRight>
+ <bt-table-page
+ v-model:page="tableParams.page"
+ v-model:page-size="tableParams.page_size"
+ :item-count="tableTotal"
+ @refresh="() => getTableData(true)">
+ </bt-table-page>
+ </template>
+ <template #modal>
+ <form-modal />
+ </template>
+ </bt-table-layout>
</div>
</template>
<script lang="tsx" setup>
import { DataTableColumns, NButton, NFlex, NSwitch } from 'naive-ui'
-import { getByteUnit } from '@/utils'
+import { confirm, getByteUnit } from '@/utils'
import { useModal } from '@/hooks/modal/useModal'
import { useTableData } from '@/hooks/useTableData'
import { deleteMailbox, getMailboxList, updateMailbox } from '@/api/modules/mailbox'
@@ -175,8 +174,16 @@ const handleEdit = (row: MailBox) => {
formModalApi.open()
}
-const handleDelete = async (row: MailBox) => {
- await deleteMailbox({ email: row.username })
- getTableData()
+const handleDelete = (row: MailBox) => {
+ confirm({
+ title: '删除邮箱',
+ content: `确定要该删除邮箱【${row.username}】吗?`,
+ confirmText: '删除',
+ confirmType: 'error',
+ onConfirm: async () => {
+ await deleteMailbox({ email: row.username })
+ getTableData()
+ },
+ })
}
</script>
diff --git a/core/frontend/src/views/settings/components/SettingsService.vue b/core/frontend/src/views/settings/components/SettingsService.vue
index 912ed029..b21963da 100644
--- a/core/frontend/src/views/settings/components/SettingsService.vue
+++ b/core/frontend/src/views/settings/components/SettingsService.vue
@@ -5,7 +5,7 @@
<script lang="tsx" setup>
import { NButton, NTag, DataTableColumns } from 'naive-ui'
-import { isArray } from '@/utils'
+import { confirm, isArray } from '@/utils'
import { getServiceList, restartService } from '@/api/modules/settings'
import { DockerService } from '../types/common'
@@ -52,8 +52,14 @@ const columns = ref<DataTableColumns<DockerService>>([
])
const handleRestart = async (row: DockerService) => {
- await restartService({ container_id: row.Id })
- getList()
+ confirm({
+ title: '重启服务',
+ content: `确定要重启【${row.Names[0]}】吗?`,
+ onConfirm: async () => {
+ await restartService({ container_id: row.Id })
+ getList()
+ },
+ })
}
const getList = async () => {
diff --git a/core/frontend/src/views/settings/index.vue b/core/frontend/src/views/settings/index.vue
index 6d332de5..d7e60b8c 100644
--- a/core/frontend/src/views/settings/index.vue
+++ b/core/frontend/src/views/settings/index.vue
@@ -1,5 +1,6 @@
<template>
- <div class="py-16px px-24px">
+ <div class="p-24px">
+ <div class="mb-20px text-24px font-bold">Settings</div>
<n-card :bordered="false">
<settings-service />
</n-card>
diff --git a/core/frontend/src/views/test/index.vue b/core/frontend/src/views/test/index.vue
new file mode 100644
index 00000000..c66de6a3
--- /dev/null
+++ b/core/frontend/src/views/test/index.vue
@@ -0,0 +1,16 @@
+<template>
+ <div class="p-20px">
+ <n-button @click="handleClick">aaaaa</n-button>
+ </div>
+</template>
+
+<script lang="ts" setup>
+import { confirm } from '@/utils'
+
+const handleClick = () => {
+ confirm({
+ title: 'xxxx',
+ content: 'bbbb',
+ })
+}
+</script>
diff --git a/core/frontend/types/components.d.ts b/core/frontend/types/components.d.ts
index d72c47ca..84b8e66f 100644
--- a/core/frontend/types/components.d.ts
+++ b/core/frontend/types/components.d.ts
@@ -21,8 +21,7 @@ declare module 'vue' {
BtTips: typeof import('./../src/components/base/bt-tips/index.vue')['default']
Message: typeof import('./../src/components/utils/message/index.tsx')['default']
MessageList: typeof import('./../src/components/utils/message/message-list.tsx')['default']
- Method: typeof import('./../src/components/utils/modal/method.tsx')['default']
- Modal: typeof import('./../src/components/utils/modal/index.vue')['default']
+ Method: typeof import('./../src/components/utils/confirm/method.tsx')['default']
NAlert: typeof import('naive-ui')['NAlert']
NButton: typeof import('naive-ui')['NButton']
NCard: typeof import('naive-ui')['NCard']