diff --git a/src/api/auth.ts b/src/api/auth.ts index 22c95a9..1024d55 100644 --- a/src/api/auth.ts +++ b/src/api/auth.ts @@ -6,6 +6,8 @@ const WECHAT_MINIAPP_AUTH_BASE_URL = "/api/v1/wechat/miniapp/auth"; export interface LoginData { username: string; password: string; + captchaId?: string; + captchaCode?: string; } export interface LoginResult { @@ -18,6 +20,11 @@ export interface LoginResult { openid?: string; } +export interface CaptchaVO { + captchaId: string; + captchaBase64: string; +} + export interface SmsLoginData { mobile: string; code: string; @@ -45,6 +52,16 @@ export interface WechatMiniappBindMobileData { } const AuthAPI = { + /** + * 获取图形验证码 + */ + getCaptcha(): Promise { + return publicRequest({ + url: `${AUTH_BASE_URL}/captcha`, + method: "GET", + }); + }, + /** * 账号密码登录 */ @@ -58,7 +75,7 @@ const AuthAPI = { /** * 发送短信验证码 - * + * * 演示环境说明:短信服务未配置,验证码固定为 123456 */ sendSmsLoginCode(mobile: string): Promise { @@ -83,7 +100,7 @@ const AuthAPI = { /** * 微信小程序静默登录 - * + * * 适用场景:个人小程序 * - 已绑定手机号的用户:直接返回 token,登录成功 * - 未绑定手机号的用户:返回 openid,需调用绑定手机号接口 @@ -97,7 +114,7 @@ const AuthAPI = { /** * 微信小程序手机号快捷登录 - * + * * 适用场景:企业认证小程序(已开通手机号快捷登录权限) * 一步完成登录,无需绑定流程,自动创建新用户 */ @@ -112,7 +129,7 @@ const AuthAPI = { /** * 微信小程序绑定手机号 - * + * * 演示环境说明:短信服务未配置,验证码固定为 123456 */ wechatMiniappBindMobile(data: WechatMiniappBindMobileData): Promise { diff --git a/src/pages.json b/src/pages.json index 782d2a4..ccfbe8a 100644 --- a/src/pages.json +++ b/src/pages.json @@ -14,7 +14,7 @@ "type": "page", "name": "login", "style": { - "navigationStyle": "custom" + "navigationBarTitleText": "登录" } }, { diff --git a/src/pages/login/index.vue b/src/pages/login/index.vue index 36d58d9..5caddd0 100644 --- a/src/pages/login/index.vue +++ b/src/pages/login/index.vue @@ -11,7 +11,7 @@ @@ -43,7 +43,7 @@ class="input-field" :password="!showPassword" placeholder="请输入密码" - maxlength="50" + :maxlength="50" @confirm="handleLogin" /> @@ -51,6 +51,25 @@ + + + + + + + @@ -59,7 +78,7 @@ class="input-field" placeholder="请输入验证码" type="number" - maxlength="6" + :maxlength="6" @confirm="handleLogin" /> - @@ -130,13 +149,11 @@ @click="loginMode = 'WECHAT'" /> - - - 登录即代表同意 + 我已阅读并同意 《用户协议》 @@ -147,6 +164,7 @@ + @@ -169,7 +187,7 @@ class="input-field" placeholder="请输入手机号" type="number" - maxlength="11" + :maxlength="11" /> @@ -180,7 +198,7 @@ class="input-field" placeholder="请输入验证码" type="number" - maxlength="6" + :maxlength="6" /> + + + + 请阅读并同意有来技术 + 《用户协议》 + 《隐私政策》 + + + @@ -210,17 +237,18 @@ { "name": "login", - "style": { "navigationStyle": "custom" } + "style": { "navigationBarTitleText": "登录" } }