main.go 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. package main
  2. import (
  3. "embed"
  4. _ "embed"
  5. "log"
  6. "github.com/wailsapp/wails/v3/pkg/application"
  7. )
  8. // Wails uses Go's `embed` package to embed the frontend files into the binary.
  9. // Any files in the frontend/dist folder will be embedded into the binary and
  10. // made available to the frontend.
  11. // See https://pkg.go.dev/embed for more information.
  12. //go:embed all:frontend/dist
  13. var assets embed.FS
  14. // main function serves as the application's entry point. It initializes the application, creates a window,
  15. // and starts a goroutine that emits a time-based event every second. It subsequently runs the application and
  16. // logs any error that might occur.
  17. func main() {
  18. // Create a new Wails application by providing the necessary options.
  19. // Variables 'Name' and 'Description' are for application metadata.
  20. // 'Assets' configures the asset server with the 'FS' variable pointing to the frontend files.
  21. // 'Bind' is a list of Go struct instances. The frontend has access to the methods of these instances.
  22. // 'Mac' options tailor the application when running an macOS.
  23. app := application.New(application.Options{
  24. Name: "剑鱼招聘管理助手/简历批量上传",
  25. Description: "剑鱼招聘管理助手简历批量上传",
  26. Services: []application.Service{
  27. //application.NewService(&GreetService{}),
  28. },
  29. Assets: application.AssetOptions{
  30. Handler: application.AssetFileServerFS(assets),
  31. },
  32. Mac: application.MacOptions{
  33. ApplicationShouldTerminateAfterLastWindowClosed: true,
  34. },
  35. })
  36. // Create a new window with the necessary options.
  37. // 'Title' is the title of the window.
  38. // 'Mac' options tailor the window when running on macOS.
  39. // 'BackgroundColour' is the background colour of the window.
  40. // 'URL' is the URL that will be loaded into the webview.
  41. app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
  42. Title: "剑鱼招聘管理助手/简历批量上传",
  43. Mac: application.MacWindow{
  44. InvisibleTitleBarHeight: 50,
  45. Backdrop: application.MacBackdropTranslucent,
  46. TitleBar: application.MacTitleBarHiddenInset,
  47. },
  48. // DragAndDrop: &options.DragAndDrop{
  49. // EnableFileDrop: false,
  50. // DisableWebViewDrop: false,
  51. // CSSDropProperty: "--wails-drop-target",
  52. // CSSDropValue: "drop",
  53. // },
  54. BackgroundColour: application.NewRGB(255, 255, 255),
  55. //DisableResize: true,
  56. Width: 668,
  57. FullscreenButtonEnabled: false,
  58. ZoomControlEnabled: false,
  59. EnableDragAndDrop: true,
  60. MinimiseButtonState: application.ButtonDisabled,
  61. MaximiseButtonState: application.ButtonDisabled,
  62. URL: "/",
  63. })
  64. // Run the application. This blocks until the application has been exited.
  65. err := app.Run()
  66. // If an error occurred while running the application, log it and exit.
  67. if err != nil {
  68. log.Fatal(err)
  69. }
  70. }