登录页调整 增加半圆角组件 基本完成路线列表功能 基本完成骑行列表 开始做编辑页
This commit is contained in:
1 parent
5156473bb2
commit
10e738f958
100 files changed
+20085
-11852
No files matched your search
@@ -27,6 +27,11 @@ public class QUserInfo
|
||||
public string Avatar { get; set; }
|
||||
public string Cookie { get; set; }
|
||||
}
|
||||
public class LoginForm
|
||||
{
|
||||
public InputField email { get; set; }
|
||||
public InputField password { get; set; }
|
||||
}
|
||||
public class SignForm
|
||||
{
|
||||
//页面1
|
||||
@@ -46,31 +51,32 @@ public class SignForm
|
||||
}
|
||||
public class LoginController : MonoBehaviour
|
||||
{
|
||||
[SerializeField] InputField[] loginForm;
|
||||
[SerializeField] Button login;
|
||||
[SerializeField] Button loginNewAccount;
|
||||
private Transform mainContent;
|
||||
/*初始页面*/
|
||||
private Transform quickContainer;
|
||||
private Transform loginContainer;
|
||||
private Transform signContainer;
|
||||
/*初始页面*/
|
||||
LoginForm loginForm;
|
||||
[SerializeField] Button loginReturn2;
|
||||
[SerializeField] Button returnQuick;
|
||||
[SerializeField] Button sign;
|
||||
[SerializeField] Button remember;
|
||||
[SerializeField] Button wechatLogin;
|
||||
private Button remember;
|
||||
/*滑动相关*/
|
||||
[SerializeField] GameObject loginScrollView;
|
||||
[SerializeField] GameObject signScrollView;
|
||||
[SerializeField] GameObject avatarScrollView;
|
||||
/*滑动相关*/
|
||||
//注册
|
||||
private Transform signPage1;
|
||||
private Transform signPage2;
|
||||
private Transform signScrollBar;
|
||||
private SignForm signForm;
|
||||
private LoginRegOptions regOptions;
|
||||
[SerializeField] GameObject avatarScrollView;
|
||||
[SerializeField] RawImage loading;
|
||||
[SerializeField] Button exit;
|
||||
|
||||
private ScrollRect scrollPanel;
|
||||
private ScrollRect scrollSign;
|
||||
private ScrollRect scrollAvatar;
|
||||
private Transform imagexf;
|
||||
private Transform mainContent;
|
||||
//注册主页面
|
||||
private Transform signContainer;
|
||||
private UserResultModel userResult;
|
||||
/*微信相关*/
|
||||
private Browser wxBrowser;
|
||||
@@ -81,8 +87,13 @@ public class LoginController : MonoBehaviour
|
||||
private JObject wxInfoJson;
|
||||
private bool wxLock;
|
||||
/*微信相关*/
|
||||
|
||||
private List<QUserInfo> userInfos;
|
||||
|
||||
/*退出按钮*/
|
||||
[SerializeField] Button exit;
|
||||
/*退出按钮*/
|
||||
//其他
|
||||
[SerializeField] RawImage loading;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
@@ -92,24 +103,21 @@ public class LoginController : MonoBehaviour
|
||||
//userInfos.RemoveAt(0);
|
||||
//PlayerPrefs.SetString("UserInfos", "");
|
||||
//transform.Find("RawImage").DOMove(new Vector3(0.5f,0.5f,0),1);
|
||||
if (loginForm.Length == 2 && loginForm[0] != null && loginForm[1] != null)
|
||||
{
|
||||
foreach (var ipt in loginForm)
|
||||
{
|
||||
UIManager.AddEvent(ipt.gameObject, EventTriggerType.PointerClick, new UnityAction<BaseEventData>
|
||||
((BaseEventData arg0) => { OnLoginInputSelect(arg0, ipt.gameObject); }));
|
||||
UIManager.AddEvent(ipt.gameObject, EventTriggerType.Select, new UnityAction<BaseEventData>
|
||||
((BaseEventData arg0) => { OnLoginInputSelect(arg0, ipt.gameObject); }));
|
||||
UIManager.AddEvent(ipt.gameObject, EventTriggerType.Deselect, new UnityAction<BaseEventData>
|
||||
((BaseEventData arg0) => { OnLoginInputDeSelect(arg0, ipt.gameObject); }));
|
||||
}
|
||||
//loginForm[0].
|
||||
}
|
||||
if (login != null)
|
||||
{
|
||||
login.onClick.AddListener(Submit);
|
||||
//login.onClick.AddListener(Submit);
|
||||
}
|
||||
|
||||
//if (loginForm.Length == 2 && loginForm[0] != null && loginForm[1] != null)
|
||||
//{
|
||||
// foreach (var ipt in loginForm)
|
||||
// {
|
||||
// UIManager.AddEvent(ipt.gameObject, EventTriggerType.PointerClick, new UnityAction<BaseEventData>
|
||||
// ((BaseEventData arg0) => { OnLoginInputSelect(arg0, ipt.gameObject); }));
|
||||
// UIManager.AddEvent(ipt.gameObject, EventTriggerType.Select, new UnityAction<BaseEventData>
|
||||
// ((BaseEventData arg0) => { OnLoginInputSelect(arg0, ipt.gameObject); }));
|
||||
// UIManager.AddEvent(ipt.gameObject, EventTriggerType.Deselect, new UnityAction<BaseEventData>
|
||||
// ((BaseEventData arg0) => { OnLoginInputDeSelect(arg0, ipt.gameObject); }));
|
||||
// }
|
||||
// //loginForm[0].
|
||||
//}
|
||||
|
||||
if (loading != null)
|
||||
{
|
||||
loading.texture.wrapMode = TextureWrapMode.Repeat;
|
||||
@@ -118,6 +126,9 @@ public class LoginController : MonoBehaviour
|
||||
{
|
||||
scrollPanel = loginScrollView.GetComponent<ScrollRect>();
|
||||
mainContent = loginScrollView.transform.Find("Viewport").Find("Content");
|
||||
quickContainer = mainContent.Find("FormContainer-Quick");
|
||||
loginContainer = mainContent.Find("FormContainer-Login").Find("FormContainer");
|
||||
signContainer = mainContent.Find("FormContainer-Sign");
|
||||
}
|
||||
if (signScrollView != null)
|
||||
{
|
||||
@@ -208,29 +219,18 @@ public class LoginController : MonoBehaviour
|
||||
content.Find("empty2").transform.SetSiblingIndex(content.childCount-1);
|
||||
scrollAvatar.GetComponent<QuickLoginScroll>().Initial();
|
||||
}
|
||||
if (loginNewAccount != null)
|
||||
if (quickContainer != null)
|
||||
{
|
||||
var loginNewAccount = quickContainer.Find("loginNewAccount").GetComponent<Button>();
|
||||
loginNewAccount.onClick.AddListener(goLogin);
|
||||
}
|
||||
if (returnQuick != null)
|
||||
if (loginContainer != null)
|
||||
{
|
||||
var returnQuick = loginContainer.Find("returnQuick").GetComponent<Button>();
|
||||
returnQuick.onClick.AddListener(ReturnQuick);
|
||||
}
|
||||
if (sign != null)
|
||||
{
|
||||
sign.onClick.AddListener(()=>goSign());
|
||||
}
|
||||
if (loginReturn2 != null)
|
||||
{
|
||||
loginReturn2.onClick.AddListener(goLoginReturn2);
|
||||
}
|
||||
if (exit != null)
|
||||
{
|
||||
exit.onClick.AddListener(() => Application.Quit());
|
||||
}
|
||||
signContainer = mainContent.Find("FormContainer-Sign");
|
||||
if (remember != null)
|
||||
{
|
||||
var sign = loginContainer.Find("reg").GetComponent<Button>();
|
||||
sign.onClick.AddListener(() => goSign());
|
||||
remember = loginContainer.Find("rememberButton").GetComponent<Button>();
|
||||
remember.onClick.AddListener(() =>
|
||||
{
|
||||
var gou = remember.transform.Find("Gou");
|
||||
@@ -243,29 +243,49 @@ public class LoginController : MonoBehaviour
|
||||
gou.gameObject.SetActive(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (wechatLogin != null)
|
||||
{
|
||||
var wechatLogin = loginContainer.Find("otherContainer").Find("Wechat").GetComponent<Button>();
|
||||
wechatLogin.onClick.AddListener(() =>
|
||||
{
|
||||
if (wxLock) return;
|
||||
wxLock = true;
|
||||
|
||||
wxState = (DateTime.Now.ToUniversalTime().Ticks / 10000 * new System.Random().Next(1,5)).ToString();
|
||||
|
||||
wxState = (DateTime.Now.ToUniversalTime().Ticks / 10000 * new System.Random().Next(1, 5)).ToString();
|
||||
wxBrowser.Url = $"https://open.weixin.qq.com/connect/qrconnect?appid={App.WxAppId}&redirect_uri=https%3A%2F%2Fwx.powerfun.com.cn%2FNoAuth%2Fv1%2FWxWebLogin&response_type=code&scope=snsapi_login&state={wxState}#wechat_redirect";
|
||||
AdjustWxQrCode();
|
||||
//AdjustWxQrCode();
|
||||
var wx1 = mainContent.Find("FormContainer-Login").Find("FormContainer-wx1");
|
||||
wx1.gameObject.SetActive(true);
|
||||
Debug.Log(178+ "已经开启"+ wx1.gameObject.activeSelf);
|
||||
wx1.DOLocalMoveY(0, 0.3f).onComplete = ()=> { wxLock = false; };
|
||||
Debug.Log(178 + "已经开启" + wx1.gameObject.activeSelf);
|
||||
wx1.DOLocalMoveY(0, 0.3f).onComplete = () => { wxLock = false; };
|
||||
});
|
||||
var login = loginContainer.Find("login").GetComponent<Button>();
|
||||
login.onClick.AddListener(Submit);
|
||||
loginForm = new LoginForm()
|
||||
{
|
||||
email = loginContainer.Find("phone").GetComponent<InputField>(),
|
||||
password = loginContainer.Find("pwd").GetComponent<InputField>()
|
||||
};
|
||||
}
|
||||
//if (loginReturn2 != null)
|
||||
//{
|
||||
// loginReturn2.onClick.AddListener(goLoginReturn2);
|
||||
//}
|
||||
if (signContainer != null)
|
||||
{
|
||||
var loginr2 = signContainer.Find("loginr2").GetComponent<Button>();
|
||||
loginr2.onClick.AddListener(goLoginReturn2);
|
||||
}
|
||||
if (exit != null)
|
||||
{
|
||||
exit.onClick.AddListener(() => Application.Quit());
|
||||
}
|
||||
|
||||
wxLogin1 = mainContent.Find("FormContainer-Login").Find("FormContainer-wx1");
|
||||
if (wxLogin1 != null)
|
||||
{
|
||||
wxLogin1.Find("Image").GetComponent<Button>().onClick.AddListener(() =>
|
||||
{
|
||||
wxLock = true;
|
||||
wxBrowser.Url = "chrome://version/";
|
||||
wxLogin1.DOMoveY(-573, 0.8f).onComplete = () =>
|
||||
{
|
||||
wxLock = false;
|
||||
@@ -338,12 +358,11 @@ public class LoginController : MonoBehaviour
|
||||
});
|
||||
}
|
||||
imagexf = transform.Find("Panel").Find("LoginContainer").Find("Imagexf");
|
||||
|
||||
|
||||
}
|
||||
private void AdjustWxQrCode()
|
||||
{
|
||||
wxBrowser.EvalJS(@"
|
||||
console.log(document.getElementsByClassName('qrcode')[0]);
|
||||
document.getElementsByClassName('qrcode')[0].style.marginTop = 0;
|
||||
document.getElementsByClassName('title')[0].style.display = 'none';
|
||||
document.body.style.background = '#272732';
|
||||
@@ -397,12 +416,12 @@ public class LoginController : MonoBehaviour
|
||||
}
|
||||
else
|
||||
{
|
||||
userResult = data.ToObject<UserResultModel>();
|
||||
RefreshWx3(data.ToObject<UserResultModel>());
|
||||
wxLogin3.gameObject.SetActive(true);
|
||||
Utils.DisplayImage(StartCoroutine,
|
||||
wxLogin3.Find("Avatar").GetComponent<RawImage>(),
|
||||
wxInfoJson.Value<string>("headimgurl"));
|
||||
wxLogin3.Find("NickName").GetComponent<Text>().text = wxInfoJson.Value<string>("nickname");
|
||||
//Utils.DisplayImage(StartCoroutine,
|
||||
//wxLogin3.Find("Avatar").GetComponent<RawImage>(),
|
||||
//wxInfoJson.Value<string>("headimgurl"));
|
||||
//wxLogin3.Find("NickName").GetComponent<Text>().text = wxInfoJson.Value<string>("nickname");
|
||||
signContainer.gameObject.SetActive(false);
|
||||
pageNums = 3;
|
||||
//this.goSign();
|
||||
@@ -444,6 +463,10 @@ public class LoginController : MonoBehaviour
|
||||
//Timer t = new Ti
|
||||
if (r.result)
|
||||
{
|
||||
if (r.data.Value<bool>("isExist") && pageNums == 5)
|
||||
{
|
||||
HidePassword();
|
||||
}
|
||||
time = 60;
|
||||
btnText.text = $"Again({time})";
|
||||
System.Timers.Timer timer = new System.Timers.Timer();
|
||||
@@ -461,6 +484,22 @@ public class LoginController : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
void HidePassword()
|
||||
{
|
||||
signPage1.Find("Password").gameObject.SetActive(false);
|
||||
signPage1.Find("CPassword").gameObject.SetActive(false);
|
||||
signPage1.Find("signThird").GetComponent<Button>().onClick.RemoveAllListeners();
|
||||
signPage1.Find("signThird").GetComponent<Button>().onClick.AddListener(goRegNextWithoutPass);
|
||||
}
|
||||
|
||||
|
||||
void ShowPassword()
|
||||
{
|
||||
signPage1.Find("Password").gameObject.SetActive(true);
|
||||
signPage1.Find("CPassword").gameObject.SetActive(true);
|
||||
signPage1.Find("signThird").GetComponent<Button>().onClick.RemoveAllListeners();
|
||||
signPage1.Find("signThird").GetComponent<Button>().onClick.AddListener(() => { goRegNext(1); });
|
||||
}
|
||||
void CaptchaTimerTick()
|
||||
{
|
||||
timer -= Time.deltaTime;
|
||||
@@ -507,6 +546,11 @@ public class LoginController : MonoBehaviour
|
||||
var Captcha = signForm.captcha;
|
||||
var Password = signForm.password;
|
||||
var CPassword = signForm.cpassword;
|
||||
if (Password.text != CPassword.text)
|
||||
{
|
||||
Utils.showToast(gameObject,"两次密码输入不一致");
|
||||
return;
|
||||
}
|
||||
//JsonConvert
|
||||
JsonResult<UserResultModel> r = null;
|
||||
if (signType == 0)
|
||||
@@ -526,14 +570,44 @@ public class LoginController : MonoBehaviour
|
||||
}
|
||||
if (r!=null && r.result)
|
||||
{
|
||||
RefreshWx3(r.data);
|
||||
StartScrollSign(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
StartScrollSign(1);
|
||||
//Utils.showToast(gameObject, r.errMsg, 1);
|
||||
Utils.showToast(gameObject, r.errMsg, 1);
|
||||
}
|
||||
}
|
||||
async void goRegNextWithoutPass()
|
||||
{
|
||||
var Email = signForm.email;
|
||||
var Captcha = signForm.captcha;
|
||||
var r = await ConfigHelper.userApi.OnWebWxLogin(Email.text,
|
||||
Captcha.text,
|
||||
wxInfoJson.Value<string>("unionid"),
|
||||
wxInfoJson.Value<string>("openid"),
|
||||
wxInfoJson.Value<string>("headimgurl"),
|
||||
wxInfoJson.Value<string>("nickname"),
|
||||
wxInfoJson.Value<int>("sex"),
|
||||
"");
|
||||
if (r.result)
|
||||
{
|
||||
RefreshWx3(r.data);
|
||||
StartScrollPanel(4);
|
||||
}
|
||||
else
|
||||
{
|
||||
Utils.showToast(gameObject, r.errMsg);
|
||||
}
|
||||
}
|
||||
void RefreshWx3(UserResultModel data)
|
||||
{
|
||||
Utils.DisplayImage(StartCoroutine,
|
||||
wxLogin3.Find("Avatar").GetComponent<RawImage>(),
|
||||
data.WxHeadImg);
|
||||
wxLogin3.Find("NickName").GetComponent<Text>().text = data.Nickname;
|
||||
userResult = data;
|
||||
}
|
||||
private void goRegEnd()
|
||||
{
|
||||
if (pageNums == 5)
|
||||
@@ -577,6 +651,7 @@ public class LoginController : MonoBehaviour
|
||||
signPage1.Find("next").gameObject.SetActive(false);
|
||||
signPage1.Find("previousThird").gameObject.SetActive(true);
|
||||
signPage1.Find("signThird").gameObject.SetActive(true);
|
||||
ShowPassword();
|
||||
this.StartScrollPanel(3);
|
||||
this.StartScrollSign(0);
|
||||
}
|
||||
@@ -588,6 +663,7 @@ public class LoginController : MonoBehaviour
|
||||
signPage1.Find("next").gameObject.SetActive(true);
|
||||
signPage1.Find("previousThird").gameObject.SetActive(false);
|
||||
signPage1.Find("signThird").gameObject.SetActive(false);
|
||||
ShowPassword();
|
||||
this.StartScrollPanel(2);
|
||||
this.StartScrollSign(0);
|
||||
}
|
||||
@@ -609,6 +685,7 @@ public class LoginController : MonoBehaviour
|
||||
});
|
||||
PlayerPrefs.SetString("UserInfos", JsonConvert.SerializeObject(userInfos));
|
||||
}
|
||||
App.CurrentUser = data;
|
||||
//App.CurrentUser = new UserModel
|
||||
//{
|
||||
// NickName = data.Nickname,
|
||||
@@ -624,19 +701,19 @@ public class LoginController : MonoBehaviour
|
||||
}
|
||||
async void Submit()
|
||||
{
|
||||
if (loginForm[0] == null || loginForm[1] == null)
|
||||
if (loginForm.email == null || loginForm.password == null)
|
||||
{
|
||||
Utils.showToast(gameObject, "未绑定", 1);
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(loginForm[0].text) || string.IsNullOrEmpty(loginForm[1].text))
|
||||
if (string.IsNullOrEmpty(loginForm.email.text) || string.IsNullOrEmpty(loginForm.password.text))
|
||||
{
|
||||
Utils.showToast(gameObject, "请输入信息", 1);
|
||||
return;
|
||||
}
|
||||
//var res = await Global.userApi.Login(phone.text, pwd.text, "");
|
||||
//测试用
|
||||
var res = await ConfigHelper.userApi.Login(loginForm[0].text, loginForm[1].text, "");
|
||||
var res = await ConfigHelper.userApi.Login(loginForm.email.text, loginForm.password.text, "");
|
||||
//var res = await NoAuthApi.Login(phone.text, pwd.text);
|
||||
if (res.result)
|
||||
{
|
||||
@@ -652,9 +729,9 @@ public class LoginController : MonoBehaviour
|
||||
void Update()
|
||||
{
|
||||
//Debug.Log($"{phone.isFocused}, ${pwd != null}, ${Input.GetKeyDown(KeyCode.Tab)}");
|
||||
if (loginForm[0].isFocused && loginForm[1] != null && Input.GetKeyDown(KeyCode.Tab))
|
||||
if (Input.GetKeyDown(KeyCode.Tab) && loginForm !=null && loginForm.email.isFocused && loginForm.password != null)
|
||||
{
|
||||
loginForm[1].ActivateInputField();
|
||||
loginForm.password.ActivateInputField();
|
||||
}
|
||||
if (startCaptcha)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user