添加关于对话框,添加温度显示

This commit is contained in:
fangxiang 2021-12-23 17:08:21 +08:00
parent 6c810501d4
commit 75bbf17edd
17 changed files with 300 additions and 27 deletions

View File

@ -1,6 +1,6 @@
{
"name": "media_player_client",
"version": "0.0.1",
"version": "1.0.2",
"description": "A Quasar Framework app",
"productName": "MediaPlayerClient",
"author": "fangxiang <fangxiang@cloudview.work>",

4
public/svgs/fan.svg Normal file
View File

@ -0,0 +1,4 @@
<svg t="1640249924387" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8472" width="35" height="35">
<path d="M486.318719 399.383843c-41.099443-89.839328-11.032583-220.416849-11.032583-220.416849C465.254216 24.247118 332.025118 11.350483 332.025118 11.350483 147.216708 29.969322 175.874691 201.891935 175.874691 201.891935c30.63041 100.554011 159.79183 211.913018 242.11354 274.752502 11.794821-33.856375 36.529627-61.553433 68.330488-77.260594zM855.679052 464.62564c154.759613-9.266069 168.320948-142.430142 168.320948-142.430142-17.7121-184.89511-189.764764-157.096903-189.764764-157.096902-93.567431 28.007733-196.921132 141.042941-261.830579 222.707176 42.851506 8.294306 78.431045 36.706639 96.731983 74.995554 85.591025-21.942341 186.542412 1.824314 186.542412 1.824314zM560.031835 656.781881c29.127609 85.883638 8.539956 193.817992 8.539956 193.817992 15.920299 154.239413 149.546772 162.049644 149.546772 162.049644 183.952247-25.652381 148.780921-196.357581 148.780922-196.357582-28.145008-81.122359-122.26154-166.926522-201.94251-228.180117-21.245128 37.635053-59.801369 64.17611-104.92514 68.670063zM415.423354 557.907684c-91.071192 36.565752-218.51306 2.590164-218.51306 2.590164C41.937543 565.219389 24.474705 697.935511 24.474705 697.935511c12.286121 185.339448 185.093798 162.580682 185.093798 162.580682 96.132308-25.739081 204.998688-139.42454 272.014225-219.452311a136.310562 136.310562 0 0 1-66.159374-83.156198z" p-id="8473" fill="#ffffff"></path>
<path d="M452.252819 520.716969a93.596331 93.126706 90 1 0 186.253411 0 93.596331 93.126706 90 1 0-186.253411 0Z" p-id="8474" fill="#ffffff"></path>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -8,12 +8,15 @@
import { defineComponent } from "vue";
import { useI18n } from "vue-i18n";
import EventBus, { EventNamesDefine } from "src/common/EventBus";
import GlobalData from "./common/GlobalData";
import { useStore } from "src/store";
export default defineComponent({
name: "App",
setup() {
const $t = useI18n();
const $q = useStore();
document.title = $t.t("title");
window.onresize = (evt: any) =>
@ -23,6 +26,21 @@ export default defineComponent({
EventBus.getInstance().emit(EventNamesDefine.DocumentBodyClick, evt);
document.body.classList.add("overflow-hidden");
const refreshFanTemp = async () => {
try {
const info = await GlobalData.getInstance()
.getCurrentClient()
?.getUnimportantInfo();
console.log(info);
if (info) {
$q.commit("setFanTemp", info.fan_temp);
}
} catch {}
};
setInterval(refreshFanTemp, 1000 * 3);
refreshFanTemp();
return {};
},
});

View File

@ -636,23 +636,27 @@ export default class ClientConnection {
}
public async unmuteWindow(window_id: number) {
try {
return await this.doRpc<Protocol.NoneResponse>(
new Protocol.UnMuteWindowRequestEntity(window_id, 0)
);
} catch (e) {
console.error(e);
}
}
public async muteWindow(window_id: number) {
try {
return await this.doRpc<Protocol.NoneResponse>(
new Protocol.MuteWindowRequestEntity(window_id, 0)
);
} catch (e) {
console.error(e);
}
public async getBuildInfo() {
return await this.doRpc<Protocol.GetBuildInfoResponseEntity>(
new Protocol.GetBuildInfoRequestEntity(0)
);
}
public async getUnimportantInfo() {
return await this.doRpc<Protocol.GetUnimportantInfoResponseEntity>(
new Protocol.GetUnimportantInfoRequestEntity(0)
);
}
public restartDevice(delay_ms?: number) {

View File

@ -0,0 +1,147 @@
<template>
<q-dialog v-model="show_dialog">
<q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 35vw">
<q-card-section class="q-ma-none q-pa-sm">
<div class="row">
<div class="col-auto text-h6" @click="click_count++">
{{ $t("about") }}
</div>
<q-space />
<div>
<q-btn flat round icon="close" color="red" v-close-popup>
<q-tooltip>
{{ $t("close") }}
</q-tooltip>
</q-btn>
</div>
</div>
</q-card-section>
<q-separator />
<q-card-section style="max-height: 50vh; width: 35vw" class="scroll">
<q-list>
<q-item>
<q-item-section>
{{ $t("product name") }}: {{ $t("TV splicing box") }}
</q-item-section>
</q-item>
<q-item>
<q-item-section>
{{ $t("copyright") }}: {{ $t("guangdong chuangxian jishu") }} LTD.
</q-item-section>
</q-item>
<q-item>
<q-item-section
>{{ $t("client version") }}:
{{ client_version.version }}</q-item-section
>
</q-item>
<q-item>
<q-item-section
>{{ $t("server version") }}: {{ server_version }}</q-item-section
>
</q-item>
<q-item v-if="click_count > target_click_count">
<q-item-section
>{{ $t("server commit hash") }}:
{{ server_commit_hash }}</q-item-section
>
</q-item>
<q-item v-if="click_count > target_click_count">
<q-item-section
>{{ $t("server branch name") }}:
{{ server_branch_name }}</q-item-section
>
</q-item>
<q-item v-if="click_count > target_click_count">
<q-item-section
>{{ $t("server build date") }}:
{{ server_build_date }}</q-item-section
>
</q-item>
<q-item
v-if="
click_count > target_click_count * 2 &&
click_count < target_click_count * 2 + 2
"
>
<q-item-section
><q-btn
:label="$t('restart device3568')"
@click="restart_device"
/>
</q-item-section>
</q-item>
</q-list>
</q-card-section>
</q-card>
</q-dialog>
</template>
<style scoped></style>
<script lang="ts">
import { defineComponent, ref, watch, computed } from "vue";
import { useStore } from "src/store";
import { useQuasar } from "quasar";
import { useI18n } from "vue-i18n";
import version from "../../package.json";
import GlobalData from "src/common/GlobalData";
export default defineComponent({
name: "ComponentAboutDialog",
setup() {
let $store = useStore();
let $q = useQuasar();
let $t = useI18n();
let show_dialog = ref(false);
let click_count = ref(0);
const target_click_count = ref(30);
let client_version = ref(version);
let server_version = ref("unknow");
let server_commit_hash = ref("unknow");
let server_build_date = ref("unknow");
let server_branch_name = ref("unknow");
const restart_device = () => {
GlobalData.getInstance()
.getCurrentClient()
?.restartDevice(1000 * 5);
};
return {
show_dialog,
click_count,
target_click_count,
client_version,
server_version,
server_commit_hash,
server_build_date,
server_branch_name,
restart_device,
async showDialog() {
click_count.value = 0;
show_dialog.value = true;
try {
const build_info = await GlobalData.getInstance()
.getCurrentClient()
?.getBuildInfo();
if (build_info) {
server_version.value = build_info.version;
server_commit_hash.value = build_info.commit_hash;
server_build_date.value = build_info.build_date;
server_branch_name.value = build_info.branch_name;
}
} catch {}
},
};
},
});
</script>

View File

@ -33,7 +33,7 @@ import { useI18n } from "vue-i18n";
import GlobalData from "src/common/GlobalData";
export default defineComponent({
name: "EditVolumeDialog",
name: "ComponentEditVolumeDialog",
setup() {
let $store = useStore();

View File

@ -133,7 +133,7 @@ import { ModeEntity } from "src/entities/ModeEntity";
import EventBus, { EventNamesDefine } from "src/common/EventBus";
export default defineComponent({
name: "PageModeTree",
name: "ComponentModeTree",
components: { ModeGroupDialog, ModeDialog },

View File

@ -170,7 +170,7 @@ import { PlanEntity } from "src/entities/PlanEntity";
import { NotifyMessage } from "src/common/ClientConnection";
export default defineComponent({
name: "PagePlanTree",
name: "ComponentPlanTree",
components: { PlanGroupDialog, PlanDialog },

View File

@ -5,7 +5,7 @@
<q-card-section class="q-ma-none q-pa-sm">
<div class="row">
<div class="col-auto text-h6">
{{ $t("data import") }}
{{ $t("database import") }}
</div>
<q-space />
<div>

View File

@ -136,7 +136,7 @@ import { Protocol } from "src/entities/WSProtocol";
import { NotifyMessage } from "src/common/ClientConnection";
export default defineComponent({
name: "PageSignalSourceTree",
name: "ComponentSignalSourceTree",
components: { SignalSourceGroupDialog, SignalSourceDialog },

View File

@ -722,7 +722,7 @@ const _time_zones = [
];
export default defineComponent({
name: "SystemSettingDialog",
name: "ComponentSystemSettingDialog",
setup() {
let $store = useStore();

View File

@ -314,7 +314,6 @@ export default defineComponent({
signal_source.value,
GlobalData.getInstance().getSignalSource(props.signal_source_table_uuid)
);
console.log(signal_source.value.window_type);
};
const is_audo_player_window = computed(

View File

@ -232,6 +232,14 @@ export namespace Protocol {
return Commands.PROTOCOL_PREFIX + "UnMuteWidow";
}
public static get kRpcGetBuildInfo() {
return Commands.PROTOCOL_PREFIX + "RpcGetBuildInfo";
}
public static get kRpcGetUnimportantInfo() {
return Commands.PROTOCOL_PREFIX + "RpcGetUnimportantInfo";
}
static _all_commands = new Set([
Commands.kUnKnowCommand,
Commands.kSearchDevice,
@ -285,6 +293,8 @@ export namespace Protocol {
Commands.kSetWindowVolume,
Commands.kMuteWidow,
Commands.kUnMuteWidow,
Commands.kRpcGetBuildInfo,
Commands.kRpcGetUnimportantInfo,
]);
public static get AllCommands() {
@ -1383,4 +1393,48 @@ export namespace Protocol {
this.window_id = window_id;
}
}
export class GetBuildInfoRequestEntity extends Protocol.PacketEntity {
timestamp = new Date().getMilliseconds();
constructor(rcp_id?: number) {
super();
this.rpc_id = rcp_id ?? 0;
this.command = Protocol.Commands.kRpcGetBuildInfo;
}
}
export class GetBuildInfoResponseEntity extends Protocol.PacketEntity {
version = "unknow";
commit_hash = "unknow";
build_date = "unknow";
branch_name = "unknow";
major_version = 0;
minor_version = 0;
patch_version = 0;
tweak_version = 0;
constructor() {
super();
this.command = Protocol.Commands.kRpcGetBuildInfo;
}
}
export class GetUnimportantInfoRequestEntity extends Protocol.PacketEntity {
timestamp = new Date().getMilliseconds();
constructor(rcp_id?: number) {
super();
this.rpc_id = rcp_id ?? 0;
this.command = Protocol.Commands.kRpcGetUnimportantInfo;
}
}
export class GetUnimportantInfoResponseEntity extends Protocol.PacketEntity {
fan_temp = 0;
note = "unknow";
constructor() {
super();
this.command = Protocol.Commands.kRpcGetUnimportantInfo;
}
}
}

View File

@ -25,6 +25,8 @@ export default {
"background image": "底图设置",
"data import": "数据导入",
"data export": "数据导出",
"database import": "数据恢复",
"database export": "数据备份",
root: "根节点",
@ -274,4 +276,15 @@ export default {
"please input mode index": "请输入模式索引(0自动生成)",
"mode index": "模式索引",
"edit volume": "修改音量",
about: "关于",
"product name": "产品名称",
"TV splicing box": "电视机拼接盒",
copyright: "版权",
"guangdong chuangxian jishu": "广东创显技术有限公司",
"client version": "客户端版本",
"server version": "服务端版本",
"server commit hash": "服务端COMMIT",
"server branch name": "服务端分支",
"server build date": "服务端编译日期",
"restart device3568": "重启电视机拼接盒",
};

View File

@ -13,7 +13,7 @@
<div
v-if="landspace && show_left_tool_bar"
class="col-auto overflow-auto"
style="border: 1px solid #bdbdbd; max-width: 45vw;"
style="border: 1px solid #bdbdbd; max-width: 45vw"
v-touch-pan.left.prevent.mouse="
(evt) => {
if (evt.offset.x < -100 && evt.duration < 1000) {
@ -34,7 +34,7 @@
<div
v-if="landspace"
class="col-auto overflow-auto"
style="border: 1px solid #bdbdbd;max-width: 45vw"
style="border: 1px solid #bdbdbd; max-width: 45vw"
v-touch-pan.right.prevent.mouse="
(evt) => {
if (evt.offset.x > 100 && evt.duration < 1000) {
@ -55,7 +55,9 @@
class="bg-white text-black"
style="height: 25px"
>
<div class="text-center fit">Copyright © 2020 - 2021 SX</div>
<div class="text-center fit">
Copyright © 2020 - 2021 广东创显技术有限公司
</div>
</q-footer>
<q-footer
v-else

View File

@ -101,7 +101,7 @@
<q-icon name="backup" />
</q-item-section>
<q-item-section>
{{ $t("data import") }}
{{ $t("database import") }}
</q-item-section>
</q-item>
<q-item clickable v-close-popup @click="backupDB">
@ -109,7 +109,19 @@
<q-icon name="cloud_download" />
</q-item-section>
<q-item-section>
{{ $t("data export") }}
{{ $t("database export") }}
</q-item-section>
</q-item>
<q-item
clickable
v-close-popup
@click="$refs.about_dialog.showDialog()"
>
<q-item-section avatar>
<q-icon name="info_outline" />
</q-item-section>
<q-item-section>
{{ $t("about") }}
</q-item-section>
</q-item>
</q-list>
@ -117,6 +129,14 @@
<q-space />
<q-separator vertical inset />
<q-item>
<q-item-section avatar style="margin-right: 0px; padding-right: 0px"
><q-icon class="text-white" name="img:svgs/fan.svg"
/></q-item-section>
<q-item-section> {{ $store.state.fan_temp }} </q-item-section>
</q-item>
<q-separator vertical inset />
<q-btn-dropdown
stretch
flat
@ -142,6 +162,7 @@
<upgrade-dialog ref="upgrade_dialog" />
<file-manage-dialog ref="file_manage_dialog" />
<system-setting-dialog ref="system_setting_dialog" />
<about-dialog ref="about_dialog" />
</template>
<script lang="ts">
@ -155,6 +176,7 @@ import UpgradeDialog from "src/components/UpgradeDialog.vue";
import FileManageDialog from "src/components/FileManageDialog.vue";
import SubtitleDialog from "src/components/SubtitleDialog.vue";
import SystemSettingDialog from "src/components/SystemSettingDialog.vue";
import AboutDialog from "src/components/AboutDialog.vue";
import EventBus, { EventNamesDefine } from "src/common/EventBus";
import { Protocol } from "src/entities/WSProtocol";
@ -176,6 +198,7 @@ export default defineComponent({
FileManageDialog,
SubtitleDialog,
SystemSettingDialog,
AboutDialog,
},
setup() {

View File

@ -40,6 +40,7 @@ export interface StateInterface {
windows: WindowOpenNotifyEntity[];
device_ip_address: string;
power_on_plan: string;
fan_temp: number;
}
// provide typings for `this.$store`
@ -266,6 +267,7 @@ export default store(function (/* { ssrContext } */) {
windows: [],
device_ip_address: "localhost",
power_on_plan: "",
fan_temp: 0,
},
mutations: {
@ -633,6 +635,13 @@ export default store(function (/* { ssrContext } */) {
if (playload != null && playload != undefined)
state.power_on_plan = playload;
},
setFanTemp(state: StateInterface, playload?: any) {
const f = parseFloat(playload);
console.log(f);
if (!isNaN(f)) {
state.fan_temp = f;
}
},
},
// enable strict mode (adds overhead!)