1中转仓订单退货功能 2中转仓订单运费根据oem或管理员设定调整 3其他一些问题修复
This commit is contained in:
1 parent
d6f81f9ef4
commit
2e20cbdf68
24 files changed
+834
-292
No files matched your search
@@ -0,0 +1,215 @@
|
||||
using _29WxOrderWpf.BaseWindows;
|
||||
using _29WxOrderWpf.UserControls;
|
||||
using AllBase;
|
||||
using AllBase.DouYinModel.Param.LoginManage;
|
||||
using NaiBa.Util;
|
||||
using NaiBa.Util.Extension;
|
||||
using NaiBa.Util.Helper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
using Work;
|
||||
using Work.BaseForms;
|
||||
|
||||
namespace _29WxOrderWpf.Windows.LoginWindows
|
||||
{
|
||||
/// <summary>
|
||||
/// LoginWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class LoginWindow : BaseWindow
|
||||
{
|
||||
public static ConcurrentList<UserParam> UserParamList { get; set; } = new ConcurrentList<UserParam>();
|
||||
|
||||
public bool IsLogin { get; set; } = false;
|
||||
|
||||
string[] argsuser;
|
||||
|
||||
public LoginWindow(string[] args)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
if (!string.IsNullOrEmpty(BaseClass.ProgramName))
|
||||
{
|
||||
lblAppName.Content = BaseClass.ProgramName;
|
||||
MainWindow.Instance.lblAppName.Content = lblAppName.Content;
|
||||
}
|
||||
|
||||
this.Title = "用户登录";
|
||||
argsuser = args;
|
||||
}
|
||||
|
||||
private void loginWindow_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
#if DEBUG
|
||||
chkDebug.Visibility = Visibility.Visible;
|
||||
#endif
|
||||
|
||||
GetUserList();
|
||||
foreach (var user in UserParamList)
|
||||
{
|
||||
cmbUserNameMobile.Items.Insert(0, user.UserName);
|
||||
}
|
||||
|
||||
this.Title = "登录";
|
||||
if (BaseClass.Remember)
|
||||
{
|
||||
chkRemember.IsChecked = true;
|
||||
cmbUserNameMobile.Text = BaseClass.UserName;
|
||||
if (!string.IsNullOrEmpty(BaseClass.PassWord))
|
||||
txtPassword.Password = "******";
|
||||
}
|
||||
|
||||
if (argsuser.Length > 1)
|
||||
{
|
||||
cmbUserNameMobile.Text = argsuser[0].Replace(" ", "");
|
||||
txtPassword.Password = "******";
|
||||
BaseClass.PassWord = argsuser[1].Replace(" ", "");
|
||||
btnLogin_Click(null, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void BaseWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
//if (BaseMsgForm.ShowConfirm("是否关闭软件?\r\n必须登录账户才能使用,无账户请先注册一个", "请先登录或者注册").DialogResult == System.Windows.Forms.DialogResult.OK)
|
||||
// Process.GetCurrentProcess().Kill();
|
||||
//else
|
||||
// e.Cancel = true;
|
||||
|
||||
if (!IsLogin)
|
||||
{
|
||||
if (BaseMsgWindow.ShowConfirm("是否关闭软件?\r\n必须登录账户才能使用,无账户请先注册一个。", "请先登录或者注册", this).DialogResult == true)
|
||||
Process.GetCurrentProcess().Kill();
|
||||
else
|
||||
e.Cancel = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnLogin_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
UserLogin ul = new UserLogin();
|
||||
ul.Mobile = cmbUserNameMobile.Text;
|
||||
ul.Password = txtPassword.Password;
|
||||
|
||||
if (cmbUserNameMobile.Text.Length != 11)
|
||||
{
|
||||
BaseMsgWindow.ShowError("手机号不正确", "提示", this);
|
||||
cmbUserNameMobile.Focus();
|
||||
return;
|
||||
}
|
||||
if (txtPassword.Password.Length < 6)
|
||||
{
|
||||
BaseMsgWindow.ShowError("密码长度不正确", "提示", this);
|
||||
txtPassword.Password = "";
|
||||
txtPassword.Focus();
|
||||
return;
|
||||
}
|
||||
string message = "";
|
||||
int weakPassword = 0;
|
||||
int lockUserName = 0;
|
||||
string messageInfo = "";
|
||||
bool ok = ul.Get(ref message, out lockUserName, out weakPassword, out messageInfo);
|
||||
if (!ok)
|
||||
{
|
||||
BaseMsgForm.ShowError(message, "登录失败");
|
||||
return;
|
||||
}
|
||||
MainWindow.Instance.Balance = BaseClass.Balance.ToString("0.00");
|
||||
if (BaseClass.Remember)
|
||||
{
|
||||
Initialization i = new Initialization();
|
||||
i.SaveConfig();
|
||||
|
||||
var eUser = UserParamList.FirstOrDefault(u => u.UserName == BaseClass.UserName);
|
||||
if (eUser != null)
|
||||
UserParamList.Remove(eUser);
|
||||
UserParamList.Add(new UserParam()
|
||||
{
|
||||
UserName = BaseClass.UserName,
|
||||
PasswordMd5 = BaseClass.PassWord
|
||||
});
|
||||
SaveUserList();
|
||||
}
|
||||
this.IsLogin = true;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
public static void SaveUserList()
|
||||
{
|
||||
ConfigHelper.SaveConfig("user_login_config", UserParamList);
|
||||
}
|
||||
public static void GetUserList()
|
||||
{
|
||||
#region 用户账户记忆功能
|
||||
UserParamList = ConfigHelper.LoadConfig<ConcurrentList<UserParam>>("user_login_config");
|
||||
if (UserParamList == null)
|
||||
UserParamList = new ConcurrentList<UserParam>();
|
||||
#endregion
|
||||
}
|
||||
|
||||
private void btnDeleteItem_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var imgButton = sender as UcImageButton;
|
||||
if (imgButton != null)
|
||||
{
|
||||
var userName = imgButton.Tag.ParseToString();
|
||||
if (!string.IsNullOrEmpty(userName))
|
||||
{
|
||||
UserParamList.RemoveAll(u => u.UserName == userName);
|
||||
SaveUserList();
|
||||
foreach (var item in cmbUserNameMobile.Items.Cast<string>().ToList())
|
||||
{
|
||||
if (item.ParseToString() == userName)
|
||||
{
|
||||
cmbUserNameMobile.Items.Remove(item);
|
||||
}
|
||||
|
||||
}
|
||||
//ShowUserDropDown();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void cmbUserNameMobile_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
var userName = cmbUserNameMobile.SelectedItem.ParseToString();
|
||||
var user = UserParamList.FirstOrDefault(u => u.UserName == userName);
|
||||
if (user != null)
|
||||
{
|
||||
BaseClass.UserName = user.UserName;
|
||||
BaseClass.PassWord = user.PasswordMd5;
|
||||
this.cmbUserNameMobile.Text = user.UserName;
|
||||
this.txtPassword.Password = "******";
|
||||
}
|
||||
}
|
||||
|
||||
private void chkRemember_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
BaseClass.Remember = chkRemember.IsChecked.ParseToBool();
|
||||
}
|
||||
|
||||
private void chkDebug_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (chkDebug.IsChecked == true)
|
||||
{
|
||||
BaseClass.LoginApiUrl = BaseClass.DebugUrl;
|
||||
}
|
||||
else
|
||||
{
|
||||
BaseClass.LoginApiUrl = BaseClass.ServerUrl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user