Skip to content

Commit cd85ff7

Browse files
committed
🔧 升级预览版本号,优化登录注册异常处理
- 将预览版本号提升至 3 - 注释掉短信验证码校验方法 CanSubmit - 登录/注册流程移除验证码校验,增加异常捕获与提示,确保 IsLoading 状态正确重置
1 parent bd30f0d commit cd85ff7

3 files changed

Lines changed: 27 additions & 19 deletions

File tree

src/AssemblyInfo.Constants.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public static partial class AssemblyInfo
1818
/// <summary>
1919
/// 预览版本号,范围 1~9,只增不减
2020
/// </summary>
21-
const string ver_for_preview = "2";
21+
const string ver_for_preview = "3";
2222

2323
/// <summary>
2424
/// RC 版本号,范围 0~9,只增不减

src/BD.WTTS.Client/Helpers/UI/SendSmsUIHelper.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -109,16 +109,16 @@ static async ValueTask<IApiRsp> SendSmsAsync(this IViewModel i, SendSmsRequest r
109109
return response;
110110
}
111111

112-
public static bool CanSubmit(this IViewModel i)
113-
{
114-
if (!i.SendSmsCodeSuccess)
115-
{
116-
Toast.Show(ToastIcon.Error, AppResources.User_SMSCode_Error);
117-
return false;
118-
}
119-
120-
return true;
121-
}
112+
//public static bool CanSubmit(this IViewModel i)
113+
//{
114+
// if (!i.SendSmsCodeSuccess)
115+
// {
116+
// Toast.Show(ToastIcon.Error, AppResources.User_SMSCode_Error);
117+
// return false;
118+
// }
119+
120+
// return true;
121+
//}
122122

123123
/// <summary>
124124
/// 移除相关委托,在 View 层销毁时调用,因平台 View 层实现与关联 ViewModel 可能不一致,所以不能在 ViewModel 释放时调用

src/BD.WTTS.Client/UI/ViewModels/Windows/LoginOrRegisterWindowViewModel.cs

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,24 +56,32 @@ internal static async Task SuccessAsync(LoginOrRegisterResponse rsp, Action<bool
5656

5757
async Task SubmitAsync()
5858
{
59-
if (IsLoading || !this.CanSubmit()) return;
59+
if (IsLoading /*|| !this.CanSubmit()*/) return;
6060

6161
var request = new LoginOrRegisterRequest
6262
{
6363
PhoneNumber = PhoneNumber,
6464
SmsCode = SmsCode
6565
};
6666
IsLoading = true;
67+
try
68+
{
69+
var response = await IMicroServiceClient.Instance.Account.LoginOrRegister(request);
6770

68-
var response = await IMicroServiceClient.Instance.Account.LoginOrRegister(request);
69-
70-
if (response.IsSuccess)
71+
if (response.IsSuccess)
72+
{
73+
await SuccessAsync(response.Content!, Close);
74+
return;
75+
}
76+
}
77+
catch (Exception ex)
7178
{
72-
await SuccessAsync(response.Content!, Close);
73-
return;
79+
Toast.Show(ToastIcon.Error, ex.GetAllMessage());
80+
}
81+
finally
82+
{
83+
IsLoading = false;
7484
}
75-
76-
IsLoading = false;
7785
}
7886

7987
async void OpenHyperlink_(string parameter)

0 commit comments

Comments
 (0)