修改细节
This commit is contained in:
1 parent
5080503ebd
commit
c8111d7db3
25 files changed
+1677
-7833
No files matched your search
@@ -6,6 +6,7 @@ using DG.Tweening;
|
||||
using UnityEngine.UI;
|
||||
using Assets.Scripts.Apis;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Assets.Scripts;
|
||||
|
||||
public class EarthController : PFUIPanel
|
||||
{
|
||||
@@ -45,7 +46,6 @@ public class EarthController : PFUIPanel
|
||||
protected override void Start()
|
||||
{
|
||||
itemObject = Resources.Load("UI/Prefab/BigMap/Item");
|
||||
|
||||
var rootPanel = this.transform.Find("Canvas").Find("Panel");
|
||||
var panel = rootPanel.Find("Panel");
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ public class EditUserController : PFUIPanel
|
||||
var result = await new UserApi().Login("13115011550", "laozhong", "");
|
||||
App.CurrentUser = result.data;
|
||||
}
|
||||
async Task LoadDataSync()
|
||||
void LoadDataSync()
|
||||
{
|
||||
//if (!App.FromLogin)
|
||||
//{
|
||||
@@ -246,6 +246,7 @@ public class EditUserController : PFUIPanel
|
||||
{
|
||||
base.Show();
|
||||
LoadDataSync();
|
||||
App.isChanged = false;
|
||||
}
|
||||
private void Switch(BaseEventData arg0)
|
||||
{
|
||||
@@ -276,58 +277,64 @@ public class EditUserController : PFUIPanel
|
||||
mDayDropdown.AddOptions(list);
|
||||
}
|
||||
|
||||
async void Save(BaseEventData e)
|
||||
void Save(BaseEventData e)
|
||||
{
|
||||
var user = JsonConvert.DeserializeObject<UserResultModel>(JsonConvert.SerializeObject(App.CurrentUser));
|
||||
user.Birthday = new DateTime(int.Parse(mYearDropdown.SelectedItem), int.Parse(mMonthDropdown.SelectedItem), int.Parse(mDayDropdown.SelectedItem));
|
||||
user.Sex = mSexDropdown.SelectedItem == "男" ? 1 : 2;
|
||||
user.Nickname = mNickName.Text;
|
||||
user.Country = UIManager.Instance.loginRegOptions.GetCountryName(mConutryDropdown.SelectedIndex);
|
||||
var errorList = new List<object>();
|
||||
if (string.IsNullOrEmpty(mNickName.Text)) errorList.Add(new { Field = "Nickname", ErrMsg = "请填写昵称" });
|
||||
if (string.IsNullOrEmpty(mFTP.Text)) errorList.Add(new { Field="FTP", ErrMsg="请填写FTP" });
|
||||
if (string.IsNullOrEmpty(mHeight.Text)) errorList.Add(new { Field = "Height", ErrMsg = "请填写身高" });
|
||||
if (string.IsNullOrEmpty(mWeight.Text)) errorList.Add(new { Field = "Weight", ErrMsg = "请填写体重" });
|
||||
if (string.IsNullOrEmpty(mMHR.Text)) errorList.Add(new { Field = "MaxHeartRate", ErrMsg = "请填写最大心率" });
|
||||
if (string.IsNullOrEmpty(mBW.Text)) errorList.Add(new { Field = "BicycleWeight", ErrMsg = "请填写车重" });
|
||||
if (string.IsNullOrEmpty(mWD.Text)) errorList.Add(new { Field = "WheelDiameter", ErrMsg = "请填写轮径" });
|
||||
if (errorList.Count > 0)
|
||||
{
|
||||
Utils.SetValidate(dict, JArray.FromObject(errorList));
|
||||
Utils.showToast(gameObject, "请填写相关信息");
|
||||
return;
|
||||
}
|
||||
user.FTP = int.Parse(mFTP.Text);
|
||||
user.Height = int.Parse(mHeight.Text);
|
||||
user.Weight = int.Parse(mWeight.Text);
|
||||
user.MaxHeartRate = int.Parse(mMHR.Text);
|
||||
user.BicycleWeight = int.Parse(mBW.Text);
|
||||
user.WheelDiameter = int.Parse(mWD.Text);
|
||||
user.Unit = mUnitDropdown.SelectedIndex;
|
||||
user.Contact = mName.Text;
|
||||
user.ContactPhone = mPhone.Text;
|
||||
user.ContactAddress = mAddr.Text;
|
||||
var result = await userApi.Update(user);
|
||||
if (result.result == false)
|
||||
{
|
||||
Utils.SetValidate(dict, JArray.FromObject(result.data));
|
||||
Utils.showToast(gameObject, result.errMsg);
|
||||
//UIManager.ShowAlert(result.errMsg);
|
||||
}
|
||||
else
|
||||
{
|
||||
App.CurrentUser = user;
|
||||
var userinfos = UIManager.Instance.userInfos;
|
||||
var i = userinfos.FindIndex(x => x.Id == App.CurrentUser.Id);
|
||||
if (i != -1)
|
||||
{
|
||||
userinfos[i].NickName = user.Nickname;
|
||||
UIManager.Instance.userInfos = userinfos;
|
||||
}
|
||||
Utils.showToast(gameObject, "Success", type: 1);
|
||||
//UIManager.ShowAlert("Success");
|
||||
}
|
||||
LoadDataSync();
|
||||
UIManager.ShowConfirm("Confirm", "Are you sure to edit?", async () =>
|
||||
{
|
||||
var user = JsonConvert.DeserializeObject<UserResultModel>(JsonConvert.SerializeObject(App.CurrentUser));
|
||||
user.Birthday = new DateTime(int.Parse(mYearDropdown.SelectedItem), int.Parse(mMonthDropdown.SelectedItem), int.Parse(mDayDropdown.SelectedItem));
|
||||
user.Sex = mSexDropdown.SelectedItem == "男" ? 1 : 2;
|
||||
user.Nickname = mNickName.Text;
|
||||
user.Country = UIManager.Instance.loginRegOptions.GetCountryName(mConutryDropdown.SelectedIndex);
|
||||
var errorList = new List<object>();
|
||||
if (string.IsNullOrEmpty(mNickName.Text)) errorList.Add(new { Field = "Nickname", ErrMsg = "请填写昵称" });
|
||||
if (string.IsNullOrEmpty(mFTP.Text)) errorList.Add(new { Field = "FTP", ErrMsg = "请填写FTP" });
|
||||
if (string.IsNullOrEmpty(mHeight.Text)) errorList.Add(new { Field = "Height", ErrMsg = "请填写身高" });
|
||||
if (string.IsNullOrEmpty(mWeight.Text)) errorList.Add(new { Field = "Weight", ErrMsg = "请填写体重" });
|
||||
if (string.IsNullOrEmpty(mMHR.Text)) errorList.Add(new { Field = "MaxHeartRate", ErrMsg = "请填写最大心率" });
|
||||
if (string.IsNullOrEmpty(mBW.Text)) errorList.Add(new { Field = "BicycleWeight", ErrMsg = "请填写车重" });
|
||||
if (string.IsNullOrEmpty(mWD.Text)) errorList.Add(new { Field = "WheelDiameter", ErrMsg = "请填写轮径" });
|
||||
if (errorList.Count > 0)
|
||||
{
|
||||
Utils.SetValidate(dict, JArray.FromObject(errorList));
|
||||
Utils.showToast(gameObject, "Please fill in the information");//请填写相关信息
|
||||
return;
|
||||
}
|
||||
user.FTP = int.Parse(mFTP.Text);
|
||||
user.Height = int.Parse(mHeight.Text);
|
||||
user.Weight = int.Parse(mWeight.Text);
|
||||
user.MaxHeartRate = int.Parse(mMHR.Text);
|
||||
user.BicycleWeight = int.Parse(mBW.Text);
|
||||
user.WheelDiameter = int.Parse(mWD.Text);
|
||||
user.Unit = mUnitDropdown.SelectedIndex;
|
||||
user.Contact = mName.Text;
|
||||
user.ContactPhone = mPhone.Text;
|
||||
user.ContactAddress = mAddr.Text;
|
||||
var result = await userApi.Update(user);
|
||||
App.isChanged = false;
|
||||
if (result.result == false)
|
||||
{
|
||||
Utils.SetValidate(dict, JArray.FromObject(result.data));
|
||||
Utils.showToast(gameObject, result.errMsg);
|
||||
//UIManager.ShowAlert(result.errMsg);
|
||||
}
|
||||
else
|
||||
{
|
||||
App.CurrentUser = user;
|
||||
var userinfos = UIManager.Instance.userInfos;
|
||||
var i = userinfos.FindIndex(x => x.Id == App.CurrentUser.Id);
|
||||
if (i != -1)
|
||||
{
|
||||
userinfos[i].NickName = user.Nickname;
|
||||
UIManager.Instance.userInfos = userinfos;
|
||||
}
|
||||
Utils.showToast(gameObject, "Success", type: 1);
|
||||
//UIManager.ShowAlert("Success");
|
||||
}
|
||||
|
||||
LoadDataSync();
|
||||
});
|
||||
|
||||
//App.CurrentUser = user;
|
||||
|
||||
//UIManager.ShowAlert("result.errMsg");
|
||||
@@ -335,6 +342,7 @@ public class EditUserController : PFUIPanel
|
||||
async void ChangeAvatar(string path)
|
||||
{
|
||||
var r = await userApi.Update(App.CurrentUser, path);
|
||||
App.isChanged = false;
|
||||
if (r.result)
|
||||
{
|
||||
var img = JObject.FromObject(r.data).Value<string>("WxHeadImg");
|
||||
@@ -358,6 +366,18 @@ public class EditUserController : PFUIPanel
|
||||
}
|
||||
void Cancel(BaseEventData e)
|
||||
{
|
||||
UIManager.ShowPrePanel();
|
||||
if (App.isChanged)
|
||||
{
|
||||
UIManager.ShowConfirm("Tips", "It is detected that you have modified, do you want to give up and return?", () =>
|
||||
{
|
||||
UIManager.ShowPrePanel();
|
||||
UIManager.CloseConfirm();
|
||||
});
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
UIManager.ShowPrePanel();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -100,6 +100,10 @@ public class HomeController : PFUIPanel
|
||||
{
|
||||
userInfo.Find("SexIcon").GetComponent<Image>().sprite = Resources.Load<Sprite>("Images/woman");
|
||||
}
|
||||
else
|
||||
{
|
||||
userInfo.Find("SexIcon").GetComponent<Image>().sprite = Resources.Load<Sprite>("Images/man");
|
||||
}
|
||||
Utils.DisplayImage(StartCoroutine, userInfo.Find("Avatar").GetComponent<RawImage>(), App.CurrentUser.WxHeadImg);
|
||||
|
||||
userInfo.Find("Country").GetComponent<RawImage>().texture = UIManager.Instance.loginRegOptions.GetCountryImageByName(App.CurrentUser.Country);
|
||||
|
||||
@@ -84,10 +84,19 @@ public class UserInfoController : PFUIPanel
|
||||
infoPanel.Find("Weight").Find("Value").GetComponent<Text>().text = $"{user.Weight}KG";
|
||||
infoPanel.Find("BW").Find("Value").GetComponent<Text>().text = $"{user.BicycleWeight}KG";
|
||||
infoPanel.Find("WD").Find("Value").GetComponent<Text>().text = $"{user.WheelDiameter}MM";
|
||||
//infoPanel.Find("Ftp").Find("Time").GetComponent<Text>().text = user.LastUpdateFtpTime.ToString("yyyy-MM-dd");
|
||||
//infoPanel.Find("MHR").Find("Time").GetComponent<Text>().text = user.MaxHeartRate.ToString();
|
||||
//infoPanel.Find("Weight").Find("Time").GetComponent<Text>().text = user.LastUpdateWeightTime.ToString("yyyy-MM-dd");
|
||||
//infoPanel.Find("BW").Find("Time").GetComponent<Text>().text = user.LastUpdateBicycleWeightTime.ToString("yyyy-MM-dd");
|
||||
//infoPanel.Find("WD").Find("Time").GetComponent<Text>().text = $"{user.WheelDiameter}MM";
|
||||
if (user.Sex == 2)
|
||||
{
|
||||
infoPanel.Find("SexIcon").GetComponent<Image>().sprite = Resources.Load<Sprite>("Images/woman");
|
||||
}
|
||||
else
|
||||
{
|
||||
infoPanel.Find("SexIcon").GetComponent<Image>().sprite = Resources.Load<Sprite>("Images/man");
|
||||
}
|
||||
summaryPanel.Find("Number").Find("Value").GetComponent<Text>().text = summary.Count.ToString();
|
||||
summaryPanel.Find("Time").Find("Value").GetComponent<Text>().text = summary.TotalTicks.ToString();
|
||||
summaryPanel.Find("KM").Find("Value").GetComponent<Text>().text = summary.TotalDistance.ToString();
|
||||
|
||||
Reference in new issue
Block a user