增加无界实例保存到store

This commit is contained in:
fangxiang 2023-01-06 10:27:43 +08:00
parent cc8a36708d
commit 3a92bee88e
3 changed files with 50 additions and 18 deletions

View File

@ -23,6 +23,11 @@ export default defineComponent({
const $store = useStore();
const $q = useQuasar();
if ((window as any).$wujie) {
const $wujie = (window as any).$wujie;
$store.commit("setWuJie", $wujie);
}
document.title = $t.t("title");
if (!navigator.cookieEnabled) {

View File

@ -1,6 +1,10 @@
<template>
<div>
<q-toolbar style="background-color: #3e9acd" class="shadow-2 text-white" @dragstart.prevent>
<q-toolbar
style="background-color: #3e9acd"
class="shadow-2 text-white"
@dragstart.prevent
>
<q-btn-dropdown
v-if="false"
v-touch-hold:10000.mouse="handleHold"
@ -29,7 +33,7 @@
</q-btn-dropdown>
<q-btn-dropdown
v-if="show_device_list"
v-if="show_device_list && !$store.state.$wujie"
stretch
no-caps
flat
@ -72,7 +76,11 @@
</q-list>
</q-btn-dropdown>
<q-separator vertical inset />
<q-separator
vertical
inset
v-if="show_device_list && !$store.state.$wujie"
/>
<q-btn
stretch
@ -288,7 +296,11 @@
:label="$t('other setting')"
class="q-mr-sm"
>
<q-list style="background-color: #3e9acd" class="shadow-2 text-white" @dragstart.prevent>
<q-list
style="background-color: #3e9acd"
class="shadow-2 text-white"
@dragstart.prevent
>
<q-item
clickable
:disable="!$store.state.power_state"
@ -442,7 +454,11 @@
<q-item-section avatar style="margin-right: 0px; padding-right: 0px">
<!-- <q-icon class="text-white rotate" name="img:svgs/fan.svg" /> -->
<!-- <q-icon class="text-white rotate" name="img:new_icon/fan.png" /> -->
<q-icon class="text-white" :style="{'animation':fan}" name="img:new_icon/fan.png" />
<q-icon
class="text-white"
:style="{ animation: fan }"
name="img:new_icon/fan.png"
/>
</q-item-section>
<q-item-section style="margin-left: -25px">
{{ $store.state.fan_temp.toFixed(1) }}
@ -475,7 +491,7 @@
/>
</template>
<style >
<style>
@keyframes rotate {
0% {
transform: rotate(0);
@ -569,13 +585,11 @@ export default defineComponent({
const plan_running = computed(
() => $store.state.current_running_plan.trim() != ""
);
const fan = computed(
() => {
let wendu:any=($store.state.fan_temp).toFixed(1)
let sulv:any=(1-(wendu/150))
return 'rotate '+sulv+'s linear infinite'
}
);
const fan = computed(() => {
let wendu: any = $store.state.fan_temp.toFixed(1);
let sulv: any = 1 - wendu / 150;
return "rotate " + sulv + "s linear infinite";
});
const checkRegistered = () => {
if (
GlobalData.getInstance().getCurrentClient()?.is_connected &&

View File

@ -39,6 +39,11 @@ export class CustomDefines {
function_mirroring_output = false;
}
export interface WuJieInterface {
props: any;
bus: EventEmitter;
}
export interface StateInterface {
// Define your own store structure, using submodules if needed
// example: ExampleStateInterface;
@ -81,6 +86,8 @@ export interface StateInterface {
isLedPlayer: () => boolean;
isSpecialVideo: () => boolean;
$wujie: WuJieInterface | null;
}
// provide typings for `this.$store`
@ -297,6 +304,7 @@ export const storeKey: InjectionKey<VuexStore<StateInterface>> =
import window_color_list from "./window_color_list.js";
import { EProductNames } from "src/entities/ProductNames";
import EventEmitter from "events";
export const NullSignalSource =
"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF";
@ -351,6 +359,8 @@ export default store(function (/* { ssrContext } */) {
isSpecialVideo: () => {
return Store.state.product_name == EProductNames.SPECIAL_VIDEO;
},
$wujie: null,
},
mutations: {
@ -558,31 +568,31 @@ export default store(function (/* { ssrContext } */) {
},
setWallCol(state: StateInterface, playload?: any) {
const num = parseInt(playload);
if (num != NaN && num > 0) {
if (!isNaN(num) && num > 0) {
state.wall_col = num;
}
},
setWallRow(state: StateInterface, playload?: any) {
const num = parseInt(playload);
if (num != NaN && num > 0) {
if (!isNaN(num) && num > 0) {
state.wall_row = num;
}
},
setDeviceScreenWidth(state: StateInterface, playload?: any) {
const num = parseInt(playload);
if (num != NaN && num > 0) {
if (!isNaN(num) && num > 0) {
state.device_screen_width = num;
}
},
setDeviceScreenHeight(state: StateInterface, playload?: any) {
const num = parseInt(playload);
if (num != NaN && num > 0) {
if (!isNaN(num) && num > 0) {
state.device_screen_height = num;
}
},
setDeviceScreenRefreshRate(state: StateInterface, playload?: any) {
const num = parseInt(playload);
if (num != NaN && num > 0) {
if (!isNaN(num) && num > 0) {
state.device_screen_refresh_rate = num;
}
},
@ -989,6 +999,9 @@ export default store(function (/* { ssrContext } */) {
state.connect_list.slice(index, 1);
}
},
setWuJie(state: StateInterface, playload?: any) {
state.$wujie = playload;
},
},
// enable strict mode (adds overhead!)