修复登录页面点击无效的BUG

修复CTRL开窗时会触发focus消息的BUG
This commit is contained in:
fangxiang 2022-02-10 09:51:59 +08:00
parent 1a1b09ca94
commit c45277cb8d
3 changed files with 63 additions and 42 deletions

View File

@ -462,6 +462,7 @@ export default defineComponent({
}; };
const flags = new _Flags(); const flags = new _Flags();
let ctrl_press_flag = false;
return { return {
signal_source, signal_source,
@ -475,6 +476,10 @@ export default defineComponent({
calc_is_audio_player_window, calc_is_audio_player_window,
onClick(evt: PointerEvent) { onClick(evt: PointerEvent) {
if (ctrl_press_flag) {
ctrl_press_flag = false;
return;
}
if (!props.mouse_area_flag) { if (!props.mouse_area_flag) {
evt.stopPropagation(); evt.stopPropagation();
if (selected.value != true) { if (selected.value != true) {
@ -487,8 +492,10 @@ export default defineComponent({
} }
}, },
onMouseDown(evt: MouseEvent) { onMouseDown(evt: MouseEvent) {
ctrl_press_flag = evt.ctrlKey;
if (!evt.ctrlKey) { if (!evt.ctrlKey) {
evt.stopPropagation(); evt.stopPropagation();
if (props.disable) { if (props.disable) {
return; return;
} }
@ -563,7 +570,7 @@ export default defineComponent({
cleanMouseDownFlag, cleanMouseDownFlag,
onMouseLeave(evt: MouseEvent) { onMouseLeave(evt: MouseEvent) {
// console.log("leave", ctrl_flag); ctrl_press_flag = false;
if (!props.mouse_area_flag) { if (!props.mouse_area_flag) {
if (selected.value && mouse_down_flag) { if (selected.value && mouse_down_flag) {
if (move_flag) { if (move_flag) {
@ -576,6 +583,7 @@ export default defineComponent({
onMouseUp(evt: MouseEvent) { onMouseUp(evt: MouseEvent) {
// console.log("up", ctrl_flag); // console.log("up", ctrl_flag);
if (selected.value && mouse_down_flag) { if (selected.value && mouse_down_flag) {
if (move_flag) { if (move_flag) {
emit("commit_geometry", props.window); emit("commit_geometry", props.window);

View File

@ -17,7 +17,6 @@
<q-input <q-input
:loading="data.loading" :loading="data.loading"
:disable="data.loading" :disable="data.loading"
filled
v-model="data.ip_address" v-model="data.ip_address"
:label="$t('server ip address')" :label="$t('server ip address')"
:hint="$t('please input server ip address')" :hint="$t('please input server ip address')"
@ -32,10 +31,11 @@
) || ) ||
$t('Please input vaild ip address'), $t('Please input vaild ip address'),
]" ]"
@mousedown="(evt) => focusElement(evt)"
@keydown=" @keydown="
(evt) => { (evt) => {
if (evt.keyCode == 13) { if (evt.keyCode == 13) {
$refs?.password_input?.focus(); $refs?.user_name?.focus();
} }
} }
" "
@ -54,7 +54,6 @@
ref="user_name" ref="user_name"
:loading="data.loading" :loading="data.loading"
:disable="data.loading" :disable="data.loading"
filled
v-model="data.user_name" v-model="data.user_name"
:label="$t('user name')" :label="$t('user name')"
:hint="$t('please input user name')" :hint="$t('please input user name')"
@ -63,6 +62,7 @@
(val) => (val) =>
(val && val.length > 0) || $t('Please type something'), (val && val.length > 0) || $t('Please type something'),
]" ]"
@mousedown="(evt) => focusElement(evt)"
@keydown=" @keydown="
(evt) => { (evt) => {
if (evt.keyCode == 13) { if (evt.keyCode == 13) {
@ -84,7 +84,6 @@
ref="password_input" ref="password_input"
:loading="data.loading" :loading="data.loading"
:disable="data.loading" :disable="data.loading"
filled
:type="data.show_password ? '' : 'password'" :type="data.show_password ? '' : 'password'"
v-model="data.password" v-model="data.password"
:label="$t('password')" :label="$t('password')"
@ -94,6 +93,7 @@
(val) => (val) =>
(val && val.length > 0) || $t('Please type something'), (val && val.length > 0) || $t('Please type something'),
]" ]"
@mousedown="(evt) => focusElement(evt)"
@keydown=" @keydown="
(evt) => { (evt) => {
if (evt.keyCode == 13) { if (evt.keyCode == 13) {
@ -272,6 +272,11 @@ export default defineComponent({
data.user_name = null; data.user_name = null;
data.password = null; data.password = null;
}, },
focusElement(evt: any) {
try {
evt.toElement.focus();
} catch {}
},
}; };
}, },
}); });

View File

@ -261,6 +261,13 @@ export default defineComponent({
const wallMouseUp = (evt: MouseEvent) => { const wallMouseUp = (evt: MouseEvent) => {
if (area_open_window_flag.value && wall.value) { if (area_open_window_flag.value && wall.value) {
evt.stopPropagation(); evt.stopPropagation();
// 0
if (
area_open_window_rect.value.start_x !=
area_open_window_rect.value.end_x &&
area_open_window_rect.value.start_y !=
area_open_window_rect.value.end_y
) {
// //
let left = let left =
wall.value.offsetLeft + (wall.value.parentElement?.offsetLeft ?? 0); wall.value.offsetLeft + (wall.value.parentElement?.offsetLeft ?? 0);
@ -301,6 +308,7 @@ export default defineComponent({
) )
); );
} }
}
area_open_window_flag.value = false; area_open_window_flag.value = false;
area_open_window_rect.value.reset(); area_open_window_rect.value.reset();
}; };