小改
This commit is contained in:
parent
5cece435ae
commit
b5e67fdb51
@ -8,8 +8,15 @@ using JetBrains.Annotations;
|
||||
using System.Data;
|
||||
public class auth_login
|
||||
{
|
||||
public string clientId = "e5cd7e4891bf95d1d19206ce24a7b32e";
|
||||
public string grantType = "password";
|
||||
//public string clientId = "e5cd7e4891bf95d1d19206ce24a7b32e";
|
||||
//public string grantType = "password";
|
||||
public string grantType;
|
||||
public string clientId;
|
||||
public string userType;
|
||||
public string username;
|
||||
public string password;
|
||||
public string phonenumber;
|
||||
public string smsCode;
|
||||
}
|
||||
//public class auth_createTemplate
|
||||
//{
|
||||
|
@ -38,22 +38,33 @@ public class LoginPanel : MonoBehaviour
|
||||
//登录逻辑
|
||||
public async void Login()
|
||||
{
|
||||
// 创建登录请求的 body
|
||||
auth_login loginBody = new auth_login
|
||||
{
|
||||
clientId = id.text,
|
||||
grantType = pwd.text
|
||||
grantType = "password",
|
||||
clientId = "e5cd7e4891bf95d1d19206ce24a7b32e",
|
||||
userType = "company_user",
|
||||
username = "13006065371",
|
||||
password = "YYL5371!",
|
||||
phonenumber = "",
|
||||
smsCode = ""
|
||||
};
|
||||
//Debug.Log(JsonUtility.ToJson(loginBody));
|
||||
|
||||
// 发送请求
|
||||
string response = await web.SendRequest(web.URL + "/auth/login", "POST", JsonUtility.ToJson(loginBody));
|
||||
Debug.Log("登录" + response);
|
||||
|
||||
// 解析服务器返回的数据
|
||||
loginResponse serverData = JsonConvert.DeserializeObject<loginResponse>(response);
|
||||
//token = serverData.data.access_token;
|
||||
|
||||
// 将登录响应数据保存到静态变量中
|
||||
GlobalData.ServerData = serverData;
|
||||
|
||||
// 打印 access_token
|
||||
Debug.Log(serverData.data.access_token);
|
||||
|
||||
//跳转场景写这里
|
||||
SceneManager.LoadScene("scheduled_exercise");
|
||||
// 跳转场景
|
||||
SceneManager.LoadScene(1);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user