feat: 新增登录功能交互
This commit is contained in:
@@ -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 }
|
||||
|
||||
Reference in New Issue
Block a user