fix: 客户公开注册默认状态改为 Normal,避免注册后无法登录
All checks were successful
Build and Deploy Front / deploy (push) Successful in 7m18s
All checks were successful
Build and Deploy Front / deploy (push) Successful in 7m18s
原先 create 默认 status=1 实为 Disabled;并透出登录业务错误文案。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
351b465d5b
commit
c2861157af
@ -3,8 +3,10 @@
|
|||||||
*/
|
*/
|
||||||
import { axiosInstance } from '@/api/rbac'
|
import { axiosInstance } from '@/api/rbac'
|
||||||
import { assertBusinessOk, omsUrl, parseListPayload, unwrapData } from '@/api/oms/common'
|
import { assertBusinessOk, omsUrl, parseListPayload, unwrapData } from '@/api/oms/common'
|
||||||
|
import { CUSTOMER_STATUS } from '@/utils/customerStatus'
|
||||||
|
|
||||||
export type CustomerStatus = 0 | 1 | 2
|
/** 与后端 CustomerStatus 对齐:0=None,1=Disabled,2=Normal,3=Frozen */
|
||||||
|
export type CustomerStatus = 0 | 1 | 2 | 3
|
||||||
|
|
||||||
export type CustomerGroup = 0 | 1 | 2 | 3 | 4 | 5
|
export type CustomerGroup = 0 | 1 | 2 | 3 | 4 | 5
|
||||||
|
|
||||||
@ -154,7 +156,7 @@ export const CustomerService = {
|
|||||||
balance: data.accountBalance ?? data.balance ?? 0,
|
balance: data.accountBalance ?? data.balance ?? 0,
|
||||||
totalQuota: data.totalQuota ?? 0,
|
totalQuota: data.totalQuota ?? 0,
|
||||||
usedQuota: data.usedQuota ?? 0,
|
usedQuota: data.usedQuota ?? 0,
|
||||||
status: data.status ?? 1,
|
status: data.status ?? CUSTOMER_STATUS.normal,
|
||||||
remark: data.remark,
|
remark: data.remark,
|
||||||
salesman: data.salesman ?? data.salesPerson,
|
salesman: data.salesman ?? data.salesPerson,
|
||||||
customerService: data.customerService,
|
customerService: data.customerService,
|
||||||
@ -186,7 +188,8 @@ export const CustomerService = {
|
|||||||
balance: data.accountBalance ?? data.balance,
|
balance: data.accountBalance ?? data.balance,
|
||||||
totalQuota: data.totalQuota,
|
totalQuota: data.totalQuota,
|
||||||
usedQuota: data.usedQuota,
|
usedQuota: data.usedQuota,
|
||||||
status: data.status ?? 1,
|
// 后端:1=Disabled,2=Normal;勿默认 1,否则公开注册账号无法登录
|
||||||
|
status: data.status ?? CUSTOMER_STATUS.normal,
|
||||||
role: data.role,
|
role: data.role,
|
||||||
remark: data.remark,
|
remark: data.remark,
|
||||||
salesman: data.salesman ?? data.salesPerson,
|
salesman: data.salesman ?? data.salesPerson,
|
||||||
|
|||||||
@ -318,7 +318,11 @@ export const useRbacUserStore = defineStore('rbacUser', () => {
|
|||||||
enableKeepAlive()
|
enableKeepAlive()
|
||||||
await hydrateUserAfterLogin(result)
|
await hydrateUserAfterLogin(result)
|
||||||
return true
|
return true
|
||||||
} catch {
|
} catch (error: unknown) {
|
||||||
|
// 交给登录页展示业务文案(如「客户已禁用」),勿一律当成账号密码错误
|
||||||
|
const anyErr = error as { body?: { message?: string }; message?: string }
|
||||||
|
const msg = String(anyErr?.body?.message || anyErr?.message || '').trim()
|
||||||
|
if (msg) throw new Error(msg)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -350,11 +350,19 @@ async function handleSubmit() {
|
|||||||
loading.value = true;
|
loading.value = true;
|
||||||
errorBox.value = '';
|
errorBox.value = '';
|
||||||
|
|
||||||
const success = await rbacUserStore.login(
|
let success = false;
|
||||||
|
try {
|
||||||
|
success = await rbacUserStore.login(
|
||||||
loginForm.account,
|
loginForm.account,
|
||||||
loginForm.password,
|
loginForm.password,
|
||||||
props.loginType,
|
props.loginType,
|
||||||
);
|
);
|
||||||
|
} catch (loginErr: unknown) {
|
||||||
|
const msg = loginErr instanceof Error ? loginErr.message.trim() : '';
|
||||||
|
errorBox.value = msg || t('login.form.login.failed');
|
||||||
|
loginCharacters.value?.onLoginFailed();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (success && rbacUserStore.userInfo) {
|
if (success && rbacUserStore.userInfo) {
|
||||||
const userInfoData = rbacUserStore.userInfo;
|
const userInfoData = rbacUserStore.userInfo;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user