feat(auth): 小程序扫码登录其它端口 —— 确认页+我的扫码登录

- 小程序 pages/scan-login(读scene→复用微信登录→/auth/mp-qr/confirm→目标端口登录)
- 我的页「跨端口登录·扫码登录其它端口」; auth.js mpQrConfirm
- 网站 Login.jsx PollingQr 支持 qr_image(小程序码)渲染
This commit is contained in:
Pine
2026-08-26 12:00:09 +08:00
parent 0b264ee9b3
commit a39fbc7955
7 changed files with 124 additions and 4 deletions
+7
View File
@@ -57,10 +57,17 @@ export async function wxLogin({ code, nickName, avatarUrl }) {
if (data.token) {
Taro.setStorageSync('pine_token', data.token);
saveUser(data);
return data;
}
return data;
}
/** 小程序扫码登录其它端口:扫跨端登录页二维码 → 用 wx.login code 确认 → 目标端口轮询取令牌 */
export async function mpQrConfirm(scene, code) {
const data = await request('POST', '/auth/mp-qr/confirm', { scene, code });
return data;
}
/** 拉取当前账号资料(刷新昵称/头像/手机绑定状态)——平台 /auth/me 返回扁平 profile */
export async function getMe() {
const data = await request('GET', '/auth/me', {}, true);