(`/user/list/type/${type}`)
},
diff --git a/Frontend/src/components.d.ts b/Frontend/src/components.d.ts
index 1102f2cd..85c1395f 100644
--- a/Frontend/src/components.d.ts
+++ b/Frontend/src/components.d.ts
@@ -49,6 +49,7 @@ declare module 'vue' {
AModal: typeof import('ant-design-vue/es')['Modal']
APageHeader: typeof import('ant-design-vue/es')['PageHeader']
APopconfirm: typeof import('ant-design-vue/es')['Popconfirm']
+ ARadio: typeof import('ant-design-vue/es')['Radio']
ARadioButton: typeof import('ant-design-vue/es')['RadioButton']
ARadioGroup: typeof import('ant-design-vue/es')['RadioGroup']
ARow: typeof import('ant-design-vue/es')['Row']
diff --git a/Frontend/src/router/index.ts b/Frontend/src/router/index.ts
index 7da3cfa6..86a5ba8e 100644
--- a/Frontend/src/router/index.ts
+++ b/Frontend/src/router/index.ts
@@ -61,7 +61,7 @@ const router = createRouter({
path: '/artist-orders',
name: 'artist-orders',
component: () => import('../views/ArtistOrderView.vue'),
- meta: { requiresAuth: true, hideNav: true, isAdmin: false, permissionCode: 'order:artist:view' }
+ meta: { requiresAuth: true, hideNav: true, isAdmin: false, permissionCode: 'order:view' }
},
{
path: '/settings',
@@ -283,4 +283,4 @@ router.beforeEach((to, _from, next) => {
}
})
-export default router
\ No newline at end of file
+export default router
diff --git a/Frontend/src/views/AccountSettingsView.vue b/Frontend/src/views/AccountSettingsView.vue
index 6bf173ce..f85ef966 100644
--- a/Frontend/src/views/AccountSettingsView.vue
+++ b/Frontend/src/views/AccountSettingsView.vue
@@ -490,7 +490,10 @@ const handleChangePasswordSubmit = async () => {
changePasswordLoading.value = true
try {
- await userApi.updatePassword({ password: changePasswordForm.password })
+ await userApi.updatePassword({
+ password: changePasswordForm.password,
+ verificationCode: changePasswordForm.verificationCode
+ })
message.success('密码修改成功')
changePasswordModalVisible.value = false
// 清除需要设置密码的标识
@@ -522,17 +525,6 @@ const handleDeactivateAccount = async () => {
cancelText: '取消',
onOk: async () => {
try {
- // 在删除前先重命名账号和手机号,添加删除时间戳
- const timestamp = new Date().getTime()
- const newPhone = `${userInfo.value.phone}_deleted_${timestamp}`
-
- try {
- await userApi.updateUserInfo({ phone: newPhone })
- } catch (renameError) {
- console.error('重命名手机号失败:', renameError)
- // 重命名失败也继续删除流程
- }
-
await userApi.deactivateAccount()
message.success('账号注销成功')
} catch (error) {
@@ -658,4 +650,4 @@ onMounted(() => {
color: #999;
margin-top: 8px;
}
-
\ No newline at end of file
+
diff --git a/Frontend/src/views/AuthView.vue b/Frontend/src/views/AuthView.vue
index 6ddb7f26..352c7b7f 100644
--- a/Frontend/src/views/AuthView.vue
+++ b/Frontend/src/views/AuthView.vue
@@ -54,11 +54,19 @@
v-model:value="formData.account"
placeholder="请输入账号"
size="large"
+ @blur="handleRegisterAccountBlur"
>
+
+ {{ registerAccountStatus.message }}
+
@@ -66,11 +74,19 @@
v-model:value="formData.phone"
placeholder="请输入手机号"
size="large"
+ @blur="handleRegisterPhoneBlur"
>
+
+ {{ registerPhoneStatus.message }}
+
@@ -99,20 +115,11 @@
v-model:value="formData.account"
placeholder="请输入账号"
size="large"
- @blur="handleAccountBlur"
>
-
-
- 账号存在,昵称:{{ accountStatus.nickname }} {{ accountStatus.hasShop ? ',已绑定店铺' : ',请选择店铺' }}
-
-
- 账号不存在
-
-
@@ -120,7 +127,6 @@
v-model:value="formData.phone"
placeholder="请输入手机号"
size="large"
- @blur="handlePhoneBlur"
>
@@ -130,14 +136,6 @@
新用户将自动注册
-
-
- {{ phoneUserStatus.hasShop ? '账号已存在,已绑定店铺' : '账号已存在,请选择店铺' }}
-
-
- 新用户,请选择店铺
-
-
@@ -161,27 +159,27 @@
-
-
暂无店铺数据
-
{{ shop.shopName }}
@@ -201,34 +199,6 @@
-
-
-
- 暂无店铺数据
-
-
- {{ shop.shopName }}
-
-
-
-
('password')
const loading = ref(false)
const loadingShops = ref(false)
const shops = ref([])
-const accountStatus = ref(null)
-const phoneUserStatus = ref(null)
const countdown = ref(0)
+const registerAccountStatus = ref(null)
+const registerPhoneStatus = ref(null)
const forgotPasswordVisible = ref(false)
const forgotCountdown = ref(0)
@@ -503,7 +473,7 @@ const fetchShops = async () => {
shops.value = (response as unknown as any[]) || []
} catch (error) {
console.error('获取店铺列表失败:', error)
- message.error('未登录,请先登录')
+ message.warning('店铺列表加载失败,普通登录不受影响')
} finally {
loadingShops.value = false
}
@@ -516,22 +486,12 @@ const handleSubmit = async () => {
let response
if (loginType.value === 'phone') {
- if (phoneUserStatus.value && !phoneUserStatus.value.hasShop && !formData.shopId) {
- message.error('请选择店铺')
- loading.value = false
- return
- }
response = await authApi.phoneLogin({
phone: formData.phone,
verificationCode: formData.verificationCode,
shopId: formData.shopId
})
} else {
- if (accountStatus.value && accountStatus.value.exists && !accountStatus.value.hasShop && !formData.shopId) {
- message.error('请选择店铺')
- loading.value = false
- return
- }
response = await authApi.login({
account: formData.account,
password: formData.password,
@@ -563,6 +523,13 @@ const handleSubmit = async () => {
message.error('登录失败:响应数据异常')
}
} else {
+ const accountAvailable = await checkRegisterAccountAvailability(false)
+ const phoneAvailable = await checkRegisterPhoneAvailability(false)
+ if (!accountAvailable || !phoneAvailable) {
+ message.error('请先处理注册信息中的占用问题')
+ return
+ }
+
await authApi.register({
account: formData.account,
password: formData.password,
@@ -643,54 +610,65 @@ const handleQQLogin = () => {
message.info('QQ登录功能开发中')
}
-const handleAccountBlur = async () => {
- if (activeTab.value === 'login' && formData.account) {
- try {
- const res = await userApi.getUserByAccount(formData.account)
- const userData = res as any
- if (userData) {
- accountStatus.value = {
- exists: true,
- nickname: userData.nickname,
- hasShop: userData.shopId && userData.shopId > 0
- }
- } else {
- accountStatus.value = {
- exists: false,
- hasShop: false
- }
- }
- } catch (error) {
- accountStatus.value = {
- exists: false,
- hasShop: false
- }
- }
+const checkRegisterAccountAvailability = async (showSuccessMessage = true) => {
+ if (activeTab.value !== 'register' || !formData.account.trim()) {
+ registerAccountStatus.value = null
+ return false
+ }
+
+ const response = await userApi.checkAccountAvailability(formData.account.trim()) as unknown as AvailabilityCheckResponse
+ registerAccountStatus.value = response
+ if (showSuccessMessage && !response.available) {
+ message.warning(response.message)
+ }
+ return response.available
+}
+
+const checkRegisterPhoneAvailability = async (showSuccessMessage = true) => {
+ if (activeTab.value !== 'register' || !formData.phone.trim()) {
+ registerPhoneStatus.value = null
+ return false
+ }
+
+ const response = await userApi.checkPhoneAvailability(formData.phone.trim()) as unknown as AvailabilityCheckResponse
+ registerPhoneStatus.value = response
+ if (showSuccessMessage && !response.available) {
+ message.warning(response.message)
+ }
+ return response.available
+}
+
+const handleRegisterAccountBlur = async () => {
+ if (activeTab.value !== 'register' || !formData.account.trim()) {
+ registerAccountStatus.value = null
+ return
+ }
+
+ try {
+ await checkRegisterAccountAvailability(false)
+ } catch (error: any) {
+ registerAccountStatus.value = null
+ message.error(error.message || '账号校验失败')
}
}
-const handlePhoneBlur = async () => {
- if (activeTab.value === 'login' && loginType.value === 'phone' && formData.phone) {
- try {
- const res = await userApi.getUserByAccount(formData.phone)
- const userData = res as any
- if (userData) {
- phoneUserStatus.value = {
- exists: true,
- hasShop: userData.shopId && userData.shopId > 0
- }
- } else {
- phoneUserStatus.value = {
- exists: false,
- hasShop: false
- }
- }
- } catch (error) {
- phoneUserStatus.value = {
- exists: false,
- hasShop: false
- }
- }
+const handleRegisterPhoneBlur = async () => {
+ if (activeTab.value !== 'register' || !formData.phone.trim()) {
+ registerPhoneStatus.value = null
+ return
+ }
+
+ const phoneRegex = /^1[3-9]\d{9}$/
+ if (!phoneRegex.test(formData.phone)) {
+ registerPhoneStatus.value = null
+ return
+ }
+
+ try {
+ await checkRegisterPhoneAvailability(false)
+ } catch (error: any) {
+ registerPhoneStatus.value = null
+ message.error(error.message || '手机号校验失败')
}
}
@@ -705,8 +683,16 @@ const handleSendVerificationCode = async () => {
message.error('手机号格式不正确')
return
}
-
+
try {
+ if (activeTab.value === 'register') {
+ const phoneAvailable = await checkRegisterPhoneAvailability(false)
+ if (!phoneAvailable) {
+ message.warning(registerPhoneStatus.value?.message || '该手机号已被注册')
+ return
+ }
+ }
+
await userApi.sendVerificationCode({ phone: formData.phone })
message.success('验证码已发送')
countdown.value = 60
@@ -824,6 +810,19 @@ onMounted(() => {
align-items: center;
}
+.field-status {
+ margin-top: 8px;
+ font-size: 12px;
+}
+
+.field-status.success {
+ color: #52c41a;
+}
+
+.field-status.error {
+ color: #ff4d4f;
+}
+
.forgot-password {
color: #667eea;
cursor: pointer;
@@ -891,19 +890,6 @@ onMounted(() => {
text-decoration: underline;
}
-.account-status {
- margin-top: 8px;
- font-size: 12px;
-}
-
-.status-success {
- color: #52c41a;
-}
-
-.status-error {
- color: #f5222d;
-}
-
.phone-login-tip {
margin-top: 8px;
font-size: 12px;
@@ -911,4 +897,4 @@ onMounted(() => {
display: flex;
align-items: center;
}
-
\ No newline at end of file
+
diff --git a/Frontend/src/views/PasswordSettingsView.vue b/Frontend/src/views/PasswordSettingsView.vue
index d898c302..e7ddbfb3 100644
--- a/Frontend/src/views/PasswordSettingsView.vue
+++ b/Frontend/src/views/PasswordSettingsView.vue
@@ -1,6 +1,5 @@