24 lines
671 B
JavaScript
24 lines
671 B
JavaScript
import { login } from "../request/api/Index";
|
|
|
|
import { getWeChatAuthCode } from "./AuthManager";
|
|
|
|
export async function loginAuth() {
|
|
try {
|
|
const openIdCode = '0f1XVM100D5JCU1BP6400WQQFD2XVM1T'// await getWeChatAuthCode();
|
|
console.log('获取到的微信授权code:', openIdCode);
|
|
const response = await login({
|
|
openIdCode,
|
|
grant_type: 'wechat',
|
|
scope: 'server',
|
|
clientId: '1'
|
|
});
|
|
if (response.success) {
|
|
return response.data;
|
|
} else {
|
|
throw new Error(response.message || '登录失败');
|
|
}
|
|
} catch (err) {
|
|
throw err;
|
|
}
|
|
}
|