diff --git a/src/test.local.txt b/src/test.local.txt deleted file mode 100644 index e69de29..0000000 diff --git a/src/views/AccountManagement/ModalAccountEditCreate.vue b/src/views/AccountManagement/ModalAccountEditCreate.vue index 7113df8..cfdb5e0 100644 --- a/src/views/AccountManagement/ModalAccountEditCreate.vue +++ b/src/views/AccountManagement/ModalAccountEditCreate.vue @@ -197,25 +197,29 @@ export default defineComponent({ return modalStore.whichModal === MODAL_CREATE_NEW ? i18next.t('AcctMgmt.CreateNew') : i18next.t('AcctMgmt.AccountEdit'); }); - watch( - [inputUserAccount, inputName, inputPwd, inputConfirmPwd, isAccountUnique, - isPwdMatched, - ], - ([newAccount, newName, newPwd, newConfirmPwd, newIsAccountUnique, - newPwdMatched, - ]) => { + const validateInputLengthAndEquality = (inputAccountToTest, inputNameToTest, inputPasswordToTest, inputConfirmPwdToTest, inputPwdMatchedToTest, + ) => { + console.log('inputAccountToTest?.length', inputAccountToTest?.length); + return !inputAccountToTest?.length || !inputNameToTest?.length || !inputPasswordToTest?.length + || !inputConfirmPwdToTest?.length || !inputPwdMatchedToTest; + } + + // watch( TODO:暫時註解 + // [inputUserAccount, inputName, inputPwd, inputConfirmPwd, + // isPwdMatched, + // ], + // async ([newAccount, newName, newPwd, newConfirmPwd, + // newPwdMatched, + // ]) => { - if (!newAccount?.length || !newName?.length || !newPwd?.length - || !newConfirmPwd?.length || !newIsAccountUnique - || !newPwdMatched - ) { - isConfirmDisabled.value = true; - } else { - isConfirmDisabled.value = false; - } - }, - { immediate: true } - ); + // if (validateInputLengthAndEquality(newAccount, newName, newPwd, newConfirmPwd, newPwdMatched)) { + // isConfirmDisabled.value = true; + // } else { + // isConfirmDisabled.value = false; + // } + // }, + // { immediate: true } + // ); const togglePwdEyeBtn = () => { @@ -293,14 +297,18 @@ export default defineComponent({ isSetActivedChecked.value = !isSetActivedChecked.value; } } - const onInputAccountFocus = () => { - if(!isAccountUnique.value) { - // 之所以要轉回true,是為了讓使用者可以繼續填寫不被阻擋 - isAccountUnique.value = true; - } - if(isConfirmDisabled.value){ - isConfirmDisabled.value = false; - } + const onInputAccountFocus = async() => { + // if(!isAccountUnique.value) { + // // 之所以要轉回true,是為了讓使用者可以繼續填寫不被阻擋 + // isAccountUnique.value = true; + // } + // if(isConfirmDisabled.value){ + // // 所有欄位都要填寫,confirm按鈕才可點選 + // if(validateInputLengthAndEquality(inputUserAccount.value, inputName.value, inputPwd.value, inputConfirmPwd.value, isPwdMatched.value) + // ){ + // isConfirmDisabled.value = false; + // } + // } } const onInputNameFocus = () => { @@ -310,9 +318,17 @@ export default defineComponent({ } onMounted(() => { - console.log('TODO:', username.value, name.value, isAdmin.value); - console.log('username', username, name, ); - console.log('userData TODO:', loginStore.userData); + watch( + [inputUserAccount, inputName, inputPwd, inputConfirmPwd, isPwdMatched], + ([newAccount, newName, newPwd, newConfirmPwd, newPwdMatched]) => { + if (validateInputLengthAndEquality(newAccount, newName, newPwd, newConfirmPwd, newPwdMatched)) { + isConfirmDisabled.value = true; + } else { + isConfirmDisabled.value = false; + } + }, + { immediate: true } + ); }); return {