feat: 新增登录功能交互

This commit is contained in:
duanshuwen
2025-07-26 17:57:25 +08:00
parent 5321b27176
commit 00c2b9e2d7
20 changed files with 393 additions and 100 deletions

View File

@@ -1,20 +1,18 @@
import { login } from "../request/api/LoginApi";
import { wxLogin, bindUserPhone, checkUserPhone } from "../request/api/LoginApi";
import { getWeChatAuthCode } from "./AuthManager";
export async function loginAuth() {
const loginAuth = async () => {
try {
const openIdCode = 'brother7'// await getWeChatAuthCode();
const openIdCode = await getWeChatAuthCode();
console.log('获取到的微信授权code:', openIdCode);
const response = await login({
const response = await wxLogin({
openIdCode: [openIdCode],
grant_type: 'password',
grant_type: 'wechat',
scope: 'server',
//clientId: '1',
username: 'admin',
password: 'YehdBPev',
clientId: '2'
});
console.log('获取到的微信授权response:', response);
if (response.access_token) {
uni.setStorageSync('token', response.access_token)
return response;
@@ -25,3 +23,23 @@ export async function loginAuth() {
throw err;
}
}
const bindPhone = async (params) => {
try {
const response = await bindUserPhone(params)
return response;
} catch (error) {
throw err;
}
}
const checkPhone = async (phone) => {
try {
const response = await checkUserPhone(phone)
return response;
} catch (error) {
throw err;
}
}
export { loginAuth, bindPhone, checkPhone }