添加项目文件。
This commit is contained in:
73
XXCpzs/Views/PageRegister.xaml.cs
Normal file
73
XXCpzs/Views/PageRegister.xaml.cs
Normal file
@@ -0,0 +1,73 @@
|
||||
using Acr.UserDialogs;
|
||||
using NPinyin;
|
||||
using Rg.Plugins.Popup.Pages;
|
||||
using Rg.Plugins.Popup.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Xaml;
|
||||
using XXCpzs.helper;
|
||||
using XXCpzs.ViewModels;
|
||||
namespace XXCpzs.Views
|
||||
{
|
||||
[XamlCompilation(XamlCompilationOptions.Compile)]
|
||||
public partial class PageRegister : PopupPage
|
||||
{
|
||||
RegisterViewModel ViewModel;
|
||||
private int DepartmentId;
|
||||
private PageMain pageMain;
|
||||
|
||||
public PageRegister(PageMain pageMain)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.pageMain = pageMain;
|
||||
this.BindingContext = ViewModel = new RegisterViewModel(pageMain.companyId);
|
||||
}
|
||||
|
||||
private async void Button_Clicked(object sender, EventArgs e)
|
||||
{
|
||||
UserDialogs.Instance.ShowLoading("正在注册,请稍后!");
|
||||
new Thread(new ThreadStart(async () =>
|
||||
{
|
||||
Random rd = new Random();
|
||||
int rdi = rd.Next(1000, 9999);
|
||||
Dictionary<string, string> _body = new Dictionary<string, string>{
|
||||
{"companyId", this.pageMain.companyId.ToString() }
|
||||
,{"departmentId", this.DepartmentId.ToString() }
|
||||
,{"deviceId", "0" }
|
||||
,{"username", Pinyin.GetPinyin(EditorRealname.Text).Trim().Replace(" ","")+ rdi.ToString() }
|
||||
,{"realname", EditorRealname.Text }
|
||||
,{"mobile", EditorMobile.Text.Trim() }
|
||||
,{"email", EditorMobile.Text.Trim() + "@163.com" }
|
||||
,{"password", EditorPassword.Text.Trim() }
|
||||
};
|
||||
var Result = HttpHelper.RequestPost(02, _body).Result;
|
||||
if (Result.Code == 200)
|
||||
{
|
||||
Device.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
UserDialogs.Instance.HideLoading();
|
||||
await PopupNavigation.Instance.PopAsync();
|
||||
pageMain.ImageButtonLogin_Clicked(sender, e);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
await DisplayAlert("访问出错", Result.Msg, "OK");
|
||||
}
|
||||
})).Start();
|
||||
}
|
||||
|
||||
private void PickerSection_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
var picker = (Picker)sender;
|
||||
int selectedIndex = picker.SelectedIndex;
|
||||
|
||||
if (selectedIndex != -1)
|
||||
{
|
||||
DepartmentId = ViewModel.BuMenItems[selectedIndex].id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user