| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- package handler
- import (
- "context"
- "file-manage-ui/data"
- "github.com/wailsapp/wails/v3/pkg/application"
- )
- type Ctx struct {
- ctx context.Context
- }
- // Service struct
- type Service struct {
- //ctx context.Context
- Ctx *Ctx
- }
- // NewService creates a new App application struct
- func NewService(Ctx *Ctx) *Service {
- return &Service{Ctx: Ctx}
- }
- // Startup is called when the app starts. The context is saved,
- // so we can call the runtime methods
- func (a *Ctx) Startup(ctx context.Context) {
- a.ctx = ctx
- }
- // CloseApp 根据名称关闭窗口
- func (a *Service) CloseApp(winName string) {
- if winName == "login-page" {
- }
- }
- func (a *Service) OpenLoginPage() {
- LoginWindow(data.App)
- }
- func LoginWindow(app *application.App) {
- //窗口管理
- win1 := app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
- Title: "Login",
- Name: "login",
- Mac: application.MacWindow{
- InvisibleTitleBarHeight: 50,
- Backdrop: application.MacBackdropTranslucent,
- TitleBar: application.MacTitleBarHiddenInset,
- },
- Frameless: true,
- Windows: application.WindowsWindow{},
- //BackgroundColour: application.NewRGB(27, 38, 54),
- URL: "/#/login",
- EnableDragAndDrop: true,
- })
- // 加载窗口到 管理器中
- data.WindowMap[win1] = true
- }
|