From 5fd397b1eabd5a7f6ac7ac010aa222e450526e64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E6=A2=A6?= Date: Fri, 29 May 2026 14:21:32 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AF=B9=E6=8E=A5=E5=AE=B6=E9=95=BF?= =?UTF-8?q?=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 4 +- src/api/login.ts | 59 +++++++++++++++------ src/api/parent.ts | 52 +++++++++++++++++++ src/manifest.json | 2 +- src/pages/login/index.vue | 42 ++++++++++----- src/pages/parent/profile/index.vue | 83 +++++++++++++++++++++++++++--- src/state/modules/user.ts | 21 ++++++-- src/utils/request.ts | 3 +- 8 files changed, 224 insertions(+), 42 deletions(-) create mode 100644 src/api/parent.ts diff --git a/.env b/.env index 710a631..e542642 100644 --- a/.env +++ b/.env @@ -1,5 +1,5 @@ -#VITE_HOST = http://hjcy.niuniuhotpot.fr/prod-api - VITE_BASE_URL = https://ai.xuexiaole.com +VITE_BASE_URL = http://43.136.52.196:9053 + # VITE_BASE_URL = https://ai.lingxixue.com # VITE_WS_URL = ws://8.138.151.141:8888/ VITE_WS_URL = ws://ec2-13-36-229-106.eu-west-3.compute.amazonaws.com:8888/ diff --git a/src/api/login.ts b/src/api/login.ts index 0232d37..b40e6df 100644 --- a/src/api/login.ts +++ b/src/api/login.ts @@ -23,32 +23,61 @@ export const psdLogin = (data: AccountLoginParams) => }); export interface ParentSmsLoginParams { - mobile: string; - smsCode: string; + phone: string; + verifyCode: string; + openid: string; } -/** 家长端 - 发送登录验证码 */ -export const sendParentLoginCode = (mobile: string) => - request({ - url: '/parent/sendLoginCode', +export interface ParentMpLoginResp { + accessToken?: string | null; + account?: string | null; + phone?: string | null; + wxUser?: { + openid?: string; + unionId?: string; + nickname?: string | null; + [key: string]: any; + }; +} + +/** 家长端 - 小程序 code 登录(查 openId & 绑定关系) */ +export const parentMpLogin = (code: string) => + request({ + url: '/mpLogin', method: 'POST', headers: { Authorization: '' }, silent: true, - data: { mobile }, + data: { code }, }); -/** 家长端 - 手机号验证码登录 */ +/** 家长端 - 发送登录验证码(form-urlencoded 请求体,非 URL 查询参数) */ +export const sendParentLoginCode = (phone: string) => + request({ + url: '/sms/sendMessage', + method: 'POST', + headers: { + Authorization: '', + 'Content-Type': 'application/x-www-form-urlencoded', + }, + silent: true, + data: `phoneNumbers=${encodeURIComponent(phone)}`, + }); + +/** 家长端 - 手机号验证码登录(绑定微信 openid),成功时 data 为 JWT 字符串 */ export const parentSmsLogin = (data: ParentSmsLoginParams) => request({ - url: '/parent/loginBySms', + url: '/smsLogin', method: 'POST', - headers: { Authorization: '' }, + headers: { + Authorization: '', + 'X-Tenant-Id': '1966391196339204098', + }, data: { - mobile: data.mobile, - smsCode: data.smsCode, - clientType: 'PARENT', - simSerialNumber: 'miniProgram', - model: 'wechat', + bindMaOpenid: true, + adminType: 16, + openid: data.openid, + phone: data.phone, + verifyCode: data.verifyCode, }, }); diff --git a/src/api/parent.ts b/src/api/parent.ts new file mode 100644 index 0000000..f627574 --- /dev/null +++ b/src/api/parent.ts @@ -0,0 +1,52 @@ +import { request } from '@/utils/request'; + +export interface ParentBindChildInfo { + account?: string; + avatar?: string; + id?: number; + name?: string; + nickname?: string; + phone?: string; + [key: string]: any; +} + +export interface ParentBindChildStudent { + account?: string; + avatar?: string; + gradeId?: number; + gradeName?: string; + id?: number; + name?: string; + nickname?: string; + [key: string]: any; +} + +export interface ParentBindChildItem { + id?: number; + bindFlag?: number; + bindTime?: string; + identityType?: number; + child?: ParentBindChildStudent; + parent?: ParentBindChildInfo; + [key: string]: any; +} + +export interface PageResult { + current?: number; + rows?: T[]; + size?: number; + totalPage?: number; + totalRows?: number; + [key: string]: any; +} + +/** 家长绑定孩子列表 */ +export const getParentBindChildList = (params?: { current?: number; size?: number }) => + request>({ + url: '/parentBindChild/list', + method: 'GET', + params: { + current: params?.current ?? 1, + size: params?.size ?? 100, + }, + }); diff --git a/src/manifest.json b/src/manifest.json index 49a735e..ecf8836 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -50,7 +50,7 @@ "quickapp" : {}, /* 小程序特有相关 */ "mp-weixin" : { - "appid" : "wxa5522671f30c5891", + "appid" : "wxab166c9b5b6401ea", "setting" : { "urlCheck" : false, "minified" : true, diff --git a/src/pages/login/index.vue b/src/pages/login/index.vue index fe41fe1..7959787 100644 --- a/src/pages/login/index.vue +++ b/src/pages/login/index.vue @@ -180,7 +180,7 @@