refactor(mac):显示windows窗体(显示最大最小化按钮)

- 在 Mac 系统中添加编辑菜单
- 注释掉全屏和还原菜单项
- 移除无边框窗口设置
- 调整搜索框和表格样式
- 优化设置页面布局
This commit is contained in:
ArvinLovegood 2025-07-16 18:01:51 +08:00
parent 23d3566f31
commit f5c8f5d0ef
3 changed files with 23 additions and 22 deletions

View File

@ -128,7 +128,7 @@ function openCenteredWindow(url, width, height) {
</script>
<template>
<n-grid :cols="24" style="max-height: calc(100vh - 170px)">
<n-grid :cols="24" style="max-height: calc(100vh - 165px)">
<n-gi :span="4">
<n-list bordered style="text-align: left;" hoverable clickable>
<n-scrollbar style="max-height: calc(100vh - 170px);">
@ -161,13 +161,13 @@ function openCenteredWindow(url, width, height) {
<!-- </n-virtual-list>-->
</n-gi>
<n-gi :span="20">
<n-flex>
<n-flex style="--wails-draggable:no-drag">
<n-input-group style="text-align: left">
<n-input :rows="1" clearable v-model:value="search" placeholder="请输入选股指标或者要求"/>
<n-button type="primary" @click="Search">搜索A股</n-button>
</n-input-group>
</n-flex>
<n-flex justify="start" v-if="traceInfo" style="margin: 5px 0">
<n-flex justify="start" v-if="traceInfo" style="margin: 5px 0;--wails-draggable:no-drag">
<n-ellipsis line-clamp="1" :tooltip="true">
<n-text type="info" :bordered="false">选股条件</n-text>
@ -183,11 +183,11 @@ function openCenteredWindow(url, width, height) {
</n-flex>
<n-data-table
:striped="true"
:max-height="'calc(100vh - 250px)'"
:max-height="'calc(100vh - 150px)'"
size="medium"
:columns="columns"
:data="dataList"
:pagination="{pageSize: 9}"
:pagination="{pageSize: 10}"
:scroll-x="1800"
:render-cell="(value, rowData, column) => {
@ -218,10 +218,10 @@ function openCenteredWindow(url, width, height) {
}
}"
/>
<n-text>共找到
<div style="margin-top: -25px">共找到
<n-tag type="info" :bordered="false">{{ dataList.length }}</n-tag>
只股
</n-text>
</div>
</n-gi>
</n-grid>

View File

@ -285,7 +285,7 @@ function deletePrompt(ID){
<template>
<n-flex justify="left" style="text-align: left;--wails-draggable:drag" >
<n-form ref="formRef" :label-placement="'left'" :label-align="'left'" >
<n-form ref="formRef" :label-placement="'left'" :label-align="'left'" style="--wails-draggable:no-drag">
<n-card :title="()=> h(NTag, { type: 'primary',bordered:false },()=> '基础设置')" size="small" >
<n-grid :cols="24" :x-gap="24" style="text-align: left" >
<!-- <n-gi :span="24">-->
@ -379,7 +379,7 @@ function deletePrompt(ID){
<n-form-item-gi :span="5" v-if="formValue.openAI.enable" label="openAI maxTokens" path="openAI.maxTokens" >
<n-input-number placeholder="maxTokens" v-model:value="formValue.openAI.maxTokens"/>
</n-form-item-gi>
<n-form-item-gi :span="5" v-if="formValue.openAI.enable" title="天数越多消耗tokens越多" label="日K线数据(天)" path="openAI.maxTokens" >
<n-form-item-gi :span="5" v-if="formValue.openAI.enable" title="天数越多消耗tokens越多" label="日K线数据(天)" path="openAI.kDays" >
<n-input-number min="30" step="1" max="365" placeholder="日K线数据(天)" title="天数越多消耗tokens越多" v-model:value="formValue.openAI.kDays"/>
</n-form-item-gi>
<n-form-item-gi :span="11" v-if="formValue.openAI.enable" label="模型系统 Prompt" path="openAI.prompt" >
@ -389,7 +389,7 @@ function deletePrompt(ID){
placeholder="请输入系统prompt"
:autosize="{
minRows: 5,
maxRows: 8
maxRows: 6
}"
/>
</n-form-item-gi>
@ -400,7 +400,7 @@ function deletePrompt(ID){
placeholder="请输入用户prompt:例如{{stockName}}[{{stockCode}}]分析和总结"
:autosize="{
minRows: 5,
maxRows: 8
maxRows: 6
}"
/>
</n-form-item-gi>

23
main.go
View File

@ -9,7 +9,6 @@ import (
"github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2/pkg/logger"
"github.com/wailsapp/wails/v2/pkg/menu"
"github.com/wailsapp/wails/v2/pkg/menu/keys"
"github.com/wailsapp/wails/v2/pkg/options"
"github.com/wailsapp/wails/v2/pkg/options/mac"
"github.com/wailsapp/wails/v2/pkg/options/windows"
@ -70,14 +69,16 @@ func main() {
// Create an instance of the app structure
app := NewApp()
AppMenu := menu.NewMenu()
AppMenu.Append(menu.EditMenu())
FileMenu := AppMenu.AddSubmenu("设置")
FileMenu.AddText("窗口全屏", keys.CmdOrCtrl("f"), func(callback *menu.CallbackData) {
runtime.WindowFullscreen(app.ctx)
})
FileMenu.AddText("窗口还原", keys.Key("Esc"), func(callback *menu.CallbackData) {
runtime.WindowUnfullscreen(app.ctx)
})
if IsMacOS() {
AppMenu.Append(menu.EditMenu())
}
//FileMenu := AppMenu.AddSubmenu("设置")
//FileMenu.AddText("窗口全屏", keys.CmdOrCtrl("f"), func(callback *menu.CallbackData) {
// runtime.WindowFullscreen(app.ctx)
//})
//FileMenu.AddText("窗口还原", keys.Key("Esc"), func(callback *menu.CallbackData) {
// runtime.WindowUnfullscreen(app.ctx)
//})
//FileMenu.AddText("显示搜索框", keys.CmdOrCtrl("s"), func(callbackData *menu.CallbackData) {
// runtime.EventsEmit(app.ctx, "showSearch", 1)
//})
@ -118,7 +119,7 @@ func main() {
backgroundColour = &options.RGBA{R: 27, G: 38, B: 54, A: 1}
}
frameless := getFrameless()
//frameless := getFrameless()
// Create application with options
err = wails.Run(&options.App{
@ -131,7 +132,7 @@ func main() {
//MaxHeight: height,
DisableResize: false,
Fullscreen: false,
Frameless: frameless,
Frameless: false,
StartHidden: false,
HideWindowOnClose: false,
EnableDefaultContextMenu: true,