diff --git a/src/pages/agent-system/change-password/index.vue b/src/pages/agent-system/change-password/index.vue index aee9a43..aaa78ad 100644 --- a/src/pages/agent-system/change-password/index.vue +++ b/src/pages/agent-system/change-password/index.vue @@ -2,36 +2,30 @@ import { ref, computed } from 'vue' import { changePassword } from '@/api/auth' -// 表单数据 const formData = ref({ old_password: '', new_password: '', confirm_password: '', }) -// 密码可见性 const passwordVisible = ref({ old: false, new: false, confirm: false, }) -// 提交状态 const submitting = ref(false) -// 密码强度 const passwordStrength = computed(() => { const password = formData.value.new_password if (!password) return { level: 0, text: '', color: '' } let strength = 0 - // 长度检查 if (password.length >= 8) strength++ if (password.length >= 12) strength++ - // 复杂度检查 if (/[a-z]/.test(password)) strength++ if (/[A-Z]/.test(password)) @@ -48,7 +42,6 @@ const passwordStrength = computed(() => { return { level: 3, text: '强', color: '#3ed268' } }) -// 表单验证 const isFormValid = computed(() => { const { old_password, new_password, confirm_password } = formData.value return ( @@ -58,255 +51,187 @@ const isFormValid = computed(() => { ) }) -// 切换密码可见性 function togglePasswordVisible(field: 'old' | 'new' | 'confirm') { passwordVisible.value[field] = !passwordVisible.value[field] } -// 提交修改 async function submitChange() { - // 验证表单 if (!formData.value.old_password) { - uni.showToast({ - title: '请输入当前密码', - icon: 'none', - }) + uni.showToast({ title: '请输入当前密码', icon: 'none' }) return } if (formData.value.new_password.length < 8) { - uni.showToast({ - title: '新密码至少8位', - icon: 'none', - }) + uni.showToast({ title: '新密码至少8位', icon: 'none' }) return } if (formData.value.new_password !== formData.value.confirm_password) { - uni.showToast({ - title: '两次密码输入不一致', - icon: 'none', - }) + uni.showToast({ title: '两次密码输入不一致', icon: 'none' }) return } if (formData.value.old_password === formData.value.new_password) { - uni.showToast({ - title: '新密码不能与当前密码相同', - icon: 'none', - }) + uni.showToast({ title: '新密码不能与当前密码相同', icon: 'none' }) return } submitting.value = true try { - // 调用修改密码接口 await changePassword({ old_password: formData.value.old_password, new_password: formData.value.new_password, }) - uni.showToast({ - title: '密码修改成功', - icon: 'success', - duration: 2000, - }) + uni.showToast({ title: '密码修改成功', icon: 'success', duration: 2000 }) - // 清除登录状态 uni.removeStorageSync('admin-token') uni.removeStorageSync('refresh_token') uni.removeStorageSync('user_info') - // 延迟跳转到登录页 setTimeout(() => { - uni.reLaunch({ - url: '/pages/common/login/index', - }) + uni.reLaunch({ url: '/pages/common/login/index' }) }, 2000) - } - catch (error: any) { + } catch (error: any) { console.error('修改密码失败:', error) - // 如果是前端逻辑错误(非 API 错误),需要手动显示提示 if (error instanceof Error && error.message && !error.statusCode) { uni.$u.toast(error.message) } - // API 请求错误已由拦截器统一处理 - } - finally { + } finally { submitting.value = false } } - -// 清空表单 -function clearForm() { - formData.value = { - old_password: '', - new_password: '', - confirm_password: '', - } -} diff --git a/src/pages/agent-system/enterprise-cards/index.vue b/src/pages/agent-system/enterprise-cards/index.vue index a654b76..daf4331 100644 --- a/src/pages/agent-system/enterprise-cards/index.vue +++ b/src/pages/agent-system/enterprise-cards/index.vue @@ -236,6 +236,17 @@ onMounted(async () => { + + + {{ option.label }} + + @@ -253,18 +264,6 @@ onMounted(async () => { - - - {{ option.label }} - - - 快捷功能 - + - - - - 资产列表 - {{ userInfo?.user_type === 3 ? '代理资产列表' : '企业资产列表' }} - - + + + 资产列表 - - - - 授权卡列表 - 企业授权IoT卡 - - + + + 授权卡 - - - - 授权设备列表 - 企业授权设备 - - + + + 授权设备 - - - - 佣金中心 - 收益统计 - - + + + 佣金中心 - - - - 提现管理 - 申请提现 - - + + + 提现管理 - + 设置 - - 修改密码 + + + + + 修改密码 + 更新登录密码 + - - - 退出登录 + + + + + + 退出登录 + 退出当前账号 +