diff --git a/App.vue b/App.vue
index 591909b..168b57a 100644
--- a/App.vue
+++ b/App.vue
@@ -14,11 +14,15 @@
diff --git a/pages/login/login.vue b/pages/login/login.vue
index cf20980..04cf85e 100644
--- a/pages/login/login.vue
+++ b/pages/login/login.vue
@@ -99,6 +99,10 @@
+
+ 登录遇到问题?去反馈
+
+
@@ -142,6 +146,7 @@ import { useUserStore } from '@/stores/user'
import { loginWithCode, loginWithPassword } from '@/api/modules/auth'
import { commonApi } from '@/api/modules/common'
import { validateEmail } from '@/utils/validator'
+import { onPageJump } from '@/utils'
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
@@ -178,6 +183,9 @@ const yszcText = ref({
let codeTimer: any = null
+// 提交点击次数
+const submitClickNum = ref(0)
+
/**
* 切换登录方式
* @param type 1000-密码登录,2000-验证码登录
@@ -278,9 +286,13 @@ const verifyCodeLogin = async () => {
if (!isCodeEmpty()) return false
- const res = await loginWithCode(email.value, code.value)
-
- return res
+ try {
+ const res = await loginWithCode(email.value, code.value)
+ return res
+ } catch (error) {
+ console.error('验证码登录失败:', error)
+ return null
+ }
}
// 密码登录
const passwordLogin = async () => {
@@ -288,11 +300,15 @@ const passwordLogin = async () => {
if (!isEmailVerified(phoneEmail.value)) return false
- if (!isPasswordEmpty) return false
+ if (!isPasswordEmpty()) return false
- const res = await loginWithPassword(phoneEmail.value, password.value)
-
- return res
+ try {
+ const res = await loginWithPassword(phoneEmail.value, password.value)
+ return res
+ } catch (error) {
+ console.error('密码登录失败:', error)
+ return null
+ }
}
// 提交登录
const onSubmit = async () => {
@@ -309,11 +325,8 @@ const onSubmit = async () => {
break
}
- console.log('res', res)
-
if (res && res.userInfo && res.token) {
res.userInfo.token = res.token.token
- console.log('设置用户信息login', res.userInfo)
userStore.setUserInfo(res.userInfo)
uni.showToast({
title: t('login.loginSuccess'),
@@ -324,6 +337,9 @@ const onSubmit = async () => {
url: '/pages/index/index'
})
}, 600)
+ } else {
+ // 登录失败时增加提交点击次数
+ submitClickNum.value++
}
}
@@ -352,6 +368,7 @@ const onSetCode = async () => {
getCodeState()
} catch (error) {
uni.hideLoading()
+ submitClickNum.value++ // 发送验证码失败时增加提交点击次数
console.error('Send code error:', error)
}
}
@@ -664,4 +681,16 @@ onMounted(() => {
line-height: 45rpx;
}
}
+.loginHelp{
+ border: 1px solid #f5dab1;
+ margin-top: 16rpx;
+ font-size: 26rpx;
+ text-align: center;
+ padding: 10rpx;
+ background-color: #fdf6ec;
+ border-radius: 15rpx;
+ .link{
+ color: #e6a23c;
+ }
+}
diff --git a/static/tailwind.css b/static/tailwind.css
index e5814d9..0ae3471 100644
--- a/static/tailwind.css
+++ b/static/tailwind.css
@@ -8,6 +8,7 @@
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
"Courier New", monospace;
--color-red-500: oklch(63.7% 0.237 25.331);
+ --color-emerald-600: oklch(59.6% 0.145 163.225);
--ease-out: cubic-bezier(0, 0, 0.2, 1);
--ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
--default-transition-duration: 150ms;
diff --git a/utils/index.ts b/utils/index.ts
new file mode 100644
index 0000000..b2be9bb
--- /dev/null
+++ b/utils/index.ts
@@ -0,0 +1,5 @@
+export const onPageJump = (path: string) => {
+ uni.navigateTo({
+ url: path
+ })
+}
\ No newline at end of file