-
+
@@ -117,7 +117,7 @@ const session = useSessionStore()
const toast = useToastStore()
const appIconUrl = `${import.meta.env.BASE_URL}assets/images/app-icon.png`
const preference = readJson(LOGIN_PREFERENCE_KEY, {})
-const loginMode = ref(preference.loginMode || 'password')
+const loginMode = ref(preference.loginMode || 'phone')
const form = reactive({
account: preference.account || '',
password: '',
@@ -213,6 +213,12 @@ const sendLoginCode = async (): Promise => {
}
codeLoading.value = true
try {
+ const selection = await authApi.getManagerPhoneLoginShops(form.phone)
+ const shops = Array.isArray(selection.shops) ? selection.shops : []
+ if (!selection.allowShoplessLogin && shops.length === 0) {
+ toast.error(selection.message || '仅店长或美甲师可登录店务端')
+ return
+ }
await authApi.sendLoginCode(form.phone)
toast.success('验证码已发送')
startCountdown()
@@ -259,8 +265,11 @@ const showLoginError = (error: unknown): void => {
const openShopSelector = async (): Promise => {
const selection = loginMode.value === 'password'
? await authApi.getPasswordLoginShops(form.account)
- : await authApi.getPhoneLoginShops(form.phone)
+ : await authApi.getManagerPhoneLoginShops(form.phone)
const shops = Array.isArray(selection.shops) ? selection.shops : []
+ if (!selection.allowShoplessLogin && shops.length === 0) {
+ throw new Error(selection.message || '仅店长或美甲师可登录店务端')
+ }
if (shops.length <= 1) {
return false
}