diff --git a/admin-frontend-vue/src/pages/shop/ShopManagePage.vue b/admin-frontend-vue/src/pages/shop/ShopManagePage.vue index e9756c5f..47f36a87 100644 --- a/admin-frontend-vue/src/pages/shop/ShopManagePage.vue +++ b/admin-frontend-vue/src/pages/shop/ShopManagePage.vue @@ -33,8 +33,35 @@ const form = reactive(emptyShopManageForm()) const credentialVisible = ref(false) const credential = ref(null) +/** 密码列“眼睛”实时读取:仅展示已读明文,其余保持掩码;读取中占位。 */ +const revealedPasswordCache = ref>({}) +const revealedRowId = ref(null) + const groupOptions = computed(() => groups.value) +function shownPassword(row: ShopSummary): string { + if (revealedRowId.value !== row.id) return row.passwordMasked || '******' + const plain = revealedPasswordCache.value[row.id] + return plain != null && plain !== '' ? plain : '读取中...' +} + +async function togglePassword(row: ShopSummary) { + if (revealedRowId.value === row.id) { + revealedRowId.value = null + return + } + revealedRowId.value = row.id + if (revealedPasswordCache.value[row.id] == null) { + try { + const cred = await fetchShopCredential(row.id, row.shopName) + revealedPasswordCache.value[row.id] = cred.password + } catch (error) { + revealedRowId.value = null + ElMessage.error(error instanceof Error ? error.message : '读取密码失败') + } + } +} + async function loadGroups() { try { groups.value = await fetchShopManageGroups() @@ -94,6 +121,16 @@ function openEdit(row: ShopSummary) { } async function submit() { + if ( + form.groupId == null || + !(form.shopName || '').trim() || + !(form.mallName || '').trim() || + !(form.account || '').trim() || + !(form.password || '').trim() + ) { + ElMessage.warning('请完整填写分组、店铺名、店铺商城名、账号、密码') + return + } saving.value = true try { const createdById = session.user?.id ?? 0 @@ -124,7 +161,7 @@ async function showCredential(row: ShopSummary) { async function remove(row: ShopSummary) { try { - await ElMessageBox.confirm(`确认删除店铺「${row.shopName}」?`, '删除店铺', { type: 'warning' }) + await ElMessageBox.confirm(`确定删除店铺“${row.shopName}”吗?`, '删除确认', { type: 'warning' }) } catch { return } @@ -188,8 +225,19 @@ onMounted(() => { - - + + @@ -197,6 +245,9 @@ onMounted(() => { + + +