Skip to content

Commit 9c0be1c

Browse files
committed
发布完善软件启动的体验
1 parent a07be9c commit 9c0be1c

File tree

9 files changed

+50
-19
lines changed

9 files changed

+50
-19
lines changed

easyToTV/app.go

+3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ func NewApp() *App {
2727
// so we can call the runtime methods
2828
func (a *App) startup(ctx context.Context) {
2929
a.ctx = ctx
30+
//隐藏窗口
31+
//runtime.WindowShow(a.ctx)
3032
}
3133

3234
// Greet returns a greeting for the given name
@@ -84,5 +86,6 @@ func (a *App) E暂停播放() string {
8486
}
8587

8688
func (a *App) GetVersion() string {
89+
println("GetVersion", myModel.Version)
8790
return myModel.Version
8891
}

easyToTV/frontend/src/App.vue

+4
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,9 @@ onMounted(() => {
4747
</script>
4848

4949
<style>
50+
body {
51+
margin: 0;
52+
padding: 0;
53+
}
5054
5155
</style>

easyToTV/frontend/src/assets/main.css

-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,4 @@ body {
77

88
* {
99
-webkit-user-select: none;
10-
11-
1210
}

easyToTV/frontend/src/main.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import {createApp} from 'vue'
22
import {createPinia} from 'pinia'
3-
import ElementPlus from 'element-plus'
3+
// import ElementPlus from 'element-plus'
44
import 'element-plus/dist/index.css'
5-
import TDesign from 'tdesign-vue-next'
5+
// import TDesign from 'tdesign-vue-next'
66
import 'tdesign-vue-next/es/style/index.css'
77

88
import App from './App.vue'
@@ -21,8 +21,8 @@ const BoxComponentNames_td = Helper.registerBoxComponentNames(app, 'td', import.
2121

2222

2323
app.use(createPinia())
24-
app.use(TDesign)
25-
app.use(ElementPlus)
24+
// app.use(TDesign)
25+
// app.use(ElementPlus)
2626
app.config.warnHandler = function (msg, vm, trace) {
2727
// 自定义处理警告的逻辑,或者什么都不做以屏蔽
2828
};

easyToTV/frontend/src/win/__load_data.js

+13-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {ref} from 'vue'
22
import {defineStore} from 'pinia'
3-
import {WindowSetSize, WindowSetTitle} from "../../wailsjs/runtime/runtime"; // 根据实际文件路径进行修改
3+
import * as systemFc from "../../wailsjs/runtime/runtime"; // 根据实际文件路径进行修改
44
import {BindWindowEvent} from '@/win/event'
55

66
export const __load_data = defineStore('window_data', {
@@ -11,12 +11,12 @@ export const __load_data = defineStore('window_data', {
1111
return data
1212
},
1313
actions: {
14-
init() {
14+
async init() {
1515

1616
BindWindowEvent(this, this.comps)
1717
try {
1818
if (this.comps.Win.hasOwnProperty("event_created")) {
19-
this.WinCreated()
19+
await this.WinCreated()
2020
}
2121
} catch (e) {
2222
console.log("WinCreated To be defined")
@@ -31,18 +31,25 @@ export const __load_data = defineStore('window_data', {
3131
if (dthis.comps.Win.height.includes('v') || dthis.comps.Win.height.includes('%')) {
3232
return;
3333
}
34-
WindowSetSize(parseInt(dthis.comps.Win.width), parseInt(dthis.comps.Win.height))
34+
systemFc.WindowSetSize(parseInt(dthis.comps.Win.width), parseInt(dthis.comps.Win.height))
3535
//Recalculate the width and height of the client area
3636
setTimeout(function () {
3737
var WidthFix = parseInt(dthis.comps.Win.width) - window.innerWidth
3838
var HeightFix = parseInt(dthis.comps.Win.height) - window.innerHeight
39-
WindowSetSize(parseInt(dthis.comps.Win.width) + WidthFix, parseInt(dthis.comps.Win.height) + HeightFix)
39+
systemFc.WindowSetSize(parseInt(dthis.comps.Win.width) + WidthFix, parseInt(dthis.comps.Win.height) + HeightFix)
4040
document.body.style.overflow = 'auto'
4141
}, 1)
42-
WindowSetTitle(dthis.comps.Win.text)
42+
systemFc.WindowSetTitle(dthis.comps.Win.text)
43+
//Move to the center of the screen
44+
systemFc.WindowCenter()
45+
//Give the interface 200 milliseconds to load
46+
setTimeout(function () {
47+
systemFc.WindowShow()
48+
}, 200)
4349
} catch (e) {
4450
console.error("Error initializing win size", e)
4551
}
52+
4653
},
4754
handleAllEvents(el, e, item, callFuncName) {
4855
try {

easyToTV/frontend/src/win/design.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"id": "1",
44
"name": "Win",
55
"componentName": "Window",
6-
"text": "多多投屏 1.0",
6+
"text": "多多投屏",
77
"top": "0",
88
"left": "0",
99
"width": "454",
@@ -202,7 +202,7 @@
202202
"componentName": "elButton",
203203
"name": "Button_检查更新",
204204
"data_id": "7007b1",
205-
"event_click": "Button_检查更新Click"
205+
"event_click": "Button_检查更新被单击"
206206
}
207207
],
208208
"id": "id-88396",

easyToTV/frontend/src/win/event.js

+12-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,13 @@ export function BindWindowEvent(c, comps) {
1313
let 设备列表Json = await goFc.E获取设备列表();
1414
console.log(设备列表Json)
1515
// json文本转换为对象
16-
let 设备列表 = JSON.parse(设备列表Json);
16+
let 设备列表 = [];
17+
try{
18+
设备列表 = JSON.parse(设备列表Json);
19+
}catch (e) {
20+
ElMessage.error('你的局域网内没有发现设备,多刷新几次看看');
21+
return
22+
}
1723
console.log(设备列表)
1824
// [{"Model":"华为智慧屏 S65","URL":"http://192.168.100.204:25826/description.xml"},{"Model":"奇异果极速投屏-华为(204)","URL":"http://192.168.100.204:39620/description.xml"},{"Model":"MacBook Pro","URL":"http://192.168.10scription.xml"}]
1925
// 转换为 Model转换为label url转换为value
@@ -78,5 +84,9 @@ export function BindWindowEvent(c, comps) {
7884
ElMessage.success('已发送停止播放指令');
7985

8086
}
81-
//Don't delete the event function flag
87+
88+
c.Button_检查更新被单击 = function () {
89+
console.log("Button_检查更新被单击")
90+
}
91+
//Don't delete the event function flag
8292
}

easyToTV/frontend/vite.config.js

+8
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import {ElementPlusResolver} from 'unplugin-vue-components/resolvers'
99
import IconsResolver from 'unplugin-icons/resolver'
1010
import vueJsx from '@vitejs/plugin-vue-jsx'
1111

12+
import { TDesignResolver } from 'unplugin-vue-components/resolvers';
13+
1214
// https://vitejs.dev/config/
1315
export default defineConfig({
1416
server: {
@@ -32,6 +34,9 @@ export default defineConfig({
3234
IconsResolver({
3335
prefix: 'Icon',
3436
}),
37+
TDesignResolver({
38+
library: 'vue-next'
39+
})
3540
],
3641
}),
3742
Components({
@@ -44,6 +49,9 @@ export default defineConfig({
4449
// Auto register Element Plus components
4550
// 自动导入 Element Plus 组件
4651
ElementPlusResolver(),
52+
TDesignResolver({
53+
library: 'vue-next'
54+
})
4755
],
4856
}),
4957

easyToTV/main.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ func main() {
1717

1818
// Create application with options
1919
err := wails.Run(&options.App{
20-
Title: "myproject",
21-
Width: 1024,
22-
Height: 768,
20+
Title: "myproject",
21+
Width: 1024,
22+
Height: 768,
23+
StartHidden: true,
2324
AssetServer: &assetserver.Options{
2425
Assets: assets,
2526
},

0 commit comments

Comments
 (0)