增加无界实例保存到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 $store = useStore();
const $q = useQuasar(); const $q = useQuasar();
if ((window as any).$wujie) {
const $wujie = (window as any).$wujie;
$store.commit("setWuJie", $wujie);
}
document.title = $t.t("title"); document.title = $t.t("title");
if (!navigator.cookieEnabled) { if (!navigator.cookieEnabled) {

View File

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

View File

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