WIP #325
This commit is contained in:
@@ -60,6 +60,7 @@ export default defineStore('acctMgmtStore', {
|
|||||||
*/
|
*/
|
||||||
setCurrentViewingUser(username: string) {
|
setCurrentViewingUser(username: string) {
|
||||||
const userFind: User | undefined = this.allUserAccoutList.find(user => user.username === username);
|
const userFind: User | undefined = this.allUserAccoutList.find(user => user.username === username);
|
||||||
|
console.log('userFind', userFind);
|
||||||
this.currentViewingUser = userFind || { username: '', detail: {} };
|
this.currentViewingUser = userFind || { username: '', detail: {} };
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -173,16 +173,16 @@ export default {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const moveCurrentLoginUserToFirstRow = () => {
|
const moveCurrentLoginUserToFirstRow = () => {
|
||||||
const currentLoginUsername = loginUserData.value.username;
|
|
||||||
if(infiniteAcctData.value && infiniteAcctData.value.length){
|
if(infiniteAcctData.value && infiniteAcctData.value.length){
|
||||||
const index = allAccountResponsive.value.findIndex(user => user.username === currentLoginUsername);
|
const loginUser = acctMgmtStore.allUserAccoutList.find(user => user.username === loginUserData.value.username);
|
||||||
|
const index = infiniteAcctData.value.findIndex(user => user.username=== loginUserData.value.username);
|
||||||
|
if(loginUser){
|
||||||
|
infiniteAcctData.value.unshift(infiniteAcctData.value.splice(index, 1)[0]);
|
||||||
|
console.log('第一個infiniteAcctData.value[0]', infiniteAcctData.value[0], 'loginUserData.value.username', loginUserData.value.username);
|
||||||
|
console.log('infiniteAcctData.value[index]',infiniteAcctData.value[index] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (index !== -1) {
|
|
||||||
// 移除匹配的對象(現正登入的使用者)並將其插入到 infiniteAcctData 陣列的第一位
|
|
||||||
const [loginUser] = allAccountResponsive.value[index];
|
|
||||||
infiniteAcctData.value.unshift(loginUser);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const moveJustCreateUserToFirstRow = () => {
|
const moveJustCreateUserToFirstRow = () => {
|
||||||
@@ -190,7 +190,7 @@ export default {
|
|||||||
const index = acctMgmtStore.allUserAccoutList.findIndex(user => user.username === acctMgmtStore.justCreateUsername);
|
const index = acctMgmtStore.allUserAccoutList.findIndex(user => user.username === acctMgmtStore.justCreateUsername);
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
// 移除匹配的對象(剛剛新增的使用者)並將其插入到陣列的第一位
|
// 移除匹配的對象(剛剛新增的使用者)並將其插入到陣列的第一位
|
||||||
const [justCreateUser] = acctMgmtStore.allUserAccoutList.splice(index, 1);
|
const [justCreateUser] = acctMgmtStore.allUserAccoutList[index];
|
||||||
infiniteAcctData.value.unshift(justCreateUser);
|
infiniteAcctData.value.unshift(justCreateUser);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -248,6 +248,7 @@ export default {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onEditButtonClick = userNameToEdit => {
|
const onEditButtonClick = userNameToEdit => {
|
||||||
|
console.log('onEditButtonClick userNameToEdit', userNameToEdit);
|
||||||
acctMgmtStore.setCurrentViewingUser(userNameToEdit);
|
acctMgmtStore.setCurrentViewingUser(userNameToEdit);
|
||||||
modalStore.openModal(MODAL_ACCT_EDIT);
|
modalStore.openModal(MODAL_ACCT_EDIT);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
const isEditable = ref(true);
|
const isEditable = ref(true);
|
||||||
|
|
||||||
// 自從加入這段 watch 之後,填寫密碼欄位之時,就不會胡亂清空掉 account 或是 full name 蘭為了。
|
// 自從加入這段 watch 之後,填寫密碼欄位之時,就不會胡亂清空掉 account 或是 full name 欄位了。
|
||||||
watch(whichCurrentModal, (newVal) => {
|
watch(whichCurrentModal, (newVal) => {
|
||||||
if (newVal === MODAL_CREATE_NEW) {
|
if (newVal === MODAL_CREATE_NEW) {
|
||||||
inputUserAccount.value = '';
|
inputUserAccount.value = '';
|
||||||
|
|||||||
Reference in New Issue
Block a user