feat: 完成,登录获取cookie有bug

This commit is contained in:
tsl 2026-02-27 09:07:50 +08:00
parent 4cf22c9205
commit 71bb171f48
19 changed files with 5210 additions and 1017 deletions

View File

@ -0,0 +1,39 @@
{
"permissions": {
"allow": [
"WebFetch(domain:tauri.app)",
"Bash(npm install @tauri-apps/plugin-http @tauri-apps/plugin-autostart)",
"Bash(npx tauri build)",
"Bash(cargo update)",
"Bash(cargo build)",
"Bash(where link.exe)",
"Bash(PATH=\"C:/Program Files \\(x86\\)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.44.35207/bin/Hostx64/x64:$PATH\" cargo build)",
"Bash(export PATH=\"C:/Program Files \\(x86\\)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.44.35207/bin/Hostx64/x64:$PATH\")",
"Bash(CC=\"C:/Program Files \\(x86\\)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.44.35207/bin/Hostx64/x64/cl.exe\" CXX=\"C:/Program Files \\(x86\\)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.44.35207/bin/Hostx64/x64/cl.exe\" INCLUDE=\"C:/Program Files \\(x86\\)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.44.35207/include;C:/Program Files \\(x86\\)/Windows Kits/10/Include/10.0.26100.0/ucrt;C:/Program Files \\(x86\\)/Windows Kits/10/Include/10.0.26100.0/um;C:/Program Files \\(x86\\)/Windows Kits/10/Include/10.0.26100.0/shared\" LIB=\"C:/Program Files \\(x86\\)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.44.35207/lib/x64;C:/Program Files \\(x86\\)/Windows Kits/10/Lib/10.0.26100.0/um/x64;C:/Program Files \\(x86\\)/Windows Kits/10/Lib/10.0.26100.0/ucrt/x64\" PATH=\"C:/Program Files \\(x86\\)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.44.35207/bin/Hostx64/x64:$PATH\" cargo build)",
"Bash(echo $PATH)",
"Bash(echo \"PATH=$PATH\")",
"Bash(cmd.exe /C \"\"\"C:/Program Files \\(x86\\)/Microsoft Visual Studio/2022/BuildTools/VC/Auxiliary/Build/vcvars64.bat\"\" && cargo build\")",
"Bash(cmd.exe //C \"\"\"C:\\\\Program Files \\(x86\\)\\\\Microsoft Visual Studio\\\\2022\\\\BuildTools\\\\VC\\\\Auxiliary\\\\Build\\\\vcvars64.bat\"\" >nul 2>&1 & cargo build\")",
"Bash(cmd.exe //C \"D:\\\\Projects\\\\tauri\\\\tauri-app\\\\build.bat\")",
"Bash(npx vue-tsc --noEmit)",
"Bash(tasklist)",
"Bash(taskkill //F //IM tauri-app.exe)",
"Bash(taskkill //F //IM vite.exe)",
"Bash(cmd.exe //C \"D:\\\\Projects\\\\tauri\\\\tauri-app\\\\run.bat\")",
"Bash(cmd /c \"\"\"C:\\\\Program Files \\(x86\\)\\\\Microsoft Visual Studio\\\\2022\\\\BuildTools\\\\VC\\\\Auxiliary\\\\Build\\\\vcvars64.bat\"\" >nul 2>&1 && set\")",
"Bash(cmd /c \"\"\"C:\\\\Program Files \\(x86\\)\\\\Microsoft Visual Studio\\\\2022\\\\BuildTools\\\\VC\\\\Auxiliary\\\\Build\\\\vcvars64.bat\"\" && set\")",
"Bash(powershell -Command \":*)",
"Bash(powershell.exe -NoProfile -Command \"& { $out = cmd /c ''\"\"C:\\\\Program Files \\(x86\\)\\\\Microsoft Visual Studio\\\\2022\\\\BuildTools\\\\VC\\\\Auxiliary\\\\Build\\\\vcvars64.bat\"\" && set'' 2>&1; $out | Select-String ''^\\(PATH|INCLUDE|LIB|LIBPATH|VCINSTALLDIR|VCToolsVersion|WindowsSdkDir\\)='' }\")",
"Bash(powershell.exe -NoProfile -ExecutionPolicy Bypass -File \"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Temp\\\\get_vcvars.ps1\")",
"Bash(\"C:/Users/Administrator/AppData/Local/Temp/set_msvc_env.ps1\":*)",
"Bash(powershell.exe -NoProfile -ExecutionPolicy Bypass -File \"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Temp\\\\set_msvc_env.ps1\")",
"Bash(powershell.exe -NoProfile -Command \"[System.Environment]::GetEnvironmentVariable\\(''INCLUDE'',''User''\\) | Select-String ''MSVC''; [System.Environment]::GetEnvironmentVariable\\(''LIB'',''User''\\) | Select-String ''MSVC''; [System.Environment]::GetEnvironmentVariable\\(''PATH'',''User''\\) | Select-String ''HostX64''\")",
"Bash(powershell.exe -NoProfile -Command \"where.exe cl.exe\")",
"Bash(powershell.exe -NoProfile -Command \"Get-ItemProperty ''HKCU:\\\\Environment'' | Select-Object -ExpandProperty PATH | Select-String ''HostX64''\")",
"Bash(cargo check)",
"Bash(pnpm run tauri dev)",
"Bash(netstat -ano)",
"Bash(findstr :1420)"
]
}
}

4
.gitignore vendored
View File

@ -22,3 +22,7 @@ dist-ssr
*.njsproj *.njsproj
*.sln *.sln
*.sw? *.sw?
target/
.bak
*.bak.*

View File

@ -1,6 +1,5 @@
{ {
"recommendations": [ "recommendations": [
"Vue.volar",
"tauri-apps.tauri-vscode", "tauri-apps.tauri-vscode",
"rust-lang.rust-analyzer" "rust-lang.rust-analyzer"
] ]

74
CLAUDE.md Normal file
View File

@ -0,0 +1,74 @@
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## 项目概述
这是一个基于 **Tauri 2.x + Vue 3** 的工单监控桌面应用,用于监控 CRM 系统crm.yunvip123.com的待处理工单并发送系统通知。
## 常用命令
项目使用 **npm** 作为包管理器(存在 package-lock.json
```bash
# 启动开发模式(前端 + Tauri
pnpm run tauri dev
# 仅启动前端开发服务器
pnpm run dev
# 构建生产版本
npm run tauri build
# 前端类型检查 + 构建
pnpm run build
# Rust 后端检查
cd src-tauri && cargo check
cd src-tauri && cargo clippy
```
## 架构概述
**前端驱动架构**所有业务逻辑API 调用、定时任务、通知)都在 Vue 前端实现Rust 后端仅负责系统级功能。
### 前端src/
- `src/App.vue` - 主界面,包含全部业务逻辑:用户认证、监控调度、通知、网络检测、配置管理、系统托盘
- 使用 Vue 3 Composition API`<script setup>`
- Vite 开发服务器端口1420HMR 端口1421
- 系统托盘使用 `@tauri-apps/api/tray``@tauri-apps/api/menu` 实现
### Rust 后端src-tauri/src/
- `lib.rs` - 应用初始化、插件注册、窗口关闭事件处理(关闭→隐藏到托盘)
### Tauri 命令
无自定义命令(所有功能通过前端 API 实现)
### API 集成
- 登录:`POST https://crm.yunvip123.com/api/SystemUser/Login`
- 工单查询:`GET https://crm.yunvip123.com/api/DemandManage/QueryIndexCount`
- 认证方式ASP.NET_SessionId Cookie
- HTTP 白名单配置在 `src-tauri/capabilities/default.json`
### 通知触发条件
当以下任意计数 > 0 时触发系统通知:
- `PendingCount`(待处理)
- `StaycloseCount`(待关闭)
- `ConfirmCount`(待确认)
## 关键配置
- `src-tauri/capabilities/default.json` - Tauri 权限配置HTTP 白名单、插件权限)
- `src-tauri/tauri.conf.json` - 应用配置窗口、图标、bundle
- 用户配置文件路径:`%APPDATA%/tauri-app/config.json`Windows
## 依赖的 Tauri 插件
- `tauri-plugin-http` - HTTP 请求
- `tauri-plugin-notification` - 系统通知
- `tauri-plugin-autostart` - 开机自启动
- `tauri-plugin-opener` - 打开外部链接
## Windows 编译要求
需要安装 Visual Studio Build Tools包含 C++ 工具链)才能编译 Rust 后端。

137
README_APP.md Normal file
View File

@ -0,0 +1,137 @@
# 系统监控应用程序
这是一个基于 Tauri + Vue 开发的系统监控应用程序,具有以下功能:
## 功能特性
1. **用户设置界面** - 配置用户名和密码
2. **系统托盘集成** - 应用启动后自动最小化到系统托盘
3. **自动登录** - 保存用户凭据并支持自动登录
4. **定时API调用** - 登录后每1分钟调用一次接口
5. **系统通知** - 根据API返回值弹出系统消息
6. **模块化架构** - 代码按功能模块组织,便于维护
## 项目结构
```
src-tauri/src/
├── lib.rs # 主模块,应用程序入口和命令处理
├── config.rs # 配置管理模块
├── api.rs # API调用模块
├── tray.rs # 系统托盘模块
└── scheduler.rs # 定时任务模块
src/
└── App.vue # Vue设置界面
```
## 使用说明
### 1. 启动应用程序
```bash
# 开发模式
pnpm tauri dev
# 构建生产版本
pnpm tauri build
```
### 2. 配置设置
- 应用启动后会自动最小化到系统托盘
- 右键点击托盘图标选择"显示设置"打开设置界面
- 输入用户名和密码,点击"保存设置"
### 3. 登录和监控
- 保存设置后点击"登录"按钮
- 登录成功后会自动启动定时任务每1分钟执行一次
- 系统会根据API返回值显示通知消息
### 4. 托盘操作
- **左键点击托盘图标** - 显示设置界面
- **右键点击托盘图标** - 显示菜单(显示设置/退出)
- **关闭窗口** - 应用会隐藏到托盘而不是退出
## 配置说明
### API接口
应用程序已配置为使用以下API接口
- **登录接口**: `https://crm.yunvip123.com/api/SystemUser/Login`
- **检查接口**: `https://crm.yunvip123.com/api/DemandManage/QueryIndexCount`
### 认证机制
- 登录时获取 `ASP.NET_SessionId` Cookie
- 所有后续请求都需要携带此Cookie进行认证
### API响应格式
**登录响应 (LoginResponse):**
```json
{
"success": true,
"code": null,
"msg": "执行成功",
"data": {
"GID": "512860ad-aa4a-4268-a5d9-6c7d2e28680b",
"SU_UserName": "A田森林"
}
}
```
**检查响应 (CheckResponse):**
```json
{
"success": true,
"code": null,
"msg": "执行成功",
"data": {
"PendingCount": 0,
"StaycloseCount": 0,
"ConfirmCount": 0
}
}
```
### 通知逻辑
- 当 `PendingCount`、`StaycloseCount`、`ConfirmCount` 三个值都为0时不发送通知
- 当任意一个值大于0时发送系统通知显示具体的工单数量
## 开发说明
### 添加新功能
1. **新的API端点** - 在 `api.rs` 中添加新的方法
2. **新的配置项** - 在 `config.rs` 中添加到 `AppConfig` 结构体
3. **新的UI组件** - 在 `App.vue` 中添加新的界面元素
4. **新的命令** - 在 `lib.rs` 中添加新的 Tauri 命令
### 错误处理
- 所有模块都使用 `anyhow::Result` 进行错误处理
- 错误信息会显示在UI的消息卡片中
- 日志记录使用 `log` crate可通过环境变量 `RUST_LOG` 控制级别
### 数据持久化
- 用户配置保存在系统配置目录:`%APPDATA%/tauri-app/config.json` (Windows)
- 配置文件使用JSON格式包含用户名、密码等信息
## 注意事项
1. **安全性** - 密码以明文形式存储在配置文件中,生产环境建议加密
2. **网络请求** - API调用失败时会显示错误通知
3. **系统权限** - 需要通知权限来显示系统消息
4. **托盘图标** - 使用应用程序默认图标,可根据登录状态切换不同图标
## TODO 项目
- [x] 配置实际的API地址和端点
- [x] 实现Cookie认证机制
- [x] 适配实际API响应格式
- [x] 添加更多的配置选项(检查间隔等)
- [x] 添加日志系统和日志显示
- [x] 实现自动启动功能
- [x] 添加网络连接状态检测
- [x] 添加测试按钮(手动检查、停止/开始、最小化等)
- [ ] 实现密码加密存储
- [ ] 支持不同登录状态的托盘图标(图标文件)
- [ ] 添加日志文件输出
- [ ] 实现会话过期自动重新登录
- [ ] 解决Windows编译环境问题需要Visual Studio Build Tools

View File

@ -0,0 +1,9 @@
/**
* https://crm.yunvip123.com/api/UsersNotice/GetUsersNoticeList
* POST
* cookie: ASP.NET_SessionId=td0mirxws4klqpm0bydhvgjj
*/
const requestData='UserGID=512860ad-aa4a-4268-a5d9-6c7d2e28680b'
const responseBody

518
data/Login.js Normal file
View File

@ -0,0 +1,518 @@
/**
* 登录
* https://crm.yunvip123.com/api/SystemUser/Login
* POST
* set-cookie ASP.NET_SessionId=td0mirxws4klqpm0bydhvgjj; path=/; HttpOnly
* 所有接口都要带 cookie: ASP.NET_SessionId=td0mirxws4klqpm0bydhvgjj
*/
const requestData = "UserAcount=&PassWord=123456&VerifyCode=&Account=18688886666_777&ValidateCode=";
const responseBody = {
success: true,
code: null,
msg: "执行成功",
data: {
GID: "512860ad-aa4a-4268-a5d9-6c7d2e28680b",
SR_GID: "44a2ccd1-bd45-4114-a999-2f2222510e44",
SD_GID: "f124825e-f2b8-414e-b03c-cfca47a9922e",
SU_Account: "18688886666_777",
SU_Password: "PdvNK8uJWJU=",
SU_AdminType: 11,
SU_IsDisable: 0,
SU_UserName: "A田森林",
SU_Telephone: "",
SU_LastLoginTime: null,
SU_CreateTime: "2022-05-27 16:04:24",
SU_Creator: null,
SU_Flag: null,
SU_Code: "777",
SU_BrowseRole: 2,
SU_QQCode: "",
SU_WeChatImageUrl: null,
SU_IsShunt: 0,
MaxReception: 0,
AG_GID: "0000",
SU_WeChatCode: null,
SU_UserType: 320,
SR_Name: "7-开发人员",
SD_Name: null,
AG_Domain: null,
AG_Type: 0,
AG_SoftwareName: null,
AG_Contacter: null,
DL_CreatNum: null,
DL_SloveNum: null,
BUGNum: null,
DMNum: null,
TESNum: null,
ACNum: null,
WorkHour: null,
WaitCloseNum: null,
CloseNum: null,
SRRole: [
{
GID: "1de667e5-079b-4631-8bad-2077164be47a",
MM_GID: "2168612e-126c-4df3-a535-35fba7459c1a",
RS_Name: "获取菜单列表",
RS_LinkUrl: "/api/SystemMenu/GetListMenu",
RS_IsShow: 1,
RS_Sort: 13,
RS_CreateTime: "2018-04-11 10:27:18",
RS_Code: null,
},
{
GID: "d6e92461-2511-4c9f-93b0-a8e413520d48",
MM_GID: "d88b1caa-b4cf-407f-bc25-9339ae2e5ece",
RS_Name: "修改工单",
RS_LinkUrl: "/api/DemandManage/EditWorkOrder",
RS_IsShow: 0,
RS_Sort: 4,
RS_CreateTime: "2025-03-04 09:14:57",
RS_Code: "",
},
{
GID: "bffee97c-139c-4735-a76d-dbe9c4d64637",
MM_GID: "a9c87517-4da2-4f98-a5b9-35bf277fb375",
RS_Name: "查询日志记录",
RS_LinkUrl: "/api/SystemLog/QueryList",
RS_IsShow: 1,
RS_Sort: 100,
RS_CreateTime: "2019-11-21 13:43:57",
RS_Code: null,
},
{
GID: "b8bd82f6-e9fa-4e8a-b77c-86803610fc7f",
MM_GID: "a9c87517-4da2-4f98-a5b9-35bf277fb375",
RS_Name: "系统日志分页",
RS_LinkUrl: "/api/SystemLog/QueryPage",
RS_IsShow: 0,
RS_Sort: 1,
RS_CreateTime: "2018-10-25 19:55:07",
RS_Code: null,
},
{
GID: "a3b894b1-1064-42ca-90c8-6c005439d2ec",
MM_GID: "2168612e-126c-4df3-a535-35fba7459c1a",
RS_Name: "根据菜单GID获取对应资源",
RS_LinkUrl: "/api/SystemResource/GetListResourceByMenuGID",
RS_IsShow: 1,
RS_Sort: 5,
RS_CreateTime: "2018-04-10 09:51:47",
RS_Code: null,
},
{
GID: "9600f960-3b5f-4e1e-ae84-1e607919ff30",
MM_GID: "d88b1caa-b4cf-407f-bc25-9339ae2e5ece",
RS_Name: "解决工单",
RS_LinkUrl: "/api/DemandManage/ResolveWorkOrders",
RS_IsShow: 0,
RS_Sort: 13,
RS_CreateTime: "2025-03-04 09:17:51",
RS_Code: "",
},
{
GID: "4bac85dc-9f40-432d-a851-2f97408d83b6",
MM_GID: "d88b1caa-b4cf-407f-bc25-9339ae2e5ece",
RS_Name: "编辑工时",
RS_LinkUrl: "/api/DemandManage/EditWorkHour",
RS_IsShow: 1,
RS_Sort: 6,
RS_CreateTime: "2025-03-04 09:15:45",
RS_Code: null,
},
{
GID: "c696815b-da5c-4d9f-ba12-6087ca7beedc",
MM_GID: "d88b1caa-b4cf-407f-bc25-9339ae2e5ece",
RS_Name: "获取项目列表",
RS_LinkUrl: "/api/ProjectMange/GetProject",
RS_IsShow: 0,
RS_Sort: 2,
RS_CreateTime: "2025-03-04 09:14:19",
RS_Code: "",
},
{
GID: "ab7ed673-4bce-4865-9688-fa1fd9d31fd7",
MM_GID: "797aff6a-ecb9-4120-831d-150f96c8d963",
RS_Name: "编辑项目状态",
RS_LinkUrl: "/api/ProjectMange/EditProjectState",
RS_IsShow: 1,
RS_Sort: 100,
RS_CreateTime: "2022-09-29 09:25:17",
RS_Code: null,
},
{
GID: "7b30e174-7472-4d8c-a243-0d5bab682e8e",
MM_GID: "797aff6a-ecb9-4120-831d-150f96c8d963",
RS_Name: "更新统计",
RS_LinkUrl: "/api/ProjectMange/GetProjectStat",
RS_IsShow: 1,
RS_Sort: 120,
RS_CreateTime: "2020-07-27 10:10:37",
RS_Code: "P42",
},
{
GID: "e283a777-a7a1-48e9-abb4-030bb0f21990",
MM_GID: "2e73c23f-f635-45a3-8ed3-1f75245c099c",
RS_Name: "添加工单",
RS_LinkUrl: "/api/DemandManage/AddDemandList",
RS_IsShow: 1,
RS_Sort: 110,
RS_CreateTime: "2019-12-02 09:57:30",
RS_Code: "E42",
},
{
GID: "a9934927-1756-4b31-a718-2cb4bd7fb9b7",
MM_GID: "2e73c23f-f635-45a3-8ed3-1f75245c099c",
RS_Name: "删除工单",
RS_LinkUrl: "/api/DemandManage/DelDemandList",
RS_IsShow: 1,
RS_Sort: 140,
RS_CreateTime: "2020-07-27 10:01:17",
RS_Code: "E40",
},
{
GID: "615b1a1e-f0a2-4596-9cd0-b10e5831db3c",
MM_GID: "d88b1caa-b4cf-407f-bc25-9339ae2e5ece",
RS_Name: "删除工单信息",
RS_LinkUrl: "/api/DemandManage/DeleteWorkOrders",
RS_IsShow: 1,
RS_Sort: 5,
RS_CreateTime: "2025-03-04 09:15:18",
RS_Code: null,
},
{
GID: "279b5274-3b1c-4d4a-a958-e4da67908c2b",
MM_GID: "d88b1caa-b4cf-407f-bc25-9339ae2e5ece",
RS_Name: "工单确认状态",
RS_LinkUrl: "/api/DemandManage/EditConfirm",
RS_IsShow: 0,
RS_Sort: 7,
RS_CreateTime: "2025-03-04 09:16:19",
RS_Code: "",
},
{
GID: "148ddcdf-a466-42af-ac7c-dd5a89043c39",
MM_GID: "d88b1caa-b4cf-407f-bc25-9339ae2e5ece",
RS_Name: "关闭工单",
RS_LinkUrl: "/api/DemandManage/CloseWorkOrders",
RS_IsShow: 0,
RS_Sort: 9,
RS_CreateTime: "2025-03-04 09:16:49",
RS_Code: "",
},
{
GID: "35af5158-e717-40c9-8278-30886a926cc9",
MM_GID: "2168612e-126c-4df3-a535-35fba7459c1a",
RS_Name: "修改密码",
RS_LinkUrl: "/api/SystemUser/ChangePwd",
RS_IsShow: 1,
RS_Sort: 23,
RS_CreateTime: "2018-05-04 11:19:09",
RS_Code: null,
},
{
GID: "dd91bb92-4977-4844-ba71-769572a35c65",
MM_GID: "2168612e-126c-4df3-a535-35fba7459c1a",
RS_Name: "根据角色GID获取对应资源",
RS_LinkUrl: "/api/SystemRole/GetMenuResourceBySR_GID",
RS_IsShow: 1,
RS_Sort: 6,
RS_CreateTime: "2018-04-10 09:52:34",
RS_Code: null,
},
{
GID: "e62504e6-1e2c-46c8-9d5b-62352a3aea20",
MM_GID: "2168612e-126c-4df3-a535-35fba7459c1a",
RS_Name: "获取待处理与待关闭工单统计",
RS_LinkUrl: "/api/DemandManage/QueryIndexCount",
RS_IsShow: 0,
RS_Sort: 100,
RS_CreateTime: "2020-07-27 10:06:35",
RS_Code: null,
},
{
GID: "e3913650-20d9-4dfc-98b6-24f9cfee6066",
MM_GID: "d88b1caa-b4cf-407f-bc25-9339ae2e5ece",
RS_Name: "获取工单列表数据",
RS_LinkUrl: "/api/DemandManage/GetWorkOrderListPage",
RS_IsShow: 0,
RS_Sort: 1,
RS_CreateTime: "2025-03-04 09:13:51",
RS_Code: "",
},
{
GID: "05277dcc-acdf-400c-972a-ac09100d9ecf",
MM_GID: "d88b1caa-b4cf-407f-bc25-9339ae2e5ece",
RS_Name: "创建工单",
RS_LinkUrl: "/api/DemandManage/AddDemandList",
RS_IsShow: 0,
RS_Sort: 3,
RS_CreateTime: "2025-03-04 09:14:44",
RS_Code: "",
},
{
GID: "634305c7-c82d-4ded-89ce-fe2f56bf8e98",
MM_GID: "2168612e-126c-4df3-a535-35fba7459c1a",
RS_Name: "获取用户公告",
RS_LinkUrl: "/api/UsersNotice/GetUsersNoticeList",
RS_IsShow: 0,
RS_Sort: 0,
RS_CreateTime: "2021-04-20 13:29:23",
RS_Code: null,
},
{
GID: "cd8a461e-61cf-475d-a102-0c847eddfefc",
MM_GID: "797aff6a-ecb9-4120-831d-150f96c8d963",
RS_Name: "项目分页",
RS_LinkUrl: "/api/ProjectMange/GetProjectPage",
RS_IsShow: 0,
RS_Sort: 90,
RS_CreateTime: "2019-12-02 09:16:30",
RS_Code: "",
},
{
GID: "1dbe692c-f31c-4dff-86e2-aa457e21061d",
MM_GID: "2168612e-126c-4df3-a535-35fba7459c1a",
RS_Name: "获取个人资料",
RS_LinkUrl: "/api/SystemUser/GetObjectUser",
RS_IsShow: 1,
RS_Sort: 21,
RS_CreateTime: "2018-05-04 11:18:24",
RS_Code: null,
},
{
GID: "bd9518e0-70e1-47c7-8c6a-5c13694f1af5",
MM_GID: "2168612e-126c-4df3-a535-35fba7459c1a",
RS_Name: "历史记录",
RS_LinkUrl: "/api/SystemLog/QueryList",
RS_IsShow: 0,
RS_Sort: 100,
RS_CreateTime: "2019-11-21 13:41:15",
RS_Code: "",
},
{
GID: "8613c0af-89c7-4398-b017-55d2ae2ca157",
MM_GID: "2168612e-126c-4df3-a535-35fba7459c1a",
RS_Name: "用户列表",
RS_LinkUrl: "/api/SystemUser/GetListUser",
RS_IsShow: 0,
RS_Sort: 1,
RS_CreateTime: "2018-04-09 19:50:58",
RS_Code: null,
},
{
GID: "e513c484-5ec0-4380-a477-c83623b4782b",
MM_GID: "2168612e-126c-4df3-a535-35fba7459c1a",
RS_Name: "工单列表",
RS_LinkUrl: "/api/DemandManage/GetDemandList",
RS_IsShow: 1,
RS_Sort: 100,
RS_CreateTime: "2019-12-02 09:21:38",
RS_Code: "",
},
{
GID: "21040880-1df6-494d-866a-b10fc257393d",
MM_GID: "2168612e-126c-4df3-a535-35fba7459c1a",
RS_Name: "查询产品",
RS_LinkUrl: "/api/ProductManage/GetProductMange",
RS_IsShow: 1,
RS_Sort: 100,
RS_CreateTime: "2019-12-02 09:26:23",
RS_Code: null,
},
{
GID: "baa47e69-9143-4860-84d7-e99c60eeb417",
MM_GID: "d88b1caa-b4cf-407f-bc25-9339ae2e5ece",
RS_Name: "完成工单",
RS_LinkUrl: "/api/DemandManage/FinishWorkOrders",
RS_IsShow: 0,
RS_Sort: 8,
RS_CreateTime: "2025-03-04 09:16:36",
RS_Code: "",
},
{
GID: "e79ef9d5-f0ae-4efb-a747-2097d64c857e",
MM_GID: "2168612e-126c-4df3-a535-35fba7459c1a",
RS_Name: "工单分页",
RS_LinkUrl: "/api/DemandManage/GetDemandListPage",
RS_IsShow: 0,
RS_Sort: 100,
RS_CreateTime: "2019-12-02 09:20:16",
RS_Code: "",
},
{
GID: "ad92007d-a867-4bee-b719-4e94323c2700",
MM_GID: "d88b1caa-b4cf-407f-bc25-9339ae2e5ece",
RS_Name: "编辑备注",
RS_LinkUrl: "/api/DemandManage/EditWorkOrdersRemark",
RS_IsShow: 0,
RS_Sort: 10,
RS_CreateTime: "2025-03-04 09:17:05",
RS_Code: "",
},
{
GID: "2acdfb25-66e3-4473-8f2c-c802122f515b",
MM_GID: "d88b1caa-b4cf-407f-bc25-9339ae2e5ece",
RS_Name: "指派工单",
RS_LinkUrl: "/api/DemandManage/AssignWorkOrder",
RS_IsShow: 0,
RS_Sort: 100,
RS_CreateTime: "2025-03-16 22:34:16",
RS_Code: "",
},
{
GID: "a1ce3461-58cd-4b45-8292-71cb73472128",
MM_GID: "2e73c23f-f635-45a3-8ed3-1f75245c099c",
RS_Name: "编辑需求",
RS_LinkUrl: "/api/DemandManage/EditDemandList",
RS_IsShow: 1,
RS_Sort: 120,
RS_CreateTime: "2019-12-02 09:57:58",
RS_Code: "E41",
},
{
GID: "31c9f51d-764e-45d5-aaef-82917ddc7013",
MM_GID: "797aff6a-ecb9-4120-831d-150f96c8d963",
RS_Name: "项目备注",
RS_LinkUrl: "/api/ProjectMange/AddProjectRemark",
RS_IsShow: 1,
RS_Sort: 130,
RS_CreateTime: "2020-07-27 10:09:48",
RS_Code: "P43",
},
{
GID: "d96bb278-771f-4411-bb22-a74d0141defd",
MM_GID: "2168612e-126c-4df3-a535-35fba7459c1a",
RS_Name: "获取部门列表",
RS_LinkUrl: "/api/SystemDepartment/GetListDepartment",
RS_IsShow: 0,
RS_Sort: 2,
RS_CreateTime: "2018-04-09 20:44:31",
RS_Code: null,
},
{
GID: "1dc15655-57fc-4505-94e2-90cc3df73e13",
MM_GID: "2168612e-126c-4df3-a535-35fba7459c1a",
RS_Name: "修改当前个人资料",
RS_LinkUrl: "/api/SystemUser/EditProfile",
RS_IsShow: 1,
RS_Sort: 22,
RS_CreateTime: "2018-05-04 11:18:36",
RS_Code: null,
},
{
GID: "52b98bfb-d55f-457d-a3ff-7bf2eefa55a3",
MM_GID: "d88b1caa-b4cf-407f-bc25-9339ae2e5ece",
RS_Name: "添加测试结果",
RS_LinkUrl: "/api/DemandManage/TestWorkOrdersResult",
RS_IsShow: 0,
RS_Sort: 11,
RS_CreateTime: "2025-03-04 09:17:20",
RS_Code: "",
},
{
GID: "03d7a89b-298f-4113-9090-d12fccb7aab4",
MM_GID: "797aff6a-ecb9-4120-831d-150f96c8d963",
RS_Name: "关闭项目",
RS_LinkUrl: "/api/ProjectMange/CloseProject",
RS_IsShow: 1,
RS_Sort: 100,
RS_CreateTime: "2021-01-12 17:13:10",
RS_Code: "P45",
},
{
GID: "fcc70c6a-03bb-4739-8676-e4ac42390c5c",
MM_GID: "2168612e-126c-4df3-a535-35fba7459c1a",
RS_Name: "修改公告已读状态",
RS_LinkUrl: "/api/UsersNotice/EditState",
RS_IsShow: 0,
RS_Sort: 0,
RS_CreateTime: "2021-04-20 13:38:11",
RS_Code: null,
},
{
GID: "76478667-e6be-49ea-b82d-f9f98350e186",
MM_GID: "d88b1caa-b4cf-407f-bc25-9339ae2e5ece",
RS_Name: "激活工单",
RS_LinkUrl: "/api/DemandManage/ActivateWorkOrder",
RS_IsShow: 0,
RS_Sort: 12,
RS_CreateTime: "2025-03-04 09:17:35",
RS_Code: "",
},
],
MenuInfoList: [
{
GID: "fd47e5a8-d361-4cc5-864f-7e19dfd2856e",
MM_Name: "工单统计",
MM_LinkUrl: "/WebUI/DemandManagement/WorkOrderStat.html",
MM_ParentID: "4dd3c69a-01e7-4aed-9c75-a94037ac9b5d",
MM_Sort: 1,
MM_Mark: null,
MM_Ico: "",
ResourceList: null,
},
{
GID: "797aff6a-ecb9-4120-831d-150f96c8d963",
MM_Name: "项目管理",
MM_LinkUrl: "/WebUI/ProjectMange/ProjectList.html",
MM_ParentID: "",
MM_Sort: 4,
MM_Mark: null,
MM_Ico: "",
ResourceList: null,
},
{
GID: "d88b1caa-b4cf-407f-bc25-9339ae2e5ece",
MM_Name: "工单列表",
MM_LinkUrl: "/WebUI/DemandManagement/DemandListNew.html",
MM_ParentID: "",
MM_Sort: 9,
MM_Mark: null,
MM_Ico: "",
ResourceList: null,
},
{
GID: "4dd3c69a-01e7-4aed-9c75-a94037ac9b5d",
MM_Name: "统计报表",
MM_LinkUrl: "",
MM_ParentID: "",
MM_Sort: 15,
MM_Mark: null,
MM_Ico: "",
ResourceList: null,
},
{
GID: "9ebc0631-149e-4d07-927d-5da9aaea1656",
MM_Name: "系统管理",
MM_LinkUrl: "",
MM_ParentID: "",
MM_Sort: 20,
MM_Mark: null,
MM_Ico: "",
ResourceList: null,
},
{
GID: "a9c87517-4da2-4f98-a5b9-35bf277fb375",
MM_Name: "系统日志",
MM_LinkUrl: "/WebUI/System/SystemLogList.html",
MM_ParentID: "9ebc0631-149e-4d07-927d-5da9aaea1656",
MM_Sort: 99,
MM_Mark: null,
MM_Ico: "",
ResourceList: null,
},
{
GID: "2168612e-126c-4df3-a535-35fba7459c1a",
MM_Name: "公共资源",
MM_LinkUrl: "",
MM_ParentID: "",
MM_Sort: 100,
MM_Mark: null,
MM_Ico: "",
ResourceList: null,
},
],
},
};

18
data/QueryIndexCount.js Normal file
View File

@ -0,0 +1,18 @@
/**
* https://crm.yunvip123.com/api/DemandManage/QueryIndexCount
* POST
* cookie: ASP.NET_SessionId=td0mirxws4klqpm0bydhvgjj
*/
const requestData = "UserGID=512860ad-aa4a-4268-a5d9-6c7d2e28680b";
const responseBody = {
success: true,
code: null,
msg: "执行成功",
data: {
PendingCount: 0,
StaycloseCount: 0,
ConfirmCount: 0,
},
};

1775
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -10,15 +10,18 @@
"tauri": "tauri" "tauri": "tauri"
}, },
"dependencies": { "dependencies": {
"vue": "^3.5.13", "@tauri-apps/api": "^2.10.1",
"@tauri-apps/api": "^2", "@tauri-apps/plugin-autostart": "^2.5.1",
"@tauri-apps/plugin-opener": "^2" "@tauri-apps/plugin-http": "^2.5.7",
"@tauri-apps/plugin-notification": "^2.3.3",
"@tauri-apps/plugin-opener": "^2.5.3",
"vue": "^3.5.29"
}, },
"devDependencies": { "devDependencies": {
"@tauri-apps/cli": "^2",
"@vitejs/plugin-vue": "^5.2.1", "@vitejs/plugin-vue": "^5.2.1",
"typescript": "~5.6.2", "typescript": "~5.6.2",
"vite": "^6.0.3", "vite": "^6.0.3",
"vue-tsc": "^2.1.10", "vue-tsc": "^2.1.10"
"@tauri-apps/cli": "^2"
} }
} }

View File

@ -9,21 +9,30 @@ importers:
.: .:
dependencies: dependencies:
'@tauri-apps/api': '@tauri-apps/api':
specifier: ^2 specifier: ^2.10.1
version: 2.8.0 version: 2.10.1
'@tauri-apps/plugin-autostart':
specifier: ^2.5.1
version: 2.5.1
'@tauri-apps/plugin-http':
specifier: ^2.5.7
version: 2.5.7
'@tauri-apps/plugin-notification':
specifier: ^2.3.3
version: 2.3.3
'@tauri-apps/plugin-opener': '@tauri-apps/plugin-opener':
specifier: ^2 specifier: ^2.5.3
version: 2.5.0 version: 2.5.3
vue: vue:
specifier: ^3.5.13 specifier: ^3.5.29
version: 3.5.22(typescript@5.6.3) version: 3.5.29(typescript@5.6.3)
devDependencies: devDependencies:
'@tauri-apps/cli': '@tauri-apps/cli':
specifier: ^2 specifier: ^2
version: 2.8.4 version: 2.8.4
'@vitejs/plugin-vue': '@vitejs/plugin-vue':
specifier: ^5.2.1 specifier: ^5.2.1
version: 5.2.4(vite@6.3.6)(vue@3.5.22(typescript@5.6.3)) version: 5.2.4(vite@6.3.6)(vue@3.5.29(typescript@5.6.3))
typescript: typescript:
specifier: ~5.6.2 specifier: ~5.6.2
version: 5.6.3 version: 5.6.3
@ -44,15 +53,28 @@ packages:
resolution: {integrity: sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow==} resolution: {integrity: sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow==}
engines: {node: '>=6.9.0'} engines: {node: '>=6.9.0'}
'@babel/helper-validator-identifier@7.28.5':
resolution: {integrity: sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==}
engines: {node: '>=6.9.0'}
'@babel/parser@7.28.4': '@babel/parser@7.28.4':
resolution: {integrity: sha512-yZbBqeM6TkpP9du/I2pUZnJsRMGGvOuIrhjzC1AwHwW+6he4mni6Bp/m8ijn0iOuZuPI2BfkCoSRunpyjnrQKg==} resolution: {integrity: sha512-yZbBqeM6TkpP9du/I2pUZnJsRMGGvOuIrhjzC1AwHwW+6he4mni6Bp/m8ijn0iOuZuPI2BfkCoSRunpyjnrQKg==}
engines: {node: '>=6.0.0'} engines: {node: '>=6.0.0'}
hasBin: true hasBin: true
'@babel/parser@7.29.0':
resolution: {integrity: sha512-IyDgFV5GeDUVX4YdF/3CPULtVGSXXMLh1xVIgdCgxApktqnQV0r7/8Nqthg+8YLGaAtdyIlo2qIdZrbCv4+7ww==}
engines: {node: '>=6.0.0'}
hasBin: true
'@babel/types@7.28.4': '@babel/types@7.28.4':
resolution: {integrity: sha512-bkFqkLhh3pMBUQQkpVgWDWq/lqzc2678eUyDlTBhRqhCHFguYYGM0Efga7tYk4TogG/3x0EEl66/OQ+WGbWB/Q==} resolution: {integrity: sha512-bkFqkLhh3pMBUQQkpVgWDWq/lqzc2678eUyDlTBhRqhCHFguYYGM0Efga7tYk4TogG/3x0EEl66/OQ+WGbWB/Q==}
engines: {node: '>=6.9.0'} engines: {node: '>=6.9.0'}
'@babel/types@7.29.0':
resolution: {integrity: sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A==}
engines: {node: '>=6.9.0'}
'@esbuild/aix-ppc64@0.25.10': '@esbuild/aix-ppc64@0.25.10':
resolution: {integrity: sha512-0NFWnA+7l41irNuaSVlLfgNT12caWJVLzp5eAVhZ0z1qpxbockccEt3s+149rE64VUI3Ml2zt8Nv5JVc4QXTsw==} resolution: {integrity: sha512-0NFWnA+7l41irNuaSVlLfgNT12caWJVLzp5eAVhZ0z1qpxbockccEt3s+149rE64VUI3Ml2zt8Nv5JVc4QXTsw==}
engines: {node: '>=18'} engines: {node: '>=18'}
@ -333,8 +355,8 @@ packages:
cpu: [x64] cpu: [x64]
os: [win32] os: [win32]
'@tauri-apps/api@2.8.0': '@tauri-apps/api@2.10.1':
resolution: {integrity: sha512-ga7zdhbS2GXOMTIZRT0mYjKJtR9fivsXzsyq5U3vjDL0s6DTMwYRm0UHNjzTY5dh4+LSC68Sm/7WEiimbQNYlw==} resolution: {integrity: sha512-hKL/jWf293UDSUN09rR69hrToyIXBb8CjGaWC7gfinvnQrBVvnLr08FeFi38gxtugAVyVcTa5/FD/Xnkb1siBw==}
'@tauri-apps/cli-darwin-arm64@2.8.4': '@tauri-apps/cli-darwin-arm64@2.8.4':
resolution: {integrity: sha512-BKu8HRkYV01SMTa7r4fLx+wjgtRK8Vep7lmBdHDioP6b8XH3q2KgsAyPWfEZaZIkZ2LY4SqqGARaE9oilNe0oA==} resolution: {integrity: sha512-BKu8HRkYV01SMTa7r4fLx+wjgtRK8Vep7lmBdHDioP6b8XH3q2KgsAyPWfEZaZIkZ2LY4SqqGARaE9oilNe0oA==}
@ -412,8 +434,17 @@ packages:
engines: {node: '>= 10'} engines: {node: '>= 10'}
hasBin: true hasBin: true
'@tauri-apps/plugin-opener@2.5.0': '@tauri-apps/plugin-autostart@2.5.1':
resolution: {integrity: sha512-B0LShOYae4CZjN8leiNDbnfjSrTwoZakqKaWpfoH6nXiJwt6Rgj6RnVIffG3DoJiKsffRhMkjmBV9VeilSb4TA==} resolution: {integrity: sha512-zS/xx7yzveCcotkA+8TqkI2lysmG2wvQXv2HGAVExITmnFfHAdj1arGsbbfs3o6EktRHf6l34pJxc3YGG2mg7w==}
'@tauri-apps/plugin-http@2.5.7':
resolution: {integrity: sha512-+F2lEH/c9b0zSsOXKq+5hZNcd9F4IIKCK1T17RqMwpCmVnx2aoqY8yIBccCd25HTYUb3j6NPVbRax/m00hKG8A==}
'@tauri-apps/plugin-notification@2.3.3':
resolution: {integrity: sha512-Zw+ZH18RJb41G4NrfHgIuofJiymusqN+q8fGUIIV7vyCH+5sSn5coqRv/MWB9qETsUs97vmU045q7OyseCV3Qg==}
'@tauri-apps/plugin-opener@2.5.3':
resolution: {integrity: sha512-CCcUltXMOfUEArbf3db3kCE7Ggy1ExBEBl51Ko2ODJ6GDYHRp1nSNlQm5uNCFY5k7/ufaK5Ib3Du/Zir19IYQQ==}
'@types/estree@1.0.8': '@types/estree@1.0.8':
resolution: {integrity: sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==} resolution: {integrity: sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==}
@ -437,14 +468,20 @@ packages:
'@vue/compiler-core@3.5.22': '@vue/compiler-core@3.5.22':
resolution: {integrity: sha512-jQ0pFPmZwTEiRNSb+i9Ow/I/cHv2tXYqsnHKKyCQ08irI2kdF5qmYedmF8si8mA7zepUFmJ2hqzS8CQmNOWOkQ==} resolution: {integrity: sha512-jQ0pFPmZwTEiRNSb+i9Ow/I/cHv2tXYqsnHKKyCQ08irI2kdF5qmYedmF8si8mA7zepUFmJ2hqzS8CQmNOWOkQ==}
'@vue/compiler-core@3.5.29':
resolution: {integrity: sha512-cuzPhD8fwRHk8IGfmYaR4eEe4cAyJEL66Ove/WZL7yWNL134nqLddSLwNRIsFlnnW1kK+p8Ck3viFnC0chXCXw==}
'@vue/compiler-dom@3.5.22': '@vue/compiler-dom@3.5.22':
resolution: {integrity: sha512-W8RknzUM1BLkypvdz10OVsGxnMAuSIZs9Wdx1vzA3mL5fNMN15rhrSCLiTm6blWeACwUwizzPVqGJgOGBEN/hA==} resolution: {integrity: sha512-W8RknzUM1BLkypvdz10OVsGxnMAuSIZs9Wdx1vzA3mL5fNMN15rhrSCLiTm6blWeACwUwizzPVqGJgOGBEN/hA==}
'@vue/compiler-sfc@3.5.22': '@vue/compiler-dom@3.5.29':
resolution: {integrity: sha512-tbTR1zKGce4Lj+JLzFXDq36K4vcSZbJ1RBu8FxcDv1IGRz//Dh2EBqksyGVypz3kXpshIfWKGOCcqpSbyGWRJQ==} resolution: {integrity: sha512-n0G5o7R3uBVmVxjTIYcz7ovr8sy7QObFG8OQJ3xGCDNhbG60biP/P5KnyY8NLd81OuT1WJflG7N4KWYHaeeaIg==}
'@vue/compiler-ssr@3.5.22': '@vue/compiler-sfc@3.5.29':
resolution: {integrity: sha512-GdgyLvg4R+7T8Nk2Mlighx7XGxq/fJf9jaVofc3IL0EPesTE86cP/8DD1lT3h1JeZr2ySBvyqKQJgbS54IX1Ww==} resolution: {integrity: sha512-oJZhN5XJs35Gzr50E82jg2cYdZQ78wEwvRO6Y63TvLVTc+6xICzJHP1UIecdSPPYIbkautNBanDiWYa64QSFIA==}
'@vue/compiler-ssr@3.5.29':
resolution: {integrity: sha512-Y/ARJZE6fpjzL5GH/phJmsFwx3g6t2KmHKHx5q+MLl2kencADKIrhH5MLF6HHpRMmlRAYBRSvv347Mepf1zVNw==}
'@vue/compiler-vue2@2.7.16': '@vue/compiler-vue2@2.7.16':
resolution: {integrity: sha512-qYC3Psj9S/mfu9uVi5WvNZIzq+xnXMhOwbTFKKDD7b1lhpnn71jXSFdTQ+WsIEk0ONCd7VV2IMm7ONl6tbQ86A==} resolution: {integrity: sha512-qYC3Psj9S/mfu9uVi5WvNZIzq+xnXMhOwbTFKKDD7b1lhpnn71jXSFdTQ+WsIEk0ONCd7VV2IMm7ONl6tbQ86A==}
@ -457,23 +494,26 @@ packages:
typescript: typescript:
optional: true optional: true
'@vue/reactivity@3.5.22': '@vue/reactivity@3.5.29':
resolution: {integrity: sha512-f2Wux4v/Z2pqc9+4SmgZC1p73Z53fyD90NFWXiX9AKVnVBEvLFOWCEgJD3GdGnlxPZt01PSlfmLqbLYzY/Fw4A==} resolution: {integrity: sha512-zcrANcrRdcLtmGZETBxWqIkoQei8HaFpZWx/GHKxx79JZsiZ8j1du0VUJtu4eJjgFvU/iKL5lRXFXksVmI+5DA==}
'@vue/runtime-core@3.5.22': '@vue/runtime-core@3.5.29':
resolution: {integrity: sha512-EHo4W/eiYeAzRTN5PCextDUZ0dMs9I8mQ2Fy+OkzvRPUYQEyK9yAjbasrMCXbLNhF7P0OUyivLjIy0yc6VrLJQ==} resolution: {integrity: sha512-8DpW2QfdwIWOLqtsNcds4s+QgwSaHSJY/SUe04LptianUQ/0xi6KVsu/pYVh+HO3NTVvVJjIPL2t6GdeKbS4Lg==}
'@vue/runtime-dom@3.5.22': '@vue/runtime-dom@3.5.29':
resolution: {integrity: sha512-Av60jsryAkI023PlN7LsqrfPvwfxOd2yAwtReCjeuugTJTkgrksYJJstg1e12qle0NarkfhfFu1ox2D+cQotww==} resolution: {integrity: sha512-AHvvJEtcY9tw/uk+s/YRLSlxxQnqnAkjqvK25ZiM4CllCZWzElRAoQnCM42m9AHRLNJ6oe2kC5DCgD4AUdlvXg==}
'@vue/server-renderer@3.5.22': '@vue/server-renderer@3.5.29':
resolution: {integrity: sha512-gXjo+ao0oHYTSswF+a3KRHZ1WszxIqO7u6XwNHqcqb9JfyIL/pbWrrh/xLv7jeDqla9u+LK7yfZKHih1e1RKAQ==} resolution: {integrity: sha512-G/1k6WK5MusLlbxSE2YTcqAAezS+VuwHhOvLx2KnQU7G2zCH6KIb+5Wyt6UjMq7a3qPzNEjJXs1hvAxDclQH+g==}
peerDependencies: peerDependencies:
vue: 3.5.22 vue: 3.5.29
'@vue/shared@3.5.22': '@vue/shared@3.5.22':
resolution: {integrity: sha512-F4yc6palwq3TT0u+FYf0Ns4Tfl9GRFURDN2gWG7L1ecIaS/4fCIuFOjMTnCyjsu/OK6vaDKLCrGAa+KvvH+h4w==} resolution: {integrity: sha512-F4yc6palwq3TT0u+FYf0Ns4Tfl9GRFURDN2gWG7L1ecIaS/4fCIuFOjMTnCyjsu/OK6vaDKLCrGAa+KvvH+h4w==}
'@vue/shared@3.5.29':
resolution: {integrity: sha512-w7SR0A5zyRByL9XUkCfdLs7t9XOHUyJ67qPGQjOou3p6GvBeBW+AVjUUmlxtZ4PIYaRvE+1LmK44O4uajlZwcg==}
alien-signals@1.0.13: alien-signals@1.0.13:
resolution: {integrity: sha512-OGj9yyTnJEttvzhTUWuscOvtqxq5vrhF7vL9oS0xJ2mK0ItPYP1/y+vCFebfxoEyAz0++1AIwJ5CMr+Fk3nDmg==} resolution: {integrity: sha512-OGj9yyTnJEttvzhTUWuscOvtqxq5vrhF7vL9oS0xJ2mK0ItPYP1/y+vCFebfxoEyAz0++1AIwJ5CMr+Fk3nDmg==}
@ -483,8 +523,8 @@ packages:
brace-expansion@2.0.2: brace-expansion@2.0.2:
resolution: {integrity: sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==} resolution: {integrity: sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==}
csstype@3.1.3: csstype@3.2.3:
resolution: {integrity: sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==} resolution: {integrity: sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==}
de-indent@1.0.2: de-indent@1.0.2:
resolution: {integrity: sha512-e/1zu3xH5MQryN2zdVaF0OrdNLUbvWxzMbi+iNA6Bky7l1RoP8a2fIbRocyHclXt/arDrrR6lL3TqFD9pMQTsg==} resolution: {integrity: sha512-e/1zu3xH5MQryN2zdVaF0OrdNLUbvWxzMbi+iNA6Bky7l1RoP8a2fIbRocyHclXt/arDrrR6lL3TqFD9pMQTsg==}
@ -493,6 +533,10 @@ packages:
resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==} resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==}
engines: {node: '>=0.12'} engines: {node: '>=0.12'}
entities@7.0.1:
resolution: {integrity: sha512-TWrgLOFUQTH994YUyl1yT4uyavY5nNB5muff+RtWaqNVCAK408b5ZnnbNAUEWLTCpum9w6arT70i1XdQ4UeOPA==}
engines: {node: '>=0.12'}
esbuild@0.25.10: esbuild@0.25.10:
resolution: {integrity: sha512-9RiGKvCwaqxO2owP61uQ4BgNborAQskMR6QusfWzQqv7AZOg5oGehdY2pRJMTKuwxd1IDBP4rSbI5lHzU7SMsQ==} resolution: {integrity: sha512-9RiGKvCwaqxO2owP61uQ4BgNborAQskMR6QusfWzQqv7AZOg5oGehdY2pRJMTKuwxd1IDBP4rSbI5lHzU7SMsQ==}
engines: {node: '>=18'} engines: {node: '>=18'}
@ -519,8 +563,8 @@ packages:
resolution: {integrity: sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==} resolution: {integrity: sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==}
hasBin: true hasBin: true
magic-string@0.30.19: magic-string@0.30.21:
resolution: {integrity: sha512-2N21sPY9Ws53PZvsEpVtNuSW+ScYbQdp4b9qUaL+9QkHUrGFKo56Lg9Emg5s9V/qrtNBmiR01sYhUOwu3H+VOw==} resolution: {integrity: sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==}
minimatch@9.0.5: minimatch@9.0.5:
resolution: {integrity: sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==} resolution: {integrity: sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==}
@ -615,8 +659,8 @@ packages:
peerDependencies: peerDependencies:
typescript: '>=5.0.0' typescript: '>=5.0.0'
vue@3.5.22: vue@3.5.29:
resolution: {integrity: sha512-toaZjQ3a/G/mYaLSbV+QsQhIdMo9x5rrqIpYRObsJ6T/J+RyCSFwN2LHNVH9v8uIcljDNa3QzPVdv3Y6b9hAJQ==} resolution: {integrity: sha512-BZqN4Ze6mDQVNAni0IHeMJ5mwr8VAJ3MQC9FmprRhcBYENw+wOAAjRj8jfmN6FLl0j96OXbR+CjWhmAmM+QGnA==}
peerDependencies: peerDependencies:
typescript: '*' typescript: '*'
peerDependenciesMeta: peerDependenciesMeta:
@ -629,15 +673,26 @@ snapshots:
'@babel/helper-validator-identifier@7.27.1': {} '@babel/helper-validator-identifier@7.27.1': {}
'@babel/helper-validator-identifier@7.28.5': {}
'@babel/parser@7.28.4': '@babel/parser@7.28.4':
dependencies: dependencies:
'@babel/types': 7.28.4 '@babel/types': 7.28.4
'@babel/parser@7.29.0':
dependencies:
'@babel/types': 7.29.0
'@babel/types@7.28.4': '@babel/types@7.28.4':
dependencies: dependencies:
'@babel/helper-string-parser': 7.27.1 '@babel/helper-string-parser': 7.27.1
'@babel/helper-validator-identifier': 7.27.1 '@babel/helper-validator-identifier': 7.27.1
'@babel/types@7.29.0':
dependencies:
'@babel/helper-string-parser': 7.27.1
'@babel/helper-validator-identifier': 7.28.5
'@esbuild/aix-ppc64@0.25.10': '@esbuild/aix-ppc64@0.25.10':
optional: true optional: true
@ -784,7 +839,7 @@ snapshots:
'@rollup/rollup-win32-x64-msvc@4.52.3': '@rollup/rollup-win32-x64-msvc@4.52.3':
optional: true optional: true
'@tauri-apps/api@2.8.0': {} '@tauri-apps/api@2.10.1': {}
'@tauri-apps/cli-darwin-arm64@2.8.4': '@tauri-apps/cli-darwin-arm64@2.8.4':
optional: true optional: true
@ -833,16 +888,28 @@ snapshots:
'@tauri-apps/cli-win32-ia32-msvc': 2.8.4 '@tauri-apps/cli-win32-ia32-msvc': 2.8.4
'@tauri-apps/cli-win32-x64-msvc': 2.8.4 '@tauri-apps/cli-win32-x64-msvc': 2.8.4
'@tauri-apps/plugin-opener@2.5.0': '@tauri-apps/plugin-autostart@2.5.1':
dependencies: dependencies:
'@tauri-apps/api': 2.8.0 '@tauri-apps/api': 2.10.1
'@tauri-apps/plugin-http@2.5.7':
dependencies:
'@tauri-apps/api': 2.10.1
'@tauri-apps/plugin-notification@2.3.3':
dependencies:
'@tauri-apps/api': 2.10.1
'@tauri-apps/plugin-opener@2.5.3':
dependencies:
'@tauri-apps/api': 2.10.1
'@types/estree@1.0.8': {} '@types/estree@1.0.8': {}
'@vitejs/plugin-vue@5.2.4(vite@6.3.6)(vue@3.5.22(typescript@5.6.3))': '@vitejs/plugin-vue@5.2.4(vite@6.3.6)(vue@3.5.29(typescript@5.6.3))':
dependencies: dependencies:
vite: 6.3.6 vite: 6.3.6
vue: 3.5.22(typescript@5.6.3) vue: 3.5.29(typescript@5.6.3)
'@volar/language-core@2.4.15': '@volar/language-core@2.4.15':
dependencies: dependencies:
@ -864,27 +931,40 @@ snapshots:
estree-walker: 2.0.2 estree-walker: 2.0.2
source-map-js: 1.2.1 source-map-js: 1.2.1
'@vue/compiler-core@3.5.29':
dependencies:
'@babel/parser': 7.29.0
'@vue/shared': 3.5.29
entities: 7.0.1
estree-walker: 2.0.2
source-map-js: 1.2.1
'@vue/compiler-dom@3.5.22': '@vue/compiler-dom@3.5.22':
dependencies: dependencies:
'@vue/compiler-core': 3.5.22 '@vue/compiler-core': 3.5.22
'@vue/shared': 3.5.22 '@vue/shared': 3.5.22
'@vue/compiler-sfc@3.5.22': '@vue/compiler-dom@3.5.29':
dependencies: dependencies:
'@babel/parser': 7.28.4 '@vue/compiler-core': 3.5.29
'@vue/compiler-core': 3.5.22 '@vue/shared': 3.5.29
'@vue/compiler-dom': 3.5.22
'@vue/compiler-ssr': 3.5.22 '@vue/compiler-sfc@3.5.29':
'@vue/shared': 3.5.22 dependencies:
'@babel/parser': 7.29.0
'@vue/compiler-core': 3.5.29
'@vue/compiler-dom': 3.5.29
'@vue/compiler-ssr': 3.5.29
'@vue/shared': 3.5.29
estree-walker: 2.0.2 estree-walker: 2.0.2
magic-string: 0.30.19 magic-string: 0.30.21
postcss: 8.5.6 postcss: 8.5.6
source-map-js: 1.2.1 source-map-js: 1.2.1
'@vue/compiler-ssr@3.5.22': '@vue/compiler-ssr@3.5.29':
dependencies: dependencies:
'@vue/compiler-dom': 3.5.22 '@vue/compiler-dom': 3.5.29
'@vue/shared': 3.5.22 '@vue/shared': 3.5.29
'@vue/compiler-vue2@2.7.16': '@vue/compiler-vue2@2.7.16':
dependencies: dependencies:
@ -904,30 +984,32 @@ snapshots:
optionalDependencies: optionalDependencies:
typescript: 5.6.3 typescript: 5.6.3
'@vue/reactivity@3.5.22': '@vue/reactivity@3.5.29':
dependencies: dependencies:
'@vue/shared': 3.5.22 '@vue/shared': 3.5.29
'@vue/runtime-core@3.5.22': '@vue/runtime-core@3.5.29':
dependencies: dependencies:
'@vue/reactivity': 3.5.22 '@vue/reactivity': 3.5.29
'@vue/shared': 3.5.22 '@vue/shared': 3.5.29
'@vue/runtime-dom@3.5.22': '@vue/runtime-dom@3.5.29':
dependencies: dependencies:
'@vue/reactivity': 3.5.22 '@vue/reactivity': 3.5.29
'@vue/runtime-core': 3.5.22 '@vue/runtime-core': 3.5.29
'@vue/shared': 3.5.22 '@vue/shared': 3.5.29
csstype: 3.1.3 csstype: 3.2.3
'@vue/server-renderer@3.5.22(vue@3.5.22(typescript@5.6.3))': '@vue/server-renderer@3.5.29(vue@3.5.29(typescript@5.6.3))':
dependencies: dependencies:
'@vue/compiler-ssr': 3.5.22 '@vue/compiler-ssr': 3.5.29
'@vue/shared': 3.5.22 '@vue/shared': 3.5.29
vue: 3.5.22(typescript@5.6.3) vue: 3.5.29(typescript@5.6.3)
'@vue/shared@3.5.22': {} '@vue/shared@3.5.22': {}
'@vue/shared@3.5.29': {}
alien-signals@1.0.13: {} alien-signals@1.0.13: {}
balanced-match@1.0.2: {} balanced-match@1.0.2: {}
@ -936,12 +1018,14 @@ snapshots:
dependencies: dependencies:
balanced-match: 1.0.2 balanced-match: 1.0.2
csstype@3.1.3: {} csstype@3.2.3: {}
de-indent@1.0.2: {} de-indent@1.0.2: {}
entities@4.5.0: {} entities@4.5.0: {}
entities@7.0.1: {}
esbuild@0.25.10: esbuild@0.25.10:
optionalDependencies: optionalDependencies:
'@esbuild/aix-ppc64': 0.25.10 '@esbuild/aix-ppc64': 0.25.10
@ -982,7 +1066,7 @@ snapshots:
he@1.2.0: {} he@1.2.0: {}
magic-string@0.30.19: magic-string@0.30.21:
dependencies: dependencies:
'@jridgewell/sourcemap-codec': 1.5.5 '@jridgewell/sourcemap-codec': 1.5.5
@ -1062,12 +1146,12 @@ snapshots:
'@vue/language-core': 2.2.12(typescript@5.6.3) '@vue/language-core': 2.2.12(typescript@5.6.3)
typescript: 5.6.3 typescript: 5.6.3
vue@3.5.22(typescript@5.6.3): vue@3.5.29(typescript@5.6.3):
dependencies: dependencies:
'@vue/compiler-dom': 3.5.22 '@vue/compiler-dom': 3.5.29
'@vue/compiler-sfc': 3.5.22 '@vue/compiler-sfc': 3.5.29
'@vue/runtime-dom': 3.5.22 '@vue/runtime-dom': 3.5.29
'@vue/server-renderer': 3.5.22(vue@3.5.22(typescript@5.6.3)) '@vue/server-renderer': 3.5.29(vue@3.5.29(typescript@5.6.3))
'@vue/shared': 3.5.22 '@vue/shared': 3.5.29
optionalDependencies: optionalDependencies:
typescript: 5.6.3 typescript: 5.6.3

4
run.bat Normal file
View File

@ -0,0 +1,4 @@
@echo off
call "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat" >nul 2>&1
cd /d D:\Projects\tauri\tauri-app
pnpm run tauri dev

View File

@ -0,0 +1,11 @@
[target.x86_64-pc-windows-msvc]
linker = "C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.44.35207\\bin\\Hostx64\\x64\\link.exe"
rustflags = [
"-Lnative=C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.26100.0\\um\\x64",
"-Lnative=C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.26100.0\\ucrt\\x64",
"-Lnative=C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.44.35207\\lib\\x64",
]
[env]
CC_x86_64_pc_windows_msvc = "C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.44.35207\\bin\\Hostx64\\x64\\cl.exe"
CXX_x86_64_pc_windows_msvc = "C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.44.35207\\bin\\Hostx64\\x64\\cl.exe"

2468
src-tauri/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -18,8 +18,14 @@ crate-type = ["staticlib", "cdylib", "rlib"]
tauri-build = { version = "2", features = [] } tauri-build = { version = "2", features = [] }
[dependencies] [dependencies]
tauri = { version = "2", features = [] } tauri = { version = "2", features = ["tray-icon", "image-png"] }
tauri-plugin-opener = "2" tauri-plugin-opener = "2"
tauri-plugin-notification = "2"
tauri-plugin-http = { version = "2", features = ["native-tls", "unsafe-headers"] }
tauri-plugin-autostart = "2"
tauri-plugin-store = "2"
serde = { version = "1", features = ["derive"] } serde = { version = "1", features = ["derive"] }
serde_json = "1" serde_json = "1"
log = "0.4"
env_logger = "0.10"

View File

@ -5,6 +5,37 @@
"windows": ["main"], "windows": ["main"],
"permissions": [ "permissions": [
"core:default", "core:default",
"opener:default" "opener:default",
"notification:default",
{
"identifier": "http:default",
"allow": [
{ "url": "https://crm.yunvip123.com/**" },
{ "url": "https://www.baidu.com/**" }
]
},
{
"identifier": "http:allow-fetch",
"allow": [
{ "url": "https://crm.yunvip123.com/**" },
{ "url": "https://www.baidu.com/**" }
]
},
"http:allow-fetch-cancel",
"http:allow-fetch-read-body",
"http:allow-fetch-send",
"autostart:default",
"autostart:allow-enable",
"autostart:allow-disable",
"autostart:allow-is-enabled",
"core:tray:default",
"core:tray:allow-new",
"core:tray:allow-set-icon",
"core:tray:allow-set-menu",
"core:tray:allow-set-tooltip",
"core:window:allow-close",
"core:window:allow-destroy",
"core:image:default",
"core:image:allow-from-path"
] ]
} }

View File

@ -1,14 +1,23 @@
// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/ use tauri_plugin_autostart::MacosLauncher;
#[tauri::command]
fn greet(name: &str) -> String {
format!("Hello, {}! You've been greeted from Rust!", name)
}
#[cfg_attr(mobile, tauri::mobile_entry_point)] #[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() { pub fn run() {
env_logger::init();
tauri::Builder::default() tauri::Builder::default()
.plugin(tauri_plugin_opener::init()) .plugin(tauri_plugin_opener::init())
.invoke_handler(tauri::generate_handler![greet]) .plugin(tauri_plugin_notification::init())
.plugin(tauri_plugin_http::init())
.plugin(tauri_plugin_autostart::init(
MacosLauncher::LaunchAgent,
Some(vec![]),
))
.on_window_event(|window, event| {
if let tauri::WindowEvent::CloseRequested { api, .. } = event {
api.prevent_close();
let _ = window.hide();
}
})
.run(tauri::generate_context!()) .run(tauri::generate_context!())
.expect("error while running tauri application"); .expect("error while running tauri application");
} }

View File

@ -1,160 +1,645 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from "vue"; import { ref, onMounted, onUnmounted } from "vue";
import { invoke } from "@tauri-apps/api/core"; import { getCurrentWindow } from "@tauri-apps/api/window";
import { TrayIcon } from "@tauri-apps/api/tray";
import { Image } from "@tauri-apps/api/image";
import { Menu, MenuItem } from "@tauri-apps/api/menu";
import { fetch } from "@tauri-apps/plugin-http";
import { isPermissionGranted, requestPermission, sendNotification } from "@tauri-apps/plugin-notification";
import { enable as enableAutostart, disable as disableAutostart, isEnabled as isAutostartEnabled } from "@tauri-apps/plugin-autostart";
const greetMsg = ref(""); // ===== =====
const name = ref(""); const API_BASE = "https://crm.yunvip123.com/api";
const LOGIN_URL = `${API_BASE}/SystemUser/Login`;
const CHECK_URL = `${API_BASE}/DemandManage/QueryIndexCount`;
async function greet() { // ===== =====
// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/ const username = ref("");
greetMsg.value = await invoke("greet", { name: name.value }); const password = ref("");
const message = ref("");
const isLoading = ref(false);
const isLoggedIn = ref(false);
const isMonitoring = ref(false);
const autoStartEnabled = ref(false);
const logs = ref<{ timestamp: string; level: string; message: string; category: string }[]>([]);
const showLogs = ref(false);
const showConfig = ref(false);
const networkStatus = ref({
is_connected: false,
api_reachable: false,
response_time: null as number | null,
last_check: "",
});
const config = ref({
check_interval: 60,
auto_start: false,
show_notifications: true,
network_timeout: 30,
});
// ===== =====
let sessionId = "";
let userGid = "";
let userName = "";
let monitorTimer: ReturnType<typeof setInterval> | null = null;
// ===== =====
function addLog(level: string, msg: string, category: string) {
const now = new Date();
const timestamp = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, "0")}-${String(now.getDate()).padStart(2, "0")} ${String(now.getHours()).padStart(2, "0")}:${String(now.getMinutes()).padStart(2, "0")}:${String(now.getSeconds()).padStart(2, "0")}`;
logs.value.push({ timestamp, level, message: msg, category });
if (logs.value.length > 1000) logs.value.shift();
} }
// ===== =====
async function notify(title: string, body: string) {
if (!config.value.show_notifications) return;
let granted = await isPermissionGranted();
if (!granted) {
const permission = await requestPermission();
granted = permission === "granted";
}
if (granted) {
sendNotification({ title, body, actionTypeId: "crm-open" });
addLog("INFO", `通知: ${title} - ${body}`, "NOTIFICATION");
}
}
// ===== API =====
async function apiLogin(): Promise<boolean> {
try {
const body = JSON.stringify({ Account: username.value, PassWord: password.value });
const resp = await fetch(LOGIN_URL, {
method: "POST",
headers: {
"Content-Type": "application/json",
"Content-Length": String(new TextEncoder().encode(body).length),
"Host": "crm.yunvip123.com",
"Cache-Control": "no-cache",
},
body,
});
console.log(Object.fromEntries(resp.headers.entries()));
const setCookie = resp.headers.get("set-cookie") || "";
const match = setCookie.match(/ASP\.NET_SessionId=([^;]+)/);
if (match) sessionId = match[1];
addLog("DEBUG", `SessionId: ${sessionId || "(未提取)"}`, "LOGIN");
const data = await resp.json();
if (data.success && data.data) {
userGid = data.data.GID;
userName = data.data.SU_UserName || "用户";
if (!sessionId) {
addLog("WARN", "未能从响应头提取SessionIdAPI检查将使用无Cookie模式", "LOGIN");
}
isLoggedIn.value = true;
addLog("INFO", `登录成功,用户: ${userName}, GID: ${userGid}`, "LOGIN");
return true;
} else {
addLog("ERROR", `登录失败: ${data.msg}`, "LOGIN");
return false;
}
} catch (e: any) {
addLog("ERROR", `登录请求失败: ${e.message || e}`, "LOGIN");
return false;
}
}
async function apiCheckStatus(): Promise<void> {
if (!userGid) {
addLog("WARN", "会话已失效,请重新登录", "SCHEDULER");
return;
}
try {
const resp = await fetch(CHECK_URL, {
method: "POST",
headers: {
"Content-Type": "application/json",
Cookie: `ASP.NET_SessionId=${sessionId}`,
},
body: JSON.stringify({ UserGID: userGid }),
});
const result = await resp.json();
if (result.success && result.data) {
const d = result.data;
const pending = d.PendingCount || 0;
const stayclose = d.StaycloseCount || 0;
const confirm = d.ConfirmCount || 0;
addLog("INFO", `检查完成 - 待处理: ${pending}, 待关闭: ${stayclose}, 待确认: ${confirm}`, "SCHEDULER");
if (pending > 0 || stayclose > 0 || confirm > 0) {
const msgs: string[] = [];
if (pending > 0) msgs.push(`待处理工单: ${pending}`);
if (stayclose > 0) msgs.push(`待关闭工单: ${stayclose}`);
if (confirm > 0) msgs.push(`待确认工单: ${confirm}`);
await notify("工单提醒", msgs.join(""));
}
} else {
addLog("WARN", `API 返回异常: ${result.msg}`, "SCHEDULER");
}
} catch (e: any) {
addLog("ERROR", `API 检查失败: ${e.message || e}`, "SCHEDULER");
}
}
// ===== =====
async function checkNetworkStatus() {
isLoading.value = true;
let isConnected = false;
let apiReachable = false;
let responseTime: number | null = null;
//
try {
const resp = await fetch("https://www.baidu.com", { method: "GET", connectTimeout: config.value.network_timeout * 1000 });
console.log("Network check response:", resp);
console.log(resp.headers);
isConnected = resp.ok;
} catch { /* 网络不通 */ }
// API
if (isConnected) {
try {
const apiStart = Date.now();
const resp = await fetch(LOGIN_URL, { method: "HEAD", connectTimeout: config.value.network_timeout * 1000 });
responseTime = Date.now() - apiStart;
apiReachable = resp.status < 500;
} catch { /* API 不可达 */ }
}
const now = new Date();
networkStatus.value = {
is_connected: isConnected,
api_reachable: apiReachable,
response_time: responseTime,
last_check: `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, "0")}-${String(now.getDate()).padStart(2, "0")} ${String(now.getHours()).padStart(2, "0")}:${String(now.getMinutes()).padStart(2, "0")}:${String(now.getSeconds()).padStart(2, "0")}`,
};
addLog("INFO", `网络检查完成 - 连接: ${isConnected}, API可达: ${apiReachable}`, "NETWORK");
message.value = "网络状态检查完成";
isLoading.value = false;
}
// ===== =====
function saveSettings() {
if (!username.value.trim() || !password.value.trim()) {
message.value = "请输入用户名和密码";
return;
}
message.value = "设置保存成功";
addLog("INFO", "用户凭据已保存", "CONFIG");
}
// ===== =====
async function startMonitoring() {
if (!username.value.trim() || !password.value.trim()) {
message.value = "请先设置用户名和密码";
return;
}
isLoading.value = true;
const ok = await apiLogin();
if (!ok) {
message.value = "登录失败,无法开始监控";
isLoading.value = false;
return;
}
//
isMonitoring.value = true;
await apiCheckStatus();
monitorTimer = setInterval(() => {
apiCheckStatus();
}, config.value.check_interval * 1000);
addLog("INFO", "监控已启动", "MONITOR");
message.value = `监控已开始,欢迎 ${userName}`;
isLoading.value = false;
}
function stopMonitoring() {
if (monitorTimer) {
clearInterval(monitorTimer);
monitorTimer = null;
}
isMonitoring.value = false;
isLoggedIn.value = false;
sessionId = "";
userGid = "";
addLog("INFO", "监控已停止", "MONITOR");
message.value = "监控已停止";
}
// ===== =====
async function manualCheck() {
if (!isLoggedIn.value) {
message.value = "请先开始监控(登录)";
return;
}
isLoading.value = true;
await apiCheckStatus();
message.value = "手动检查完成";
isLoading.value = false;
}
// ===== =====
async function updateConfig() {
isLoading.value = true;
//
try {
if (config.value.auto_start) {
await enableAutostart();
} else {
await disableAutostart();
}
autoStartEnabled.value = config.value.auto_start;
addLog("INFO", `自启动设置: ${config.value.auto_start ? "启用" : "禁用"}`, "CONFIG");
} catch (e: any) {
addLog("ERROR", `自启动设置失败: ${e.message || e}`, "CONFIG");
}
//
if (isMonitoring.value && monitorTimer) {
clearInterval(monitorTimer);
monitorTimer = setInterval(() => {
apiCheckStatus();
}, config.value.check_interval * 1000);
addLog("INFO", `检查间隔已更新为: ${config.value.check_interval}`, "CONFIG");
}
message.value = "配置更新成功";
isLoading.value = false;
}
// ===== =====
async function setupTray() {
try {
const mainWindow = getCurrentWindow();
//
const menu = await Menu.new({
items: [
await MenuItem.new({
id: "show",
text: "显示设置",
action: async () => {
await mainWindow.show();
await mainWindow.setFocus();
}
}),
await MenuItem.new({
id: "quit",
text: "退出",
action: async () => {
await mainWindow.destroy();
}
})
]
});
//
const icon = await Image.fromPath("icons/32x32.png");
await TrayIcon.new({
icon,
tooltip: "工单监控系统",
menu,
menuOnLeftClick: false,
action: async (event) => {
if (event.type === "Click" && event.button === "Left") {
await mainWindow.show();
await mainWindow.setFocus();
}
}
});
addLog("INFO", "系统托盘创建成功", "SYSTEM");
} catch (e: any) {
addLog("ERROR", `系统托盘创建失败: ${e.message || e}`, "SYSTEM");
}
}
// ===== =====
async function minimizeToTray() {
try {
const mainWindow = getCurrentWindow();
await mainWindow.hide();
} catch (e: any) {
message.value = `最小化失败: ${e}`;
}
}
// ===== =====
function toggleLogs() {
showLogs.value = !showLogs.value;
}
function clearLogs() {
logs.value = [];
message.value = "日志已清除";
}
function toggleConfig() {
showConfig.value = !showConfig.value;
if (showConfig.value) {
config.value.auto_start = autoStartEnabled.value;
}
}
function clearMessage() {
message.value = "";
}
function formatResponseTime(time: number | null) {
return time ? `${time}ms` : "N/A";
}
function getNetworkStatusText() {
if (!networkStatus.value.is_connected) return "网络断开";
if (!networkStatus.value.api_reachable) return "API不可达";
return "网络正常";
}
// ===== =====
onMounted(async () => {
//
await setupTray();
//
try {
autoStartEnabled.value = await isAutostartEnabled();
config.value.auto_start = autoStartEnabled.value;
} catch { /* ignore */ }
addLog("INFO", "应用程序启动完成", "SYSTEM");
});
onUnmounted(() => {
if (monitorTimer) clearInterval(monitorTimer);
});
</script> </script>
<template> <template>
<main class="container"> <main class="app">
<h1>Welcome to Tauri + Vue</h1> <div class="app__header">
<h1 class="app__title">系统监控设置</h1>
<div class="row"> <div class="app__status">
<a href="https://vite.dev" target="_blank"> <div class="status-row">
<img src="/vite.svg" class="logo vite" alt="Vite logo" /> <span class="status-indicator" :class="{ 'status-indicator--active': isLoggedIn }"></span>
</a> <span class="status-text">
<a href="https://tauri.app" target="_blank"> {{ isLoggedIn ? '已登录' : '未登录' }}
<img src="/tauri.svg" class="logo tauri" alt="Tauri logo" /> {{ isMonitoring ? ' - 监控中' : '' }}
</a> </span>
<a href="https://vuejs.org/" target="_blank"> </div>
<img src="./assets/vue.svg" class="logo vue" alt="Vue logo" /> <div class="status-row">
</a> <span class="network-indicator" :class="{
'network-indicator--connected': networkStatus.is_connected,
'network-indicator--api': networkStatus.api_reachable
}"></span>
<span class="network-text">
{{ getNetworkStatusText() }}
<span v-if="networkStatus.response_time" class="response-time">
({{ formatResponseTime(networkStatus.response_time) }})
</span>
</span>
</div>
</div>
</div> </div>
<p>Click on the Tauri, Vite, and Vue logos to learn more.</p>
<form class="row" @submit.prevent="greet"> <div class="app__content">
<input id="greet-input" v-model="name" placeholder="Enter a name..." /> <!-- 设置表单 -->
<button type="submit">Greet</button> <div class="settings-card">
<h2 class="settings-card__title">登录设置</h2>
<form class="settings-form" @submit.prevent="saveSettings">
<div class="form-group">
<label for="username" class="form-group__label">用户名</label>
<input id="username" v-model="username" type="text" class="form-group__input" placeholder="请输入用户名" :disabled="isLoading" />
</div>
<div class="form-group">
<label for="password" class="form-group__label">密码</label>
<input id="password" v-model="password" type="password" class="form-group__input" placeholder="请输入密码" :disabled="isLoading" />
</div>
<button type="submit" class="btn btn--primary" :disabled="isLoading">
{{ isLoading ? '保存中...' : '保存设置' }}
</button>
</form> </form>
<p>{{ greetMsg }}</p> </div>
<!-- 操作按钮 -->
<div class="actions-card">
<h2 class="actions-card__title">监控控制</h2>
<div class="actions-grid">
<button class="btn btn--success" :disabled="isLoading || isMonitoring" @click="startMonitoring">
{{ isLoading ? '启动中...' : '开始监控' }}
</button>
<button class="btn btn--warning" :disabled="isLoading || !isMonitoring" @click="stopMonitoring">
停止监控
</button>
<button class="btn btn--info" :disabled="isLoading || !isLoggedIn" @click="manualCheck">
{{ isLoading ? '检查中...' : '手动检查API' }}
</button>
<button class="btn btn--secondary" :disabled="isLoading" @click="minimizeToTray">
最小化到托盘
</button>
</div>
</div>
<!-- 测试按钮 -->
<div class="actions-card">
<h2 class="actions-card__title">测试功能</h2>
<div class="actions-grid">
<button class="btn btn--primary" :disabled="isLoading" @click="checkNetworkStatus">
{{ isLoading ? '检查中...' : '网络检测' }}
</button>
<button class="btn btn--info" @click="toggleLogs">
{{ showLogs ? '隐藏日志' : '显示日志' }}
</button>
<button class="btn btn--primary" @click="toggleConfig">
{{ showConfig ? '隐藏配置' : '显示配置' }}
</button>
</div>
</div>
<!-- 配置面板 -->
<div v-if="showConfig" class="config-card">
<h2 class="config-card__title">高级配置</h2>
<div class="config-form">
<div class="form-group">
<label for="check_interval" class="form-group__label">检查间隔</label>
<input id="check_interval" v-model.number="config.check_interval" type="number" min="10" max="3600" class="form-group__input" />
</div>
<div class="form-group">
<label for="network_timeout" class="form-group__label">网络超时</label>
<input id="network_timeout" v-model.number="config.network_timeout" type="number" min="5" max="120" class="form-group__input" />
</div>
<div class="form-group form-group--checkbox">
<label class="checkbox-label">
<input v-model="config.auto_start" type="checkbox" class="checkbox-input" />
<span class="checkbox-text">开机自启动</span>
</label>
</div>
<div class="form-group form-group--checkbox">
<label class="checkbox-label">
<input v-model="config.show_notifications" type="checkbox" class="checkbox-input" />
<span class="checkbox-text">显示系统通知</span>
</label>
</div>
<button class="btn btn--primary" :disabled="isLoading" @click="updateConfig">
{{ isLoading ? '保存中...' : '保存配置' }}
</button>
</div>
</div>
<!-- 日志面板 -->
<div v-if="showLogs" class="logs-card">
<div class="logs-header">
<h2 class="logs-card__title">系统日志</h2>
<button class="btn btn--small btn--secondary" @click="clearLogs">清除日志</button>
</div>
<div class="logs-content">
<div v-if="logs.length === 0" class="logs-empty">暂无日志记录</div>
<div v-else class="logs-list">
<div v-for="log in [...logs].reverse()" :key="`${log.timestamp}-${log.message}`" class="log-entry" :class="`log-entry--${log.level.toLowerCase()}`">
<span class="log-time">{{ log.timestamp }}</span>
<span class="log-category">[{{ log.category }}]</span>
<span class="log-level">{{ log.level }}</span>
<span class="log-message">{{ log.message }}</span>
</div>
</div>
</div>
</div>
<!-- 消息显示 -->
<div v-if="message" class="message-card">
<div class="message-card__content">
<p class="message-card__text">{{ message }}</p>
<button class="message-card__close" @click="clearMessage">×</button>
</div>
</div>
</div>
</main> </main>
</template> </template>
<style scoped> <style scoped>
.logo.vite:hover { .app {
filter: drop-shadow(0 0 2em #747bff); min-height: 100vh;
padding: 20px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
} }
.app__header {
.logo.vue:hover {
filter: drop-shadow(0 0 2em #249b73);
}
</style>
<style>
:root {
font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
font-size: 16px;
line-height: 24px;
font-weight: 400;
color: #0f0f0f;
background-color: #f6f6f6;
font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-text-size-adjust: 100%;
}
.container {
margin: 0;
padding-top: 10vh;
display: flex; display: flex;
flex-direction: column; justify-content: space-between;
justify-content: center; align-items: center;
text-align: center; margin-bottom: 30px;
padding: 20px;
background: rgba(255, 255, 255, 0.1);
border-radius: 12px;
backdrop-filter: blur(10px);
} }
.app__title { color: white; font-size: 24px; font-weight: 600; margin: 0; }
.logo { .app__status { display: flex; flex-direction: column; gap: 8px; }
height: 6em; .status-row { display: flex; align-items: center; gap: 8px; }
padding: 1.5em; .status-indicator {
will-change: filter; width: 12px; height: 12px; border-radius: 50%;
transition: 0.75s; background-color: #dc3545; transition: background-color 0.3s ease;
} }
.status-indicator--active { background-color: #28a745; }
.logo.tauri:hover { .status-text { color: white; font-size: 14px; font-weight: 500; }
filter: drop-shadow(0 0 2em #24c8db); .network-indicator {
width: 12px; height: 12px; border-radius: 50%;
background-color: #dc3545; transition: background-color 0.3s ease;
} }
.network-indicator--connected { background-color: #ffc107; }
.row { .network-indicator--api { background-color: #28a745; }
display: flex; .network-text { color: white; font-size: 12px; font-weight: 400; }
justify-content: center; .response-time { color: #ccc; font-size: 11px; }
.app__content { display: grid; gap: 20px; max-width: 600px; margin: 0 auto; }
.settings-card, .actions-card, .config-card, .logs-card {
background: rgba(255, 255, 255, 0.95);
border-radius: 12px; padding: 24px;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
} }
.settings-card__title, .actions-card__title, .config-card__title, .logs-card__title {
a { color: #333; font-size: 18px; font-weight: 600; margin: 0 0 20px 0;
font-weight: 500;
color: #646cff;
text-decoration: inherit;
} }
.settings-form, .config-form { display: flex; flex-direction: column; gap: 16px; }
a:hover { .form-group { display: flex; flex-direction: column; gap: 6px; }
color: #535bf2; .form-group__label { color: #555; font-size: 14px; font-weight: 500; }
.form-group__input {
padding: 12px 16px; border: 2px solid #e1e5e9; border-radius: 8px;
font-size: 14px; transition: border-color 0.3s ease; background: white;
} }
.form-group__input:focus { outline: none; border-color: #667eea; }
h1 { .form-group__input:disabled { background-color: #f8f9fa; cursor: not-allowed; }
text-align: center; .actions-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.btn {
padding: 12px 20px; border: none; border-radius: 8px;
font-size: 14px; font-weight: 500; cursor: pointer;
transition: all 0.3s ease; text-align: center;
} }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
input, .btn--primary { background: #667eea; color: white; }
button { .btn--primary:hover:not(:disabled) { background: #5a6fd8; transform: translateY(-2px); }
border-radius: 8px; .btn--success { background: #28a745; color: white; }
border: 1px solid transparent; .btn--success:hover:not(:disabled) { background: #218838; transform: translateY(-2px); }
padding: 0.6em 1.2em; .btn--warning { background: #ffc107; color: #212529; }
font-size: 1em; .btn--warning:hover:not(:disabled) { background: #e0a800; transform: translateY(-2px); }
font-weight: 500; .btn--info { background: #17a2b8; color: white; }
font-family: inherit; .btn--info:hover:not(:disabled) { background: #138496; transform: translateY(-2px); }
color: #0f0f0f; .btn--secondary { background: #6c757d; color: white; }
background-color: #ffffff; .btn--secondary:hover:not(:disabled) { background: #545b62; transform: translateY(-2px); }
transition: border-color 0.25s; .btn--small { padding: 6px 12px; font-size: 12px; }
box-shadow: 0 2px 2px rgba(0, 0, 0, 0.2); .message-card {
background: rgba(255, 255, 255, 0.95); border-radius: 12px;
padding: 16px; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
border-left: 4px solid #667eea;
} }
.message-card__content { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
button { .message-card__text { color: #333; font-size: 14px; margin: 0; flex: 1; }
cursor: pointer; .message-card__close {
background: none; border: none; font-size: 20px; color: #999;
cursor: pointer; padding: 0; width: 24px; height: 24px;
display: flex; align-items: center; justify-content: center;
border-radius: 4px; transition: all 0.3s ease;
} }
.message-card__close:hover { background: #f8f9fa; color: #333; }
button:hover { .form-group--checkbox { flex-direction: row; align-items: center; }
border-color: #396cd8; .checkbox-label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox-input { width: 16px; height: 16px; }
.checkbox-text { color: #555; font-size: 14px; font-weight: 500; }
.logs-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.logs-content {
max-height: 400px; overflow-y: auto;
border: 1px solid #e1e5e9; border-radius: 8px; background: #f8f9fa;
} }
button:active { .logs-empty { padding: 20px; text-align: center; color: #999; font-style: italic; }
border-color: #396cd8; .logs-list { padding: 8px; }
background-color: #e8e8e8; .log-entry {
display: grid; grid-template-columns: auto auto auto 1fr; gap: 8px;
padding: 4px 8px; font-family: 'Courier New', monospace; font-size: 12px;
border-bottom: 1px solid #e9ecef;
} }
.log-entry:last-child { border-bottom: none; }
input, .log-entry--info { color: #0066cc; }
button { .log-entry--warn { color: #ff8800; }
outline: none; .log-entry--error { color: #cc0000; }
.log-entry--debug { color: #666; }
.log-time { color: #666; font-weight: 500; }
.log-category { color: #0066cc; font-weight: 600; }
.log-level { font-weight: 600; text-transform: uppercase; }
.log-message { word-break: break-word; }
@media (max-width: 768px) {
.app { padding: 16px; }
.app__header { flex-direction: column; gap: 12px; text-align: center; }
.actions-grid { grid-template-columns: 1fr; }
.log-entry { grid-template-columns: 1fr; gap: 4px; }
.logs-content { max-height: 300px; }
} }
#greet-input {
margin-right: 5px;
}
@media (prefers-color-scheme: dark) {
:root {
color: #f6f6f6;
background-color: #2f2f2f;
}
a:hover {
color: #24c8db;
}
input,
button {
color: #ffffff;
background-color: #0f0f0f98;
}
button:active {
background-color: #0f0f0f69;
}
}
</style> </style>

71
src/App2.vue Normal file
View File

@ -0,0 +1,71 @@
<script setup>
import { ref, onMounted } from 'vue'
import { invoke } from '@tauri-apps/api/core'
const showSettings = ref(true)
const username = ref('')
const password = ref('')
//
onMounted(async () => {
try {
const config = await invoke('load_config')
if (config && config.username) {
username.value = config.username
password.value = config.password || ''
}
} catch (error) {
console.log('No saved config found.')
}
})
//
async function saveAndLogin() {
try {
await invoke('save_config', {
config: { username: username.value, password: password.value }
})
await invoke('start_monitoring') //
showSettings.value = false //
await invoke('minimize_to_tray') //
} catch (error) {
alert('保存失败: ' + error)
}
}
</script>
<template>
<div v-if="showSettings" class="settings">
<h2>登录设置</h2>
<div>
<label>用户名:</label>
<input v-model="username" type="text" />
</div>
<div>
<label>密码:</label>
<input v-model="password" type="password" />
</div>
<button @click="saveAndLogin">登录</button>
</div>
<div v-else class="main">
<h2>正在监控...</h2>
<p>程序已最小化到系统托盘</p>
<button @click="() => showSettings = true">重新打开设置</button>
</div>
</template>
<style>
.settings, .main {
padding: 20px;
font-family: Arial, sans-serif;
}
input {
margin: 5px 0;
padding: 8px;
width: 200px;
}
button {
margin-top: 10px;
padding: 10px 20px;
}
</style>