Skip to content

Commit

Permalink
发布完善软件启动的体验
Browse files Browse the repository at this point in the history
  • Loading branch information
duolabmeng6 committed Nov 7, 2023
1 parent a07be9c commit 9c0be1c
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 19 deletions.
3 changes: 3 additions & 0 deletions easyToTV/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ func NewApp() *App {
// so we can call the runtime methods
func (a *App) startup(ctx context.Context) {
a.ctx = ctx
//隐藏窗口
//runtime.WindowShow(a.ctx)
}

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

func (a *App) GetVersion() string {
println("GetVersion", myModel.Version)
return myModel.Version
}
4 changes: 4 additions & 0 deletions easyToTV/frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,9 @@ onMounted(() => {
</script>

<style>
body {
margin: 0;
padding: 0;
}
</style>
2 changes: 0 additions & 2 deletions easyToTV/frontend/src/assets/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,4 @@ body {

* {
-webkit-user-select: none;


}
8 changes: 4 additions & 4 deletions easyToTV/frontend/src/main.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {createApp} from 'vue'
import {createPinia} from 'pinia'
import ElementPlus from 'element-plus'
// import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import TDesign from 'tdesign-vue-next'
// import TDesign from 'tdesign-vue-next'
import 'tdesign-vue-next/es/style/index.css'

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


app.use(createPinia())
app.use(TDesign)
app.use(ElementPlus)
// app.use(TDesign)
// app.use(ElementPlus)
app.config.warnHandler = function (msg, vm, trace) {
// 自定义处理警告的逻辑,或者什么都不做以屏蔽
};
Expand Down
19 changes: 13 additions & 6 deletions easyToTV/frontend/src/win/__load_data.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {ref} from 'vue'
import {defineStore} from 'pinia'
import {WindowSetSize, WindowSetTitle} from "../../wailsjs/runtime/runtime"; // 根据实际文件路径进行修改
import * as systemFc from "../../wailsjs/runtime/runtime"; // 根据实际文件路径进行修改
import {BindWindowEvent} from '@/win/event'

export const __load_data = defineStore('window_data', {
Expand All @@ -11,12 +11,12 @@ export const __load_data = defineStore('window_data', {
return data
},
actions: {
init() {
async init() {

BindWindowEvent(this, this.comps)
try {
if (this.comps.Win.hasOwnProperty("event_created")) {
this.WinCreated()
await this.WinCreated()
}
} catch (e) {
console.log("WinCreated To be defined")
Expand All @@ -31,18 +31,25 @@ export const __load_data = defineStore('window_data', {
if (dthis.comps.Win.height.includes('v') || dthis.comps.Win.height.includes('%')) {
return;
}
WindowSetSize(parseInt(dthis.comps.Win.width), parseInt(dthis.comps.Win.height))
systemFc.WindowSetSize(parseInt(dthis.comps.Win.width), parseInt(dthis.comps.Win.height))
//Recalculate the width and height of the client area
setTimeout(function () {
var WidthFix = parseInt(dthis.comps.Win.width) - window.innerWidth
var HeightFix = parseInt(dthis.comps.Win.height) - window.innerHeight
WindowSetSize(parseInt(dthis.comps.Win.width) + WidthFix, parseInt(dthis.comps.Win.height) + HeightFix)
systemFc.WindowSetSize(parseInt(dthis.comps.Win.width) + WidthFix, parseInt(dthis.comps.Win.height) + HeightFix)
document.body.style.overflow = 'auto'
}, 1)
WindowSetTitle(dthis.comps.Win.text)
systemFc.WindowSetTitle(dthis.comps.Win.text)
//Move to the center of the screen
systemFc.WindowCenter()
//Give the interface 200 milliseconds to load
setTimeout(function () {
systemFc.WindowShow()
}, 200)
} catch (e) {
console.error("Error initializing win size", e)
}

},
handleAllEvents(el, e, item, callFuncName) {
try {
Expand Down
4 changes: 2 additions & 2 deletions easyToTV/frontend/src/win/design.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"id": "1",
"name": "Win",
"componentName": "Window",
"text": "多多投屏 1.0",
"text": "多多投屏",
"top": "0",
"left": "0",
"width": "454",
Expand Down Expand Up @@ -202,7 +202,7 @@
"componentName": "elButton",
"name": "Button_检查更新",
"data_id": "7007b1",
"event_click": "Button_检查更新Click"
"event_click": "Button_检查更新被单击"
}
],
"id": "id-88396",
Expand Down
14 changes: 12 additions & 2 deletions easyToTV/frontend/src/win/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ export function BindWindowEvent(c, comps) {
let 设备列表Json = await goFc.E获取设备列表();
console.log(设备列表Json)
// json文本转换为对象
let 设备列表 = JSON.parse(设备列表Json);
let 设备列表 = [];
try{
设备列表 = JSON.parse(设备列表Json);
}catch (e) {
ElMessage.error('你的局域网内没有发现设备,多刷新几次看看');
return
}
console.log(设备列表)
// [{"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"}]
// 转换为 Model转换为label url转换为value
Expand Down Expand Up @@ -78,5 +84,9 @@ export function BindWindowEvent(c, comps) {
ElMessage.success('已发送停止播放指令');

}
//Don't delete the event function flag

c.Button_检查更新被单击 = function () {
console.log("Button_检查更新被单击")
}
//Don't delete the event function flag
}
8 changes: 8 additions & 0 deletions easyToTV/frontend/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import {ElementPlusResolver} from 'unplugin-vue-components/resolvers'
import IconsResolver from 'unplugin-icons/resolver'
import vueJsx from '@vitejs/plugin-vue-jsx'

import { TDesignResolver } from 'unplugin-vue-components/resolvers';

// https://vitejs.dev/config/
export default defineConfig({
server: {
Expand All @@ -32,6 +34,9 @@ export default defineConfig({
IconsResolver({
prefix: 'Icon',
}),
TDesignResolver({
library: 'vue-next'
})
],
}),
Components({
Expand All @@ -44,6 +49,9 @@ export default defineConfig({
// Auto register Element Plus components
// 自动导入 Element Plus 组件
ElementPlusResolver(),
TDesignResolver({
library: 'vue-next'
})
],
}),

Expand Down
7 changes: 4 additions & 3 deletions easyToTV/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ func main() {

// Create application with options
err := wails.Run(&options.App{
Title: "myproject",
Width: 1024,
Height: 768,
Title: "myproject",
Width: 1024,
Height: 768,
StartHidden: true,
AssetServer: &assetserver.Options{
Assets: assets,
},
Expand Down

0 comments on commit 9c0be1c

Please sign in to comment.