开关机按钮被点击后禁用五秒

This commit is contained in:
fangxiang 2022-09-23 10:09:38 +08:00
parent 9a50790629
commit 05d932586c
4 changed files with 52 additions and 10 deletions

View File

@ -10,7 +10,7 @@
},
"dependencies": {
"@quasar/cli": "^1.3.2",
"@quasar/extras": "^1.15.0",
"@quasar/extras": "^1.15.3",
"@tinymce/tinymce-vue": "4",
"@types/element-resize-detector": "^1.1.3",
"autoprefixer": "^10.4.2",
@ -18,7 +18,7 @@
"core-js": "^3.21.0",
"element-resize-detector": "^1.2.4",
"qrcode.vue": "^3.3.3",
"quasar": "^2.7.5",
"quasar": "^2.8.4",
"reconnecting-websocket": "^4.4.0",
"sortablejs": "^1.15.0",
"to": "^0.2.9",

View File

@ -92,6 +92,7 @@
stack
flat
no-caps
:disable="power_flag"
icon="img:pad/toolbar/power_on_icon.png"
:label="$t('power on')"
@click="powerOn"
@ -102,6 +103,7 @@
stack
flat
no-caps
:disable="power_flag"
icon="img:pad/toolbar/power_off_icon.png"
:label="$t('power off')"
@click="powerOff"
@ -298,11 +300,24 @@ export default defineComponent({
}
);
const power_flag = ref(false);
watch(
() => power_flag.value,
(newV) => {
if (newV) {
setTimeout(() => {
power_flag.value = false;
}, 1100 * 5);
}
}
);
return {
plan_running,
function_center_control,
is_custon_isv,
window_rect_edit_dialog,
power_flag,
toogleFullScreen() {
if (!$q.fullscreen.isCapable) {
@ -428,6 +443,9 @@ export default defineComponent({
success = response?.success ?? false;
}
} catch {}
if (success) {
power_flag.value = true;
}
$q.notify({
color: success ? "positive" : "negative",
icon: success ? "done" : "warning",
@ -449,6 +467,9 @@ export default defineComponent({
success = response?.success ?? false;
}
} catch {}
if (success) {
power_flag.value = true;
}
$q.notify({
color: success ? "positive" : "negative",
icon: success ? "done" : "warning",

View File

@ -218,6 +218,7 @@
no-caps
flat
stack
:disable="power_flag"
icon="img:new_icon/power_off.png"
:label="$t('power off')"
class="q-mr-sm"
@ -229,6 +230,7 @@
no-caps
flat
stack
:disable="power_flag"
icon="img:new_icon/power_on.png"
:label="$t('power on')"
class="q-mr-sm"
@ -501,6 +503,18 @@ export default defineComponent({
const window_rect_edit_dialog: Ref<any> = ref(null);
const power_flag = ref(false);
watch(
() => power_flag.value,
(newV) => {
if (newV) {
setTimeout(() => {
power_flag.value = false;
}, 1100 * 5);
}
}
);
const plan_running = computed(
() => $store.state.current_running_plan.trim() != ""
);
@ -589,6 +603,7 @@ export default defineComponent({
is_custon_isv,
window_rect_edit_dialog,
show_device_list,
power_flag,
async backupDB() {
let client = GlobalData.getInstance().getCurrentClient();
@ -715,6 +730,9 @@ export default defineComponent({
success = response?.success ?? false;
}
} catch {}
if (success) {
power_flag.value = true;
}
$q.notify({
color: success ? "positive" : "negative",
icon: success ? "done" : "warning",
@ -737,6 +755,9 @@ export default defineComponent({
success = response?.success ?? false;
}
} catch {}
if (success) {
power_flag.value = true;
}
$q.notify({
color: success ? "positive" : "negative",
icon: success ? "done" : "warning",

View File

@ -1245,10 +1245,10 @@
update-notifier "^5.1.0"
validate-npm-package-name "^3.0.0"
"@quasar/extras@^1.15.0":
version "1.15.0"
resolved "https://registry.npmmirror.com/@quasar/extras/-/extras-1.15.0.tgz#ed397abdc8372b2b1de525dd93c7ec6bc061db8f"
integrity sha512-e5IHHqo3i/u7yWdcdspBbthnrDDZ3VRXaQoyhEEy526lzITFAw3hnlt4h7YnZ6Ck6gVIM0YbCaZbKaQYfKPOzQ==
"@quasar/extras@^1.15.3":
version "1.15.3"
resolved "https://registry.npmmirror.com/@quasar/extras/-/extras-1.15.3.tgz#3fa4cab6df9b6d2001e6e8192a005ca71b1b0719"
integrity sha512-kc2h+zTOBRx8eR3TYUjB3ZmALYoH3LBSaOFuha11Ncixk8NTwm9GNCQL6kxmC/CQiaP9Q78KFFgrv3AXGnCvLw==
"@quasar/fastclick@1.1.4":
version "1.1.4"
@ -8890,10 +8890,10 @@ qs@6.9.6:
resolved "https://registry.npmmirror.com/qs/-/qs-6.9.6.tgz#26ed3c8243a431b2924aca84cc90471f35d5a0ee"
integrity sha512-TIRk4aqYLNoJUbd+g2lEdz5kLWIuTMRagAXxl78Q0RiVjAOugHmeKNGdd3cwo/ktpf9aL9epCfFqWDEKysUlLQ==
quasar@^2.7.5:
version "2.7.5"
resolved "https://registry.npmmirror.com/quasar/-/quasar-2.7.5.tgz#a3feb5d50647313c4d6e1451223c158e10792902"
integrity sha512-DWI0S+bXASfMSPrB8c/LVsXpA4dF7cBUbaJlcrM+1ioTNBHtiudma2Nhk2SDd5bzk9AYVHh5A8JCZuKqQAXt7g==
quasar@^2.8.4:
version "2.8.4"
resolved "https://registry.npmmirror.com/quasar/-/quasar-2.8.4.tgz#d32d7f0c1c4f313ee45f8f3d72028f3085727172"
integrity sha512-bygg0GgSwQyrUJJTaHmYV50nVrz779QsNeH/cg2R/SHOQ4UmJI2FBA1hxU/nlpJ6DbmezNab1COa5ID57PvKfw==
query-string@^5.0.1:
version "5.1.1"